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 //! Definitions to be used with the WinSock 2 DLL and WinSock 2 applications.
7 use ctypes::{
8 __uint32, __uint64, c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint,
9 c_ulong, c_ushort,
10 };
11 use shared::basetsd::{DWORD_PTR, UINT_PTR, ULONG_PTR};
12 use shared::guiddef::{GUID, LPGUID};
13 use shared::inaddr::in_addr;
14 use shared::minwindef::{
15 BOOL, DWORD, FARPROC, HIWORD, INT, LOWORD, LPDWORD, LPHANDLE, LPINT, LPVOID, MAKELONG, UINT,
16 ULONG, WORD, WPARAM,
17 };
18 use shared::qos::FLOWSPEC;
19 use shared::windef::HWND;
20 use shared::winerror::{
21 ERROR_INVALID_HANDLE, ERROR_INVALID_PARAMETER, ERROR_IO_INCOMPLETE, ERROR_IO_PENDING,
22 ERROR_NOT_ENOUGH_MEMORY, ERROR_OPERATION_ABORTED, WAIT_TIMEOUT,
23 };
24 use shared::ws2def::{
25 AF_APPLETALK, AF_ATM, AF_BAN, AF_BTH, AF_CCITT, AF_CHAOS, AF_DATAKIT, AF_DECnet, AF_DLI,
26 AF_ECMA, AF_FIREFOX, AF_HYLINK, AF_IMPLINK, AF_INET, AF_INET6, AF_IPX, AF_ISO, AF_LAT,
27 AF_MAX, AF_NS, AF_OSI, AF_PUP, AF_SNA, AF_UNIX, AF_UNKNOWN1, AF_UNSPEC, AF_VOICEVIEW,
28 INADDR_ANY, LPCSADDR_INFO, LPSOCKADDR, LPWSABUF, LPWSAMSG, PSOCKET_ADDRESS_LIST, SOCKADDR,
29 SOCKADDR_IN, WSABUF,
30 };
31 use shared::wtypesbase::{BLOB, LPBLOB};
32 use um::minwinbase::OVERLAPPED;
33 use um::winbase::{INFINITE, WAIT_FAILED, WAIT_IO_COMPLETION, WAIT_OBJECT_0};
34 use um::winnt::{
35 CHAR, HANDLE, LONG, LPCSTR, LPSTR, LPWSTR, MAXIMUM_WAIT_OBJECTS, PWSTR, SHORT, WCHAR,
36 };
37 pub const WINSOCK_VERSION: WORD = 2 | (2 << 8);
38 pub type u_char = c_uchar;
39 pub type u_short = c_ushort;
40 pub type u_int = c_uint;
41 pub type u_long = c_ulong;
42 pub type u_int64 = __uint64;
43 pub type SOCKET = UINT_PTR;
44 pub const FD_SETSIZE: usize = 64;
45 STRUCT!{struct fd_set {
46 fd_count: u_int,
47 fd_array: [SOCKET; FD_SETSIZE],
48 }}
49 extern "system" {
__WSAFDIsSet( fd: SOCKET, _: *mut fd_set, ) -> c_int50 pub fn __WSAFDIsSet(
51 fd: SOCKET,
52 _: *mut fd_set,
53 ) -> c_int;
54 }
55 STRUCT!{struct timeval {
56 tv_sec: c_long,
57 tv_usec: c_long,
58 }}
59 pub const IOCPARM_MASK: c_long = 0x7f;
60 pub const IOC_VOID: c_long = 0x20000000;
61 pub const IOC_OUT: c_long = 0x40000000;
62 pub const IOC_IN: c_long = 0x80000000;
63 pub const IOC_INOUT: c_long = IOC_IN | IOC_OUT;
64 pub const FIONREAD: c_long = IOC_OUT | ((4 & IOCPARM_MASK) << 16) | (0x66 << 8) | 127;
65 pub const FIONBIO: c_long = IOC_IN | ((4 & IOCPARM_MASK) << 16) | (0x66 << 8) | 126;
66 pub const FIOASYNC: c_long = IOC_IN | ((4 & IOCPARM_MASK) << 16) | (0x66 << 8) | 125;
67 pub const SIOCSHIWAT: c_long = IOC_IN | ((4 & IOCPARM_MASK) << 16) | (0x73 << 8) | 0;
68 pub const SIOCGHIWAT: c_long = IOC_OUT | ((4 & IOCPARM_MASK) << 16) | (0x73 << 8) | 1;
69 pub const SIOCSLOWAT: c_long = IOC_IN | ((4 & IOCPARM_MASK) << 16) | (0x73 << 8) | 2;
70 pub const SIOCGLOWAT: c_long = IOC_OUT | ((4 & IOCPARM_MASK) << 16) | (0x73 << 8) | 3;
71 pub const SIOCATMARK: c_long = IOC_OUT | ((4 & IOCPARM_MASK) << 16) | (0x73 << 8) | 7;
72 STRUCT!{struct hostent {
73 h_name: *mut c_char,
74 h_aliases: *mut *mut c_char,
75 h_addrtype: c_short,
76 h_length: c_short,
77 h_addr_list: *mut *mut c_char,
78 }}
79 STRUCT!{struct netent {
80 n_name: *mut c_char,
81 n_aliases: *mut *mut c_char,
82 n_addrtype: c_short,
83 n_net: u_long,
84 }}
85 #[cfg(target_arch = "x86")]
86 STRUCT!{struct servent {
87 s_name: *mut c_char,
88 s_aliases: *mut *mut c_char,
89 s_port: c_short,
90 s_proto: *mut c_char,
91 }}
92 #[cfg(target_pointer_width = "64")]
93 STRUCT!{struct servent {
94 s_name: *mut c_char,
95 s_aliases: *mut *mut c_char,
96 s_proto: *mut c_char,
97 s_port: c_short,
98 }}
99 STRUCT!{struct protoent {
100 p_name: *mut c_char,
101 p_aliases: *mut *mut c_char,
102 p_proto: c_short,
103 }}
104 pub const IPPORT_ECHO: c_short = 7;
105 pub const IPPORT_DISCARD: c_short = 9;
106 pub const IPPORT_SYSTAT: c_short = 11;
107 pub const IPPORT_DAYTIME: c_short = 13;
108 pub const IPPORT_NETSTAT: c_short = 15;
109 pub const IPPORT_FTP: c_short = 21;
110 pub const IPPORT_TELNET: c_short = 23;
111 pub const IPPORT_SMTP: c_short = 25;
112 pub const IPPORT_TIMESERVER: c_short = 37;
113 pub const IPPORT_NAMESERVER: c_short = 42;
114 pub const IPPORT_WHOIS: c_short = 43;
115 pub const IPPORT_MTP: c_short = 57;
116 pub const IPPORT_TFTP: c_short = 69;
117 pub const IPPORT_RJE: c_short = 77;
118 pub const IPPORT_FINGER: c_short = 79;
119 pub const IPPORT_TTYLINK: c_short = 87;
120 pub const IPPORT_SUPDUP: c_short = 95;
121 pub const IPPORT_EXECSERVER: c_short = 512;
122 pub const IPPORT_LOGINSERVER: c_short = 513;
123 pub const IPPORT_CMDSERVER: c_short = 514;
124 pub const IPPORT_EFSSERVER: c_short = 520;
125 pub const IPPORT_BIFFUDP: c_short = 512;
126 pub const IPPORT_WHOSERVER: c_short = 513;
127 pub const IPPORT_ROUTESERVER: c_short = 520;
128 pub const IPPORT_RESERVED: c_short = 1024;
129 pub const IMPLINK_IP: c_short = 155;
130 pub const IMPLINK_LOWEXPER: c_short = 156;
131 pub const IMPLINK_HIGHEXPER: c_short = 158;
132 pub const ADDR_ANY: ULONG = INADDR_ANY;
133 pub const WSADESCRIPTION_LEN: usize = 256;
134 pub const WSASYS_STATUS_LEN: usize = 128;
135 #[cfg(target_arch = "x86")]
136 STRUCT!{struct WSADATA {
137 wVersion: WORD,
138 wHighVersion: WORD,
139 szDescription: [c_char; WSADESCRIPTION_LEN + 1],
140 szSystemStatus: [c_char; WSASYS_STATUS_LEN + 1],
141 iMaxSockets: c_ushort,
142 iMaxUdpDg: c_ushort,
143 lpVendorInfo: *mut c_char,
144 }}
145 #[cfg(target_pointer_width = "64")]
146 STRUCT!{struct WSADATA {
147 wVersion: WORD,
148 wHighVersion: WORD,
149 iMaxSockets: c_ushort,
150 iMaxUdpDg: c_ushort,
151 lpVendorInfo: *mut c_char,
152 szDescription: [c_char; WSADESCRIPTION_LEN + 1],
153 szSystemStatus: [c_char; WSASYS_STATUS_LEN + 1],
154 }}
155 pub type LPWSADATA = *mut WSADATA;
156 pub const INVALID_SOCKET: SOCKET = !0;
157 pub const SOCKET_ERROR: c_int = -1;
158 pub const FROM_PROTOCOL_INFO: c_int = -1;
159 pub const SOCK_STREAM: c_int = 1;
160 pub const SOCK_DGRAM: c_int = 2;
161 pub const SOCK_RAW: c_int = 3;
162 pub const SOCK_RDM: c_int = 4;
163 pub const SOCK_SEQPACKET: c_int = 5;
164 pub const SO_DEBUG: c_int = 0x0001;
165 pub const SO_ACCEPTCONN: c_int = 0x0002;
166 pub const SO_REUSEADDR: c_int = 0x0004;
167 pub const SO_KEEPALIVE: c_int = 0x0008;
168 pub const SO_DONTROUTE: c_int = 0x0010;
169 pub const SO_BROADCAST: c_int = 0x0020;
170 pub const SO_USELOOPBACK: c_int = 0x0040;
171 pub const SO_LINGER: c_int = 0x0080;
172 pub const SO_OOBINLINE: c_int = 0x0100;
173 pub const SO_DONTLINGER: c_int = !SO_LINGER;
174 pub const SO_EXCLUSIVEADDRUSE: c_int = !SO_REUSEADDR;
175 pub const SO_SNDBUF: c_int = 0x1001;
176 pub const SO_RCVBUF: c_int = 0x1002;
177 pub const SO_SNDLOWAT: c_int = 0x1003;
178 pub const SO_RCVLOWAT: c_int = 0x1004;
179 pub const SO_SNDTIMEO: c_int = 0x1005;
180 pub const SO_RCVTIMEO: c_int = 0x1006;
181 pub const SO_ERROR: c_int = 0x1007;
182 pub const SO_TYPE: c_int = 0x1008;
183 pub const SO_GROUP_ID: c_int = 0x2001;
184 pub const SO_GROUP_PRIORITY: c_int = 0x2002;
185 pub const SO_MAX_MSG_SIZE: c_int = 0x2003;
186 pub const SO_PROTOCOL_INFOA: c_int = 0x2004;
187 pub const SO_PROTOCOL_INFOW: c_int = 0x2005;
188 pub const PVD_CONFIG: c_int = 0x3001;
189 pub const SO_CONDITIONAL_ACCEPT: c_int = 0x3002;
190 STRUCT!{struct sockproto {
191 sp_family: u_short,
192 sp_protocol: u_short,
193 }}
194 pub const PF_UNSPEC: c_int = AF_UNSPEC;
195 pub const PF_UNIX: c_int = AF_UNIX;
196 pub const PF_INET: c_int = AF_INET;
197 pub const PF_IMPLINK: c_int = AF_IMPLINK;
198 pub const PF_PUP: c_int = AF_PUP;
199 pub const PF_CHAOS: c_int = AF_CHAOS;
200 pub const PF_NS: c_int = AF_NS;
201 pub const PF_IPX: c_int = AF_IPX;
202 pub const PF_ISO: c_int = AF_ISO;
203 pub const PF_OSI: c_int = AF_OSI;
204 pub const PF_ECMA: c_int = AF_ECMA;
205 pub const PF_DATAKIT: c_int = AF_DATAKIT;
206 pub const PF_CCITT: c_int = AF_CCITT;
207 pub const PF_SNA: c_int = AF_SNA;
208 pub const PF_DECnet: c_int = AF_DECnet;
209 pub const PF_DLI: c_int = AF_DLI;
210 pub const PF_LAT: c_int = AF_LAT;
211 pub const PF_HYLINK: c_int = AF_HYLINK;
212 pub const PF_APPLETALK: c_int = AF_APPLETALK;
213 pub const PF_VOICEVIEW: c_int = AF_VOICEVIEW;
214 pub const PF_FIREFOX: c_int = AF_FIREFOX;
215 pub const PF_UNKNOWN1: c_int = AF_UNKNOWN1;
216 pub const PF_BAN: c_int = AF_BAN;
217 pub const PF_ATM: c_int = AF_ATM;
218 pub const PF_INET6: c_int = AF_INET6;
219 pub const PF_BTH: c_int = AF_BTH;
220 pub const PF_MAX: c_int = AF_MAX;
221 STRUCT!{struct linger {
222 l_onoff: u_short,
223 l_linger: u_short,
224 }}
225 pub const SOL_SOCKET: c_int = 0xffff;
226 pub const SOMAXCONN: c_int = 0x7fffffff;
227 #[inline]
SOMAXCONN_HINT(b: c_int) -> c_int228 pub fn SOMAXCONN_HINT(b: c_int) -> c_int {
229 -b
230 }
231 pub const MSG_OOB: c_int = 0x1;
232 pub const MSG_PEEK: c_int = 0x2;
233 pub const MSG_DONTROUTE: c_int = 0x4;
234 pub const MSG_WAITALL: c_int = 0x8;
235 pub const MSG_PUSH_IMMEDIATE: c_int = 0x20;
236 pub const MSG_PARTIAL: c_int = 0x8000;
237 pub const MSG_INTERRUPT: c_int = 0x10;
238 pub const MSG_MAXIOVLEN: c_int = 16;
239 pub const MAXGETHOSTSTRUCT: usize = 1024;
240 pub const FD_READ_BIT: c_long = 0;
241 pub const FD_READ: c_long = 1 << FD_READ_BIT;
242 pub const FD_WRITE_BIT: c_long = 1;
243 pub const FD_WRITE: c_long = 1 << FD_WRITE_BIT;
244 pub const FD_OOB_BIT: c_long = 2;
245 pub const FD_OOB: c_long = 1 << FD_OOB_BIT;
246 pub const FD_ACCEPT_BIT: c_long = 3;
247 pub const FD_ACCEPT: c_long = 1 << FD_ACCEPT_BIT;
248 pub const FD_CONNECT_BIT: c_long = 4;
249 pub const FD_CONNECT: c_long = 1 << FD_CONNECT_BIT;
250 pub const FD_CLOSE_BIT: c_long = 5;
251 pub const FD_CLOSE: c_long = 1 << FD_CLOSE_BIT;
252 pub const FD_QOS_BIT: c_long = 6;
253 pub const FD_QOS: c_long = 1 << FD_QOS_BIT;
254 pub const FD_GROUP_QOS_BIT: c_long = 7;
255 pub const FD_GROUP_QOS: c_long = 1 << FD_GROUP_QOS_BIT;
256 pub const FD_ROUTING_INTERFACE_CHANGE_BIT: c_long = 8;
257 pub const FD_ROUTING_INTERFACE_CHANGE: c_long = 1 << FD_ROUTING_INTERFACE_CHANGE_BIT;
258 pub const FD_ADDRESS_LIST_CHANGE_BIT: c_long = 9;
259 pub const FD_ADDRESS_LIST_CHANGE: c_long = 1 << FD_ADDRESS_LIST_CHANGE_BIT;
260 pub const FD_MAX_EVENTS: usize = 10;
261 pub const FD_ALL_EVENTS: c_long = (1 << FD_MAX_EVENTS) - 1;
262 pub const WSABASEERR: c_int = 10000;
263 pub const WSAEINTR: c_int = WSABASEERR+4;
264 pub const WSAEBADF: c_int = WSABASEERR+9;
265 pub const WSAEACCES: c_int = WSABASEERR+13;
266 pub const WSAEFAULT: c_int = WSABASEERR+14;
267 pub const WSAEINVAL: c_int = WSABASEERR+22;
268 pub const WSAEMFILE: c_int = WSABASEERR+24;
269 pub const WSAEWOULDBLOCK: c_int = WSABASEERR+35;
270 pub const WSAEINPROGRESS: c_int = WSABASEERR+36;
271 pub const WSAEALREADY: c_int = WSABASEERR+37;
272 pub const WSAENOTSOCK: c_int = WSABASEERR+38;
273 pub const WSAEDESTADDRREQ: c_int = WSABASEERR+39;
274 pub const WSAEMSGSIZE: c_int = WSABASEERR+40;
275 pub const WSAEPROTOTYPE: c_int = WSABASEERR+41;
276 pub const WSAENOPROTOOPT: c_int = WSABASEERR+42;
277 pub const WSAEPROTONOSUPPORT: c_int = WSABASEERR+43;
278 pub const WSAESOCKTNOSUPPORT: c_int = WSABASEERR+44;
279 pub const WSAEOPNOTSUPP: c_int = WSABASEERR+45;
280 pub const WSAEPFNOSUPPORT: c_int = WSABASEERR+46;
281 pub const WSAEAFNOSUPPORT: c_int = WSABASEERR+47;
282 pub const WSAEADDRINUSE: c_int = WSABASEERR+48;
283 pub const WSAEADDRNOTAVAIL: c_int = WSABASEERR+49;
284 pub const WSAENETDOWN: c_int = WSABASEERR+50;
285 pub const WSAENETUNREACH: c_int = WSABASEERR+51;
286 pub const WSAENETRESET: c_int = WSABASEERR+52;
287 pub const WSAECONNABORTED: c_int = WSABASEERR+53;
288 pub const WSAECONNRESET: c_int = WSABASEERR+54;
289 pub const WSAENOBUFS: c_int = WSABASEERR+55;
290 pub const WSAEISCONN: c_int = WSABASEERR+56;
291 pub const WSAENOTCONN: c_int = WSABASEERR+57;
292 pub const WSAESHUTDOWN: c_int = WSABASEERR+58;
293 pub const WSAETOOMANYREFS: c_int = WSABASEERR+59;
294 pub const WSAETIMEDOUT: c_int = WSABASEERR+60;
295 pub const WSAECONNREFUSED: c_int = WSABASEERR+61;
296 pub const WSAELOOP: c_int = WSABASEERR+62;
297 pub const WSAENAMETOOLONG: c_int = WSABASEERR+63;
298 pub const WSAEHOSTDOWN: c_int = WSABASEERR+64;
299 pub const WSAEHOSTUNREACH: c_int = WSABASEERR+65;
300 pub const WSAENOTEMPTY: c_int = WSABASEERR+66;
301 pub const WSAEPROCLIM: c_int = WSABASEERR+67;
302 pub const WSAEUSERS: c_int = WSABASEERR+68;
303 pub const WSAEDQUOT: c_int = WSABASEERR+69;
304 pub const WSAESTALE: c_int = WSABASEERR+70;
305 pub const WSAEREMOTE: c_int = WSABASEERR+71;
306 pub const WSASYSNOTREADY: c_int = WSABASEERR+91;
307 pub const WSAVERNOTSUPPORTED: c_int = WSABASEERR+92;
308 pub const WSANOTINITIALISED: c_int = WSABASEERR+93;
309 pub const WSAEDISCON: c_int = WSABASEERR+101;
310 pub const WSAENOMORE: c_int = WSABASEERR+102;
311 pub const WSAECANCELLED: c_int = WSABASEERR+103;
312 pub const WSAEINVALIDPROCTABLE: c_int = WSABASEERR+104;
313 pub const WSAEINVALIDPROVIDER: c_int = WSABASEERR+105;
314 pub const WSAEPROVIDERFAILEDINIT: c_int = WSABASEERR+106;
315 pub const WSASYSCALLFAILURE: c_int = WSABASEERR+107;
316 pub const WSASERVICE_NOT_FOUND: c_int = WSABASEERR+108;
317 pub const WSATYPE_NOT_FOUND: c_int = WSABASEERR+109;
318 pub const WSA_E_NO_MORE: c_int = WSABASEERR+110;
319 pub const WSA_E_CANCELLED: c_int = WSABASEERR+111;
320 pub const WSAEREFUSED: c_int = WSABASEERR+112;
321 pub const WSAHOST_NOT_FOUND: c_int = WSABASEERR+1001;
322 pub const WSATRY_AGAIN: c_int = WSABASEERR+1002;
323 pub const WSANO_RECOVERY: c_int = WSABASEERR+1003;
324 pub const WSANO_DATA: c_int = WSABASEERR+1004;
325 pub const WSA_QOS_RECEIVERS: c_int = WSABASEERR + 1005;
326 pub const WSA_QOS_SENDERS: c_int = WSABASEERR + 1006;
327 pub const WSA_QOS_NO_SENDERS: c_int = WSABASEERR + 1007;
328 pub const WSA_QOS_NO_RECEIVERS: c_int = WSABASEERR + 1008;
329 pub const WSA_QOS_REQUEST_CONFIRMED: c_int = WSABASEERR + 1009;
330 pub const WSA_QOS_ADMISSION_FAILURE: c_int = WSABASEERR + 1010;
331 pub const WSA_QOS_POLICY_FAILURE: c_int = WSABASEERR + 1011;
332 pub const WSA_QOS_BAD_STYLE: c_int = WSABASEERR + 1012;
333 pub const WSA_QOS_BAD_OBJECT: c_int = WSABASEERR + 1013;
334 pub const WSA_QOS_TRAFFIC_CTRL_ERROR: c_int = WSABASEERR + 1014;
335 pub const WSA_QOS_GENERIC_ERROR: c_int = WSABASEERR + 1015;
336 pub const WSA_QOS_ESERVICETYPE: c_int = WSABASEERR + 1016;
337 pub const WSA_QOS_EFLOWSPEC: c_int = WSABASEERR + 1017;
338 pub const WSA_QOS_EPROVSPECBUF: c_int = WSABASEERR + 1018;
339 pub const WSA_QOS_EFILTERSTYLE: c_int = WSABASEERR + 1019;
340 pub const WSA_QOS_EFILTERTYPE: c_int = WSABASEERR + 1020;
341 pub const WSA_QOS_EFILTERCOUNT: c_int = WSABASEERR + 1021;
342 pub const WSA_QOS_EOBJLENGTH: c_int = WSABASEERR + 1022;
343 pub const WSA_QOS_EFLOWCOUNT: c_int = WSABASEERR + 1023;
344 pub const WSA_QOS_EUNKOWNPSOBJ: c_int = WSABASEERR + 1024;
345 pub const WSA_QOS_EPOLICYOBJ: c_int = WSABASEERR + 1025;
346 pub const WSA_QOS_EFLOWDESC: c_int = WSABASEERR + 1026;
347 pub const WSA_QOS_EPSFLOWSPEC: c_int = WSABASEERR + 1027;
348 pub const WSA_QOS_EPSFILTERSPEC: c_int = WSABASEERR + 1028;
349 pub const WSA_QOS_ESDMODEOBJ: c_int = WSABASEERR + 1029;
350 pub const WSA_QOS_ESHAPERATEOBJ: c_int = WSABASEERR + 1030;
351 pub const WSA_QOS_RESERVED_PETYPE: c_int = WSABASEERR + 1031;
352 #[inline]
h_errno() -> c_int353 pub unsafe fn h_errno() -> c_int {
354 WSAGetLastError()
355 }
356 pub const HOST_NOT_FOUND: c_int = WSAHOST_NOT_FOUND;
357 pub const TRY_AGAIN: c_int = WSATRY_AGAIN;
358 pub const NO_RECOVERY: c_int = WSANO_RECOVERY;
359 pub const NO_DATA: c_int = WSANO_DATA;
360 pub const WSANO_ADDRESS: c_int = WSANO_DATA;
361 pub const NO_ADDRESS: c_int = WSANO_ADDRESS;
362 pub type WSAEVENT = HANDLE;
363 pub type LPWSAEVENT = LPHANDLE;
364 pub type WSAOVERLAPPED = OVERLAPPED;
365 pub type LPWSAOVERLAPPED = *mut OVERLAPPED;
366 pub const WSA_IO_PENDING: c_int = ERROR_IO_PENDING as i32;
367 pub const WSA_IO_INCOMPLETE: c_int = ERROR_IO_INCOMPLETE as i32;
368 pub const WSA_INVALID_HANDLE: c_int = ERROR_INVALID_HANDLE as i32;
369 pub const WSA_INVALID_PARAMETER: c_int = ERROR_INVALID_PARAMETER as i32;
370 pub const WSA_NOT_ENOUGH_MEMORY: c_int = ERROR_NOT_ENOUGH_MEMORY as i32;
371 pub const WSA_OPERATION_ABORTED: c_int = ERROR_OPERATION_ABORTED as i32;
372 pub const WSA_INVALID_EVENT: WSAEVENT = 0 as WSAEVENT;
373 pub const WSA_MAXIMUM_WAIT_EVENTS: DWORD = MAXIMUM_WAIT_OBJECTS;
374 pub const WSA_WAIT_FAILED: DWORD = WAIT_FAILED;
375 pub const WSA_WAIT_EVENT_0: DWORD = WAIT_OBJECT_0;
376 pub const WSA_WAIT_IO_COMPLETION: DWORD = WAIT_IO_COMPLETION;
377 pub const WSA_WAIT_TIMEOUT: DWORD = WAIT_TIMEOUT;
378 pub const WSA_INFINITE: DWORD = INFINITE;
379 STRUCT!{struct QOS {
380 SendingFlowspec: FLOWSPEC,
381 FLOWSPEC: FLOWSPEC,
382 ProviderSpecific: WSABUF,
383 }}
384 pub type LPQOS = *mut QOS;
385 pub const CF_ACCEPT: c_int = 0x0000;
386 pub const CF_REJECT: c_int = 0x0001;
387 pub const CF_DEFER: c_int = 0x0002;
388 pub const SD_RECEIVE: c_int = 0x00;
389 pub const SD_SEND: c_int = 0x01;
390 pub const SD_BOTH: c_int = 0x02;
391 pub type GROUP = c_uint;
392 pub const SG_UNCONSTRAINED_GROUP: GROUP = 0x01;
393 pub const SG_CONSTRAINED_GROUP: GROUP = 0x02;
394 STRUCT!{struct WSANETWORKEVENTS {
395 lNetworkEvents: c_long,
396 iErrorCode: [c_int; FD_MAX_EVENTS],
397 }}
398 pub type LPWSANETWORKEVENTS = *mut WSANETWORKEVENTS;
399 pub const MAX_PROTOCOL_CHAIN: usize = 7;
400 pub const BASE_PROTOCOL: c_int = 1;
401 pub const LAYERED_PROTOCOL: c_int = 0;
402 STRUCT!{struct WSAPROTOCOLCHAIN {
403 ChainLen: c_int,
404 ChainEntries: [DWORD; MAX_PROTOCOL_CHAIN],
405 }}
406 pub type LPWSAPROTOCOLCHAIN = *mut WSAPROTOCOLCHAIN;
407 pub const WSAPROTOCOL_LEN: usize = 255;
408 STRUCT!{struct WSAPROTOCOL_INFOA {
409 dwServiceFlags1: DWORD,
410 dwServiceFlags2: DWORD,
411 dwServiceFlags3: DWORD,
412 dwServiceFlags4: DWORD,
413 dwServiceFlags5: DWORD,
414 ProviderId: GUID,
415 dwCatalogEntryId: DWORD,
416 ProtocolChain: WSAPROTOCOLCHAIN,
417 iVersion: c_int,
418 iAddressFamily: c_int,
419 iMaxSockAddr: c_int,
420 iMinSockAddr: c_int,
421 iSocketType: c_int,
422 iProtocol: c_int,
423 iProtocolMaxOffset: c_int,
424 iNetworkByteOrder: c_int,
425 iSecurityScheme: c_int,
426 dwMessageSize: DWORD,
427 dwProviderReserved: DWORD,
428 szProtocol: [CHAR; WSAPROTOCOL_LEN + 1],
429 }}
430 pub type LPWSAPROTOCOL_INFOA = *mut WSAPROTOCOL_INFOA;
431 STRUCT!{struct WSAPROTOCOL_INFOW {
432 dwServiceFlags1: DWORD,
433 dwServiceFlags2: DWORD,
434 dwServiceFlags3: DWORD,
435 dwServiceFlags4: DWORD,
436 dwServiceFlags5: DWORD,
437 ProviderId: GUID,
438 dwCatalogEntryId: DWORD,
439 ProtocolChain: WSAPROTOCOLCHAIN,
440 iVersion: c_int,
441 iAddressFamily: c_int,
442 iMaxSockAddr: c_int,
443 iMinSockAddr: c_int,
444 iSocketType: c_int,
445 iProtocol: c_int,
446 iProtocolMaxOffset: c_int,
447 iNetworkByteOrder: c_int,
448 iSecurityScheme: c_int,
449 dwMessageSize: DWORD,
450 dwProviderReserved: DWORD,
451 szProtocol: [WCHAR; WSAPROTOCOL_LEN + 1],
452 }}
453 pub type LPWSAPROTOCOL_INFOW = *mut WSAPROTOCOL_INFOW;
454 pub const PFL_MULTIPLE_PROTO_ENTRIES: DWORD = 0x00000001;
455 pub const PFL_RECOMMENDED_PROTO_ENTRY: DWORD = 0x00000002;
456 pub const PFL_HIDDEN: DWORD = 0x00000004;
457 pub const PFL_MATCHES_PROTOCOL_ZERO: DWORD = 0x00000008;
458 pub const PFL_NETWORKDIRECT_PROVIDER: DWORD = 0x00000010;
459 pub const XP1_CONNECTIONLESS: DWORD = 0x00000001;
460 pub const XP1_GUARANTEED_DELIVERY: DWORD = 0x00000002;
461 pub const XP1_GUARANTEED_ORDER: DWORD = 0x00000004;
462 pub const XP1_MESSAGE_ORIENTED: DWORD = 0x00000008;
463 pub const XP1_PSEUDO_STREAM: DWORD = 0x00000010;
464 pub const XP1_GRACEFUL_CLOSE: DWORD = 0x00000020;
465 pub const XP1_EXPEDITED_DATA: DWORD = 0x00000040;
466 pub const XP1_CONNECT_DATA: DWORD = 0x00000080;
467 pub const XP1_DISCONNECT_DATA: DWORD = 0x00000100;
468 pub const XP1_SUPPORT_BROADCAST: DWORD = 0x00000200;
469 pub const XP1_SUPPORT_MULTIPOINT: DWORD = 0x00000400;
470 pub const XP1_MULTIPOINT_CONTROL_PLANE: DWORD = 0x00000800;
471 pub const XP1_MULTIPOINT_DATA_PLANE: DWORD = 0x00001000;
472 pub const XP1_QOS_SUPPORTED: DWORD = 0x00002000;
473 pub const XP1_INTERRUPT: DWORD = 0x00004000;
474 pub const XP1_UNI_SEND: DWORD = 0x00008000;
475 pub const XP1_UNI_RECV: DWORD = 0x00010000;
476 pub const XP1_IFS_HANDLES: DWORD = 0x00020000;
477 pub const XP1_PARTIAL_MESSAGE: DWORD = 0x00040000;
478 pub const XP1_SAN_SUPPORT_SDP: DWORD = 0x00080000;
479 pub const BIGENDIAN: DWORD = 0x0000;
480 pub const LITTLEENDIAN: DWORD = 0x0001;
481 pub const SECURITY_PROTOCOL_NONE: DWORD = 0x0000;
482 pub const JL_SENDER_ONLY: DWORD = 0x01;
483 pub const JL_RECEIVER_ONLY: DWORD = 0x02;
484 pub const JL_BOTH: DWORD = 0x04;
485 pub const WSA_FLAG_OVERLAPPED: DWORD = 0x01;
486 pub const WSA_FLAG_MULTIPOINT_C_ROOT: DWORD = 0x02;
487 pub const WSA_FLAG_MULTIPOINT_C_LEAF: DWORD = 0x04;
488 pub const WSA_FLAG_MULTIPOINT_D_ROOT: DWORD = 0x08;
489 pub const WSA_FLAG_MULTIPOINT_D_LEAF: DWORD = 0x10;
490 pub const WSA_FLAG_ACCESS_SYSTEM_SECURITY: DWORD = 0x40;
491 pub const WSA_FLAG_NO_HANDLE_INHERIT: DWORD = 0x80;
492 pub const WSA_FLAG_REGISTERED_IO: DWORD = 0x100;
493 FN!{stdcall LPCONDITIONPROC(
494 lpCallerId: LPWSABUF,
495 lpCallerData: LPWSABUF,
496 lpSQOS: LPQOS,
497 lpGQOS: LPQOS,
498 lpCalleeId: LPWSABUF,
499 lpCalleeData: LPWSABUF,
500 g: *mut GROUP,
501 dwCallbackData: DWORD,
502 ) -> c_int}
503 FN!{stdcall LPWSAOVERLAPPED_COMPLETION_ROUTINE(
504 dwError: DWORD,
505 cbTransferred: DWORD,
506 lpOverlapped: LPWSAOVERLAPPED,
507 dwFlags: DWORD,
508 ) -> ()}
509 ENUM!{enum WSACOMPLETIONTYPE {
510 NSP_NOTIFY_IMMEDIATELY = 0,
511 NSP_NOTIFY_HWND,
512 NSP_NOTIFY_EVENT,
513 NSP_NOTIFY_PORT,
514 NSP_NOTIFY_APC,
515 }}
516 pub type PWSACOMPLETIONTYPE = *mut WSACOMPLETIONTYPE;
517 pub type LPWSACOMPLETIONTYPE = *mut WSACOMPLETIONTYPE;
518 STRUCT!{struct WSACOMPLETION_WindowMessage {
519 hWnd: HWND,
520 uMsg: UINT,
521 context: WPARAM,
522 }}
523 STRUCT!{struct WSACOMPLETION_Event {
524 lpOverlapped: LPWSAOVERLAPPED,
525 }}
526 STRUCT!{struct WSACOMPLETION_Apc {
527 lpOverlapped: LPWSAOVERLAPPED,
528 lpfnCompletionProc: LPWSAOVERLAPPED_COMPLETION_ROUTINE,
529 }}
530 STRUCT!{struct WSACOMPLETION_Port {
531 lpOverlapped: LPWSAOVERLAPPED,
532 hPort: HANDLE,
533 Key: ULONG_PTR,
534 }}
535 UNION!{union WSACOMPLETION_Parameter {
536 [usize; 3],
537 WindowMessage WindowMessage_mut: WSACOMPLETION_WindowMessage,
538 Event Event_mut: WSACOMPLETION_Event,
539 Apc Apc_mut: WSACOMPLETION_Apc,
540 Port Port_mut: WSACOMPLETION_Port,
541 }}
542 STRUCT!{struct WSACOMPLETION {
543 Type: WSACOMPLETIONTYPE,
544 Parameters: WSACOMPLETION_Parameter,
545 }}
546 pub type PWSACOMPLETION = *mut WSACOMPLETION;
547 pub type LPWSACOMPLETION = *mut WSACOMPLETION;
548 pub const TH_NETDEV: DWORD = 0x00000001;
549 pub const TH_TAPI: DWORD = 0x00000002;
550 pub const SERVICE_MULTIPLE: DWORD = 0x00000001;
551 pub const NS_ALL: DWORD = 0;
552 pub const NS_SAP: DWORD = 1;
553 pub const NS_NDS: DWORD = 2;
554 pub const NS_PEER_BROWSE: DWORD = 3;
555 pub const NS_SLP: DWORD = 5;
556 pub const NS_DHCP: DWORD = 6;
557 pub const NS_TCPIP_LOCAL: DWORD = 10;
558 pub const NS_TCPIP_HOSTS: DWORD = 11;
559 pub const NS_DNS: DWORD = 12;
560 pub const NS_NETBT: DWORD = 13;
561 pub const NS_WINS: DWORD = 14;
562 pub const NS_NLA: DWORD = 15;
563 pub const NS_BTH: DWORD = 16;
564 pub const NS_LOCALNAME: DWORD = 19;
565 pub const NS_NBP: DWORD = 20;
566 pub const NS_MS: DWORD = 30;
567 pub const NS_STDA: DWORD = 31;
568 pub const NS_NTDS: DWORD = 32;
569 pub const NS_EMAIL: DWORD = 37;
570 pub const NS_PNRPNAME: DWORD = 38;
571 pub const NS_PNRPCLOUD: DWORD = 39;
572 pub const NS_X500: DWORD = 40;
573 pub const NS_NIS: DWORD = 41;
574 pub const NS_NISPLUS: DWORD = 42;
575 pub const NS_WRQ: DWORD = 50;
576 pub const NS_NETDES: DWORD = 60;
577 pub const RES_UNUSED_1: DWORD = 0x00000001;
578 pub const RES_FLUSH_CACHE: DWORD = 0x00000002;
579 pub const RES_SERVICE: DWORD = 0x00000004;
580 pub const SERVICE_TYPE_VALUE_IPXPORT: &'static str = "IpxSocket";
581 pub const SERVICE_TYPE_VALUE_SAPID: &'static str = "SapId";
582 pub const SERVICE_TYPE_VALUE_TCPPORT: &'static str = "TcpPort";
583 pub const SERVICE_TYPE_VALUE_UDPPORT: &'static str = "UdpPort";
584 pub const SERVICE_TYPE_VALUE_OBJECTID: &'static str = "ObjectId";
585 STRUCT!{struct AFPROTOCOLS {
586 iAddressFamily: INT,
587 iProtocol: INT,
588 }}
589 pub type PAFPROTOCOLS = *mut AFPROTOCOLS;
590 pub type LPAFPROTOCOLS = *mut AFPROTOCOLS;
591 ENUM!{enum WSAECOMPARATOR {
592 COMP_EQUAL = 0,
593 COMP_NOTLESS,
594 }}
595 pub type PWSAECOMPARATOR = *mut WSAECOMPARATOR;
596 pub type LPWSAECOMPARATOR = *mut WSAECOMPARATOR;
597 STRUCT!{struct WSAVERSION {
598 dwVersion: DWORD,
599 ecHow: WSAECOMPARATOR,
600 }}
601 pub type PWSAVERSION = *mut WSAVERSION;
602 pub type LPWSAVERSION = *mut WSAVERSION;
603 STRUCT!{struct WSAQUERYSETA {
604 dwSize: DWORD,
605 lpszServiceInstanceName: LPSTR,
606 lpServiceClassId: LPGUID,
607 lpVersion: LPWSAVERSION,
608 lpszComment: LPSTR,
609 dwNameSpace: DWORD,
610 lpNSProviderId: LPGUID,
611 lpszContext: LPSTR,
612 dwNumberOfProtocols: DWORD,
613 lpafpProtocols: LPAFPROTOCOLS,
614 lpszQueryString: LPSTR,
615 dwNumberOfCsAddrs: DWORD,
616 lpcsaBuffer: LPCSADDR_INFO,
617 dwOutputFlags: DWORD,
618 lpBlob: LPBLOB,
619 }}
620 pub type PWSAQUERYSETA = *mut WSAQUERYSETA;
621 pub type LPWSAQUERYSETA = *mut WSAQUERYSETA;
622 STRUCT!{struct WSAQUERYSETW {
623 dwSize: DWORD,
624 lpszServiceInstanceName: LPWSTR,
625 lpServiceClassId: LPGUID,
626 lpVersion: LPWSAVERSION,
627 lpszComment: LPWSTR,
628 dwNameSpace: DWORD,
629 lpNSProviderId: LPGUID,
630 lpszContext: LPWSTR,
631 dwNumberOfProtocols: DWORD,
632 lpafpProtocols: LPAFPROTOCOLS,
633 lpszQueryString: LPWSTR,
634 dwNumberOfCsAddrs: DWORD,
635 lpcsaBuffer: LPCSADDR_INFO,
636 dwOutputFlags: DWORD,
637 lpBlob: LPBLOB,
638 }}
639 pub type PWSAQUERYSETW = *mut WSAQUERYSETW;
640 pub type LPWSAQUERYSETW = *mut WSAQUERYSETW;
641 STRUCT!{struct WSAQUERYSET2A {
642 dwSize: DWORD,
643 lpszServiceInstanceName: LPSTR,
644 lpVersion: LPWSAVERSION,
645 lpszComment: LPSTR,
646 dwNameSpace: DWORD,
647 lpNSProviderId: LPGUID,
648 lpszContext: LPSTR,
649 dwNumberOfProtocols: DWORD,
650 lpafpProtocols: LPAFPROTOCOLS,
651 lpszQueryString: LPSTR,
652 dwNumberOfCsAddrs: DWORD,
653 lpcsaBuffer: LPCSADDR_INFO,
654 dwOutputFlags: DWORD,
655 lpBlob: LPBLOB,
656 }}
657 pub type PWSAQUERYSET2A = *mut WSAQUERYSET2A;
658 pub type LPWSAQUERYSET2A = *mut WSAQUERYSET2A;
659 STRUCT!{struct WSAQUERYSET2W {
660 dwSize: DWORD,
661 lpszServiceInstanceName: LPWSTR,
662 lpVersion: LPWSAVERSION,
663 lpszComment: LPWSTR,
664 dwNameSpace: DWORD,
665 lpNSProviderId: LPGUID,
666 lpszContext: LPWSTR,
667 dwNumberOfProtocols: DWORD,
668 lpafpProtocols: LPAFPROTOCOLS,
669 lpszQueryString: LPWSTR,
670 dwNumberOfCsAddrs: DWORD,
671 lpcsaBuffer: LPCSADDR_INFO,
672 dwOutputFlags: DWORD,
673 lpBlob: LPBLOB,
674 }}
675 pub type PWSAQUERYSET2W = *mut WSAQUERYSET2W;
676 pub type LPWSAQUERYSET2W = *mut WSAQUERYSET2W;
677 pub const LUP_DEEP: DWORD = 0x0001;
678 pub const LUP_CONTAINERS: DWORD = 0x0002;
679 pub const LUP_NOCONTAINERS: DWORD = 0x0004;
680 pub const LUP_NEAREST: DWORD = 0x0008;
681 pub const LUP_RETURN_NAME: DWORD = 0x0010;
682 pub const LUP_RETURN_TYPE: DWORD = 0x0020;
683 pub const LUP_RETURN_VERSION: DWORD = 0x0040;
684 pub const LUP_RETURN_COMMENT: DWORD = 0x0080;
685 pub const LUP_RETURN_ADDR: DWORD = 0x0100;
686 pub const LUP_RETURN_BLOB: DWORD = 0x0200;
687 pub const LUP_RETURN_ALIASES: DWORD = 0x0400;
688 pub const LUP_RETURN_QUERY_STRING: DWORD = 0x0800;
689 pub const LUP_RETURN_ALL: DWORD = 0x0FF0;
690 pub const LUP_RES_SERVICE: DWORD = 0x8000;
691 pub const LUP_FLUSHCACHE: DWORD = 0x1000;
692 pub const LUP_FLUSHPREVIOUS: DWORD = 0x2000;
693 pub const LUP_NON_AUTHORITATIVE: DWORD = 0x4000;
694 pub const LUP_SECURE: DWORD = 0x8000;
695 pub const LUP_RETURN_PREFERRED_NAMES: DWORD = 0x10000;
696 pub const LUP_DNS_ONLY: DWORD = 0x20000;
697 pub const LUP_ADDRCONFIG: DWORD = 0x00100000;
698 pub const LUP_DUAL_ADDR: DWORD = 0x00200000;
699 pub const LUP_FILESERVER: DWORD = 0x00400000;
700 pub const LUP_DISABLE_IDN_ENCODING: DWORD = 0x00800000;
701 pub const LUP_API_ANSI: DWORD = 0x01000000;
702 pub const LUP_RESOLUTION_HANDLE: DWORD = 0x80000000;
703 pub const RESULT_IS_ALIAS: DWORD = 0x0001;
704 pub const RESULT_IS_ADDED: DWORD = 0x0010;
705 pub const RESULT_IS_CHANGED: DWORD = 0x0020;
706 pub const RESULT_IS_DELETED: DWORD = 0x0040;
707 ENUM!{enum WSAESETSERVICEOP {
708 RNRSERVICE_REGISTER = 0,
709 RNRSERVICE_DEREGISTER,
710 RNRSERVICE_DELETE,
711 }}
712 pub type PWSAESETSERVICEOP = *mut WSAESETSERVICEOP;
713 pub type LPWSAESETSERVICEOP = *mut WSAESETSERVICEOP;
714 STRUCT!{struct WSANSCLASSINFOA {
715 lpszName: LPSTR,
716 dwNameSpace: DWORD,
717 dwValueType: DWORD,
718 dwValueSize: DWORD,
719 lpValue: LPVOID,
720 }}
721 pub type PWSANSCLASSINFOA = *mut WSANSCLASSINFOA;
722 pub type LPWSANSCLASSINFOA = *mut WSANSCLASSINFOA;
723 STRUCT!{struct WSANSCLASSINFOW {
724 lpszName: LPWSTR,
725 dwNameSpace: DWORD,
726 dwValueType: DWORD,
727 dwValueSize: DWORD,
728 lpValue: LPVOID,
729 }}
730 pub type PWSANSCLASSINFOW = *mut WSANSCLASSINFOW;
731 pub type LPWSANSCLASSINFOW = *mut WSANSCLASSINFOW;
732 STRUCT!{struct WSASERVICECLASSINFOA {
733 lpServiceClassId: LPGUID,
734 lpszServiceClassName: LPSTR,
735 dwCount: DWORD,
736 lpClassInfos: LPWSANSCLASSINFOA,
737 }}
738 pub type PWSASERVICECLASSINFOA = *mut WSASERVICECLASSINFOA;
739 pub type LPWSASERVICECLASSINFOA = *mut WSASERVICECLASSINFOA;
740 STRUCT!{struct WSASERVICECLASSINFOW {
741 lpServiceClassId: LPGUID,
742 lpszServiceClassName: LPWSTR,
743 dwCount: DWORD,
744 lpClassInfos: LPWSANSCLASSINFOW,
745 }}
746 pub type PWSASERVICECLASSINFOW = *mut WSASERVICECLASSINFOW;
747 pub type LPWSASERVICECLASSINFOW = *mut WSASERVICECLASSINFOW;
748 STRUCT!{struct WSANAMESPACE_INFOA {
749 NSProviderId: GUID,
750 dwNameSpace: DWORD,
751 fActive: BOOL,
752 dwVersion: DWORD,
753 lpszIdentifier: LPSTR,
754 }}
755 pub type PWSANAMESPACE_INFOA = *mut WSANAMESPACE_INFOA;
756 pub type LPWSANAMESPACE_INFOA = *mut WSANAMESPACE_INFOA;
757 STRUCT!{struct WSANAMESPACE_INFOW {
758 NSProviderId: GUID,
759 dwNameSpace: DWORD,
760 fActive: BOOL,
761 dwVersion: DWORD,
762 lpszIdentifier: LPWSTR,
763 }}
764 pub type PWSANAMESPACE_INFOW = *mut WSANAMESPACE_INFOW;
765 pub type LPWSANAMESPACE_INFOW = *mut WSANAMESPACE_INFOW;
766 STRUCT!{struct WSANAMESPACE_INFOEXA {
767 NSProviderId: GUID,
768 dwNameSpace: DWORD,
769 fActive: BOOL,
770 dwVersion: DWORD,
771 lpszIdentifier: LPSTR,
772 ProviderSpecific: BLOB,
773 }}
774 pub type PWSANAMESPACE_INFOEXA = *mut WSANAMESPACE_INFOEXA;
775 pub type LPWSANAMESPACE_INFOEXA = *mut WSANAMESPACE_INFOEXA;
776 STRUCT!{struct WSANAMESPACE_INFOEXW {
777 NSProviderId: GUID,
778 dwNameSpace: DWORD,
779 fActive: BOOL,
780 dwVersion: DWORD,
781 lpszIdentifier: LPWSTR,
782 ProviderSpecific: BLOB,
783 }}
784 pub type PWSANAMESPACE_INFOEXW = *mut WSANAMESPACE_INFOEXW;
785 pub type LPWSANAMESPACE_INFOEXW = *mut WSANAMESPACE_INFOEXW;
786 pub const POLLRDNORM: SHORT = 0x0100;
787 pub const POLLRDBAND: SHORT = 0x0200;
788 pub const POLLIN: SHORT = POLLRDNORM | POLLRDBAND;
789 pub const POLLPRI: SHORT = 0x0400;
790 pub const POLLWRNORM: SHORT = 0x0010;
791 pub const POLLOUT: SHORT = POLLWRNORM;
792 pub const POLLWRBAND: SHORT = 0x0020;
793 pub const POLLERR: SHORT = 0x0001;
794 pub const POLLHUP: SHORT = 0x0002;
795 pub const POLLNVAL: SHORT = 0x0004;
796 STRUCT!{struct WSAPOLLFD {
797 fd: SOCKET,
798 events: SHORT,
799 revents: SHORT,
800 }}
801 pub type PWSAPOLLFD = *mut WSAPOLLFD;
802 pub type LPWSAPOLLFD = *mut WSAPOLLFD;
803 extern "system" {
accept( s: SOCKET, addr: *mut SOCKADDR, addrlen: *mut c_int, ) -> SOCKET804 pub fn accept(
805 s: SOCKET,
806 addr: *mut SOCKADDR,
807 addrlen: *mut c_int,
808 ) -> SOCKET;
bind(s: SOCKET, name: *const SOCKADDR, namelen: c_int, ) -> c_int809 pub fn bind(s: SOCKET,
810 name: *const SOCKADDR,
811 namelen: c_int,
812 ) -> c_int;
closesocket( s: SOCKET, ) -> c_int813 pub fn closesocket(
814 s: SOCKET,
815 ) -> c_int;
connect( s: SOCKET, name: *const SOCKADDR, namelen: c_int, ) -> c_int816 pub fn connect(
817 s: SOCKET,
818 name: *const SOCKADDR,
819 namelen: c_int,
820 ) -> c_int;
ioctlsocket( s: SOCKET, cmd: c_long, argp: *mut u_long, ) -> c_int821 pub fn ioctlsocket(
822 s: SOCKET,
823 cmd: c_long,
824 argp: *mut u_long,
825 ) -> c_int;
getpeername( s: SOCKET, name: *mut SOCKADDR, namelen: *mut c_int, ) -> c_int826 pub fn getpeername(
827 s: SOCKET,
828 name: *mut SOCKADDR,
829 namelen: *mut c_int,
830 ) -> c_int;
getsockname( s: SOCKET, name: *mut SOCKADDR, namelen: *mut c_int, ) -> c_int831 pub fn getsockname(
832 s: SOCKET,
833 name: *mut SOCKADDR,
834 namelen: *mut c_int,
835 ) -> c_int;
getsockopt( s: SOCKET, level: c_int, optname: c_int, optval: *mut c_char, optlen: *mut c_int, ) -> c_int836 pub fn getsockopt(
837 s: SOCKET,
838 level: c_int,
839 optname: c_int,
840 optval: *mut c_char,
841 optlen: *mut c_int,
842 ) -> c_int;
htonl( hostlong: u_long, ) -> u_long843 pub fn htonl(
844 hostlong: u_long,
845 ) -> u_long;
htons( hostshort: u_short, ) -> u_short846 pub fn htons(
847 hostshort: u_short,
848 ) -> u_short;
inet_addr( cp: *const c_char, ) -> c_ulong849 pub fn inet_addr(
850 cp: *const c_char,
851 ) -> c_ulong;
inet_ntoa( _in: in_addr, ) -> *mut c_char852 pub fn inet_ntoa(
853 _in: in_addr,
854 ) -> *mut c_char;
855 }
856 #[inline]
_WS2_32_WINSOCK_SWAP_LONG(l: __uint32) -> __uint32857 pub fn _WS2_32_WINSOCK_SWAP_LONG(l: __uint32) -> __uint32 {
858 ((l >> 24) & 0x000000FF) | ((l >> 8) & 0x0000FF00) | ((l << 8) & 0x00FF0000)
859 | ((l << 24) & 0xFF000000)
860 }
861 #[inline]
_WS2_32_WINSOCK_SWAP_LONGLONG(l: __uint64) -> __uint64862 pub fn _WS2_32_WINSOCK_SWAP_LONGLONG(l: __uint64) -> __uint64 {
863 ((l >> 56) & 0x00000000000000FF) | ((l >> 40) & 0x000000000000FF00)
864 | ((l >> 24) & 0x0000000000FF0000) | ((l >> 8) & 0x00000000FF000000)
865 | ((l << 8) & 0x000000FF00000000) | ((l << 24) & 0x0000FF0000000000)
866 | ((l << 40) & 0x00FF000000000000) | ((l << 56) & 0xFF00000000000000)
867 }
868 #[inline]
htonll(Value: __uint64) -> __uint64869 pub fn htonll(Value: __uint64) -> __uint64 {
870 _WS2_32_WINSOCK_SWAP_LONGLONG(Value)
871 }
872 #[inline]
ntohll(Value: __uint64) -> __uint64873 pub fn ntohll(Value: __uint64) -> __uint64 {
874 _WS2_32_WINSOCK_SWAP_LONGLONG(Value)
875 }
876 #[inline]
htonf(Value: c_float) -> __uint32877 pub fn htonf(Value: c_float) -> __uint32 {
878 let Tempval: __uint32 = unsafe { ::core::mem::transmute(Value) };
879 _WS2_32_WINSOCK_SWAP_LONG(Tempval)
880 }
881 #[inline]
ntohf(Value: __uint32) -> c_float882 pub fn ntohf(Value: __uint32) -> c_float {
883 let Tempval = _WS2_32_WINSOCK_SWAP_LONG(Value);
884 unsafe { ::core::mem::transmute(Tempval) }
885 }
886 #[inline]
htond(Value: c_double) -> __uint64887 pub fn htond(Value: c_double) -> __uint64 {
888 let Tempval: __uint64 = unsafe { ::core::mem::transmute(Value) };
889 _WS2_32_WINSOCK_SWAP_LONGLONG(Tempval)
890 }
891 #[inline]
ntohd(Value: __uint64) -> c_double892 pub fn ntohd(Value: __uint64) -> c_double {
893 let Tempval = _WS2_32_WINSOCK_SWAP_LONGLONG(Value);
894 unsafe { ::core::mem::transmute(Tempval) }
895 }
896 extern "system" {
listen( s: SOCKET, backlog: c_int, ) -> c_int897 pub fn listen(
898 s: SOCKET,
899 backlog: c_int,
900 ) -> c_int;
ntohl( netlong: u_long, ) -> u_long901 pub fn ntohl(
902 netlong: u_long,
903 ) -> u_long;
ntohs( netshort: u_short, ) -> u_short904 pub fn ntohs(
905 netshort: u_short,
906 ) -> u_short;
recv( s: SOCKET, buf: *mut c_char, len: c_int, flags: c_int, ) -> c_int907 pub fn recv(
908 s: SOCKET,
909 buf: *mut c_char,
910 len: c_int,
911 flags: c_int,
912 ) -> c_int;
recvfrom( s: SOCKET, buf: *mut c_char, len: c_int, flags: c_int, from: *mut SOCKADDR, fromlen: *mut c_int, ) -> c_int913 pub fn recvfrom(
914 s: SOCKET,
915 buf: *mut c_char,
916 len: c_int,
917 flags: c_int,
918 from: *mut SOCKADDR,
919 fromlen: *mut c_int,
920 ) -> c_int;
select( nfds: c_int, readfds: *mut fd_set, writefds: *mut fd_set, exceptfds: *mut fd_set, timeout: *const timeval, ) -> c_int921 pub fn select(
922 nfds: c_int,
923 readfds: *mut fd_set,
924 writefds: *mut fd_set,
925 exceptfds: *mut fd_set,
926 timeout: *const timeval,
927 ) -> c_int;
send( s: SOCKET, buf: *const c_char, len: c_int, flags: c_int, ) -> c_int928 pub fn send(
929 s: SOCKET,
930 buf: *const c_char,
931 len: c_int,
932 flags: c_int,
933 ) -> c_int;
sendto( s: SOCKET, buf: *const c_char, len: c_int, flags: c_int, to: *const SOCKADDR, tolen: c_int, ) -> c_int934 pub fn sendto(
935 s: SOCKET,
936 buf: *const c_char,
937 len: c_int,
938 flags: c_int,
939 to: *const SOCKADDR,
940 tolen: c_int,
941 ) -> c_int;
setsockopt( s: SOCKET, level: c_int, optname: c_int, optval: *const c_char, optlen: c_int, ) -> c_int942 pub fn setsockopt(
943 s: SOCKET,
944 level: c_int,
945 optname: c_int,
946 optval: *const c_char,
947 optlen: c_int,
948 ) -> c_int;
shutdown( s: SOCKET, how: c_int, ) -> c_int949 pub fn shutdown(
950 s: SOCKET,
951 how: c_int,
952 ) -> c_int;
socket( af: c_int, _type: c_int, protocol: c_int, ) -> SOCKET953 pub fn socket(
954 af: c_int,
955 _type: c_int,
956 protocol: c_int,
957 ) -> SOCKET;
gethostbyaddr( addr: *const c_char, len: c_int, _type: c_int, ) -> *mut hostent958 pub fn gethostbyaddr(
959 addr: *const c_char,
960 len: c_int,
961 _type: c_int,
962 ) -> *mut hostent;
gethostbyname( name: *const c_char, ) -> *mut hostent963 pub fn gethostbyname(
964 name: *const c_char,
965 ) -> *mut hostent;
gethostname( name: *mut c_char, namelen: c_int, ) -> c_int966 pub fn gethostname(
967 name: *mut c_char,
968 namelen: c_int,
969 ) -> c_int;
GetHostNameW( name: PWSTR, namelen: c_int, ) -> c_int970 pub fn GetHostNameW(
971 name: PWSTR,
972 namelen: c_int,
973 ) -> c_int;
getservbyport( port: c_int, proto: *const c_char, ) -> *mut servent974 pub fn getservbyport(
975 port: c_int,
976 proto: *const c_char,
977 ) -> *mut servent;
getservbyname( name: *const c_char, proto: *const c_char, ) -> *mut servent978 pub fn getservbyname(
979 name: *const c_char,
980 proto: *const c_char,
981 ) -> *mut servent;
getprotobynumber( number: c_int, ) -> *mut protoent982 pub fn getprotobynumber(
983 number: c_int,
984 ) -> *mut protoent;
getprotobyname( name: *const c_char, ) -> *mut protoent985 pub fn getprotobyname(
986 name: *const c_char,
987 ) -> *mut protoent;
WSAStartup( wVersionRequested: WORD, lpWSAData: LPWSADATA, ) -> c_int988 pub fn WSAStartup(
989 wVersionRequested: WORD,
990 lpWSAData: LPWSADATA,
991 ) -> c_int;
WSACleanup() -> c_int992 pub fn WSACleanup() -> c_int;
WSASetLastError( iError: c_int, )993 pub fn WSASetLastError(
994 iError: c_int,
995 );
WSAGetLastError() -> c_int996 pub fn WSAGetLastError() -> c_int;
WSAIsBlocking() -> BOOL997 pub fn WSAIsBlocking() -> BOOL;
WSAUnhookBlockingHook() -> c_int998 pub fn WSAUnhookBlockingHook() -> c_int;
WSASetBlockingHook( lpBlockFunc: FARPROC, ) -> FARPROC999 pub fn WSASetBlockingHook(
1000 lpBlockFunc: FARPROC,
1001 ) -> FARPROC;
WSACancelBlockingCall() -> c_int1002 pub fn WSACancelBlockingCall() -> c_int;
WSAAsyncGetServByName( hWnd: HWND, wMsg: u_int, name: *const c_char, proto: *const c_char, buf: *mut c_char, buflen: c_int, ) -> HANDLE1003 pub fn WSAAsyncGetServByName(
1004 hWnd: HWND,
1005 wMsg: u_int,
1006 name: *const c_char,
1007 proto: *const c_char,
1008 buf: *mut c_char,
1009 buflen: c_int,
1010 ) -> HANDLE;
WSAAsyncGetServByPort( hWnd: HWND, wMsg: u_int, port: c_int, proto: *const c_char, buf: *mut c_char, buflen: c_int, ) -> HANDLE1011 pub fn WSAAsyncGetServByPort(
1012 hWnd: HWND,
1013 wMsg: u_int,
1014 port: c_int,
1015 proto: *const c_char,
1016 buf: *mut c_char,
1017 buflen: c_int,
1018 ) -> HANDLE;
WSAAsyncGetProtoByName( hWnd: HWND, wMsg: u_int, name: *const c_char, buf: *mut c_char, buflen: c_int, ) -> HANDLE1019 pub fn WSAAsyncGetProtoByName(
1020 hWnd: HWND,
1021 wMsg: u_int,
1022 name: *const c_char,
1023 buf: *mut c_char,
1024 buflen: c_int,
1025 ) -> HANDLE;
WSAAsyncGetProtoByNumber( hWnd: HWND, wMsg: u_int, number: c_int, buf: *mut c_char, buflen: c_int, ) -> HANDLE1026 pub fn WSAAsyncGetProtoByNumber(
1027 hWnd: HWND,
1028 wMsg: u_int,
1029 number: c_int,
1030 buf: *mut c_char,
1031 buflen: c_int,
1032 ) -> HANDLE;
WSAAsyncGetHostByName( hWnd: HWND, wMsg: u_int, name: *const c_char, buf: *mut c_char, buflen: c_int, ) -> HANDLE1033 pub fn WSAAsyncGetHostByName(
1034 hWnd: HWND,
1035 wMsg: u_int,
1036 name: *const c_char,
1037 buf: *mut c_char,
1038 buflen: c_int,
1039 ) -> HANDLE;
WSAAsyncGetHostByAddr( hWnd: HWND, wMsg: u_int, addr: *const c_char, len: c_int, _type: c_int, buf: *mut c_char, buflen: c_int, ) -> HANDLE1040 pub fn WSAAsyncGetHostByAddr(
1041 hWnd: HWND,
1042 wMsg: u_int,
1043 addr: *const c_char,
1044 len: c_int,
1045 _type: c_int,
1046 buf: *mut c_char,
1047 buflen: c_int,
1048 ) -> HANDLE;
WSACancelAsyncRequest( hAsyncTaskHandle: HANDLE, ) -> c_int1049 pub fn WSACancelAsyncRequest(
1050 hAsyncTaskHandle: HANDLE,
1051 ) -> c_int;
WSAAsyncSelect( s: SOCKET, hWnd: HWND, wMsg: u_int, lEvent: c_long, ) -> c_int1052 pub fn WSAAsyncSelect(
1053 s: SOCKET,
1054 hWnd: HWND,
1055 wMsg: u_int,
1056 lEvent: c_long,
1057 ) -> c_int;
WSAAccept( s: SOCKET, addr: *mut SOCKADDR, addrlen: LPINT, lpfnCondition: LPCONDITIONPROC, dwCallbackData: DWORD_PTR, ) -> SOCKET1058 pub fn WSAAccept(
1059 s: SOCKET,
1060 addr: *mut SOCKADDR,
1061 addrlen: LPINT,
1062 lpfnCondition: LPCONDITIONPROC,
1063 dwCallbackData: DWORD_PTR,
1064 ) -> SOCKET;
WSACloseEvent( hEvent: WSAEVENT, ) -> BOOL1065 pub fn WSACloseEvent(
1066 hEvent: WSAEVENT,
1067 ) -> BOOL;
WSAConnect( s: SOCKET, name: *const SOCKADDR, namelen: c_int, lpCallerData: LPWSABUF, lpCalleeData: LPWSABUF, lpSQOS: LPQOS, lpGQOS: LPQOS, ) -> c_int1068 pub fn WSAConnect(
1069 s: SOCKET,
1070 name: *const SOCKADDR,
1071 namelen: c_int,
1072 lpCallerData: LPWSABUF,
1073 lpCalleeData: LPWSABUF,
1074 lpSQOS: LPQOS,
1075 lpGQOS: LPQOS,
1076 ) -> c_int;
WSAConnectByNameW( s: SOCKET, nodename: LPWSTR, servicename: LPWSTR, LocalAddressLength: LPDWORD, LocalAddress: LPSOCKADDR, RemoteAddressLength: LPDWORD, RemoteAddress: LPSOCKADDR, timeout: *const timeval, Reserved: LPWSAOVERLAPPED, ) -> BOOL1077 pub fn WSAConnectByNameW(
1078 s: SOCKET,
1079 nodename: LPWSTR,
1080 servicename: LPWSTR,
1081 LocalAddressLength: LPDWORD,
1082 LocalAddress: LPSOCKADDR,
1083 RemoteAddressLength: LPDWORD,
1084 RemoteAddress: LPSOCKADDR,
1085 timeout: *const timeval,
1086 Reserved: LPWSAOVERLAPPED,
1087 ) -> BOOL;
WSAConnectByNameA( s: SOCKET, nodename: LPCSTR, servicename: LPCSTR, LocalAddressLength: LPDWORD, LocalAddress: LPSOCKADDR, RemoteAddressLength: LPDWORD, RemoteAddress: LPSOCKADDR, timeout: *const timeval, Reserved: LPWSAOVERLAPPED, ) -> BOOL1088 pub fn WSAConnectByNameA(
1089 s: SOCKET,
1090 nodename: LPCSTR,
1091 servicename: LPCSTR,
1092 LocalAddressLength: LPDWORD,
1093 LocalAddress: LPSOCKADDR,
1094 RemoteAddressLength: LPDWORD,
1095 RemoteAddress: LPSOCKADDR,
1096 timeout: *const timeval,
1097 Reserved: LPWSAOVERLAPPED,
1098 ) -> BOOL;
WSAConnectByList( s: SOCKET, SocketAddress: PSOCKET_ADDRESS_LIST, LocalAddressLength: LPDWORD, LocalAddress: LPSOCKADDR, RemoteAddressLength: LPDWORD, RemoteAddress: LPSOCKADDR, timeout: *const timeval, Reserved: LPWSAOVERLAPPED, ) -> BOOL1099 pub fn WSAConnectByList(
1100 s: SOCKET,
1101 SocketAddress: PSOCKET_ADDRESS_LIST,
1102 LocalAddressLength: LPDWORD,
1103 LocalAddress: LPSOCKADDR,
1104 RemoteAddressLength: LPDWORD,
1105 RemoteAddress: LPSOCKADDR,
1106 timeout: *const timeval,
1107 Reserved: LPWSAOVERLAPPED,
1108 ) -> BOOL;
WSACreateEvent() -> WSAEVENT1109 pub fn WSACreateEvent() -> WSAEVENT;
WSADuplicateSocketA( s: SOCKET, dwProcessId: DWORD, lpProtocolInfo: LPWSAPROTOCOL_INFOA, ) -> c_int1110 pub fn WSADuplicateSocketA(
1111 s: SOCKET,
1112 dwProcessId: DWORD,
1113 lpProtocolInfo: LPWSAPROTOCOL_INFOA,
1114 ) -> c_int;
WSADuplicateSocketW( s: SOCKET, dwProcessId: DWORD, lpProtocolInfo: LPWSAPROTOCOL_INFOW, ) -> c_int1115 pub fn WSADuplicateSocketW(
1116 s: SOCKET,
1117 dwProcessId: DWORD,
1118 lpProtocolInfo: LPWSAPROTOCOL_INFOW,
1119 ) -> c_int;
WSAEnumNetworkEvents( s: SOCKET, hEventObject: WSAEVENT, lpNetworkEvents: LPWSANETWORKEVENTS, ) -> c_int1120 pub fn WSAEnumNetworkEvents(
1121 s: SOCKET,
1122 hEventObject: WSAEVENT,
1123 lpNetworkEvents: LPWSANETWORKEVENTS,
1124 ) -> c_int;
WSAEnumProtocolsA( lpiProtocols: LPINT, lpProtocolBuffer: LPWSAPROTOCOL_INFOA, lpdwBufferLength: LPDWORD, ) -> c_int1125 pub fn WSAEnumProtocolsA(
1126 lpiProtocols: LPINT,
1127 lpProtocolBuffer: LPWSAPROTOCOL_INFOA,
1128 lpdwBufferLength: LPDWORD,
1129 ) -> c_int;
WSAEnumProtocolsW( lpiProtocols: LPINT, lpProtocolBuffer: LPWSAPROTOCOL_INFOW, lpdwBufferLength: LPDWORD, ) -> c_int1130 pub fn WSAEnumProtocolsW(
1131 lpiProtocols: LPINT,
1132 lpProtocolBuffer: LPWSAPROTOCOL_INFOW,
1133 lpdwBufferLength: LPDWORD,
1134 ) -> c_int;
WSAEventSelect( s: SOCKET, hEventObject: WSAEVENT, lNetworkEvents: c_long, ) -> c_int1135 pub fn WSAEventSelect(
1136 s: SOCKET,
1137 hEventObject: WSAEVENT,
1138 lNetworkEvents: c_long,
1139 ) -> c_int;
WSAGetOverlappedResult( s: SOCKET, lpOverlapped: LPWSAOVERLAPPED, lpcbTransfer: LPDWORD, fWait: BOOL, lpdwFlags: LPDWORD, ) -> BOOL1140 pub fn WSAGetOverlappedResult(
1141 s: SOCKET,
1142 lpOverlapped: LPWSAOVERLAPPED,
1143 lpcbTransfer: LPDWORD,
1144 fWait: BOOL,
1145 lpdwFlags: LPDWORD,
1146 ) -> BOOL;
WSAGetQOSByName( s: SOCKET, lpQOSName: LPWSABUF, lpQOS: LPQOS, ) -> BOOL1147 pub fn WSAGetQOSByName(
1148 s: SOCKET,
1149 lpQOSName: LPWSABUF,
1150 lpQOS: LPQOS,
1151 ) -> BOOL;
WSAHtonl( s: SOCKET, hostlong: u_long, lpnetlong: *mut u_long, ) -> c_int1152 pub fn WSAHtonl(
1153 s: SOCKET,
1154 hostlong: u_long,
1155 lpnetlong: *mut u_long,
1156 ) -> c_int;
WSAHtons(s: SOCKET, hostshort: u_short, lpnetshort: *mut u_short, ) -> c_int1157 pub fn WSAHtons(s: SOCKET,
1158 hostshort: u_short,
1159 lpnetshort: *mut u_short,
1160 ) -> c_int;
WSAIoctl( s: SOCKET, dwIoControlCode: DWORD, lpvInBuffer: LPVOID, cbInBuffer: DWORD, lpvOutBuffer: LPVOID, cbOutBuffer: DWORD, lpcbBytesReturned: LPDWORD, lpOverlapped: LPWSAOVERLAPPED, lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, ) -> c_int1161 pub fn WSAIoctl(
1162 s: SOCKET,
1163 dwIoControlCode: DWORD,
1164 lpvInBuffer: LPVOID,
1165 cbInBuffer: DWORD,
1166 lpvOutBuffer: LPVOID,
1167 cbOutBuffer: DWORD,
1168 lpcbBytesReturned: LPDWORD,
1169 lpOverlapped: LPWSAOVERLAPPED,
1170 lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE,
1171 ) -> c_int;
WSAJoinLeaf( s: SOCKET, name: *const SOCKADDR, namelen: c_int, lpCallerData: LPWSABUF, lpCalleeData: LPWSABUF, lpSQOS: LPQOS, lpGQOS: LPQOS, dwFlags: DWORD, ) -> SOCKET1172 pub fn WSAJoinLeaf(
1173 s: SOCKET,
1174 name: *const SOCKADDR,
1175 namelen: c_int,
1176 lpCallerData: LPWSABUF,
1177 lpCalleeData: LPWSABUF,
1178 lpSQOS: LPQOS,
1179 lpGQOS: LPQOS,
1180 dwFlags: DWORD,
1181 ) -> SOCKET;
WSANtohl( s: SOCKET, netlong: u_long, lphostlong: *mut c_long, ) -> c_int1182 pub fn WSANtohl(
1183 s: SOCKET,
1184 netlong: u_long,
1185 lphostlong: *mut c_long,
1186 ) -> c_int;
WSANtohs( s: SOCKET, netshort: u_short, lphostshort: *mut c_short, ) -> c_int1187 pub fn WSANtohs(
1188 s: SOCKET,
1189 netshort: u_short,
1190 lphostshort: *mut c_short,
1191 ) -> c_int;
WSARecv( s: SOCKET, lpBuffers: LPWSABUF, dwBufferCount: DWORD, lpNumberOfBytesRecvd: LPDWORD, lpFlags: LPDWORD, lpOverlapped: LPWSAOVERLAPPED, lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, ) -> c_int1192 pub fn WSARecv(
1193 s: SOCKET,
1194 lpBuffers: LPWSABUF,
1195 dwBufferCount: DWORD,
1196 lpNumberOfBytesRecvd: LPDWORD,
1197 lpFlags: LPDWORD,
1198 lpOverlapped: LPWSAOVERLAPPED,
1199 lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE,
1200 ) -> c_int;
WSARecvDisconnect( s: SOCKET, lpInboundDisconnectData: LPWSABUF, ) -> c_int1201 pub fn WSARecvDisconnect(
1202 s: SOCKET,
1203 lpInboundDisconnectData: LPWSABUF,
1204 ) -> c_int;
WSARecvFrom( s: SOCKET, lpBuffers: LPWSABUF, dwBufferCount: DWORD, lpNumberOfBytesRecvd: LPDWORD, lpFlags: LPDWORD, lpFrom: *mut SOCKADDR, lpFromlen: LPINT, lpOverlapped: LPWSAOVERLAPPED, lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, ) -> c_int1205 pub fn WSARecvFrom(
1206 s: SOCKET,
1207 lpBuffers: LPWSABUF,
1208 dwBufferCount: DWORD,
1209 lpNumberOfBytesRecvd: LPDWORD,
1210 lpFlags: LPDWORD,
1211 lpFrom: *mut SOCKADDR,
1212 lpFromlen: LPINT,
1213 lpOverlapped: LPWSAOVERLAPPED,
1214 lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE,
1215 ) -> c_int;
WSAResetEvent( hEvent: WSAEVENT, ) -> BOOL1216 pub fn WSAResetEvent(
1217 hEvent: WSAEVENT,
1218 ) -> BOOL;
WSASend( s: SOCKET, lpBuffers: LPWSABUF, dwBufferCount: DWORD, lpNumberOfBytesSent: LPDWORD, dwFlags: DWORD, lpOverlapped: LPWSAOVERLAPPED, lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, ) -> c_int1219 pub fn WSASend(
1220 s: SOCKET,
1221 lpBuffers: LPWSABUF,
1222 dwBufferCount: DWORD,
1223 lpNumberOfBytesSent: LPDWORD,
1224 dwFlags: DWORD,
1225 lpOverlapped: LPWSAOVERLAPPED,
1226 lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE,
1227 ) -> c_int;
WSASendMsg( Handle: SOCKET, lpMsg: LPWSAMSG, dwFlags: DWORD, lpNumberOfBytesSent: LPDWORD, lpOverlapped: LPWSAOVERLAPPED, lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, ) -> c_int1228 pub fn WSASendMsg(
1229 Handle: SOCKET,
1230 lpMsg: LPWSAMSG,
1231 dwFlags: DWORD,
1232 lpNumberOfBytesSent: LPDWORD,
1233 lpOverlapped: LPWSAOVERLAPPED,
1234 lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE,
1235 ) -> c_int;
WSASendDisconnect( s: SOCKET, lpOutboundDisconnectData: LPWSABUF, ) -> c_int1236 pub fn WSASendDisconnect(
1237 s: SOCKET,
1238 lpOutboundDisconnectData: LPWSABUF,
1239 ) -> c_int;
WSASendTo( s: SOCKET, lpBuffers: LPWSABUF, dwBufferCount: DWORD, lpNumberOfBytesSent: LPDWORD, dwFlags: DWORD, lpTo: *const SOCKADDR, iToLen: c_int, lpOverlapped: LPWSAOVERLAPPED, lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, ) -> c_int1240 pub fn WSASendTo(
1241 s: SOCKET,
1242 lpBuffers: LPWSABUF,
1243 dwBufferCount: DWORD,
1244 lpNumberOfBytesSent: LPDWORD,
1245 dwFlags: DWORD,
1246 lpTo: *const SOCKADDR,
1247 iToLen: c_int,
1248 lpOverlapped: LPWSAOVERLAPPED,
1249 lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE,
1250 ) -> c_int;
WSASetEvent( hEvent: WSAEVENT, ) -> BOOL1251 pub fn WSASetEvent(
1252 hEvent: WSAEVENT,
1253 ) -> BOOL;
WSASocketA( af: c_int, _type: c_int, protocol: c_int, lpProtocolInfo: LPWSAPROTOCOL_INFOA, g: GROUP, dwFlags: DWORD, ) -> SOCKET1254 pub fn WSASocketA(
1255 af: c_int,
1256 _type: c_int,
1257 protocol: c_int,
1258 lpProtocolInfo: LPWSAPROTOCOL_INFOA,
1259 g: GROUP,
1260 dwFlags: DWORD,
1261 ) -> SOCKET;
WSASocketW( af: c_int, _type: c_int, protocol: c_int, lpProtocolInfo: LPWSAPROTOCOL_INFOW, g: GROUP, dwFlags: DWORD, ) -> SOCKET1262 pub fn WSASocketW(
1263 af: c_int,
1264 _type: c_int,
1265 protocol: c_int,
1266 lpProtocolInfo: LPWSAPROTOCOL_INFOW,
1267 g: GROUP,
1268 dwFlags: DWORD,
1269 ) -> SOCKET;
WSAWaitForMultipleEvents( cEvents: DWORD, lphEvents: *const WSAEVENT, fWaitAll: BOOL, dwTimeout: DWORD, fAlertable: BOOL, ) -> DWORD1270 pub fn WSAWaitForMultipleEvents(
1271 cEvents: DWORD,
1272 lphEvents: *const WSAEVENT,
1273 fWaitAll: BOOL,
1274 dwTimeout: DWORD,
1275 fAlertable: BOOL,
1276 ) -> DWORD;
WSAAddressToStringA( lpsaAddress: LPSOCKADDR, dwAddressLength: DWORD, lpProtocolInfo: LPWSAPROTOCOL_INFOA, lpszAddressString: LPSTR, lpdwAddressStringLength: LPDWORD, ) -> INT1277 pub fn WSAAddressToStringA(
1278 lpsaAddress: LPSOCKADDR,
1279 dwAddressLength: DWORD,
1280 lpProtocolInfo: LPWSAPROTOCOL_INFOA,
1281 lpszAddressString: LPSTR,
1282 lpdwAddressStringLength: LPDWORD,
1283 ) -> INT;
WSAAddressToStringW( lpsaAddress: LPSOCKADDR, dwAddressLength: DWORD, lpProtocolInfo: LPWSAPROTOCOL_INFOW, lpszAddressString: LPWSTR, lpdwAddressStringLength: LPDWORD, ) -> INT1284 pub fn WSAAddressToStringW(
1285 lpsaAddress: LPSOCKADDR,
1286 dwAddressLength: DWORD,
1287 lpProtocolInfo: LPWSAPROTOCOL_INFOW,
1288 lpszAddressString: LPWSTR,
1289 lpdwAddressStringLength: LPDWORD,
1290 ) -> INT;
WSAStringToAddressA( AddressString: LPSTR, AddressFamily: INT, lpProtocolInfo: LPWSAPROTOCOL_INFOA, lpAddress: LPSOCKADDR, lpAddressLength: LPINT, ) -> INT1291 pub fn WSAStringToAddressA(
1292 AddressString: LPSTR,
1293 AddressFamily: INT,
1294 lpProtocolInfo: LPWSAPROTOCOL_INFOA,
1295 lpAddress: LPSOCKADDR,
1296 lpAddressLength: LPINT,
1297 ) -> INT;
WSAStringToAddressW( AddressString: LPWSTR, AddressFamily: INT, lpProtocolInfo: LPWSAPROTOCOL_INFOW, lpAddress: LPSOCKADDR, lpAddressLength: LPINT, ) -> INT1298 pub fn WSAStringToAddressW(
1299 AddressString: LPWSTR,
1300 AddressFamily: INT,
1301 lpProtocolInfo: LPWSAPROTOCOL_INFOW,
1302 lpAddress: LPSOCKADDR,
1303 lpAddressLength: LPINT,
1304 ) -> INT;
WSALookupServiceBeginA( lpqsRestrictions: LPWSAQUERYSETA, dwControlFlags: DWORD, lphLookup: LPHANDLE, ) -> INT1305 pub fn WSALookupServiceBeginA(
1306 lpqsRestrictions: LPWSAQUERYSETA,
1307 dwControlFlags: DWORD,
1308 lphLookup: LPHANDLE,
1309 ) -> INT;
WSALookupServiceBeginW( lpqsRestrictions: LPWSAQUERYSETW, dwControlFlags: DWORD, lphLookup: LPHANDLE, ) -> INT1310 pub fn WSALookupServiceBeginW(
1311 lpqsRestrictions: LPWSAQUERYSETW,
1312 dwControlFlags: DWORD,
1313 lphLookup: LPHANDLE,
1314 ) -> INT;
WSALookupServiceNextA( hLookup: HANDLE, dwControlFlags: DWORD, lpdwBufferLength: LPDWORD, lpqsResults: LPWSAQUERYSETA, ) -> INT1315 pub fn WSALookupServiceNextA(
1316 hLookup: HANDLE,
1317 dwControlFlags: DWORD,
1318 lpdwBufferLength: LPDWORD,
1319 lpqsResults: LPWSAQUERYSETA,
1320 ) -> INT;
WSALookupServiceNextW( hLookup: HANDLE, dwControlFlags: DWORD, lpdwBufferLength: LPDWORD, lpqsResults: LPWSAQUERYSETW, ) -> INT1321 pub fn WSALookupServiceNextW(
1322 hLookup: HANDLE,
1323 dwControlFlags: DWORD,
1324 lpdwBufferLength: LPDWORD,
1325 lpqsResults: LPWSAQUERYSETW,
1326 ) -> INT;
WSANSPIoctl( hLookup: HANDLE, dwControlFlags: DWORD, lpvInBuffer: LPVOID, cbInBuffer: DWORD, lpvOutBuffer: LPVOID, cbOutBuffer: DWORD, lpcbBytesReturned: LPDWORD, lpCompletion: LPWSACOMPLETION, ) -> INT1327 pub fn WSANSPIoctl(
1328 hLookup: HANDLE,
1329 dwControlFlags: DWORD,
1330 lpvInBuffer: LPVOID,
1331 cbInBuffer: DWORD,
1332 lpvOutBuffer: LPVOID,
1333 cbOutBuffer: DWORD,
1334 lpcbBytesReturned: LPDWORD,
1335 lpCompletion: LPWSACOMPLETION,
1336 ) -> INT;
WSALookupServiceEnd( hLookup: HANDLE, ) -> INT1337 pub fn WSALookupServiceEnd(
1338 hLookup: HANDLE,
1339 ) -> INT;
WSAInstallServiceClassA( lpServiceClassInfo: LPWSASERVICECLASSINFOA, ) -> INT1340 pub fn WSAInstallServiceClassA(
1341 lpServiceClassInfo: LPWSASERVICECLASSINFOA,
1342 ) -> INT;
WSAInstallServiceClassW( lpServiceClassInfo: LPWSASERVICECLASSINFOW, ) -> INT1343 pub fn WSAInstallServiceClassW(
1344 lpServiceClassInfo: LPWSASERVICECLASSINFOW,
1345 ) -> INT;
WSARemoveServiceClass( lpServiceClassId: LPGUID, ) -> INT1346 pub fn WSARemoveServiceClass(
1347 lpServiceClassId: LPGUID,
1348 ) -> INT;
WSAGetServiceClassInfoA( lpProviderId: LPGUID, lpServiceClassId: LPGUID, lpdwBufSize: LPDWORD, lpServiceClassInfo: LPWSASERVICECLASSINFOA, ) -> INT1349 pub fn WSAGetServiceClassInfoA(
1350 lpProviderId: LPGUID,
1351 lpServiceClassId: LPGUID,
1352 lpdwBufSize: LPDWORD,
1353 lpServiceClassInfo: LPWSASERVICECLASSINFOA,
1354 ) -> INT;
WSAGetServiceClassInfoW( lpProviderId: LPGUID, lpServiceClassId: LPGUID, lpdwBufSize: LPDWORD, lpServiceClassInfo: LPWSASERVICECLASSINFOW, ) -> INT1355 pub fn WSAGetServiceClassInfoW(
1356 lpProviderId: LPGUID,
1357 lpServiceClassId: LPGUID,
1358 lpdwBufSize: LPDWORD,
1359 lpServiceClassInfo: LPWSASERVICECLASSINFOW,
1360 ) -> INT;
WSAEnumNameSpaceProvidersA( lpdwBufferLength: LPDWORD, lpnspBuffer: LPWSANAMESPACE_INFOA, ) -> INT1361 pub fn WSAEnumNameSpaceProvidersA(
1362 lpdwBufferLength: LPDWORD,
1363 lpnspBuffer: LPWSANAMESPACE_INFOA,
1364 ) -> INT;
WSAEnumNameSpaceProvidersW( lpdwBufferLength: LPDWORD, lpnspBuffer: LPWSANAMESPACE_INFOW, ) -> INT1365 pub fn WSAEnumNameSpaceProvidersW(
1366 lpdwBufferLength: LPDWORD,
1367 lpnspBuffer: LPWSANAMESPACE_INFOW,
1368 ) -> INT;
WSAEnumNameSpaceProvidersExA( lpdwBufferLength: LPDWORD, lpnspBuffer: LPWSANAMESPACE_INFOEXA, ) -> INT1369 pub fn WSAEnumNameSpaceProvidersExA(
1370 lpdwBufferLength: LPDWORD,
1371 lpnspBuffer: LPWSANAMESPACE_INFOEXA,
1372 ) -> INT;
WSAEnumNameSpaceProvidersExW( lpdwBufferLength: LPDWORD, lpnspBuffer: LPWSANAMESPACE_INFOEXW, ) -> INT1373 pub fn WSAEnumNameSpaceProvidersExW(
1374 lpdwBufferLength: LPDWORD,
1375 lpnspBuffer: LPWSANAMESPACE_INFOEXW,
1376 ) -> INT;
WSAGetServiceClassNameByClassIdA( lpServiceClassId: LPGUID, lpszServiceClassName: LPSTR, lpdwBufferLength: LPDWORD, ) -> INT1377 pub fn WSAGetServiceClassNameByClassIdA(
1378 lpServiceClassId: LPGUID,
1379 lpszServiceClassName: LPSTR,
1380 lpdwBufferLength: LPDWORD,
1381 ) -> INT;
WSAGetServiceClassNameByClassIdW( lpServiceClassId: LPGUID, lpszServiceClassName: LPWSTR, lpdwBufferLength: LPDWORD, ) -> INT1382 pub fn WSAGetServiceClassNameByClassIdW(
1383 lpServiceClassId: LPGUID,
1384 lpszServiceClassName: LPWSTR,
1385 lpdwBufferLength: LPDWORD,
1386 ) -> INT;
WSASetServiceA( lpqsRegInfo: LPWSAQUERYSETA, essoperation: WSAESETSERVICEOP, dwControlFlags: DWORD, ) -> INT1387 pub fn WSASetServiceA(
1388 lpqsRegInfo: LPWSAQUERYSETA,
1389 essoperation: WSAESETSERVICEOP,
1390 dwControlFlags: DWORD,
1391 ) -> INT;
WSASetServiceW( lpqsRegInfo: LPWSAQUERYSETW, essoperation: WSAESETSERVICEOP, dwControlFlags: DWORD, ) -> INT1392 pub fn WSASetServiceW(
1393 lpqsRegInfo: LPWSAQUERYSETW,
1394 essoperation: WSAESETSERVICEOP,
1395 dwControlFlags: DWORD,
1396 ) -> INT;
WSAProviderConfigChange( lpNotificationHandle: LPHANDLE, lpOverlapped: LPWSAOVERLAPPED, lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, ) -> INT1397 pub fn WSAProviderConfigChange(
1398 lpNotificationHandle: LPHANDLE,
1399 lpOverlapped: LPWSAOVERLAPPED,
1400 lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE,
1401 ) -> INT;
WSAPoll( fdArray: LPWSAPOLLFD, fds: ULONG, timeout: INT, ) -> c_int1402 pub fn WSAPoll(
1403 fdArray: LPWSAPOLLFD,
1404 fds: ULONG,
1405 timeout: INT,
1406 ) -> c_int;
1407 }
1408 pub type LPSOCKADDR_IN = *mut SOCKADDR_IN;
1409 pub type LINGER = linger;
1410 pub type PLINGER = *mut linger;
1411 pub type LPLINGER = *mut linger;
1412 pub type FD_SET = fd_set;
1413 pub type PFD_SET = *mut fd_set;
1414 pub type LPFD_SET = *mut fd_set;
1415 pub type HOSTENT = hostent;
1416 pub type PHOSTENT = *mut hostent;
1417 pub type LPHOSTENT = *mut hostent;
1418 pub type SERVENT = servent;
1419 pub type PSERVENT = *mut servent;
1420 pub type LPSERVENT = *mut servent;
1421 pub type PROTOENT = protoent;
1422 pub type PPROTOENT = *mut protoent;
1423 pub type LPPROTOENT = *mut protoent;
1424 pub type TIMEVAL = timeval;
1425 pub type PTIMEVAL = *mut timeval;
1426 pub type LPTIMEVAL = *mut timeval;
1427 #[inline]
WSAMAKEASYNCREPLY(buflen: WORD, error: WORD) -> LONG1428 pub fn WSAMAKEASYNCREPLY(buflen: WORD, error: WORD) -> LONG {
1429 MAKELONG(buflen, error)
1430 }
1431 #[inline]
WSAMAKESELECTREPLY(event: WORD, error: WORD) -> LONG1432 pub fn WSAMAKESELECTREPLY(event: WORD, error: WORD) -> LONG {
1433 MAKELONG(event, error)
1434 }
1435 #[inline]
WSAGETASYNCBUFLEN(lParam: DWORD) -> WORD1436 pub fn WSAGETASYNCBUFLEN(lParam: DWORD) -> WORD {
1437 LOWORD(lParam)
1438 }
1439 #[inline]
WSAGETASYNCERROR(lParam: DWORD) -> WORD1440 pub fn WSAGETASYNCERROR(lParam: DWORD) -> WORD {
1441 HIWORD(lParam)
1442 }
1443 #[inline]
WSAGETSELECTEVENT(lParam: DWORD) -> WORD1444 pub fn WSAGETSELECTEVENT(lParam: DWORD) -> WORD {
1445 LOWORD(lParam)
1446 }
1447 #[inline]
WSAGETSELECTERROR(lParam: DWORD) -> WORD1448 pub fn WSAGETSELECTERROR(lParam: DWORD) -> WORD {
1449 HIWORD(lParam)
1450 }
1451