winapi_ui_automation/shared/
ws2def.rs

1// Licensed under the Apache License, Version 2.0
2// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4// All files in the project carrying such notice may not be copied, modified, or distributed
5// except according to those terms.
6//! Core definitions for the Winsock2 specification
7use ctypes::{__int64, c_char, c_int, c_long, c_short, c_void};
8use shared::basetsd::SIZE_T;
9use shared::guiddef::LPGUID;
10use shared::inaddr::IN_ADDR;
11use shared::minwindef::{DWORD, INT, UCHAR, ULONG, USHORT};
12use um::winnt::{CHAR, HANDLE, LONG, PROCESSOR_NUMBER, PWSTR};
13use vc::vcruntime::size_t;
14pub type ADDRESS_FAMILY = USHORT;
15pub const AF_UNSPEC: c_int = 0;
16pub const AF_UNIX: c_int = 1;
17pub const AF_INET: c_int = 2;
18pub const AF_IMPLINK: c_int = 3;
19pub const AF_PUP: c_int = 4;
20pub const AF_CHAOS: c_int = 5;
21pub const AF_NS: c_int = 6;
22pub const AF_IPX: c_int = AF_NS;
23pub const AF_ISO: c_int = 7;
24pub const AF_OSI: c_int = AF_ISO;
25pub const AF_ECMA: c_int = 8;
26pub const AF_DATAKIT: c_int = 9;
27pub const AF_CCITT: c_int = 10;
28pub const AF_SNA: c_int = 11;
29pub const AF_DECnet: c_int = 12;
30pub const AF_DLI: c_int = 13;
31pub const AF_LAT: c_int = 14;
32pub const AF_HYLINK: c_int = 15;
33pub const AF_APPLETALK: c_int = 16;
34pub const AF_NETBIOS: c_int = 17;
35pub const AF_VOICEVIEW: c_int = 18;
36pub const AF_FIREFOX: c_int = 19;
37pub const AF_UNKNOWN1: c_int = 20;
38pub const AF_BAN: c_int = 21;
39pub const AF_ATM: c_int = 22;
40pub const AF_INET6: c_int = 23;
41pub const AF_CLUSTER: c_int = 24;
42pub const AF_12844: c_int = 25;
43pub const AF_IRDA: c_int = 26;
44pub const AF_NETDES: c_int = 28;
45pub const AF_TCNPROCESS: c_int = 29;
46pub const AF_TCNMESSAGE: c_int = 30;
47pub const AF_ICLFXBM: c_int = 31;
48pub const AF_BTH: c_int = 32;
49pub const AF_LINK: c_int = 33;
50pub const AF_HYPERV: c_int = 34;
51pub const AF_MAX: c_int = 35;
52pub const SOCK_STREAM: c_int = 1;
53pub const SOCK_DGRAM: c_int = 2;
54pub const SOCK_RAW: c_int = 3;
55pub const SOCK_RDM: c_int = 4;
56pub const SOCK_SEQPACKET: c_int = 5;
57pub const SOL_SOCKET: c_int = 0xffff;
58pub const SO_DEBUG: c_int = 0x0001;
59pub const SO_ACCEPTCONN: c_int = 0x0002;
60pub const SO_REUSEADDR: c_int = 0x0004;
61pub const SO_KEEPALIVE: c_int = 0x0008;
62pub const SO_DONTROUTE: c_int = 0x0010;
63pub const SO_BROADCAST: c_int = 0x0020;
64pub const SO_USELOOPBACK: c_int = 0x0040;
65pub const SO_LINGER: c_int = 0x0080;
66pub const SO_OOBINLINE: c_int = 0x0100;
67pub const SO_DONTLINGER: c_int = !SO_LINGER;
68pub const SO_EXCLUSIVEADDRUSE: c_int = !SO_REUSEADDR;
69pub const SO_SNDBUF: c_int = 0x1001;
70pub const SO_RCVBUF: c_int = 0x1002;
71pub const SO_SNDLOWAT: c_int = 0x1003;
72pub const SO_RCVLOWAT: c_int = 0x1004;
73pub const SO_SNDTIMEO: c_int = 0x1005;
74pub const SO_RCVTIMEO: c_int = 0x1006;
75pub const SO_ERROR: c_int = 0x1007;
76pub const SO_TYPE: c_int = 0x1008;
77pub const SO_BSP_STATE: c_int = 0x1009;
78pub const SO_GROUP_ID: c_int = 0x2001;
79pub const SO_GROUP_PRIORITY: c_int = 0x2002;
80pub const SO_MAX_MSG_SIZE: c_int = 0x2003;
81pub const SO_CONDITIONAL_ACCEPT: c_int = 0x3002;
82pub const SO_PAUSE_ACCEPT: c_int = 0x3003;
83pub const SO_COMPARTMENT_ID: c_int = 0x3004;
84pub const SO_RANDOMIZE_PORT: c_int = 0x3005;
85pub const SO_PORT_SCALABILITY: c_int = 0x3006;
86pub const SO_REUSE_UNICASTPORT: c_int = 0x3007;
87pub const SO_REUSE_MULTICASTPORT: c_int = 0x3008;
88pub const WSK_SO_BASE: c_int = 0x4000;
89pub const TCP_NODELAY: c_int = 0x0001;
90STRUCT!{struct SOCKADDR {
91    sa_family: ADDRESS_FAMILY,
92    sa_data: [CHAR; 14],
93}}
94pub type PSOCKADDR = *mut SOCKADDR;
95pub type LPSOCKADDR = *mut SOCKADDR;
96STRUCT!{struct SOCKET_ADDRESS {
97    lpSockaddr: LPSOCKADDR,
98    iSockaddrLength: INT,
99}}
100pub type PSOCKET_ADDRESS = *mut SOCKET_ADDRESS;
101pub type LPSOCKET_ADDRESS = *mut SOCKET_ADDRESS;
102STRUCT!{struct SOCKET_ADDRESS_LIST {
103    iAddressCount: INT,
104    Address: [SOCKET_ADDRESS; 1],
105}}
106pub type PSOCKET_ADDRESS_LIST = *mut SOCKET_ADDRESS_LIST;
107pub type LPSOCKET_ADDRESS_LIST = *mut SOCKET_ADDRESS_LIST;
108STRUCT!{struct CSADDR_INFO {
109    LocalAddr: SOCKET_ADDRESS,
110    RemoteAddr: SOCKET_ADDRESS,
111    iSocketType: INT,
112    iProtocol: INT,
113}}
114pub type PCSADDR_INFO = *mut CSADDR_INFO;
115pub type LPCSADDR_INFO = *mut CSADDR_INFO;
116STRUCT!{struct SOCKADDR_STORAGE_LH {
117    ss_family: ADDRESS_FAMILY,
118    __ss_pad1: [CHAR; 6],
119    __ss_align: __int64,
120    __ss_pad2: [CHAR; 112],
121}}
122pub type PSOCKADDR_STORAGE_LH = *mut SOCKADDR_STORAGE_LH;
123pub type LPSOCKADDR_STORAGE_LH = *mut SOCKADDR_STORAGE_LH;
124STRUCT!{struct SOCKADDR_STORAGE_XP {
125    ss_family: c_short,
126    __ss_pad1: [CHAR; 6],
127    __ss_align: __int64,
128    __ss_pad2: [CHAR; 112],
129}}
130pub type PSOCKADDR_STORAGE_XP = *mut SOCKADDR_STORAGE_XP;
131pub type LPSOCKADDR_STORAGE_XP = *mut SOCKADDR_STORAGE_XP;
132pub type SOCKADDR_STORAGE = SOCKADDR_STORAGE_LH;
133pub type PSOCKADDR_STORAGE = *mut SOCKADDR_STORAGE;
134pub type LPSOCKADDR_STORAGE = *mut SOCKADDR_STORAGE;
135STRUCT!{struct SOCKET_PROCESSOR_AFFINITY {
136    Processor: PROCESSOR_NUMBER,
137    NumaNodeId: USHORT,
138    Reserved: USHORT,
139}}
140pub type PSOCKET_PROCESSOR_AFFINITY = *mut SOCKET_PROCESSOR_AFFINITY;
141pub const IOC_UNIX: DWORD = 0x00000000;
142pub const IOC_WS2: DWORD = 0x08000000;
143pub const IOC_PROTOCOL: DWORD = 0x10000000;
144pub const IOC_VENDOR: DWORD = 0x18000000;
145pub const IOC_WSK: DWORD = IOC_WS2 | 0x07000000;
146pub const SIO_ASSOCIATE_HANDLE: DWORD = _WSAIOW!(IOC_WS2, 1);
147pub const SIO_ENABLE_CIRCULAR_QUEUEING: DWORD = _WSAIO!(IOC_WS2, 2);
148pub const SIO_FIND_ROUTE: DWORD = _WSAIOR!(IOC_WS2, 3);
149pub const SIO_FLUSH: DWORD = _WSAIO!(IOC_WS2, 4);
150pub const SIO_GET_BROADCAST_ADDRESS: DWORD = _WSAIOR!(IOC_WS2, 5);
151pub const SIO_GET_EXTENSION_FUNCTION_POINTER: DWORD = _WSAIORW!(IOC_WS2, 6);
152pub const SIO_GET_QOS: DWORD = _WSAIORW!(IOC_WS2, 7);
153pub const SIO_GET_GROUP_QOS: DWORD = _WSAIORW!(IOC_WS2, 8);
154pub const SIO_MULTIPOINT_LOOPBACK: DWORD = _WSAIOW!(IOC_WS2, 9);
155pub const SIO_MULTICAST_SCOPE: DWORD = _WSAIOW!(IOC_WS2, 10);
156pub const SIO_SET_QOS: DWORD = _WSAIOW!(IOC_WS2, 11);
157pub const SIO_SET_GROUP_QOS: DWORD = _WSAIOW!(IOC_WS2, 12);
158pub const SIO_TRANSLATE_HANDLE: DWORD = _WSAIORW!(IOC_WS2, 13);
159pub const SIO_ROUTING_INTERFACE_QUERY: DWORD = _WSAIORW!(IOC_WS2, 20);
160pub const SIO_ROUTING_INTERFACE_CHANGE: DWORD = _WSAIOW!(IOC_WS2, 21);
161pub const SIO_ADDRESS_LIST_QUERY: DWORD = _WSAIOR!(IOC_WS2, 22);
162pub const SIO_ADDRESS_LIST_CHANGE: DWORD = _WSAIO!(IOC_WS2, 23);
163pub const SIO_QUERY_TARGET_PNP_HANDLE: DWORD = _WSAIOR!(IOC_WS2, 24);
164pub const SIO_QUERY_RSS_PROCESSOR_INFO: DWORD = _WSAIOR!(IOC_WS2, 37);
165pub const SIO_ADDRESS_LIST_SORT: DWORD = _WSAIORW!(IOC_WS2, 25);
166pub const SIO_RESERVED_1: DWORD = _WSAIOW!(IOC_WS2, 26);
167pub const SIO_RESERVED_2: DWORD = _WSAIOW!(IOC_WS2, 33);
168pub const SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER: DWORD = _WSAIORW!(IOC_WS2, 36);
169pub const IPPROTO_IP: c_int = 0;
170ENUM!{enum IPPROTO {
171    IPPROTO_HOPOPTS = 0, // IPv6 Hop-by-Hop options
172    IPPROTO_ICMP = 1,
173    IPPROTO_IGMP = 2,
174    IPPROTO_GGP = 3,
175    IPPROTO_IPV4 = 4,
176    IPPROTO_ST = 5,
177    IPPROTO_TCP = 6,
178    IPPROTO_CBT = 7,
179    IPPROTO_EGP = 8,
180    IPPROTO_IGP = 9,
181    IPPROTO_PUP = 12,
182    IPPROTO_UDP = 17,
183    IPPROTO_IDP = 22,
184    IPPROTO_RDP = 27,
185    IPPROTO_IPV6 = 41, // IPv6 header
186    IPPROTO_ROUTING = 43, // IPv6 Routing header
187    IPPROTO_FRAGMENT = 44, // IPv6 fragmentation header
188    IPPROTO_ESP = 50, // encapsulating security payload
189    IPPROTO_AH = 51, // authentication header
190    IPPROTO_ICMPV6 = 58, // ICMPv6
191    IPPROTO_NONE = 59, // IPv6 no next header
192    IPPROTO_DSTOPTS = 60, // IPv6 Destination options
193    IPPROTO_ND = 77,
194    IPPROTO_ICLFXBM = 78,
195    IPPROTO_PIM = 103,
196    IPPROTO_PGM = 113,
197    IPPROTO_L2TP = 115,
198    IPPROTO_SCTP = 132,
199    IPPROTO_RAW = 255,
200    IPPROTO_MAX = 256,
201    IPPROTO_RESERVED_RAW = 257,
202    IPPROTO_RESERVED_IPSEC = 258,
203    IPPROTO_RESERVED_IPSECOFFLOAD = 259,
204    IPPROTO_RESERVED_WNV = 260,
205    IPPROTO_RESERVED_MAX = 261,
206}}
207pub type PIPPROTO = *mut IPPROTO;
208pub const IPPORT_TCPMUX: USHORT = 1;
209pub const IPPORT_ECHO: USHORT = 7;
210pub const IPPORT_DISCARD: USHORT = 9;
211pub const IPPORT_SYSTAT: USHORT = 11;
212pub const IPPORT_DAYTIME: USHORT = 13;
213pub const IPPORT_NETSTAT: USHORT = 15;
214pub const IPPORT_QOTD: USHORT = 17;
215pub const IPPORT_MSP: USHORT = 18;
216pub const IPPORT_CHARGEN: USHORT = 19;
217pub const IPPORT_FTP_DATA: USHORT = 20;
218pub const IPPORT_FTP: USHORT = 21;
219pub const IPPORT_TELNET: USHORT = 23;
220pub const IPPORT_SMTP: USHORT = 25;
221pub const IPPORT_TIMESERVER: USHORT = 37;
222pub const IPPORT_NAMESERVER: USHORT = 42;
223pub const IPPORT_WHOIS: USHORT = 43;
224pub const IPPORT_MTP: USHORT = 57;
225pub const IPPORT_TFTP: USHORT = 69;
226pub const IPPORT_RJE: USHORT = 77;
227pub const IPPORT_FINGER: USHORT = 79;
228pub const IPPORT_TTYLINK: USHORT = 87;
229pub const IPPORT_SUPDUP: USHORT = 95;
230pub const IPPORT_POP3: USHORT = 110;
231pub const IPPORT_NTP: USHORT = 123;
232pub const IPPORT_EPMAP: USHORT = 135;
233pub const IPPORT_NETBIOS_NS: USHORT = 137;
234pub const IPPORT_NETBIOS_DGM: USHORT = 138;
235pub const IPPORT_NETBIOS_SSN: USHORT = 139;
236pub const IPPORT_IMAP: USHORT = 143;
237pub const IPPORT_SNMP: USHORT = 161;
238pub const IPPORT_SNMP_TRAP: USHORT = 162;
239pub const IPPORT_IMAP3: USHORT = 220;
240pub const IPPORT_LDAP: USHORT = 389;
241pub const IPPORT_HTTPS: USHORT = 443;
242pub const IPPORT_MICROSOFT_DS: USHORT = 445;
243pub const IPPORT_EXECSERVER: USHORT = 512;
244pub const IPPORT_LOGINSERVER: USHORT = 513;
245pub const IPPORT_CMDSERVER: USHORT = 514;
246pub const IPPORT_EFSSERVER: USHORT = 520;
247pub const IPPORT_BIFFUDP: USHORT = 512;
248pub const IPPORT_WHOSERVER: USHORT = 513;
249pub const IPPORT_ROUTESERVER: USHORT = 520;
250pub const IPPORT_RESERVED: USHORT = 1024;
251pub const IPPORT_REGISTERED_MIN: USHORT = IPPORT_RESERVED;
252pub const IPPORT_REGISTERED_MAX: USHORT = 0xbfff;
253pub const IPPORT_DYNAMIC_MIN: USHORT = 0xc000;
254pub const IPPORT_DYNAMIC_MAX: USHORT = 0xffff;
255#[inline]
256pub fn IN_CLASSA(i: LONG) -> bool {
257    (i & 0x80000000) == 0
258}
259pub const IN_CLASSA_NET: LONG = 0xff000000;
260pub const IN_CLASSA_NSHIFT: LONG = 24;
261pub const IN_CLASSA_HOST: LONG = 0x00ffffff;
262pub const IN_CLASSA_MAX: LONG = 128;
263#[inline]
264pub fn IN_CLASSB(i: LONG) -> bool {
265    (i as u32 & 0xc0000000) == 0x80000000
266}
267pub const IN_CLASSB_NET: LONG = 0xffff0000;
268pub const IN_CLASSB_NSHIFT: LONG = 16;
269pub const IN_CLASSB_HOST: LONG = 0x0000ffff;
270pub const IN_CLASSB_MAX: LONG = 65536;
271#[inline]
272pub fn IN_CLASSC(i: LONG) -> bool {
273    (i as u32 & 0xe0000000) == 0xc0000000
274}
275pub const IN_CLASSC_NET: LONG = 0xffffff00;
276pub const IN_CLASSC_NSHIFT: LONG = 8;
277pub const IN_CLASSC_HOST: LONG = 0x000000ff;
278#[inline]
279pub fn IN_CLASSD(i: c_long) -> bool {
280    (i as u32 & 0xf0000000) == 0xe0000000
281}
282pub const IN_CLASSD_NET: LONG = 0xf0000000;
283pub const IN_CLASSD_NSHIFT: LONG = 28;
284pub const IN_CLASSD_HOST: LONG = 0x0fffffff;
285#[inline]
286pub fn IN_MULTICAST(i: c_long) -> bool {
287    IN_CLASSD(i)
288}
289pub const INADDR_ANY: ULONG = 0x00000000;
290pub const INADDR_LOOPBACK: ULONG = 0x7f000001;
291pub const INADDR_BROADCAST: ULONG = 0xffffffff;
292pub const INADDR_NONE: ULONG = 0xffffffff;
293ENUM!{enum SCOPE_LEVEL {
294    ScopeLevelInterface = 1,
295    ScopeLevelLink = 2,
296    ScopeLevelSubnet = 3,
297    ScopeLevelAdmin = 4,
298    ScopeLevelSite = 5,
299    ScopeLevelOrganization = 8,
300    ScopeLevelGlobal = 14,
301    ScopeLevelCount = 16,
302}}
303STRUCT!{struct SCOPE_ID_u_s {
304    bitfield: ULONG,
305}}
306BITFIELD!{SCOPE_ID_u_s bitfield: ULONG [
307    Zone set_Zone[0..28],
308    Level set_Level[28..32],
309]}
310UNION!{union SCOPE_ID_u {
311    [u32; 1],
312    s s_mut: SCOPE_ID_u_s,
313    Value Value_mut: ULONG,
314}}
315STRUCT!{struct SCOPE_ID {
316    u: SCOPE_ID_u,
317}}
318pub type PSCOPE_ID = *mut SCOPE_ID;
319STRUCT!{struct SOCKADDR_IN {
320    sin_family: ADDRESS_FAMILY,
321    sin_port: USHORT,
322    sin_addr: IN_ADDR,
323    sin_zero: [CHAR; 8],
324}}
325pub type PSOCKADDR_IN = *mut SOCKADDR_IN;
326STRUCT!{struct SOCKADDR_DL {
327    sdl_family: ADDRESS_FAMILY,
328    sdl_data: [UCHAR; 8],
329    sdl_zero: [UCHAR; 4],
330}}
331pub type PSOCKADDR_DL = *mut SOCKADDR_DL;
332pub const IOCPARM_MASK: DWORD = 0x7f;
333pub const IOC_VOID: DWORD = 0x20000000;
334pub const IOC_OUT: DWORD = 0x40000000;
335pub const IOC_IN: DWORD = 0x80000000;
336pub const IOC_INOUT: DWORD = IOC_IN | IOC_OUT;
337STRUCT!{struct WSABUF {
338    len: ULONG,
339    buf: *mut CHAR,
340}}
341pub type LPWSABUF = *mut WSABUF;
342STRUCT!{struct WSAMSG {
343    name: LPSOCKADDR,
344    namelen: INT,
345    lpBuffers: LPWSABUF,
346    dwBufferCount: ULONG,
347    Control: WSABUF,
348    dwFlags: ULONG,
349}}
350pub type PWSAMSG = *mut WSAMSG;
351pub type LPWSAMSG = *mut WSAMSG;
352STRUCT!{struct WSACMSGHDR {
353    cmsg_len: SIZE_T,
354    cmsg_level: INT,
355    cmsg_type: INT,
356}}
357pub type PWSACMSGHDR = *mut WSACMSGHDR;
358pub type LPWSACMSGHDR = *mut WSACMSGHDR;
359pub type CMSGHDR = WSACMSGHDR;
360pub type PCMSGHDR = *mut WSACMSGHDR;
361pub const MSG_TRUNC: ULONG = 0x0100;
362pub const MSG_CTRUNC: ULONG = 0x0200;
363pub const MSG_BCAST: ULONG = 0x0400;
364pub const MSG_MCAST: ULONG = 0x0800;
365pub const AI_PASSIVE: c_int = 0x00000001;
366pub const AI_CANONNAME: c_int = 0x00000002;
367pub const AI_NUMERICHOST: c_int = 0x00000004;
368pub const AI_NUMERICSERV: c_int = 0x00000008;
369pub const AI_DNS_ONLY: c_int = 0x00000010;
370pub const AI_ALL: c_int = 0x00000100;
371pub const AI_ADDRCONFIG: c_int = 0x00000400;
372pub const AI_V4MAPPED: c_int = 0x00000800;
373pub const AI_NON_AUTHORITATIVE: c_int = 0x00004000;
374pub const AI_SECURE: c_int = 0x00008000;
375pub const AI_RETURN_PREFERRED_NAMES: c_int = 0x00010000;
376pub const AI_FQDN: c_int = 0x00020000;
377pub const AI_FILESERVER: c_int = 0x00040000;
378pub const AI_DISABLE_IDN_ENCODING: c_int = 0x00080000;
379pub const AI_EXTENDED: c_int = 0x80000000;
380pub const AI_RESOLUTION_HANDLE: c_int = 0x40000000;
381STRUCT!{struct ADDRINFOA {
382    ai_flags: c_int,
383    ai_family: c_int,
384    ai_socktype: c_int,
385    ai_protocol: c_int,
386    ai_addrlen: size_t,
387    ai_canonname: *mut c_char,
388    ai_addr: *mut SOCKADDR,
389    ai_next: *mut ADDRINFOA,
390}}
391pub type PADDRINFOA = *mut ADDRINFOA;
392STRUCT!{struct ADDRINFOW {
393    ai_flags: c_int,
394    ai_family: c_int,
395    ai_socktype: c_int,
396    ai_protocol: c_int,
397    ai_addrlen: size_t,
398    ai_canonname: PWSTR,
399    ai_addr: *mut SOCKADDR,
400    ai_next: *mut ADDRINFOW,
401}}
402pub type PADDRINFOW = *mut ADDRINFOW;
403STRUCT!{struct ADDRINFOEXA {
404    ai_flags: c_int,
405    ai_family: c_int,
406    ai_socktype: c_int,
407    ai_protocol: c_int,
408    ai_addrlen: size_t,
409    ai_canonname: *mut c_char,
410    ai_addr: *mut SOCKADDR,
411    ai_blob: *mut c_void,
412    ai_bloblen: size_t,
413    ai_provider: LPGUID,
414    ai_next: *mut ADDRINFOEXA,
415}}
416pub type PADDRINFOEXA = *mut ADDRINFOEXA;
417pub type LPADDRINFOEXA = *mut ADDRINFOEXA;
418STRUCT!{struct ADDRINFOEXW {
419    ai_flags: c_int,
420    ai_family: c_int,
421    ai_socktype: c_int,
422    ai_protocol: c_int,
423    ai_addrlen: size_t,
424    ai_canonname: PWSTR,
425    ai_addr: *mut SOCKADDR,
426    ai_blob: *mut c_void,
427    ai_bloblen: size_t,
428    ai_provider: LPGUID,
429    ai_next: *mut ADDRINFOEXW,
430}}
431pub type PADDRINFOEXW = *mut ADDRINFOEXW;
432pub type LPADDRINFOEXW = *mut ADDRINFOEXW;
433pub const ADDRINFOEX_VERSION_2: c_int = 2;
434pub const ADDRINFOEX_VERSION_3: c_int = 3;
435pub const ADDRINFOEX_VERSION_4: c_int = 4;
436STRUCT!{struct ADDRINFOEX2A {
437    ai_flags: c_int,
438    ai_family: c_int,
439    ai_socktype: c_int,
440    ai_protocol: c_int,
441    ai_addrlen: size_t,
442    ai_canonname: *mut c_char,
443    ai_addr: *mut SOCKADDR,
444    ai_blob: *mut c_void,
445    ai_bloblen: size_t,
446    ai_provider: LPGUID,
447    ai_next: *mut ADDRINFOEX2W,
448    ai_version: c_int,
449    ai_fqdn: *mut c_char,
450}}
451pub type PADDRINFOEX2A = *mut ADDRINFOEX2A;
452pub type LPADDRINFOEX2A = *mut ADDRINFOEX2A;
453STRUCT!{struct ADDRINFOEX2W {
454    ai_flags: c_int,
455    ai_family: c_int,
456    ai_socktype: c_int,
457    ai_protocol: c_int,
458    ai_addrlen: size_t,
459    ai_canonname: PWSTR,
460    ai_addr: *mut SOCKADDR,
461    ai_blob: *mut c_void,
462    ai_bloblen: size_t,
463    ai_provider: LPGUID,
464    ai_next: *mut ADDRINFOEX2W,
465    ai_version: c_int,
466    ai_fqdn: PWSTR,
467}}
468pub type PADDRINFOEX2W = *mut ADDRINFOEX2W;
469pub type LPADDRINFOEX2W = *mut ADDRINFOEX2W;
470STRUCT!{struct ADDRINFOEX3A {
471    ai_flags: c_int,
472    ai_family: c_int,
473    ai_socktype: c_int,
474    ai_protocol: c_int,
475    ai_addrlen: size_t,
476    ai_canonname: *mut c_char,
477    ai_addr: *mut SOCKADDR,
478    ai_blob: *mut c_void,
479    ai_bloblen: size_t,
480    ai_provider: LPGUID,
481    ai_next: *mut ADDRINFOEX3W,
482    ai_version: c_int,
483    ai_fqdn: *mut c_char,
484    ai_interfaceindex: c_int,
485}}
486pub type PADDRINFOEX3A = *mut ADDRINFOEX3A;
487pub type LPADDRINFOEX3A = *mut ADDRINFOEX3A;
488STRUCT!{struct ADDRINFOEX3W {
489    ai_flags: c_int,
490    ai_family: c_int,
491    ai_socktype: c_int,
492    ai_protocol: c_int,
493    ai_addrlen: size_t,
494    ai_canonname: PWSTR,
495    ai_addr: *mut SOCKADDR,
496    ai_blob: *mut c_void,
497    ai_bloblen: size_t,
498    ai_provider: LPGUID,
499    ai_next: *mut ADDRINFOEX3W,
500    ai_version: c_int,
501    ai_fqdn: PWSTR,
502    ai_interfaceindex: c_int,
503}}
504pub type PADDRINFOEX3W = *mut ADDRINFOEX3W;
505pub type LPADDRINFOEX3W = *mut ADDRINFOEX3W;
506STRUCT!{struct ADDRINFOEX4 {
507    ai_flags: c_int,
508    ai_family: c_int,
509    ai_socktype: c_int,
510    ai_protocol: c_int,
511    ai_addrlen: size_t,
512    ai_canonname: PWSTR,
513    ai_addr: *mut SOCKADDR,
514    ai_blob: *mut c_void,
515    ai_bloblen: size_t,
516    ai_provider: LPGUID,
517    ai_next: *mut ADDRINFOEX4,
518    ai_version: c_int,
519    ai_fqdn: PWSTR,
520    ai_interfaceindex: c_int,
521    ai_resolutionhandle: HANDLE,
522}}
523pub type PADDRINFOEX4 = *mut ADDRINFOEX4;
524pub type LPADDRINFOEX4 = *mut ADDRINFOEX4;
525pub const NS_ALL: DWORD = 0;
526pub const NS_SAP: DWORD = 1;
527pub const NS_NDS: DWORD = 2;
528pub const NS_PEER_BROWSE: DWORD = 3;
529pub const NS_SLP: DWORD = 5;
530pub const NS_DHCP: DWORD = 6;
531pub const NS_TCPIP_LOCAL: DWORD = 10;
532pub const NS_TCPIP_HOSTS: DWORD = 11;
533pub const NS_DNS: DWORD = 12;
534pub const NS_NETBT: DWORD = 13;
535pub const NS_WINS: DWORD = 14;
536pub const NS_NLA: DWORD = 15;
537pub const NS_BTH: DWORD = 16;
538pub const NS_NBP: DWORD = 20;
539pub const NS_MS: DWORD = 30;
540pub const NS_STDA: DWORD = 31;
541pub const NS_NTDS: DWORD = 32;
542pub const NS_EMAIL: DWORD = 37;
543pub const NS_PNRPNAME: DWORD = 38;
544pub const NS_PNRPCLOUD: DWORD = 39;
545pub const NS_X500: DWORD = 40;
546pub const NS_NIS: DWORD = 41;
547pub const NS_NISPLUS: DWORD = 42;
548pub const NS_WRQ: DWORD = 50;
549pub const NS_NETDES: DWORD = 60;
550pub const NI_NOFQDN: c_int = 0x01;
551pub const NI_NUMERICHOST: c_int = 0x02;
552pub const NI_NAMEREQD: c_int = 0x04;
553pub const NI_NUMERICSERV: c_int = 0x08;
554pub const NI_DGRAM: c_int = 0x10;
555pub const NI_MAXHOST: c_int = 1025;
556pub const NI_MAXSERV: c_int = 32;