diff --git a/src/sys/socket/addr.rs b/src/sys/socket/addr.rs index 1716b15d46..4855e5442a 100644 --- a/src/sys/socket/addr.rs +++ b/src/sys/socket/addr.rs @@ -32,6 +32,196 @@ pub enum AddressFamily { Packet = libc::AF_PACKET, #[cfg(any(target_os = "macos", target_os = "ios"))] System = libc::AF_SYSTEM, + #[cfg(any(target_os = "linux", target_os = "android"))] + Ax25 = libc::AF_AX25, + Ipx = libc::AF_IPX, + AppleTalk = libc::AF_APPLETALK, + #[cfg(any(target_os = "linux", target_os = "android"))] + NetRom = libc::AF_NETROM, + #[cfg(any(target_os = "linux", target_os = "android"))] + Bridge = libc::AF_BRIDGE, + #[cfg(any(target_os = "linux", target_os = "android"))] + AtmPvc = libc::AF_ATMPVC, + #[cfg(any(target_os = "linux", target_os = "android"))] + X25 = libc::AF_X25, + #[cfg(any(target_os = "linux", target_os = "android"))] + Rose = libc::AF_ROSE, + Decnet = libc::AF_DECnet, + #[cfg(any(target_os = "linux", target_os = "android"))] + NetBeui = libc::AF_NETBEUI, + #[cfg(any(target_os = "linux", target_os = "android"))] + Security = libc::AF_SECURITY, + #[cfg(any(target_os = "linux", target_os = "android"))] + Key = libc::AF_KEY, + #[cfg(any(target_os = "linux", target_os = "android"))] + Ash = libc::AF_ASH, + #[cfg(any(target_os = "linux", target_os = "android"))] + Econet = libc::AF_ECONET, + #[cfg(any(target_os = "linux", target_os = "android"))] + AtmSvc = libc::AF_ATMSVC, + #[cfg(any(target_os = "linux", target_os = "android"))] + Rds = libc::AF_RDS, + Sna = libc::AF_SNA, + #[cfg(any(target_os = "linux", target_os = "android"))] + Irda = libc::AF_IRDA, + #[cfg(any(target_os = "linux", target_os = "android"))] + Pppox = libc::AF_PPPOX, + #[cfg(any(target_os = "linux", target_os = "android"))] + Wanpipe = libc::AF_WANPIPE, + #[cfg(any(target_os = "linux", target_os = "android"))] + Llc = libc::AF_LLC, + #[cfg(target_os = "linux")] + Ib = libc::AF_IB, + #[cfg(target_os = "linux")] + Mpls = libc::AF_MPLS, + #[cfg(any(target_os = "linux", target_os = "android"))] + Can = libc::AF_CAN, + #[cfg(any(target_os = "linux", target_os = "android"))] + Tipc = libc::AF_TIPC, + Bluetooth = libc::AF_BLUETOOTH, + #[cfg(any(target_os = "linux", target_os = "android"))] + Iucv = libc::AF_IUCV, + #[cfg(any(target_os = "linux", target_os = "android"))] + RxRpc = libc::AF_RXRPC, + Isdn = libc::AF_ISDN, + #[cfg(any(target_os = "linux", target_os = "android"))] + Phonet = libc::AF_PHONET, + #[cfg(any(target_os = "linux", target_os = "android"))] + Ieee802154 = libc::AF_IEEE802154, + #[cfg(any(target_os = "linux", target_os = "android"))] + Caif = libc::AF_CAIF, + #[cfg(any(target_os = "linux", target_os = "android"))] + Alg = libc::AF_ALG, + #[cfg(target_os = "linux")] + Nfc = libc::AF_NFC, + #[cfg(target_os = "linux")] + Vsock = libc::AF_VSOCK, + #[cfg(any(target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd", + target_os = "dragonfly"))] + ImpLink = libc::AF_IMPLINK, + #[cfg(any(target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd", + target_os = "dragonfly"))] + Pup = libc::AF_PUP, + #[cfg(any(target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd", + target_os = "dragonfly"))] + Chaos = libc::AF_CHAOS, + #[cfg(any(target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd", + target_os = "dragonfly"))] + Ns = libc::AF_NS, + #[cfg(any(target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd", + target_os = "dragonfly"))] + Iso = libc::AF_ISO, + #[cfg(any(target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd", + target_os = "dragonfly"))] + Osi = libc::AF_OSI, + #[cfg(any(target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd", + target_os = "dragonfly"))] + Datakit = libc::AF_DATAKIT, + #[cfg(any(target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd", + target_os = "dragonfly"))] + Ccitt = libc::AF_CCITT, + #[cfg(any(target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd", + target_os = "dragonfly"))] + Dli = libc::AF_DLI, + #[cfg(any(target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd", + target_os = "dragonfly"))] + Lat = libc::AF_LAT, + #[cfg(any(target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd", + target_os = "dragonfly"))] + Hylink = libc::AF_HYLINK, + #[cfg(any(target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd", + target_os = "dragonfly"))] + Link = libc::AF_LINK, + #[cfg(any(target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd", + target_os = "dragonfly"))] + Xtp = libc::AF_XTP, + #[cfg(any(target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd", + target_os = "dragonfly"))] + Coip = libc::AF_COIP, + #[cfg(any(target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd", + target_os = "dragonfly"))] + Cnt = libc::AF_CNT, + #[cfg(any(target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd", + target_os = "dragonfly"))] + Rtip = libc::AF_RTIP, + #[cfg(any(target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd", + target_os = "dragonfly"))] + Pip = libc::AF_PIP, + #[cfg(any(target_os = "macos", + target_os = "ios", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd", + target_os = "dragonfly"))] + Natm = libc::AF_NATM, } #[derive(Copy)] diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs index 4cc82b6297..792bcb00fd 100644 --- a/src/sys/socket/sockopt.rs +++ b/src/sys/socket/sockopt.rs @@ -166,14 +166,11 @@ sockopt_impl!(Both, TcpKeepAlive, libc::IPPROTO_TCP, libc::TCP_KEEPALIVE, u32); sockopt_impl!(Both, TcpKeepIdle, libc::IPPROTO_TCP, libc::TCP_KEEPIDLE, u32); sockopt_impl!(Both, RcvBuf, libc::SOL_SOCKET, libc::SO_RCVBUF, usize); sockopt_impl!(Both, SndBuf, libc::SOL_SOCKET, libc::SO_SNDBUF, usize); -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "android"))] sockopt_impl!(SetOnly, RcvBufForce, libc::SOL_SOCKET, libc::SO_RCVBUFFORCE, usize); -#[cfg(all(target_os = "linux", not(target_arch="arm")))] +#[cfg(any(target_os = "linux", target_os = "android"))] sockopt_impl!(SetOnly, SndBufForce, libc::SOL_SOCKET, libc::SO_SNDBUFFORCE, usize); sockopt_impl!(GetOnly, SockType, libc::SOL_SOCKET, libc::SO_TYPE, super::SockType); -#[cfg(any(target_os = "freebsd", - target_os = "linux", - target_os = "nacl"))] sockopt_impl!(GetOnly, AcceptConn, libc::SOL_SOCKET, libc::SO_ACCEPTCONN, bool); #[cfg(any(target_os = "linux", target_os = "android"))] sockopt_impl!(GetOnly, OriginalDst, libc::SOL_IP, libc::SO_ORIGINAL_DST, sockaddr_in);