diff options
author | Michael Neumann <mneumann@ntecs.de> | 2015-09-09 20:16:42 +0200 |
---|---|---|
committer | Michael Neumann <mneumann@ntecs.de> | 2015-09-09 20:16:42 +0200 |
commit | f37e45628e44d86c16a6f02b38ea0a9d68e8b3d4 (patch) | |
tree | 3757e147ff4e9b4d30f493e63dec27e2eeebd6a7 /src/sys/socket/consts.rs | |
parent | fad667e4e2c72889b55bcc7a21d87fa72218e101 (diff) | |
download | nix-f37e45628e44d86c16a6f02b38ea0a9d68e8b3d4.zip |
Add/Fix support for DragonFly BSD
Diffstat (limited to 'src/sys/socket/consts.rs')
-rw-r--r-- | src/sys/socket/consts.rs | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/src/sys/socket/consts.rs b/src/sys/socket/consts.rs index ddd77c05..4deb9f59 100644 --- a/src/sys/socket/consts.rs +++ b/src/sys/socket/consts.rs @@ -205,6 +205,81 @@ mod os { pub const SHUT_RDWR: c_int = 2; } +#[cfg(target_os = "dragonfly")] +mod os { + use libc::{c_int, uint8_t}; + + pub const AF_UNIX: c_int = 1; + pub const AF_LOCAL: c_int = AF_UNIX; + pub const AF_INET: c_int = 2; + pub const AF_INET6: c_int = 28; + + pub const SOCK_STREAM: c_int = 1; + pub const SOCK_DGRAM: c_int = 2; + pub const SOCK_SEQPACKET: c_int = 5; + pub const SOCK_RAW: c_int = 3; + pub const SOCK_RDM: c_int = 4; + + pub const SOL_SOCKET: c_int = 0xffff; + pub const IPPROTO_IP: c_int = 0; + pub const IPPROTO_IPV6: c_int = 41; + pub const IPPROTO_TCP: c_int = 6; + pub const IPPROTO_UDP: c_int = 17; + + pub const SO_ACCEPTCONN: c_int = 0x0002; + pub const SO_BROADCAST: c_int = 0x0020; + pub const SO_DEBUG: c_int = 0x0001; + pub const SO_ERROR: c_int = 0x1007; + pub const SO_DONTROUTE: c_int = 0x0010; + pub const SO_KEEPALIVE: c_int = 0x0008; + pub const SO_LINGER: c_int = 0x0080; + pub const SO_NOSIGPIPE: c_int = 0x0800; // different value! + pub const SO_OOBINLINE: c_int = 0x0100; + pub const SO_RCVBUF: c_int = 0x1002; + pub const SO_RCVLOWAT: c_int = 0x1004; + pub const SO_SNDLOWAT: c_int = 0x1003; + pub const SO_RCVTIMEO: c_int = 0x1006; + pub const SO_SNDTIMEO: c_int = 0x1005; + pub const SO_REUSEADDR: c_int = 0x0004; + pub const SO_REUSEPORT: c_int = 0x0200; + pub const SO_SNDBUF: c_int = 0x1001; + pub const SO_TIMESTAMP: c_int = 0x0400; + pub const SO_TYPE: c_int = 0x1008; + + // Socket options for TCP sockets + pub const TCP_NODELAY: c_int = 1; + pub const TCP_MAXSEG: c_int = 2; + pub const TCP_KEEPIDLE: c_int = 0x100; + + // Socket options for the IP layer of the socket + pub const IP_MULTICAST_IF: c_int = 9; + + pub type IpMulticastTtl = uint8_t; + + pub const IP_MULTICAST_TTL: c_int = 10; + pub const IP_MULTICAST_LOOP: c_int = 11; + pub const IP_ADD_MEMBERSHIP: c_int = 12; + pub const IP_DROP_MEMBERSHIP: c_int = 13; + + pub type InAddrT = u32; + + // Declarations of special addresses + pub const INADDR_ANY: InAddrT = 0; + pub const INADDR_NONE: InAddrT = 0xffffffff; + pub const INADDR_BROADCAST: InAddrT = 0xffffffff; + + pub type SockMessageFlags = i32; + // Flags for send/recv and their relatives + pub const MSG_OOB: SockMessageFlags = 0x1; + pub const MSG_PEEK: SockMessageFlags = 0x2; + pub const MSG_DONTWAIT: SockMessageFlags = 0x80; + + // shutdown flags + pub const SHUT_RD: c_int = 0; + pub const SHUT_WR: c_int = 1; + pub const SHUT_RDWR: c_int = 2; +} + #[cfg(test)] mod test { use super::*; |