1 module tango.sys.win32.consts.socket;
2 
3 /***************************************************************
4 
5 
6 ***************************************************************/
7 
8 enum : int
9 {
10         IOCPARM_MASK =  0x7f,
11         IOC_IN =        0x80000000,
12         FIONBIO =       (IOC_IN | ((int.sizeof & IOCPARM_MASK) << 16) | (102 << 8) | 126),
13 }
14 
15 /***************************************************************
16 
17 
18 ***************************************************************/
19 enum {SOCKET_ERROR = -1}
20 
21 enum
22 {
23         //consistent
24         SO_DEBUG =              0x1,
25 
26         //possibly Winsock-only values
27         SO_BROADCAST =          0x20,
28         SO_REUSEADDR =          0x4,
29         SO_LINGER =             0x80,
30         SO_DONTLINGER =         ~(SO_LINGER),
31         SO_OOBINLINE =          0x100,
32         SO_SNDBUF =             0x1001,
33         SO_RCVBUF =             0x1002,
34         SO_ERROR =              0x1007,
35 
36         SO_ACCEPTCONN =         0x2, // ?
37         SO_KEEPALIVE =          0x8, // ?
38         SO_DONTROUTE =          0x10, // ?
39         SO_TYPE =               0x1008, // ?
40 
41         // OptionLevel.IP settings
42         IP_MULTICAST_TTL =      10,
43         IP_MULTICAST_LOOP =     11,
44         IP_ADD_MEMBERSHIP =     12,
45         IP_DROP_MEMBERSHIP =    13,
46 
47         // OptionLevel.TCP settings
48         TCP_NODELAY =           0x0001,
49 }
50 
51 /***************************************************************
52 
53 
54 ***************************************************************/
55 
56 enum
57 {
58         SOL_SOCKET =  0xFFFF,
59 }
60 
61 /***************************************************************
62 
63 
64 ***************************************************************/
65 
66 enum
67 {
68         AF_UNSPEC =     0,
69         AF_UNIX =       1,
70         AF_INET =       2,
71         AF_INET6 =      23,
72         AF_IPX =        6,
73         AF_APPLETALK =  16,
74 }
75 
76 /***********************************************************************
77 
78         Protocol
79 
80 ***********************************************************************/
81 
82 enum
83 {
84         IPPROTO_IP =    0,      /// internet protocol version 4
85         IPPROTO_IPV4 =  4,      /// internet protocol version 4
86         IPPROTO_IPV6 =  41,     /// internet protocol version 6
87         IPPROTO_ICMP =  1,      /// internet control message protocol
88         IPPROTO_IGMP =  2,      /// internet group management protocol
89         IPPROTO_GGP =   3,      /// gateway to gateway protocol
90         IPPROTO_TCP =   6,      /// transmission control protocol
91         IPPROTO_PUP =   12,     /// PARC universal packet protocol
92         IPPROTO_UDP =   17,     /// user datagram protocol
93         IPPROTO_IDP =   22,     /// Xerox NS protocol
94 }
95 
96 /***********************************************************************
97 
98          Communication semantics
99 
100 ***********************************************************************/
101 
102 enum
103 {
104         SOCK_STREAM =     1, /// sequenced, reliable, two-way communication-based byte streams
105         SOCK_DGRAM =      2, /// connectionless, unreliable datagrams with a fixed maximum length; data may be lost or arrive out of order
106         SOCK_RAW =        3, /// raw protocol access
107         SOCK_RDM =        4, /// reliably-delivered message datagrams
108         SOCK_SEQPACKET =  5, /// sequenced, reliable, two-way connection-based datagrams with a fixed maximum length
109 }
110 enum : uint
111 {
112         SCM_RIGHTS = 0x01
113 }
114 enum
115 {
116         SOMAXCONN       = 128,
117 }
118 
119 enum : uint
120 {
121         MSG_DONTROUTE   = 0x4,
122         MSG_OOB         = 0x1,
123         MSG_PEEK        = 0x2,
124 }
125 
126 enum
127 {
128         SHUT_RD = 0,
129         SHUT_WR = 1,
130         SHUT_RDWR = 2
131 }
132 
133 enum: int
134 {
135          AI_PASSIVE = 0x00000001,               /// Socket address will be used in bind() call
136          AI_CANONNAME = 0x00000002,             /// Return canonical name in first ai_canonname
137          AI_NUMERICHOST = 0x00000004 ,          /// Nodename must be a numeric address string
138          AI_NUMERICSERV = 0x00000008,           /// Servicename must be a numeric port number
139          AI_ALL = 0x00000100,                   /// Query both IP6 and IP4 with AI_V4MAPPED
140          AI_ADDRCONFIG = 0x00000400,            /// Resolution only if global address configured
141          AI_V4MAPPED = 0x00000800,              /// On v6 failure, query v4 and convert to V4MAPPED format
142          AI_NON_AUTHORITATIVE = 0x00004000,     /// LUP_NON_AUTHORITATIVE
143          AI_SECURE = 0x00008000,                /// LUP_SECURE
144          AI_RETURN_PREFERRED_NAMES = 0x00010000,/// LUP_RETURN_PREFERRED_NAMES
145          AI_FQDN = 0x00020000,                  /// Return the FQDN in ai_canonname
146          AI_FILESERVER = 0x00040000,            /// Resolving fileserver name resolution 
147          AI_MASK = (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | AI_ADDRCONFIG),
148          AI_DEFAULT = (AI_V4MAPPED | AI_ADDRCONFIG),
149 }
150 
151 enum
152 {
153         EAI_BADFLAGS = 10022,                   /// Invalid value for `ai_flags' field.
154         EAI_NONAME = 11001,                     /// NAME or SERVICE is unknown.
155         EAI_AGAIN = 11002,                      /// Temporary failure in name resolution.
156         EAI_FAIL = 11003,                       /// Non-recoverable failure in name res.
157         EAI_NODATA = 11001,                     /// No address associated with NAME.
158         EAI_FAMILY = 10047,                     /// `ai_family' not supported.
159         EAI_SOCKTYPE = 10044,                   /// `ai_socktype' not supported.
160         EAI_SERVICE = 10109,                    /// SERVICE not supported for `ai_socktype'.
161         EAI_MEMORY = 8,                         /// Memory allocation failure.
162 }       
163 
164 enum
165 {
166         NI_MAXHOST = 1025,
167         NI_MAXSERV = 32,
168         NI_NUMERICHOST = 0x01,                  /// Don't try to look up hostname.
169         NI_NUMERICSERV = 0x02,                  /// Don't convert port number to name.
170         NI_NOFQDN = 0x04,                       /// Only return nodename portion.
171         NI_NAMEREQD = 0x08,                     /// Don't return numeric addresses.
172         NI_DGRAM = 0x10,                        /// Look up UDP service rather than TCP.
173 }       
174