Add network interface flag constants for all platforms

Add network interface flag constants for all platforms.
This commit is contained in:
luozijun 2017-11-09 16:54:03 +08:00
parent 86b4281c98
commit 9108f5b51d
11 changed files with 194 additions and 22 deletions

View File

@ -1443,7 +1443,24 @@ pub const MSG_RCVMORE: ::c_int = 0x4000;
pub const SCM_TIMESTAMP: ::c_int = 0x02;
pub const SCM_CREDS: ::c_int = 0x03;
pub const IFF_LOOPBACK: ::c_int = 0x8;
/// https://github.com/aosm/xnu/blob/master/bsd/net/if.h#L140-L156
pub const IFF_UP: ::c_int = 0x1; // interface is up
pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid
pub const IFF_DEBUG: ::c_int = 0x4; // turn on debugging
pub const IFF_LOOPBACK: ::c_int = 0x8; // is a loopback net
pub const IFF_POINTOPOINT: ::c_int = 0x10; // interface is point-to-point link
pub const IFF_NOTRAILERS: ::c_int = 0x20; // obsolete: avoid use of trailers
pub const IFF_RUNNING: ::c_int = 0x40; // resources allocated
pub const IFF_NOARP: ::c_int = 0x80; // no address resolution protocol
pub const IFF_PROMISC: ::c_int = 0x100; // receive all packets
pub const IFF_ALLMULTI: ::c_int = 0x200; // receive all multicast packets
pub const IFF_OACTIVE: ::c_int = 0x400; // transmission in progress
pub const IFF_SIMPLEX: ::c_int = 0x800; // can't hear own transmissions
pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit
pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit
pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit
pub const IFF_ALTPHYS: ::c_int = IFF_LINK2; // use alternate physical connection
pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
pub const SHUT_RD: ::c_int = 0;
pub const SHUT_WR: ::c_int = 1;

View File

@ -386,6 +386,31 @@ pub const NOTE_CHILD: ::uint32_t = 0x00000004;
pub const SO_SNDSPACE: ::c_int = 0x100a;
pub const SO_CPUHINT: ::c_int = 0x1030;
// https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/net/if.h#L101
pub const IFF_UP: ::c_int = 0x1; // interface is up
pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid
pub const IFF_DEBUG: ::c_int = 0x4; // turn on debugging
pub const IFF_LOOPBACK: ::c_int = 0x8; // is a loopback net
pub const IFF_POINTOPOINT: ::c_int = 0x10; // interface is point-to-point link
pub const IFF_SMART: ::c_int = 0x20; // interface manages own routes
pub const IFF_RUNNING: ::c_int = 0x40; // resources allocated
pub const IFF_NOARP: ::c_int = 0x80; // no address resolution protocol
pub const IFF_PROMISC: ::c_int = 0x100; // receive all packets
pub const IFF_ALLMULTI: ::c_int = 0x200; // receive all multicast packets
pub const IFF_OACTIVE_COMPAT: ::c_int = 0x400; // was transmission in progress
pub const IFF_SIMPLEX: ::c_int = 0x800; // can't hear own transmissions
pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit
pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit
pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit
pub const IFF_ALTPHYS: ::c_int = IFF_LINK2; // use alternate physical connection
pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
pub const IFF_POLLING_COMPAT: ::c_int = 0x10000; // was interface is in polling mode
pub const IFF_PPROMISC: ::c_int = 0x20000; // user-requested promisc mode
pub const IFF_MONITOR: ::c_int = 0x40000; // user-requested monitor mode
pub const IFF_STATICARP: ::c_int = 0x80000; // static ARP
pub const IFF_NPOLLING: ::c_int = 0x100000; // interface is in polling mode
pub const IFF_IDIRECT: ::c_int = 0x200000; // direct input
//
// sys/netinet/in.h
// Protocols (RFC 1700)

View File

@ -425,6 +425,31 @@ pub const AF_INET6_SDP: ::c_int = 42;
#[doc(hidden)]
pub const AF_MAX: ::c_int = 42;
// https://github.com/freebsd/freebsd/blob/master/sys/net/if.h#L140
pub const IFF_UP: ::c_int = 0x1; // (n) interface is up
pub const IFF_BROADCAST: ::c_int = 0x2; // (i) broadcast address valid
pub const IFF_DEBUG: ::c_int = 0x4; // (n) turn on debugging
pub const IFF_LOOPBACK: ::c_int = 0x8; // (i) is a loopback net
pub const IFF_POINTOPOINT: ::c_int = 0x10; // (i) is a point-to-point link
// 0x20 was IFF_SMART
pub const IFF_DRV_RUNNING: ::c_int = 0x40; // (d) resources allocated
pub const IFF_NOARP: ::c_int = 0x80; // (n) no address resolution protocol
pub const IFF_PROMISC: ::c_int = 0x100; // (n) receive all packets
pub const IFF_ALLMULTI: ::c_int = 0x200; // (n) receive all multicast packets
pub const IFF_DRV_OACTIVE: ::c_int = 0x400; // (d) tx hardware queue is full
pub const IFF_SIMPLEX: ::c_int = 0x800; // (i) can't hear own transmissions
pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit
pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit
pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit
pub const IFF_ALTPHYS: ::c_int = IFF_LINK2; // use alternate physical connection
pub const IFF_MULTICAST: ::c_int = 0x8000; // (i) supports multicast
pub const IFF_CANTCONFIG: ::c_int = 0x10000; // (i) unconfigurable using ioctl(2)
pub const IFF_PPROMISC: ::c_int = 0x20000; // (n) user-requested promisc mode
pub const IFF_MONITOR: ::c_int = 0x40000; // (n) user-requested monitor mode
pub const IFF_STATICARP: ::c_int = 0x80000; // (n) static ARP
pub const IFF_DYING: ::c_int = 0x200000; // (n) interface is winding down
pub const IFF_RENAMING: ::c_int = 0x400000; // (n) interface is being renamed
// sys/netinet/in.h
// Protocols (RFC 1700)
// NOTE: These are in addition to the constants defined in src/unix/mod.rs

View File

@ -640,8 +640,6 @@ pub const SO_RCVTIMEO: ::c_int = 0x1006;
pub const SO_ERROR: ::c_int = 0x1007;
pub const SO_TYPE: ::c_int = 0x1008;
pub const IFF_LOOPBACK: ::c_int = 0x8;
pub const SHUT_RD: ::c_int = 0;
pub const SHUT_WR: ::c_int = 1;
pub const SHUT_RDWR: ::c_int = 2;

View File

@ -448,8 +448,6 @@ pub const MSG_MCAST: ::c_int = 0x200;
pub const MSG_NOSIGNAL: ::c_int = 0x400;
pub const MSG_CMSG_CLOEXEC: ::c_int = 0x800;
pub const IFF_LOOPBACK: ::c_int = 0x8;
pub const SHUT_RD: ::c_int = 0;
pub const SHUT_WR: ::c_int = 1;
pub const SHUT_RDWR: ::c_int = 2;

View File

@ -346,6 +346,24 @@ pub const SO_TIMESTAMP: ::c_int = 0x2000;
pub const SO_OVERFLOWED: ::c_int = 0x1009;
pub const SO_NOHEADER: ::c_int = 0x100a;
// https://github.com/NetBSD/src/blob/trunk/sys/net/if.h#L373
pub const IFF_UP: ::c_int = 0x0001; // interface is up
pub const IFF_BROADCAST: ::c_int = 0x0002; // broadcast address valid
pub const IFF_DEBUG: ::c_int = 0x0004; // turn on debugging
pub const IFF_LOOPBACK: ::c_int = 0x0008; // is a loopback net
pub const IFF_POINTOPOINT: ::c_int = 0x0010; // interface is point-to-point link
pub const IFF_NOTRAILERS: ::c_int = 0x0020; // avoid use of trailers
pub const IFF_RUNNING: ::c_int = 0x0040; // resources allocated
pub const IFF_NOARP: ::c_int = 0x0080; // no address resolution protocol
pub const IFF_PROMISC: ::c_int = 0x0100; // receive all packets
pub const IFF_ALLMULTI: ::c_int = 0x0200; // receive all multicast packets
pub const IFF_OACTIVE: ::c_int = 0x0400; // transmission in progress
pub const IFF_SIMPLEX: ::c_int = 0x0800; // can't hear own transmissions
pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit
pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit
pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit
pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
// sys/netinet/in.h
// Protocols (RFC 1700)
// NOTE: These are in addition to the constants defined in src/unix/mod.rs

View File

@ -221,6 +221,24 @@ pub const SO_RTABLE: ::c_int = 0x1021;
pub const SO_PEERCRED: ::c_int = 0x1022;
pub const SO_SPLICE: ::c_int = 0x1023;
// https://github.com/openbsd/src/blob/master/sys/net/if.h#L187
pub const IFF_UP: ::c_int = 0x1; // interface is up
pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid
pub const IFF_DEBUG: ::c_int = 0x4; // turn on debugging
pub const IFF_LOOPBACK: ::c_int = 0x8; // is a loopback net
pub const IFF_POINTOPOINT: ::c_int = 0x10; // interface is point-to-point link
pub const IFF_NOTRAILERS: ::c_int = 0x20; // avoid use of trailers
pub const IFF_RUNNING: ::c_int = 0x40; // resources allocated
pub const IFF_NOARP: ::c_int = 0x80; // no address resolution protocol
pub const IFF_PROMISC: ::c_int = 0x100; // receive all packets
pub const IFF_ALLMULTI: ::c_int = 0x200; // receive all multicast packets
pub const IFF_OACTIVE: ::c_int = 0x400; // transmission in progress
pub const IFF_SIMPLEX: ::c_int = 0x800; // can't hear own transmissions
pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit
pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit
pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit
pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
// sys/netinet/in.h
// Protocols (RFC 1700)
// NOTE: These are in addition to the constants defined in src/unix/mod.rs

View File

@ -606,7 +606,20 @@ pub const MADV_RANDOM: ::c_int = 3;
pub const MADV_WILLNEED: ::c_int = 4;
pub const MADV_DONTNEED: ::c_int = 5;
// https://github.com/haiku/haiku/blob/master/headers/posix/net/if.h#L80
pub const IFF_UP: ::c_int = 0x0001;
pub const IFF_BROADCAST: ::c_int = 0x0002; // valid broadcast address
pub const IFF_LOOPBACK: ::c_int = 0x0008;
pub const IFF_POINTOPOINT: ::c_int = 0x0010; // point-to-point link
pub const IFF_NOARP: ::c_int = 0x0040; // no address resolution
pub const IFF_AUTOUP: ::c_int = 0x0080; // auto dial
pub const IFF_PROMISC: ::c_int = 0x0100; // receive all packets
pub const IFF_ALLMULTI: ::c_int = 0x0200; // receive all multicast packets
pub const IFF_SIMPLEX: ::c_int = 0x0800; // doesn't receive own transmissions
pub const IFF_LINK: ::c_int = 0x1000; // has link
pub const IFF_AUTO_CONFIGURED: ::c_int = 0x2000;
pub const IFF_CONFIGURING: ::c_int = 0x4000;
pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
pub const AF_UNSEC: ::c_int = 0;
pub const AF_INET: ::c_int = 1;

View File

@ -517,6 +517,26 @@ pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC;
pub const INET_ADDRSTRLEN: ::c_int = 16;
// https://github.
// com/bminor/newlib/blob/master/newlib/libc/sys/linux/include/net/if.h#L121
pub const IFF_UP: ::c_int = 0x1; // interface is up
pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid
pub const IFF_DEBUG: ::c_int = 0x4; // turn on debugging
pub const IFF_LOOPBACK: ::c_int = 0x8; // is a loopback net
pub const IFF_POINTOPOINT: ::c_int = 0x10; // interface is point-to-point link
pub const IFF_NOTRAILERS: ::c_int = 0x20; // avoid use of trailers
pub const IFF_RUNNING: ::c_int = 0x40; // resources allocated
pub const IFF_NOARP: ::c_int = 0x80; // no address resolution protocol
pub const IFF_PROMISC: ::c_int = 0x100; // receive all packets
pub const IFF_ALLMULTI: ::c_int = 0x200; // receive all multicast packets
pub const IFF_OACTIVE: ::c_int = 0x400; // transmission in progress
pub const IFF_SIMPLEX: ::c_int = 0x800; // can't hear own transmissions
pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit
pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit
pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit
pub const IFF_ALTPHYS: ::c_int = IFF_LINK2; // use alternate physical connection
pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
pub const IPPROTO_IP: ::c_int = 0;
pub const IPPROTO_UDP: ::c_int = 17;
pub const IPPROTO_TCP: ::c_int = 6;

View File

@ -867,7 +867,45 @@ pub const SO_TYPE: ::c_int = 0x1008;
pub const MSG_PEEK: ::c_int = 0x2;
pub const IFF_LOOPBACK: ::c_int = 0x8;
// https://docs.oracle.com/cd/E23824_01/html/821-1475/if-7p.html
pub const IFF_UP: ::c_int = 0x0000000001; // Address is up
pub const IFF_BROADCAST: ::c_int = 0x0000000002; // Broadcast address valid
pub const IFF_DEBUG: ::c_int = 0x0000000004; // Turn on debugging
pub const IFF_LOOPBACK: ::c_int = 0x0000000008; // Loopback net
pub const IFF_POINTOPOINT: ::c_int = 0x0000000010; // Interface is p-to-p
pub const IFF_NOTRAILERS: ::c_int = 0x0000000020; // Avoid use of trailers
pub const IFF_RUNNING: ::c_int = 0x0000000040; // Resources allocated
pub const IFF_NOARP: ::c_int = 0x0000000080; // No address res. protocol
pub const IFF_PROMISC: ::c_int = 0x0000000100; // Receive all packets
pub const IFF_ALLMULTI: ::c_int = 0x0000000200; // Receive all multicast pkts
pub const IFF_INTELLIGENT: ::c_int = 0x0000000400; // Protocol code on board
pub const IFF_MULTICAST: ::c_int = 0x0000000800; // Supports multicast
pub const IFF_MULTI_BCAST: ::c_int = 0x0000001000; // Multicast using broadcst. add.
pub const IFF_UNNUMBERED: ::c_int = 0x0000002000; // Non-unique address
pub const IFF_DHCPRUNNING: ::c_int = 0x0000004000; // DHCP controls interface
pub const IFF_PRIVATE: ::c_int = 0x0000008000; // Do not advertise
pub const IFF_NOXMIT: ::c_int = 0x0000010000; // Do not transmit pkts
pub const IFF_NOLOCAL: ::c_int = 0x0000020000; // No address - just on-link subnet
pub const IFF_DEPRECATED: ::c_int = 0x0000040000; // Address is deprecated
pub const IFF_ADDRCONF: ::c_int = 0x0000080000; // Addr. from stateless addrconf
pub const IFF_ROUTER: ::c_int = 0x0000100000; // Router on interface
pub const IFF_NONUD: ::c_int = 0x0000200000; // No NUD on interface
pub const IFF_ANYCAST: ::c_int = 0x0000400000; // Anycast address
pub const IFF_NORTEXCH: ::c_int = 0x0000800000; // Don't xchange rout. info
pub const IFF_IPV4: ::c_int = 0x0001000000; // IPv4 interface
pub const IFF_IPV6: ::c_int = 0x0002000000; // IPv6 interface
pub const IFF_NOFAILOVER: ::c_int = 0x0008000000; // in.mpathd test address
pub const IFF_FAILED: ::c_int = 0x0010000000; // Interface has failed
pub const IFF_STANDBY: ::c_int = 0x0020000000; // Interface is a hot-spare
pub const IFF_INACTIVE: ::c_int = 0x0040000000; // Functioning but not used
pub const IFF_OFFLINE: ::c_int = 0x0080000000; // Interface is offline
pub const IFF_COS_ENABLED: ::c_int = 0x0200000000; // If CoS marking is supported
pub const IFF_PREFERRED: ::c_int = 0x0400000000; // Prefer as source address
pub const IFF_TEMPORARY: ::c_int = 0x0800000000; // RFC3041
pub const IFF_FIXEDMTU: ::c_int = 0x1000000000; // MTU set with SIOCSLIFMTU
pub const IFF_VIRTUAL: ::c_int = 0x2000000000; // Cannot send/receive pkts
pub const IFF_DUPLICATE: ::c_int = 0x4000000000; // Local address in use
pub const IFF_IPMP: ::c_int = 0x8000000000; // IPMP IP interface
pub const SHUT_RD: ::c_int = 0;
pub const SHUT_WR: ::c_int = 1;

View File

@ -653,22 +653,24 @@ pub const MADV_MERGEABLE: ::c_int = 12;
pub const MADV_UNMERGEABLE: ::c_int = 13;
pub const MADV_HWPOISON: ::c_int = 100;
pub const IFF_UP: ::c_int = 0x1;
pub const IFF_BROADCAST: ::c_int = 0x2;
pub const IFF_DEBUG: ::c_int = 0x4;
pub const IFF_LOOPBACK: ::c_int = 0x8;
pub const IFF_POINTOPOINT: ::c_int = 0x10;
pub const IFF_NOTRAILERS: ::c_int = 0x20;
pub const IFF_RUNNING: ::c_int = 0x40;
pub const IFF_NOARP: ::c_int = 0x80;
pub const IFF_PROMISC: ::c_int = 0x100;
pub const IFF_ALLMULTI: ::c_int = 0x200;
pub const IFF_MASTER: ::c_int = 0x400;
pub const IFF_SLAVE: ::c_int = 0x800;
pub const IFF_MULTICAST: ::c_int = 0x1000;
pub const IFF_PORTSEL: ::c_int = 0x2000;
pub const IFF_AUTOMEDIA: ::c_int = 0x4000;
pub const IFF_DYNAMIC: ::c_int = 0x8000;
// https://github.com/kraj/uClibc/blob/master/include/net/if.h#L44
pub const IFF_UP: ::c_int = 0x1; // Interface is up.
pub const IFF_BROADCAST: ::c_int = 0x2; // Broadcast address valid.
pub const IFF_DEBUG: ::c_int = 0x4; // Turn on debugging.
pub const IFF_LOOPBACK: ::c_int = 0x8; // Is a loopback net.
pub const IFF_POINTOPOINT: ::c_int = 0x10; // Interface is point-to-point link.
pub const IFF_NOTRAILERS: ::c_int = 0x20; // Avoid use of trailers.
pub const IFF_RUNNING: ::c_int = 0x40; // Resources allocated.
pub const IFF_NOARP: ::c_int = 0x80; // No address resolution protocol.
pub const IFF_PROMISC: ::c_int = 0x100; // Receive all packets.
// Not supported
pub const IFF_ALLMULTI: ::c_int = 0x200; // Receive all multicast packets.
pub const IFF_MASTER: ::c_int = 0x400; // Master of a load balancer.
pub const IFF_SLAVE: ::c_int = 0x800; // Slave of a load balancer.
pub const IFF_MULTICAST: ::c_int = 0x1000; // Supports multicast.
pub const IFF_PORTSEL: ::c_int = 0x2000; // Can set media type.
pub const IFF_AUTOMEDIA: ::c_int = 0x4000; // Auto media select active.
pub const IFF_DYNAMIC: ::c_int = 0x8000; // Dialup device with changing addresses.
pub const SOL_IP: ::c_int = 0;
pub const SOL_TCP: ::c_int = 6;