#[repr(transparent)]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub struct So9SockProtocol(pub libc::c_int);
impl So9SockProtocol
{
pub const NONE: Self = Self(0);
pub const ICMPV4: Self = Self(libc::IPPROTO_ICMP);
pub const ICMPV6: Self = Self(libc::IPPROTO_ICMPV6);
pub const TCP: Self = Self(libc::IPPROTO_TCP);
pub const UDP: Self = Self(libc::IPPROTO_UDP);
#[cfg(target_os = "linux")]
pub const MPTCP: Self = Self(libc::IPPROTO_MPTCP);
pub const SCTP: Self = Self(libc::IPPROTO_SCTP);
#[cfg(target_os = "linux")]
pub const DCCP: Self = Self(libc::IPPROTO_DCCP);
pub const UDPLITE: Self = Self(libc::IPPROTO_UDPLITE);
#[cfg( any(target_os = "freebsd", target_os = "openbsd"))]
pub const DIVERT: Self = Self(libc::IPPROTO_DIVERT);
}
#[cfg(target_family = "windows")]
impl From<WSAPROTOCOL_INFOW> for So9SockProtocol
{
fn from(value: WSAPROTOCOL_INFOW) -> Self
{
Self(value.iProtocol)
}
}
#[cfg(target_family = "unix")]
impl From<libc::c_int> for So9SockProtocol
{
fn from(value: libc::c_int) -> Self
{
Self(value)
}
}