socket9 0.1.0-alpha.1

Extended untilities for the networking/unix sockets and raw network sockets
Documentation
/*-
 * socket9 - A RAW networking sockets manipulation and configration basing on 
 * strong types.
 * 
 * Copyright (C) 2021 Aleksandr Morozov, Lucia Hoffmann
 * Copyright (C) 2025 Aleksandr Morozov
 * 
 * The syslog-rs crate can be redistributed and/or modified
 * under the terms of either of the following licenses:
 *
 *   1. EUROPEAN UNION PUBLIC LICENCE v. 1.2 EUPL © the European Union 2007, 2016 OR
 *
 *   2. the Mozilla Public License Version 2.0 (the “MPL”) OR
 *                     
 *   3. The MIT License (MIT)
 */


//todo add SOL_SOCKET SO_BSDCOMPAT, SO_DETACH_BPF, SO_BINDTODEVICE, SO_BINDTOIFINDEX, SO_INCOMING_CPU, SO_COOKIE, SO_BUSY_POLL


#[cfg(any(target_os = "freebsd"))]
pub mod so_label;

#[cfg(any(target_os = "freebsd"))]
pub mod so_reuse_port_lb;
#[cfg(any(target_os = "freebsd"))]
pub use so_reuse_port_lb::SoReusePortLb;

#[cfg(any(target_os = "freebsd"))]
pub mod so_accept_filter;
#[cfg(any(target_os = "freebsd"))]
pub use so_accept_filter::SoAcceptFilter;



pub mod so_type;
pub use so_type::SoType;

#[cfg(unix)]
pub mod so_protocol;
#[cfg(unix)]
pub use so_protocol::SoProtocol;

#[cfg(any(
    target_os = "ios",
    target_os = "visionos",
    target_os = "macos",
    target_os = "tvos",
    target_os = "watchos",
))]
pub mod so_nosigpipe;
#[cfg(any(
    target_os = "ios",
    target_os = "visionos",
    target_os = "macos",
    target_os = "tvos",
    target_os = "watchos",
))]
pub use so_nosigpipe;

pub mod so_broadcast;
pub use so_broadcast::SoBroadcast;

pub mod so_error;
pub use so_error::SoError;

pub mod so_keepalive;
pub use so_keepalive::SoKeepAlive;

pub mod so_linger;
pub use so_linger::SoLinger;

pub mod so_rcv_timeout;
pub use so_rcv_timeout::SoRcvTimeout;

pub mod so_snd_timeout;
pub use so_snd_timeout::SoSndTimeout;

#[cfg(any(target_os = "linux", target_os = "android"))]
pub mod so_incom_napi_id;
#[cfg(any(target_os = "linux", target_os = "android"))]
pub use so_incom_napi_id::SoIncomingNapiId;

#[cfg(any(target_os = "linux", target_os = "android"))]
pub mod so_mark;
#[cfg(any(target_os = "linux", target_os = "android"))]
pub use so_mark::SoMark;

#[cfg(any(target_os = "linux", target_os = "android"))]
pub mod so_busy_poll;
#[cfg(any(target_os = "linux", target_os = "android"))]
pub use so_busy_poll::SoBusyPoll;

#[cfg(any(target_os = "linux", target_os = "android"))]
pub mod so_timestamp_ns;
#[cfg(any(target_os = "linux", target_os = "android"))]
pub use so_timestamp_ns::SoTimestampNs;

#[cfg(any(target_os = "linux", target_os = "android"))]
pub mod so_snd_buf_force;
#[cfg(any(target_os = "linux", target_os = "android"))]
pub use so_snd_buf_force::SoSndBufForce;

#[cfg(any(target_os = "linux", target_os = "android"))]
pub mod so_select_err_que;
#[cfg(any(target_os = "linux", target_os = "android"))]
pub use so_select_err_que::SoSelectErrQue;

#[cfg(any(target_os = "linux", target_os = "android"))]
pub mod so_rqx_ovfl;
#[cfg(any(target_os = "linux", target_os = "android"))]
pub use so_rqx_ovfl::SoRqxOvfl;

#[cfg(any(target_os = "linux", target_os = "android"))]
pub mod so_peercred;
#[cfg(any(target_os = "linux", target_os = "android"))]
pub use so_peercred::SoPeercred;

#[cfg(any(target_os = "linux", target_os = "android"))]
pub mod so_peersec;
#[cfg(any(target_os = "linux", target_os = "android"))]
pub use so_peersec::SoPeersec;

#[cfg(any(target_os = "linux", target_os = "android"))]
pub mod so_passec;
#[cfg(any(target_os = "linux", target_os = "android"))]
pub use so_passec::SoPassec;

#[cfg(any(target_os = "linux", target_os = "android"))]
pub mod so_peek_off;
#[cfg(any(target_os = "linux", target_os = "android"))]
pub use so_peek_off::SoPeekOff;

#[cfg(target_family = "unix")]
pub mod so_timestamp;
#[cfg(target_family = "unix")]
pub use so_timestamp::SoTimestamp;

#[cfg(target_family = "unix")]
pub mod so_snd_lowat;
#[cfg(target_family = "unix")]
pub use so_snd_lowat::SoSndLoWat;

#[cfg(target_family = "unix")]
pub mod so_rcv_lowat;
#[cfg(target_family = "unix")]
pub use so_rcv_lowat::SoRcvLoWat;

#[cfg(target_family = "unix")]
pub mod so_passcred;
#[cfg(target_family = "unix")]
pub use so_passcred::SoPasscred;

#[cfg(target_family = "unix")]
pub mod so_priority;
#[cfg(target_family = "unix")]
pub use so_priority::SoPriority;

#[cfg(target_family = "unix")]
pub mod so_reuse_port;
#[cfg(target_family = "unix")]
pub use so_reuse_port::SoReusePort;

#[cfg(target_family = "unix")]
pub mod so_domain;
#[cfg(target_family = "unix")]
pub use so_domain::SoDomain;

#[cfg(target_family = "unix")]
pub mod so_cpu_affinity;
#[cfg(target_family = "unix")]
pub use so_cpu_affinity::SoCpuAffinity;

// --- not Redox
#[cfg(not(target_os = "redox"))]
pub mod so_oo_bin_line;
#[cfg(not(target_os = "redox"))]
pub use so_oo_bin_line::SoOoBinLine;

// ---

pub mod so_rcv_buf;
pub use so_rcv_buf::SoRcvBuf;

pub mod so_reuse_addr;
pub use so_reuse_addr::SoReuseAddr;

pub mod so_dont_route;
pub use so_dont_route::SoRDontRoute;

pub mod so_snd_buf;
pub use so_snd_buf::SoSndBuf;

pub mod so_accept_conn;
pub use so_accept_conn::SoAcceptConn;

#[cfg(target_os = "windows")]
pub mod so_proto_info_domain;
#[cfg(target_os = "windows")]
pub use so_proto_info_domain::SoProtocolInfoDomain;

#[cfg(target_os = "windows")]
pub mod so_protocol_win;
#[cfg(target_os = "windows")]
pub use so_protocol_win::SoProtocol;



 /* #[repr(transparent)]
    #[derive(Debug, Clone, Copy)]
    pub struct SoProtocolInfoProtocol(WSAPROTOCOL_INFOW);

    impl SockOptMarker for SoProtocolInfoProtocol
    {
        const SO_LEVEL: c_int = SOL_SOCKET;   
        const SO_OPTNAME: c_int = SO_PROTOCOL_INFOW;

        type DataType = SockProtocol;
        type InputType = WSAPROTOCOL_INFOW;

        #[inline]
        fn from(value: Self::InputType) -> Self 
        {
            return Self(value);
        }

        #[inline]
        fn get(self) -> Self::DataType
        {
            SockProtocol::from(self.0)
        }

        fn from_user(sz: Self::DataType) -> Self where Self: Sized
        {
            panic!("SoProtocolInfow is not writable!")
        }
    }

    impl OptRMarker for SoProtocolInfoProtocol {}*/