1 module tango.sys.freebsd.consts.socket; 2 import tango.sys.freebsd.consts.fcntl: F_GETFL, F_SETFL,O_NONBLOCK; 3 enum {SOCKET_ERROR = -1} 4 enum 5 { 6 SO_ACCEPTCONN = 0x0002, 7 SO_BROADCAST = 0x0020, 8 SO_DEBUG = 0x0001, 9 SO_DONTROUTE = 0x0010, 10 SO_ERROR = 0x1007, 11 SO_KEEPALIVE = 0x0008, 12 SO_LINGER = 0x0080, 13 SO_OOBINLINE = 0x0100, 14 SO_RCVBUF = 0x1002, 15 SO_RCVLOWAT = 0x1004, 16 SO_RCVTIMEO = 0x1006, 17 SO_REUSEADDR = 0x0004, 18 SO_SNDBUF = 0x1001, 19 SO_SNDLOWAT = 0x1003, 20 SO_SNDTIMEO = 0x1005, 21 SO_TYPE = 0x1008, 22 SO_DONTLINGER = ~(SO_LINGER), 23 // OptionLevel.IP settings unconfirmed 24 IP_MULTICAST_TTL = 33 , 25 IP_MULTICAST_LOOP = 34 , 26 IP_ADD_MEMBERSHIP = 35 , 27 IP_DROP_MEMBERSHIP = 36, 28 // OptionLevel.TCP settings 29 TCP_NODELAY = 1 , 30 } 31 32 enum 33 { 34 SOCK_STREAM = 1 , /++ sequential, reliable +/ 35 SOCK_DGRAM = 2 , /++ connectionless unreliable, max length +/ 36 SOCK_SEQPACKET = 5, /++ sequential, reliable, max length +/ 37 SOCK_RAW = 3 , /++ raw protocol +/ 38 } 39 40 enum 41 { 42 SOL_SOCKET = 0xffff, 43 } 44 /* Standard well-defined IP protocols. */ 45 enum 46 { 47 IPPROTO_IP = 0, /* Dummy protocol for TCP. */ 48 IPPROTO_IPV4 = 4, /* Dummy protocol for TCP. */ 49 IPPROTO_IPV6 = 41, /* IPv6 header. */ 50 IPPROTO_ICMP = 1, /* Internet Control Message Protocol. */ 51 IPPROTO_IGMP = 2, /* Internet Group Management Protocol. */ 52 IPPROTO_TCP = 6, /* Transmission Control Protocol. */ 53 IPPROTO_PUP = 12, /* PUP protocol. */ 54 IPPROTO_UDP = 17, /* User Datagram Protocol. */ 55 IPPROTO_IDP = 22, /* XNS IDP protocol. */ 56 /+ 57 // undefined for cross platform reasons, if you need them ask 58 IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options. */ 59 IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94). */ 60 IPPROTO_EGP = 8, /* Exterior Gateway Protocol. */ 61 IPPROTO_TP = 29, /* SO Transport Protocol Class 4. */ 62 IPPROTO_ROUTING = 43, /* IPv6 routing header. */ 63 IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header. */ 64 IPPROTO_RSVP = 46, /* Reservation Protocol. */ 65 IPPROTO_GRE = 47, /* General Routing Encapsulation. */ 66 IPPROTO_ESP = 50, /* encapsulating security payload. */ 67 IPPROTO_AH = 51, /* authentication header. */ 68 IPPROTO_ICMPV6 = 58, /* ICMPv6. */ 69 IPPROTO_NONE = 59, /* IPv6 no next header. */ 70 IPPROTO_DSTOPTS = 60, /* IPv6 destination options. */ 71 IPPROTO_MTP = 92, /* Multicast Transport Protocol. */ 72 IPPROTO_ENCAP = 98, /* Encapsulation Header. */ 73 IPPROTO_PIM = 103, /* Protocol Independent Multicast. */ 74 IPPROTO_COMP = 108, /* Compression Header Protocol. */ 75 IPPROTO_SCTP = 132, /* Stream Control Transmission Protocol. */ 76 IPPROTO_RAW = 255, /* Raw IP packets. */ 77 IPPROTO_MAX 78 +/ 79 }; 80 enum 81 { 82 AF_UNSPEC = 0 , 83 AF_UNIX = 1 , 84 AF_INET = 2 , 85 AF_IPX = 23 , 86 AF_APPLETALK = 16, 87 AF_INET6 = 28 88 } 89 enum : uint 90 { 91 SCM_RIGHTS = 0x01 92 } 93 enum 94 { 95 SOMAXCONN = 128 96 } 97 enum : uint 98 { 99 MSG_CTRUNC = 0x20, 100 MSG_DONTROUTE = 0x4, 101 MSG_EOR = 0x8, 102 MSG_OOB = 0x1, 103 MSG_PEEK = 0x2, 104 MSG_TRUNC = 0x10, 105 MSG_WAITALL = 0x40, 106 MSG_NOSIGNAL = 0x20000 107 } 108 enum 109 { 110 SHUT_RD = 0, 111 SHUT_WR = 1, 112 SHUT_RDWR = 2 113 } 114 115 enum: int 116 { 117 AI_PASSIVE = 0x00000001, /// get address to use bind() 118 AI_CANONNAME = 0x00000002, /// fill ai_canonname 119 AI_NUMERICHOST = 0x00000004, /// prevent host name resolution 120 AI_NUMERICSERV = 0x00000008, /// prevent service name resolution valid flags for addrinfo (not a standard def, apps should not use it) 121 AI_ALL = 0x00000100, /// IPv6 and IPv4-mapped (with AI_V4MAPPED) 122 AI_V4MAPPED_CFG = 0x00000200, /// accept IPv4-mapped if kernel supports 123 AI_ADDRCONFIG = 0x00000400, /// only if any address is assigned 124 AI_V4MAPPED = 0x00000800, /// accept IPv4-mapped IPv6 address special recommended flags for getipnodebyname 125 AI_MASK = (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | AI_ADDRCONFIG), 126 AI_DEFAULT = (AI_V4MAPPED_CFG | AI_ADDRCONFIG), 127 } 128 129 130 enum 131 { 132 EAI_BADFLAGS = 3, /// Invalid value for `ai_flags' field. 133 EAI_NONAME = 8, /// NAME or SERVICE is unknown. 134 EAI_AGAIN = 2, /// Temporary failure in name resolution. 135 EAI_FAIL = 4, /// Non-recoverable failure in name res. 136 EAI_NODATA = 7, /// No address associated with NAME. 137 EAI_FAMILY = 5, /// `ai_family' not supported. 138 EAI_SOCKTYPE = 10, /// `ai_socktype' not supported. 139 EAI_SERVICE = 9, /// SERVICE not supported for `ai_socktype'. 140 EAI_MEMORY = 6, /// Memory allocation failure. 141 } 142 143 enum 144 { 145 NI_MAXHOST = 1025, 146 NI_MAXSERV = 32, 147 NI_NUMERICHOST = 0x00000002, /// Don't try to look up hostname. 148 NI_NUMERICSERV = 0x00000008, /// Don't convert port number to name. 149 NI_NOFQDN = 0x00000001, /// Only return nodename portion. 150 NI_NAMEREQD = 0x00000004, /// Don't return numeric addresses. 151 NI_DGRAM = 0x00000010, /// Look up UDP service rather than TCP. 152 } 153 154