master
1const std = @import("../../std.zig");
2const assert = std.debug.assert;
3const windows = std.os.windows;
4
5const OVERLAPPED = windows.OVERLAPPED;
6const WORD = windows.WORD;
7const DWORD = windows.DWORD;
8const GUID = windows.GUID;
9const USHORT = windows.USHORT;
10const WCHAR = windows.WCHAR;
11const BOOL = windows.BOOL;
12const HANDLE = windows.HANDLE;
13const HWND = windows.HWND;
14const INT = windows.INT;
15const SHORT = windows.SHORT;
16const CHAR = windows.CHAR;
17const LONG = windows.LONG;
18const ULONG = windows.ULONG;
19const LPARAM = windows.LPARAM;
20const FARPROC = windows.FARPROC;
21
22pub const SOCKET = *opaque {};
23pub const INVALID_SOCKET = @as(SOCKET, @ptrFromInt(~@as(usize, 0)));
24
25pub const GROUP = u32;
26pub const ADDRESS_FAMILY = u16;
27pub const WSAEVENT = HANDLE;
28
29// Microsoft use the signed c_int for this, but it should never be negative
30pub const socklen_t = u32;
31
32pub const LM_HB_Extension = 128;
33pub const LM_HB1_PnP = 1;
34pub const LM_HB1_PDA_Palmtop = 2;
35pub const LM_HB1_Computer = 4;
36pub const LM_HB1_Printer = 8;
37pub const LM_HB1_Modem = 16;
38pub const LM_HB1_Fax = 32;
39pub const LM_HB1_LANAccess = 64;
40pub const LM_HB2_Telephony = 1;
41pub const LM_HB2_FileServer = 2;
42pub const ATMPROTO_AALUSER = 0;
43pub const ATMPROTO_AAL1 = 1;
44pub const ATMPROTO_AAL2 = 2;
45pub const ATMPROTO_AAL34 = 3;
46pub const ATMPROTO_AAL5 = 5;
47pub const SAP_FIELD_ABSENT = 4294967294;
48pub const SAP_FIELD_ANY = 4294967295;
49pub const SAP_FIELD_ANY_AESA_SEL = 4294967290;
50pub const SAP_FIELD_ANY_AESA_REST = 4294967291;
51pub const ATM_E164 = 1;
52pub const ATM_NSAP = 2;
53pub const ATM_AESA = 2;
54pub const ATM_ADDR_SIZE = 20;
55pub const BLLI_L2_ISO_1745 = 1;
56pub const BLLI_L2_Q921 = 2;
57pub const BLLI_L2_X25L = 6;
58pub const BLLI_L2_X25M = 7;
59pub const BLLI_L2_ELAPB = 8;
60pub const BLLI_L2_HDLC_ARM = 9;
61pub const BLLI_L2_HDLC_NRM = 10;
62pub const BLLI_L2_HDLC_ABM = 11;
63pub const BLLI_L2_LLC = 12;
64pub const BLLI_L2_X75 = 13;
65pub const BLLI_L2_Q922 = 14;
66pub const BLLI_L2_USER_SPECIFIED = 16;
67pub const BLLI_L2_ISO_7776 = 17;
68pub const BLLI_L3_X25 = 6;
69pub const BLLI_L3_ISO_8208 = 7;
70pub const BLLI_L3_X223 = 8;
71pub const BLLI_L3_SIO_8473 = 9;
72pub const BLLI_L3_T70 = 10;
73pub const BLLI_L3_ISO_TR9577 = 11;
74pub const BLLI_L3_USER_SPECIFIED = 16;
75pub const BLLI_L3_IPI_SNAP = 128;
76pub const BLLI_L3_IPI_IP = 204;
77pub const BHLI_ISO = 0;
78pub const BHLI_UserSpecific = 1;
79pub const BHLI_HighLayerProfile = 2;
80pub const BHLI_VendorSpecificAppId = 3;
81pub const AAL5_MODE_MESSAGE = 1;
82pub const AAL5_MODE_STREAMING = 2;
83pub const AAL5_SSCS_NULL = 0;
84pub const AAL5_SSCS_SSCOP_ASSURED = 1;
85pub const AAL5_SSCS_SSCOP_NON_ASSURED = 2;
86pub const AAL5_SSCS_FRAME_RELAY = 4;
87pub const BCOB_A = 1;
88pub const BCOB_C = 3;
89pub const BCOB_X = 16;
90pub const TT_NOIND = 0;
91pub const TT_CBR = 4;
92pub const TT_VBR = 8;
93pub const TR_NOIND = 0;
94pub const TR_END_TO_END = 1;
95pub const TR_NO_END_TO_END = 2;
96pub const CLIP_NOT = 0;
97pub const CLIP_SUS = 32;
98pub const UP_P2P = 0;
99pub const UP_P2MP = 1;
100pub const BLLI_L2_MODE_NORMAL = 64;
101pub const BLLI_L2_MODE_EXT = 128;
102pub const BLLI_L3_MODE_NORMAL = 64;
103pub const BLLI_L3_MODE_EXT = 128;
104pub const BLLI_L3_PACKET_16 = 4;
105pub const BLLI_L3_PACKET_32 = 5;
106pub const BLLI_L3_PACKET_64 = 6;
107pub const BLLI_L3_PACKET_128 = 7;
108pub const BLLI_L3_PACKET_256 = 8;
109pub const BLLI_L3_PACKET_512 = 9;
110pub const BLLI_L3_PACKET_1024 = 10;
111pub const BLLI_L3_PACKET_2048 = 11;
112pub const BLLI_L3_PACKET_4096 = 12;
113pub const PI_ALLOWED = 0;
114pub const PI_RESTRICTED = 64;
115pub const PI_NUMBER_NOT_AVAILABLE = 128;
116pub const SI_USER_NOT_SCREENED = 0;
117pub const SI_USER_PASSED = 1;
118pub const SI_USER_FAILED = 2;
119pub const SI_NETWORK = 3;
120pub const CAUSE_LOC_USER = 0;
121pub const CAUSE_LOC_PRIVATE_LOCAL = 1;
122pub const CAUSE_LOC_PUBLIC_LOCAL = 2;
123pub const CAUSE_LOC_TRANSIT_NETWORK = 3;
124pub const CAUSE_LOC_PUBLIC_REMOTE = 4;
125pub const CAUSE_LOC_PRIVATE_REMOTE = 5;
126pub const CAUSE_LOC_INTERNATIONAL_NETWORK = 7;
127pub const CAUSE_LOC_BEYOND_INTERWORKING = 10;
128pub const CAUSE_UNALLOCATED_NUMBER = 1;
129pub const CAUSE_NO_ROUTE_TO_TRANSIT_NETWORK = 2;
130pub const CAUSE_NO_ROUTE_TO_DESTINATION = 3;
131pub const CAUSE_VPI_VCI_UNACCEPTABLE = 10;
132pub const CAUSE_NORMAL_CALL_CLEARING = 16;
133pub const CAUSE_USER_BUSY = 17;
134pub const CAUSE_NO_USER_RESPONDING = 18;
135pub const CAUSE_CALL_REJECTED = 21;
136pub const CAUSE_NUMBER_CHANGED = 22;
137pub const CAUSE_USER_REJECTS_CLIR = 23;
138pub const CAUSE_DESTINATION_OUT_OF_ORDER = 27;
139pub const CAUSE_INVALID_NUMBER_FORMAT = 28;
140pub const CAUSE_STATUS_ENQUIRY_RESPONSE = 30;
141pub const CAUSE_NORMAL_UNSPECIFIED = 31;
142pub const CAUSE_VPI_VCI_UNAVAILABLE = 35;
143pub const CAUSE_NETWORK_OUT_OF_ORDER = 38;
144pub const CAUSE_TEMPORARY_FAILURE = 41;
145pub const CAUSE_ACCESS_INFORMAION_DISCARDED = 43;
146pub const CAUSE_NO_VPI_VCI_AVAILABLE = 45;
147pub const CAUSE_RESOURCE_UNAVAILABLE = 47;
148pub const CAUSE_QOS_UNAVAILABLE = 49;
149pub const CAUSE_USER_CELL_RATE_UNAVAILABLE = 51;
150pub const CAUSE_BEARER_CAPABILITY_UNAUTHORIZED = 57;
151pub const CAUSE_BEARER_CAPABILITY_UNAVAILABLE = 58;
152pub const CAUSE_OPTION_UNAVAILABLE = 63;
153pub const CAUSE_BEARER_CAPABILITY_UNIMPLEMENTED = 65;
154pub const CAUSE_UNSUPPORTED_TRAFFIC_PARAMETERS = 73;
155pub const CAUSE_INVALID_CALL_REFERENCE = 81;
156pub const CAUSE_CHANNEL_NONEXISTENT = 82;
157pub const CAUSE_INCOMPATIBLE_DESTINATION = 88;
158pub const CAUSE_INVALID_ENDPOINT_REFERENCE = 89;
159pub const CAUSE_INVALID_TRANSIT_NETWORK_SELECTION = 91;
160pub const CAUSE_TOO_MANY_PENDING_ADD_PARTY = 92;
161pub const CAUSE_AAL_PARAMETERS_UNSUPPORTED = 93;
162pub const CAUSE_MANDATORY_IE_MISSING = 96;
163pub const CAUSE_UNIMPLEMENTED_MESSAGE_TYPE = 97;
164pub const CAUSE_UNIMPLEMENTED_IE = 99;
165pub const CAUSE_INVALID_IE_CONTENTS = 100;
166pub const CAUSE_INVALID_STATE_FOR_MESSAGE = 101;
167pub const CAUSE_RECOVERY_ON_TIMEOUT = 102;
168pub const CAUSE_INCORRECT_MESSAGE_LENGTH = 104;
169pub const CAUSE_PROTOCOL_ERROR = 111;
170pub const CAUSE_COND_UNKNOWN = 0;
171pub const CAUSE_COND_PERMANENT = 1;
172pub const CAUSE_COND_TRANSIENT = 2;
173pub const CAUSE_REASON_USER = 0;
174pub const CAUSE_REASON_IE_MISSING = 4;
175pub const CAUSE_REASON_IE_INSUFFICIENT = 8;
176pub const CAUSE_PU_PROVIDER = 0;
177pub const CAUSE_PU_USER = 8;
178pub const CAUSE_NA_NORMAL = 0;
179pub const CAUSE_NA_ABNORMAL = 4;
180pub const QOS_CLASS0 = 0;
181pub const QOS_CLASS1 = 1;
182pub const QOS_CLASS2 = 2;
183pub const QOS_CLASS3 = 3;
184pub const QOS_CLASS4 = 4;
185pub const TNS_TYPE_NATIONAL = 64;
186pub const TNS_PLAN_CARRIER_ID_CODE = 1;
187pub const SIO_GET_NUMBER_OF_ATM_DEVICES = 1343619073;
188pub const SIO_GET_ATM_ADDRESS = 3491102722;
189pub const SIO_ASSOCIATE_PVC = 2417360899;
190pub const SIO_GET_ATM_CONNECTION_ID = 1343619076;
191pub const RIO_MSG_DONT_NOTIFY = 1;
192pub const RIO_MSG_DEFER = 2;
193pub const RIO_MSG_WAITALL = 4;
194pub const RIO_MSG_COMMIT_ONLY = 8;
195pub const RIO_MAX_CQ_SIZE = 134217728;
196pub const RIO_CORRUPT_CQ = 4294967295;
197pub const WINDOWS_AF_IRDA = 26;
198pub const WCE_AF_IRDA = 22;
199pub const IRDA_PROTO_SOCK_STREAM = 1;
200pub const IRLMP_ENUMDEVICES = 16;
201pub const IRLMP_IAS_SET = 17;
202pub const IRLMP_IAS_QUERY = 18;
203pub const IRLMP_SEND_PDU_LEN = 19;
204pub const IRLMP_EXCLUSIVE_MODE = 20;
205pub const IRLMP_IRLPT_MODE = 21;
206pub const IRLMP_9WIRE_MODE = 22;
207pub const IRLMP_TINYTP_MODE = 23;
208pub const IRLMP_PARAMETERS = 24;
209pub const IRLMP_DISCOVERY_MODE = 25;
210pub const IRLMP_SHARP_MODE = 32;
211pub const IAS_ATTRIB_NO_CLASS = 16;
212pub const IAS_ATTRIB_NO_ATTRIB = 0;
213pub const IAS_ATTRIB_INT = 1;
214pub const IAS_ATTRIB_OCTETSEQ = 2;
215pub const IAS_ATTRIB_STR = 3;
216pub const IAS_MAX_USER_STRING = 256;
217pub const IAS_MAX_OCTET_STRING = 1024;
218pub const IAS_MAX_CLASSNAME = 64;
219pub const IAS_MAX_ATTRIBNAME = 256;
220pub const LmCharSetASCII = 0;
221pub const LmCharSetISO_8859_1 = 1;
222pub const LmCharSetISO_8859_2 = 2;
223pub const LmCharSetISO_8859_3 = 3;
224pub const LmCharSetISO_8859_4 = 4;
225pub const LmCharSetISO_8859_5 = 5;
226pub const LmCharSetISO_8859_6 = 6;
227pub const LmCharSetISO_8859_7 = 7;
228pub const LmCharSetISO_8859_8 = 8;
229pub const LmCharSetISO_8859_9 = 9;
230pub const LmCharSetUNICODE = 255;
231pub const LM_BAUD_1200 = 1200;
232pub const LM_BAUD_2400 = 2400;
233pub const LM_BAUD_9600 = 9600;
234pub const LM_BAUD_19200 = 19200;
235pub const LM_BAUD_38400 = 38400;
236pub const LM_BAUD_57600 = 57600;
237pub const LM_BAUD_115200 = 115200;
238pub const LM_BAUD_576K = 576000;
239pub const LM_BAUD_1152K = 1152000;
240pub const LM_BAUD_4M = 4000000;
241pub const LM_BAUD_16M = 16000000;
242pub const IPX_PTYPE = 16384;
243pub const IPX_FILTERPTYPE = 16385;
244pub const IPX_STOPFILTERPTYPE = 16387;
245pub const IPX_DSTYPE = 16386;
246pub const IPX_EXTENDED_ADDRESS = 16388;
247pub const IPX_RECVHDR = 16389;
248pub const IPX_MAXSIZE = 16390;
249pub const IPX_ADDRESS = 16391;
250pub const IPX_GETNETINFO = 16392;
251pub const IPX_GETNETINFO_NORIP = 16393;
252pub const IPX_SPXGETCONNECTIONSTATUS = 16395;
253pub const IPX_ADDRESS_NOTIFY = 16396;
254pub const IPX_MAX_ADAPTER_NUM = 16397;
255pub const IPX_RERIPNETNUMBER = 16398;
256pub const IPX_RECEIVE_BROADCAST = 16399;
257pub const IPX_IMMEDIATESPXACK = 16400;
258pub const MAX_MCAST_TTL = 255;
259pub const RM_OPTIONSBASE = 1000;
260pub const RM_RATE_WINDOW_SIZE = 1001;
261pub const RM_SET_MESSAGE_BOUNDARY = 1002;
262pub const RM_FLUSHCACHE = 1003;
263pub const RM_SENDER_WINDOW_ADVANCE_METHOD = 1004;
264pub const RM_SENDER_STATISTICS = 1005;
265pub const RM_LATEJOIN = 1006;
266pub const RM_SET_SEND_IF = 1007;
267pub const RM_ADD_RECEIVE_IF = 1008;
268pub const RM_DEL_RECEIVE_IF = 1009;
269pub const RM_SEND_WINDOW_ADV_RATE = 1010;
270pub const RM_USE_FEC = 1011;
271pub const RM_SET_MCAST_TTL = 1012;
272pub const RM_RECEIVER_STATISTICS = 1013;
273pub const RM_HIGH_SPEED_INTRANET_OPT = 1014;
274pub const SENDER_DEFAULT_RATE_KBITS_PER_SEC = 56;
275pub const SENDER_DEFAULT_WINDOW_ADV_PERCENTAGE = 15;
276pub const MAX_WINDOW_INCREMENT_PERCENTAGE = 25;
277pub const SENDER_DEFAULT_LATE_JOINER_PERCENTAGE = 0;
278pub const SENDER_MAX_LATE_JOINER_PERCENTAGE = 75;
279pub const BITS_PER_BYTE = 8;
280pub const LOG2_BITS_PER_BYTE = 3;
281
282pub const SOCKET_DEFAULT2_QM_POLICY = GUID.parse("{aec2ef9c-3a4d-4d3e-8842-239942e39a47}");
283pub const REAL_TIME_NOTIFICATION_CAPABILITY = GUID.parse("{6b59819a-5cae-492d-a901-2a3c2c50164f}");
284pub const REAL_TIME_NOTIFICATION_CAPABILITY_EX = GUID.parse("{6843da03-154a-4616-a508-44371295f96b}");
285pub const ASSOCIATE_NAMERES_CONTEXT = GUID.parse("{59a38b67-d4fe-46e1-ba3c-87ea74ca3049}");
286
287pub const WSAID_CONNECTEX = GUID{
288 .Data1 = 0x25a207b9,
289 .Data2 = 0xddf3,
290 .Data3 = 0x4660,
291 .Data4 = [8]u8{ 0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e },
292};
293
294pub const WSAID_ACCEPTEX = GUID{
295 .Data1 = 0xb5367df1,
296 .Data2 = 0xcbac,
297 .Data3 = 0x11cf,
298 .Data4 = [8]u8{ 0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92 },
299};
300
301pub const WSAID_GETACCEPTEXSOCKADDRS = GUID{
302 .Data1 = 0xb5367df2,
303 .Data2 = 0xcbac,
304 .Data3 = 0x11cf,
305 .Data4 = [8]u8{ 0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92 },
306};
307
308pub const WSAID_WSARECVMSG = GUID{
309 .Data1 = 0xf689d7c8,
310 .Data2 = 0x6f1f,
311 .Data3 = 0x436b,
312 .Data4 = [8]u8{ 0x8a, 0x53, 0xe5, 0x4f, 0xe3, 0x51, 0xc3, 0x22 },
313};
314
315pub const WSAID_WSAPOLL = GUID{
316 .Data1 = 0x18C76F85,
317 .Data2 = 0xDC66,
318 .Data3 = 0x4964,
319 .Data4 = [8]u8{ 0x97, 0x2E, 0x23, 0xC2, 0x72, 0x38, 0x31, 0x2B },
320};
321
322pub const WSAID_WSASENDMSG = GUID{
323 .Data1 = 0xa441e712,
324 .Data2 = 0x754f,
325 .Data3 = 0x43ca,
326 .Data4 = [8]u8{ 0x84, 0xa7, 0x0d, 0xee, 0x44, 0xcf, 0x60, 0x6d },
327};
328
329pub const TCP_INITIAL_RTO_DEFAULT_RTT = 0;
330pub const TCP_INITIAL_RTO_DEFAULT_MAX_SYN_RETRANSMISSIONS = 0;
331pub const SOCKET_SETTINGS_GUARANTEE_ENCRYPTION = 1;
332pub const SOCKET_SETTINGS_ALLOW_INSECURE = 2;
333pub const SOCKET_SETTINGS_IPSEC_SKIP_FILTER_INSTANTIATION = 1;
334pub const SOCKET_SETTINGS_IPSEC_OPTIONAL_PEER_NAME_VERIFICATION = 2;
335pub const SOCKET_SETTINGS_IPSEC_ALLOW_FIRST_INBOUND_PKT_UNENCRYPTED = 4;
336pub const SOCKET_SETTINGS_IPSEC_PEER_NAME_IS_RAW_FORMAT = 8;
337pub const SOCKET_QUERY_IPSEC2_ABORT_CONNECTION_ON_FIELD_CHANGE = 1;
338pub const SOCKET_QUERY_IPSEC2_FIELD_MASK_MM_SA_ID = 1;
339pub const SOCKET_QUERY_IPSEC2_FIELD_MASK_QM_SA_ID = 2;
340pub const SOCKET_INFO_CONNECTION_SECURED = 1;
341pub const SOCKET_INFO_CONNECTION_ENCRYPTED = 2;
342pub const SOCKET_INFO_CONNECTION_IMPERSONATED = 4;
343pub const IN4ADDR_LOOPBACK = 16777343;
344pub const IN4ADDR_LOOPBACKPREFIX_LENGTH = 8;
345pub const IN4ADDR_LINKLOCALPREFIX_LENGTH = 16;
346pub const IN4ADDR_MULTICASTPREFIX_LENGTH = 4;
347pub const IFF_UP = 1;
348pub const IFF_BROADCAST = 2;
349pub const IFF_LOOPBACK = 4;
350pub const IFF_POINTTOPOINT = 8;
351pub const IFF_MULTICAST = 16;
352pub const IP_OPTIONS = 1;
353pub const IP_HDRINCL = 2;
354pub const IP_TOS = 3;
355pub const IP_TTL = 4;
356pub const IP_MULTICAST_IF = 9;
357pub const IP_MULTICAST_TTL = 10;
358pub const IP_MULTICAST_LOOP = 11;
359pub const IP_ADD_MEMBERSHIP = 12;
360pub const IP_DROP_MEMBERSHIP = 13;
361pub const IP_DONTFRAGMENT = 14;
362pub const IP_ADD_SOURCE_MEMBERSHIP = 15;
363pub const IP_DROP_SOURCE_MEMBERSHIP = 16;
364pub const IP_BLOCK_SOURCE = 17;
365pub const IP_UNBLOCK_SOURCE = 18;
366pub const IP_PKTINFO = 19;
367pub const IP_HOPLIMIT = 21;
368pub const IP_RECVTTL = 21;
369pub const IP_RECEIVE_BROADCAST = 22;
370pub const IP_RECVIF = 24;
371pub const IP_RECVDSTADDR = 25;
372pub const IP_IFLIST = 28;
373pub const IP_ADD_IFLIST = 29;
374pub const IP_DEL_IFLIST = 30;
375pub const IP_UNICAST_IF = 31;
376pub const IP_RTHDR = 32;
377pub const IP_GET_IFLIST = 33;
378pub const IP_RECVRTHDR = 38;
379pub const IP_TCLASS = 39;
380pub const IP_RECVTCLASS = 40;
381pub const IP_RECVTOS = 40;
382pub const IP_ORIGINAL_ARRIVAL_IF = 47;
383pub const IP_ECN = 50;
384pub const IP_PKTINFO_EX = 51;
385pub const IP_WFP_REDIRECT_RECORDS = 60;
386pub const IP_WFP_REDIRECT_CONTEXT = 70;
387pub const IP_MTU_DISCOVER = 71;
388pub const IP_MTU = 73;
389pub const IP_NRT_INTERFACE = 74;
390pub const IP_RECVERR = 75;
391pub const IP_USER_MTU = 76;
392pub const IP_UNSPECIFIED_TYPE_OF_SERVICE = -1;
393pub const IN6ADDR_LINKLOCALPREFIX_LENGTH = 64;
394pub const IN6ADDR_MULTICASTPREFIX_LENGTH = 8;
395pub const IN6ADDR_SOLICITEDNODEMULTICASTPREFIX_LENGTH = 104;
396pub const IN6ADDR_V4MAPPEDPREFIX_LENGTH = 96;
397pub const IN6ADDR_6TO4PREFIX_LENGTH = 16;
398pub const IN6ADDR_TEREDOPREFIX_LENGTH = 32;
399pub const MCAST_JOIN_GROUP = 41;
400pub const MCAST_LEAVE_GROUP = 42;
401pub const MCAST_BLOCK_SOURCE = 43;
402pub const MCAST_UNBLOCK_SOURCE = 44;
403pub const MCAST_JOIN_SOURCE_GROUP = 45;
404pub const MCAST_LEAVE_SOURCE_GROUP = 46;
405pub const IPV6_HOPOPTS = 1;
406pub const IPV6_HDRINCL = 2;
407pub const IPV6_UNICAST_HOPS = 4;
408pub const IPV6_MULTICAST_IF = 9;
409pub const IPV6_MULTICAST_HOPS = 10;
410pub const IPV6_MULTICAST_LOOP = 11;
411pub const IPV6_ADD_MEMBERSHIP = 12;
412pub const IPV6_DROP_MEMBERSHIP = 13;
413pub const IPV6_DONTFRAG = 14;
414pub const IPV6_PKTINFO = 19;
415pub const IPV6_HOPLIMIT = 21;
416pub const IPV6_PROTECTION_LEVEL = 23;
417pub const IPV6_RECVIF = 24;
418pub const IPV6_RECVDSTADDR = 25;
419pub const IPV6_CHECKSUM = 26;
420pub const IPV6_V6ONLY = 27;
421pub const IPV6_IFLIST = 28;
422pub const IPV6_ADD_IFLIST = 29;
423pub const IPV6_DEL_IFLIST = 30;
424pub const IPV6_UNICAST_IF = 31;
425pub const IPV6_RTHDR = 32;
426pub const IPV6_GET_IFLIST = 33;
427pub const IPV6_RECVRTHDR = 38;
428pub const IPV6_TCLASS = 39;
429pub const IPV6_RECVTCLASS = 40;
430pub const IPV6_ECN = 50;
431pub const IPV6_PKTINFO_EX = 51;
432pub const IPV6_WFP_REDIRECT_RECORDS = 60;
433pub const IPV6_WFP_REDIRECT_CONTEXT = 70;
434pub const IPV6_MTU_DISCOVER = 71;
435pub const IPV6_MTU = 72;
436pub const IPV6_NRT_INTERFACE = 74;
437pub const IPV6_RECVERR = 75;
438pub const IPV6_USER_MTU = 76;
439pub const IP_UNSPECIFIED_HOP_LIMIT = -1;
440pub const PROTECTION_LEVEL_UNRESTRICTED = 10;
441pub const PROTECTION_LEVEL_EDGERESTRICTED = 20;
442pub const PROTECTION_LEVEL_RESTRICTED = 30;
443pub const INET_ADDRSTRLEN = 22;
444pub const INET6_ADDRSTRLEN = 65;
445
446pub const TCP = struct {
447 pub const NODELAY = 1;
448 pub const EXPEDITED_1122 = 2;
449 pub const OFFLOAD_NO_PREFERENCE = 0;
450 pub const OFFLOAD_NOT_PREFERRED = 1;
451 pub const OFFLOAD_PREFERRED = 2;
452 pub const KEEPALIVE = 3;
453 pub const MAXSEG = 4;
454 pub const MAXRT = 5;
455 pub const STDURG = 6;
456 pub const NOURG = 7;
457 pub const ATMARK = 8;
458 pub const NOSYNRETRIES = 9;
459 pub const TIMESTAMPS = 10;
460 pub const OFFLOAD_PREFERENCE = 11;
461 pub const CONGESTION_ALGORITHM = 12;
462 pub const DELAY_FIN_ACK = 13;
463 pub const MAXRTMS = 14;
464 pub const FASTOPEN = 15;
465 pub const KEEPCNT = 16;
466 pub const KEEPINTVL = 17;
467 pub const FAIL_CONNECT_ON_ICMP_ERROR = 18;
468 pub const ICMP_ERROR_INFO = 19;
469 pub const BSDURGENT = 28672;
470};
471
472pub const UDP_SEND_MSG_SIZE = 2;
473pub const UDP_RECV_MAX_COALESCED_SIZE = 3;
474pub const UDP_COALESCED_INFO = 3;
475
476pub const AF = struct {
477 pub const UNSPEC = 0;
478 pub const UNIX = 1;
479 pub const INET = 2;
480 pub const IMPLINK = 3;
481 pub const PUP = 4;
482 pub const CHAOS = 5;
483 pub const NS = 6;
484 pub const IPX = 6;
485 pub const ISO = 7;
486 pub const ECMA = 8;
487 pub const DATAKIT = 9;
488 pub const CCITT = 10;
489 pub const SNA = 11;
490 pub const DECnet = 12;
491 pub const DLI = 13;
492 pub const LAT = 14;
493 pub const HYLINK = 15;
494 pub const APPLETALK = 16;
495 pub const NETBIOS = 17;
496 pub const VOICEVIEW = 18;
497 pub const FIREFOX = 19;
498 pub const UNKNOWN1 = 20;
499 pub const BAN = 21;
500 pub const ATM = 22;
501 pub const INET6 = 23;
502 pub const CLUSTER = 24;
503 pub const @"12844" = 25;
504 pub const IRDA = 26;
505 pub const NETDES = 28;
506 pub const MAX = 29;
507 pub const TCNPROCESS = 29;
508 pub const TCNMESSAGE = 30;
509 pub const ICLFXBM = 31;
510 pub const LINK = 33;
511 pub const HYPERV = 34;
512};
513
514pub const SOCK = struct {
515 pub const STREAM = 1;
516 pub const DGRAM = 2;
517 pub const RAW = 3;
518 pub const RDM = 4;
519 pub const SEQPACKET = 5;
520
521 /// WARNING: this flag is not supported by windows socket functions directly,
522 /// it is only supported by std.os.socket. Be sure that this value does
523 /// not share any bits with any of the `SOCK` values.
524 pub const CLOEXEC = 0x10000;
525 /// WARNING: this flag is not supported by windows socket functions directly,
526 /// it is only supported by std.os.socket. Be sure that this value does
527 /// not share any bits with any of the `SOCK` values.
528 pub const NONBLOCK = 0x20000;
529};
530
531pub const SOL = struct {
532 pub const IRLMP = 255;
533 pub const SOCKET = 65535;
534};
535
536pub const SO = struct {
537 pub const DEBUG = 1;
538 pub const ACCEPTCONN = 2;
539 pub const REUSEADDR = 4;
540 pub const KEEPALIVE = 8;
541 pub const DONTROUTE = 16;
542 pub const BROADCAST = 32;
543 pub const USELOOPBACK = 64;
544 pub const LINGER = 128;
545 pub const OOBINLINE = 256;
546 pub const SNDBUF = 4097;
547 pub const RCVBUF = 4098;
548 pub const SNDLOWAT = 4099;
549 pub const RCVLOWAT = 4100;
550 pub const SNDTIMEO = 4101;
551 pub const RCVTIMEO = 4102;
552 pub const ERROR = 4103;
553 pub const TYPE = 4104;
554 pub const BSP_STATE = 4105;
555 pub const GROUP_ID = 8193;
556 pub const GROUP_PRIORITY = 8194;
557 pub const MAX_MSG_SIZE = 8195;
558 pub const CONDITIONAL_ACCEPT = 12290;
559 pub const PAUSE_ACCEPT = 12291;
560 pub const COMPARTMENT_ID = 12292;
561 pub const RANDOMIZE_PORT = 12293;
562 pub const PORT_SCALABILITY = 12294;
563 pub const REUSE_UNICASTPORT = 12295;
564 pub const REUSE_MULTICASTPORT = 12296;
565 pub const ORIGINAL_DST = 12303;
566 pub const PROTOCOL_INFOA = 8196;
567 pub const PROTOCOL_INFOW = 8197;
568 pub const CONNDATA = 28672;
569 pub const CONNOPT = 28673;
570 pub const DISCDATA = 28674;
571 pub const DISCOPT = 28675;
572 pub const CONNDATALEN = 28676;
573 pub const CONNOPTLEN = 28677;
574 pub const DISCDATALEN = 28678;
575 pub const DISCOPTLEN = 28679;
576 pub const OPENTYPE = 28680;
577 pub const SYNCHRONOUS_ALERT = 16;
578 pub const SYNCHRONOUS_NONALERT = 32;
579 pub const MAXDG = 28681;
580 pub const MAXPATHDG = 28682;
581 pub const UPDATE_ACCEPT_CONTEXT = 28683;
582 pub const CONNECT_TIME = 28684;
583 pub const UPDATE_CONNECT_CONTEXT = 28688;
584};
585
586pub const WSK_SO_BASE = 16384;
587pub const IOC_UNIX = 0;
588pub const IOC_WS2 = 134217728;
589pub const IOC_PROTOCOL = 268435456;
590pub const IOC_VENDOR = 402653184;
591pub const SIO_GET_EXTENSION_FUNCTION_POINTER = IOC_OUT | IOC_IN | IOC_WS2 | 6;
592pub const SIO_BSP_HANDLE = IOC_OUT | IOC_WS2 | 27;
593pub const SIO_BSP_HANDLE_SELECT = IOC_OUT | IOC_WS2 | 28;
594pub const SIO_BSP_HANDLE_POLL = IOC_OUT | IOC_WS2 | 29;
595pub const SIO_BASE_HANDLE = IOC_OUT | IOC_WS2 | 34;
596pub const IPPORT_TCPMUX = 1;
597pub const IPPORT_ECHO = 7;
598pub const IPPORT_DISCARD = 9;
599pub const IPPORT_SYSTAT = 11;
600pub const IPPORT_DAYTIME = 13;
601pub const IPPORT_NETSTAT = 15;
602pub const IPPORT_QOTD = 17;
603pub const IPPORT_MSP = 18;
604pub const IPPORT_CHARGEN = 19;
605pub const IPPORT_FTP_DATA = 20;
606pub const IPPORT_FTP = 21;
607pub const IPPORT_TELNET = 23;
608pub const IPPORT_SMTP = 25;
609pub const IPPORT_TIMESERVER = 37;
610pub const IPPORT_NAMESERVER = 42;
611pub const IPPORT_WHOIS = 43;
612pub const IPPORT_MTP = 57;
613pub const IPPORT_TFTP = 69;
614pub const IPPORT_RJE = 77;
615pub const IPPORT_FINGER = 79;
616pub const IPPORT_TTYLINK = 87;
617pub const IPPORT_SUPDUP = 95;
618pub const IPPORT_POP3 = 110;
619pub const IPPORT_NTP = 123;
620pub const IPPORT_EPMAP = 135;
621pub const IPPORT_NETBIOS_NS = 137;
622pub const IPPORT_NETBIOS_DGM = 138;
623pub const IPPORT_NETBIOS_SSN = 139;
624pub const IPPORT_IMAP = 143;
625pub const IPPORT_SNMP = 161;
626pub const IPPORT_SNMP_TRAP = 162;
627pub const IPPORT_IMAP3 = 220;
628pub const IPPORT_LDAP = 389;
629pub const IPPORT_HTTPS = 443;
630pub const IPPORT_MICROSOFT_DS = 445;
631pub const IPPORT_EXECSERVER = 512;
632pub const IPPORT_LOGINSERVER = 513;
633pub const IPPORT_CMDSERVER = 514;
634pub const IPPORT_EFSSERVER = 520;
635pub const IPPORT_BIFFUDP = 512;
636pub const IPPORT_WHOSERVER = 513;
637pub const IPPORT_ROUTESERVER = 520;
638pub const IPPORT_RESERVED = 1024;
639pub const IPPORT_REGISTERED_MAX = 49151;
640pub const IPPORT_DYNAMIC_MIN = 49152;
641pub const IPPORT_DYNAMIC_MAX = 65535;
642pub const IN_CLASSA_NET = 4278190080;
643pub const IN_CLASSA_NSHIFT = 24;
644pub const IN_CLASSA_HOST = 16777215;
645pub const IN_CLASSA_MAX = 128;
646pub const IN_CLASSB_NET = 4294901760;
647pub const IN_CLASSB_NSHIFT = 16;
648pub const IN_CLASSB_HOST = 65535;
649pub const IN_CLASSB_MAX = 65536;
650pub const IN_CLASSC_NET = 4294967040;
651pub const IN_CLASSC_NSHIFT = 8;
652pub const IN_CLASSC_HOST = 255;
653pub const IN_CLASSD_NET = 4026531840;
654pub const IN_CLASSD_NSHIFT = 28;
655pub const IN_CLASSD_HOST = 268435455;
656pub const INADDR_LOOPBACK = 2130706433;
657pub const INADDR_NONE = 4294967295;
658pub const IOCPARM_MASK = 127;
659pub const IOC_VOID = 536870912;
660pub const IOC_OUT = 1073741824;
661pub const IOC_IN = 2147483648;
662
663pub const MSG = struct {
664 pub const TRUNC = 256;
665 pub const CTRUNC = 512;
666 pub const BCAST = 1024;
667 pub const MCAST = 2048;
668 pub const ERRQUEUE = 4096;
669
670 pub const PEEK = 2;
671 pub const WAITALL = 8;
672 pub const PUSH_IMMEDIATE = 32;
673 pub const PARTIAL = 32768;
674 pub const INTERRUPT = 16;
675 pub const MAXIOVLEN = 16;
676};
677
678pub const AI = packed struct(u32) {
679 PASSIVE: bool = false,
680 CANONNAME: bool = false,
681 NUMERICHOST: bool = false,
682 NUMERICSERV: bool = false,
683 DNS_ONLY: bool = false,
684 _5: u3 = 0,
685 ALL: bool = false,
686 _9: u1 = 0,
687 ADDRCONFIG: bool = false,
688 V4MAPPED: bool = false,
689 _12: u2 = 0,
690 NON_AUTHORITATIVE: bool = false,
691 SECURE: bool = false,
692 RETURN_PREFERRED_NAMES: bool = false,
693 FQDN: bool = false,
694 FILESERVER: bool = false,
695 DISABLE_IDN_ENCODING: bool = false,
696 _20: u10 = 0,
697 RESOLUTION_HANDLE: bool = false,
698 EXTENDED: bool = false,
699};
700
701pub const FIONBIO = -2147195266;
702pub const ADDRINFOEX_VERSION_2 = 2;
703pub const ADDRINFOEX_VERSION_3 = 3;
704pub const ADDRINFOEX_VERSION_4 = 4;
705
706pub const NS = enum(u32) {
707 ALL = 0,
708 SAP = 1,
709 NDS = 2,
710 PEER_BROWSE = 3,
711 SLP = 5,
712 DHCP = 6,
713 TCPIP_LOCAL = 10,
714 TCPIP_HOSTS = 11,
715 DNS = 12,
716 NETBT = 13,
717 WINS = 14,
718 NLA = 15,
719 NBP = 20,
720 MS = 30,
721 STDA = 31,
722 NTDS = 32,
723 EMAIL = 37,
724 X500 = 40,
725 NIS = 41,
726 NISPLUS = 42,
727 WRQ = 50,
728 NETDES = 60,
729};
730
731pub const NI_NOFQDN = 1;
732pub const NI_NUMERICHOST = 2;
733pub const NI_NAMEREQD = 4;
734pub const NI_NUMERICSERV = 8;
735pub const NI_DGRAM = 16;
736pub const NI_MAXHOST = 1025;
737pub const NI_MAXSERV = 32;
738pub const INCL_WINSOCK_API_PROTOTYPES = 1;
739pub const INCL_WINSOCK_API_TYPEDEFS = 0;
740pub const FD_SETSIZE = 64;
741pub const IMPLINK_IP = 155;
742pub const IMPLINK_LOWEXPER = 156;
743pub const IMPLINK_HIGHEXPER = 158;
744pub const WSADESCRIPTION_LEN = 256;
745pub const WSASYS_STATUS_LEN = 128;
746pub const SOCKET_ERROR = -1;
747pub const FROM_PROTOCOL_INFO = -1;
748pub const PVD_CONFIG = 12289;
749pub const SOMAXCONN = 2147483647;
750pub const MAXGETHOSTSTRUCT = 1024;
751pub const FD_READ_BIT = 0;
752pub const FD_WRITE_BIT = 1;
753pub const FD_OOB_BIT = 2;
754pub const FD_ACCEPT_BIT = 3;
755pub const FD_CONNECT_BIT = 4;
756pub const FD_CLOSE_BIT = 5;
757pub const FD_QOS_BIT = 6;
758pub const FD_GROUP_QOS_BIT = 7;
759pub const FD_ROUTING_INTERFACE_CHANGE_BIT = 8;
760pub const FD_ADDRESS_LIST_CHANGE_BIT = 9;
761pub const FD_MAX_EVENTS = 10;
762pub const CF_ACCEPT = 0;
763pub const CF_REJECT = 1;
764pub const CF_DEFER = 2;
765pub const SD_RECEIVE = 0;
766pub const SD_SEND = 1;
767pub const SD_BOTH = 2;
768pub const SG_UNCONSTRAINED_GROUP = 1;
769pub const SG_CONSTRAINED_GROUP = 2;
770pub const MAX_PROTOCOL_CHAIN = 7;
771pub const BASE_PROTOCOL = 1;
772pub const LAYERED_PROTOCOL = 0;
773pub const WSAPROTOCOL_LEN = 255;
774pub const PFL_MULTIPLE_PROTO_ENTRIES = 1;
775pub const PFL_RECOMMENDED_PROTO_ENTRY = 2;
776pub const PFL_HIDDEN = 4;
777pub const PFL_MATCHES_PROTOCOL_ZERO = 8;
778pub const PFL_NETWORKDIRECT_PROVIDER = 16;
779pub const XP1_CONNECTIONLESS = 1;
780pub const XP1_GUARANTEED_DELIVERY = 2;
781pub const XP1_GUARANTEED_ORDER = 4;
782pub const XP1_MESSAGE_ORIENTED = 8;
783pub const XP1_PSEUDO_STREAM = 16;
784pub const XP1_GRACEFUL_CLOSE = 32;
785pub const XP1_EXPEDITED_DATA = 64;
786pub const XP1_CONNECT_DATA = 128;
787pub const XP1_DISCONNECT_DATA = 256;
788pub const XP1_SUPPORT_BROADCAST = 512;
789pub const XP1_SUPPORT_MULTIPOINT = 1024;
790pub const XP1_MULTIPOINT_CONTROL_PLANE = 2048;
791pub const XP1_MULTIPOINT_DATA_PLANE = 4096;
792pub const XP1_QOS_SUPPORTED = 8192;
793pub const XP1_INTERRUPT = 16384;
794pub const XP1_UNI_SEND = 32768;
795pub const XP1_UNI_RECV = 65536;
796pub const XP1_IFS_HANDLES = 131072;
797pub const XP1_PARTIAL_MESSAGE = 262144;
798pub const XP1_SAN_SUPPORT_SDP = 524288;
799pub const BIGENDIAN = 0;
800pub const LITTLEENDIAN = 1;
801pub const SECURITY_PROTOCOL_NONE = 0;
802pub const JL_SENDER_ONLY = 1;
803pub const JL_RECEIVER_ONLY = 2;
804pub const JL_BOTH = 4;
805pub const WSA_FLAG_OVERLAPPED = 1;
806pub const WSA_FLAG_MULTIPOINT_C_ROOT = 2;
807pub const WSA_FLAG_MULTIPOINT_C_LEAF = 4;
808pub const WSA_FLAG_MULTIPOINT_D_ROOT = 8;
809pub const WSA_FLAG_MULTIPOINT_D_LEAF = 16;
810pub const WSA_FLAG_ACCESS_SYSTEM_SECURITY = 64;
811pub const WSA_FLAG_NO_HANDLE_INHERIT = 128;
812pub const WSA_FLAG_REGISTERED_IO = 256;
813pub const TH_NETDEV = 1;
814pub const TH_TAPI = 2;
815pub const SERVICE_MULTIPLE = 1;
816pub const NS_LOCALNAME = 19;
817pub const RES_UNUSED_1 = 1;
818pub const RES_FLUSH_CACHE = 2;
819pub const RES_SERVICE = 4;
820pub const LUP_DEEP = 1;
821pub const LUP_CONTAINERS = 2;
822pub const LUP_NOCONTAINERS = 4;
823pub const LUP_NEAREST = 8;
824pub const LUP_RETURN_NAME = 16;
825pub const LUP_RETURN_TYPE = 32;
826pub const LUP_RETURN_VERSION = 64;
827pub const LUP_RETURN_COMMENT = 128;
828pub const LUP_RETURN_ADDR = 256;
829pub const LUP_RETURN_BLOB = 512;
830pub const LUP_RETURN_ALIASES = 1024;
831pub const LUP_RETURN_QUERY_STRING = 2048;
832pub const LUP_RETURN_ALL = 4080;
833pub const LUP_RES_SERVICE = 32768;
834pub const LUP_FLUSHCACHE = 4096;
835pub const LUP_FLUSHPREVIOUS = 8192;
836pub const LUP_NON_AUTHORITATIVE = 16384;
837pub const LUP_SECURE = 32768;
838pub const LUP_RETURN_PREFERRED_NAMES = 65536;
839pub const LUP_DNS_ONLY = 131072;
840pub const LUP_ADDRCONFIG = 1048576;
841pub const LUP_DUAL_ADDR = 2097152;
842pub const LUP_FILESERVER = 4194304;
843pub const LUP_DISABLE_IDN_ENCODING = 8388608;
844pub const LUP_API_ANSI = 16777216;
845pub const LUP_RESOLUTION_HANDLE = 2147483648;
846pub const RESULT_IS_ALIAS = 1;
847pub const RESULT_IS_ADDED = 16;
848pub const RESULT_IS_CHANGED = 32;
849pub const RESULT_IS_DELETED = 64;
850
851pub const POLL = struct {
852 pub const RDNORM = 256;
853 pub const RDBAND = 512;
854 pub const PRI = 1024;
855 pub const WRNORM = 16;
856 pub const WRBAND = 32;
857 pub const ERR = 1;
858 pub const HUP = 2;
859 pub const NVAL = 4;
860 pub const IN = RDNORM | RDBAND;
861 pub const OUT = WRNORM;
862};
863
864pub const TF_DISCONNECT = 1;
865pub const TF_REUSE_SOCKET = 2;
866pub const TF_WRITE_BEHIND = 4;
867pub const TF_USE_DEFAULT_WORKER = 0;
868pub const TF_USE_SYSTEM_THREAD = 16;
869pub const TF_USE_KERNEL_APC = 32;
870pub const TP_ELEMENT_MEMORY = 1;
871pub const TP_ELEMENT_FILE = 2;
872pub const TP_ELEMENT_EOP = 4;
873pub const NLA_ALLUSERS_NETWORK = 1;
874pub const NLA_FRIENDLY_NAME = 2;
875pub const WSPDESCRIPTION_LEN = 255;
876pub const WSS_OPERATION_IN_PROGRESS = 259;
877pub const LSP_SYSTEM = 2147483648;
878pub const LSP_INSPECTOR = 1;
879pub const LSP_REDIRECTOR = 2;
880pub const LSP_PROXY = 4;
881pub const LSP_FIREWALL = 8;
882pub const LSP_INBOUND_MODIFY = 16;
883pub const LSP_OUTBOUND_MODIFY = 32;
884pub const LSP_CRYPTO_COMPRESS = 64;
885pub const LSP_LOCAL_CACHE = 128;
886
887pub const IPPROTO = struct {
888 pub const IP = 0;
889 pub const ICMP = 1;
890 pub const IGMP = 2;
891 pub const GGP = 3;
892 pub const TCP = 6;
893 pub const PUP = 12;
894 pub const UDP = 17;
895 pub const IDP = 22;
896 pub const ND = 77;
897 pub const RM = 113;
898 pub const RAW = 255;
899 pub const MAX = 256;
900};
901
902pub const IP_DEFAULT_MULTICAST_TTL = 1;
903pub const IP_DEFAULT_MULTICAST_LOOP = 1;
904pub const IP_MAX_MEMBERSHIPS = 20;
905pub const FD_READ = 1;
906pub const FD_WRITE = 2;
907pub const FD_OOB = 4;
908pub const FD_ACCEPT = 8;
909pub const FD_CONNECT = 16;
910pub const FD_CLOSE = 32;
911pub const SERVICE_RESOURCE = 1;
912pub const SERVICE_SERVICE = 2;
913pub const SERVICE_LOCAL = 4;
914pub const SERVICE_FLAG_DEFER = 1;
915pub const SERVICE_FLAG_HARD = 2;
916pub const PROP_COMMENT = 1;
917pub const PROP_LOCALE = 2;
918pub const PROP_DISPLAY_HINT = 4;
919pub const PROP_VERSION = 8;
920pub const PROP_START_TIME = 16;
921pub const PROP_MACHINE = 32;
922pub const PROP_ADDRESSES = 256;
923pub const PROP_SD = 512;
924pub const PROP_ALL = 2147483648;
925pub const SERVICE_ADDRESS_FLAG_RPC_CN = 1;
926pub const SERVICE_ADDRESS_FLAG_RPC_DG = 2;
927pub const SERVICE_ADDRESS_FLAG_RPC_NB = 4;
928pub const NS_DEFAULT = 0;
929pub const NS_VNS = 50;
930pub const NSTYPE_HIERARCHICAL = 1;
931pub const NSTYPE_DYNAMIC = 2;
932pub const NSTYPE_ENUMERABLE = 4;
933pub const NSTYPE_WORKGROUP = 8;
934pub const XP_CONNECTIONLESS = 1;
935pub const XP_GUARANTEED_DELIVERY = 2;
936pub const XP_GUARANTEED_ORDER = 4;
937pub const XP_MESSAGE_ORIENTED = 8;
938pub const XP_PSEUDO_STREAM = 16;
939pub const XP_GRACEFUL_CLOSE = 32;
940pub const XP_EXPEDITED_DATA = 64;
941pub const XP_CONNECT_DATA = 128;
942pub const XP_DISCONNECT_DATA = 256;
943pub const XP_SUPPORTS_BROADCAST = 512;
944pub const XP_SUPPORTS_MULTICAST = 1024;
945pub const XP_BANDWIDTH_ALLOCATION = 2048;
946pub const XP_FRAGMENTATION = 4096;
947pub const XP_ENCRYPTS = 8192;
948pub const RES_SOFT_SEARCH = 1;
949pub const RES_FIND_MULTIPLE = 2;
950pub const SET_SERVICE_PARTIAL_SUCCESS = 1;
951pub const UDP_NOCHECKSUM = 1;
952pub const UDP_CHECKSUM_COVERAGE = 20;
953pub const GAI_STRERROR_BUFFER_SIZE = 1024;
954
955pub const LPCONDITIONPROC = *const fn (
956 lpCallerId: *WSABUF,
957 lpCallerData: *WSABUF,
958 lpSQOS: *QOS,
959 lpGQOS: *QOS,
960 lpCalleeId: *WSABUF,
961 lpCalleeData: *WSABUF,
962 g: *u32,
963 dwCallbackData: usize,
964) callconv(.winapi) i32;
965
966pub const LPWSAOVERLAPPED_COMPLETION_ROUTINE = *const fn (
967 dwError: u32,
968 cbTransferred: u32,
969 lpOverlapped: *OVERLAPPED,
970 dwFlags: u32,
971) callconv(.winapi) void;
972
973pub const FLOWSPEC = extern struct {
974 TokenRate: u32,
975 TokenBucketSize: u32,
976 PeakBandwidth: u32,
977 Latency: u32,
978 DelayVariation: u32,
979 ServiceType: u32,
980 MaxSduSize: u32,
981 MinimumPolicedSize: u32,
982};
983
984pub const QOS = extern struct {
985 SendingFlowspec: FLOWSPEC,
986 ReceivingFlowspec: FLOWSPEC,
987 ProviderSpecific: WSABUF,
988};
989
990pub const SOCKET_ADDRESS = extern struct {
991 lpSockaddr: *sockaddr,
992 iSockaddrLength: i32,
993};
994
995pub const SOCKET_ADDRESS_LIST = extern struct {
996 iAddressCount: i32,
997 Address: [1]SOCKET_ADDRESS,
998};
999
1000pub const WSADATA = if (@sizeOf(usize) == @sizeOf(u64))
1001 extern struct {
1002 wVersion: WORD,
1003 wHighVersion: WORD,
1004 iMaxSockets: u16,
1005 iMaxUdpDg: u16,
1006 lpVendorInfo: *u8,
1007 szDescription: [WSADESCRIPTION_LEN + 1]u8,
1008 szSystemStatus: [WSASYS_STATUS_LEN + 1]u8,
1009 }
1010else
1011 extern struct {
1012 wVersion: WORD,
1013 wHighVersion: WORD,
1014 szDescription: [WSADESCRIPTION_LEN + 1]u8,
1015 szSystemStatus: [WSASYS_STATUS_LEN + 1]u8,
1016 iMaxSockets: u16,
1017 iMaxUdpDg: u16,
1018 lpVendorInfo: *u8,
1019 };
1020
1021pub const WSAPROTOCOLCHAIN = extern struct {
1022 ChainLen: c_int,
1023 ChainEntries: [MAX_PROTOCOL_CHAIN]DWORD,
1024};
1025
1026pub const WSAPROTOCOL_INFOA = extern struct {
1027 dwServiceFlags1: DWORD,
1028 dwServiceFlags2: DWORD,
1029 dwServiceFlags3: DWORD,
1030 dwServiceFlags4: DWORD,
1031 dwProviderFlags: DWORD,
1032 ProviderId: GUID,
1033 dwCatalogEntryId: DWORD,
1034 ProtocolChain: WSAPROTOCOLCHAIN,
1035 iVersion: c_int,
1036 iAddressFamily: c_int,
1037 iMaxSockAddr: c_int,
1038 iMinSockAddr: c_int,
1039 iSocketType: c_int,
1040 iProtocol: c_int,
1041 iProtocolMaxOffset: c_int,
1042 iNetworkByteOrder: c_int,
1043 iSecurityScheme: c_int,
1044 dwMessageSize: DWORD,
1045 dwProviderReserved: DWORD,
1046 szProtocol: [WSAPROTOCOL_LEN + 1]CHAR,
1047};
1048
1049pub const WSAPROTOCOL_INFOW = extern struct {
1050 dwServiceFlags1: DWORD,
1051 dwServiceFlags2: DWORD,
1052 dwServiceFlags3: DWORD,
1053 dwServiceFlags4: DWORD,
1054 dwProviderFlags: DWORD,
1055 ProviderId: GUID,
1056 dwCatalogEntryId: DWORD,
1057 ProtocolChain: WSAPROTOCOLCHAIN,
1058 iVersion: c_int,
1059 iAddressFamily: c_int,
1060 iMaxSockAddr: c_int,
1061 iMinSockAddr: c_int,
1062 iSocketType: c_int,
1063 iProtocol: c_int,
1064 iProtocolMaxOffset: c_int,
1065 iNetworkByteOrder: c_int,
1066 iSecurityScheme: c_int,
1067 dwMessageSize: DWORD,
1068 dwProviderReserved: DWORD,
1069 szProtocol: [WSAPROTOCOL_LEN + 1]WCHAR,
1070};
1071
1072pub const sockproto = extern struct {
1073 sp_family: u16,
1074 sp_protocol: u16,
1075};
1076
1077pub const linger = extern struct {
1078 onoff: u16,
1079 linger: u16,
1080};
1081
1082pub const WSANETWORKEVENTS = extern struct {
1083 lNetworkEvents: i32,
1084 iErrorCode: [10]i32,
1085};
1086
1087pub const ADDRINFOEXW = extern struct {
1088 flags: AI,
1089 family: i32,
1090 socktype: i32,
1091 protocol: i32,
1092 addrlen: usize,
1093 canonname: ?[*:0]u16,
1094 addr: ?*sockaddr,
1095 blob: ?*anyopaque,
1096 bloblen: usize,
1097 provider: ?*GUID,
1098 next: ?*ADDRINFOEXW,
1099};
1100
1101pub const sockaddr = extern struct {
1102 family: ADDRESS_FAMILY,
1103 data: [14]u8,
1104
1105 pub const SS_MAXSIZE = 128;
1106 pub const storage = extern struct {
1107 family: ADDRESS_FAMILY align(8),
1108 padding: [SS_MAXSIZE - @sizeOf(ADDRESS_FAMILY)]u8 = undefined,
1109
1110 comptime {
1111 assert(@sizeOf(storage) == SS_MAXSIZE);
1112 assert(@alignOf(storage) == 8);
1113 }
1114 };
1115
1116 /// IPv4 socket address
1117 pub const in = extern struct {
1118 family: ADDRESS_FAMILY = AF.INET,
1119 port: USHORT,
1120 addr: u32,
1121 zero: [8]u8 = [8]u8{ 0, 0, 0, 0, 0, 0, 0, 0 },
1122 };
1123
1124 /// IPv6 socket address
1125 pub const in6 = extern struct {
1126 family: ADDRESS_FAMILY = AF.INET6,
1127 port: USHORT,
1128 flowinfo: u32,
1129 addr: [16]u8,
1130 scope_id: u32,
1131 };
1132
1133 /// UNIX domain socket address
1134 pub const un = extern struct {
1135 family: ADDRESS_FAMILY = AF.UNIX,
1136 path: [108]u8,
1137 };
1138};
1139
1140pub const WSABUF = extern struct {
1141 len: ULONG,
1142 buf: [*]u8,
1143};
1144
1145pub const msghdr = WSAMSG;
1146pub const msghdr_const = WSAMSG_const;
1147
1148pub const WSAMSG_const = extern struct {
1149 name: *const sockaddr,
1150 namelen: INT,
1151 lpBuffers: [*]const WSABUF,
1152 dwBufferCount: DWORD,
1153 Control: WSABUF,
1154 dwFlags: DWORD,
1155};
1156
1157pub const WSAMSG = extern struct {
1158 name: *sockaddr,
1159 namelen: INT,
1160 lpBuffers: [*]WSABUF,
1161 dwBufferCount: DWORD,
1162 Control: WSABUF,
1163 dwFlags: DWORD,
1164};
1165
1166pub const WSAPOLLFD = pollfd;
1167
1168pub const pollfd = extern struct {
1169 fd: SOCKET,
1170 events: SHORT,
1171 revents: SHORT,
1172};
1173
1174pub const TRANSMIT_FILE_BUFFERS = extern struct {
1175 Head: *anyopaque,
1176 HeadLength: u32,
1177 Tail: *anyopaque,
1178 TailLength: u32,
1179};
1180
1181pub const LPFN_TRANSMITFILE = *const fn (
1182 hSocket: SOCKET,
1183 hFile: HANDLE,
1184 nNumberOfBytesToWrite: u32,
1185 nNumberOfBytesPerSend: u32,
1186 lpOverlapped: ?*OVERLAPPED,
1187 lpTransmitBuffers: ?*TRANSMIT_FILE_BUFFERS,
1188 dwReserved: u32,
1189) callconv(.winapi) BOOL;
1190
1191pub const LPFN_ACCEPTEX = *const fn (
1192 sListenSocket: SOCKET,
1193 sAcceptSocket: SOCKET,
1194 lpOutputBuffer: *anyopaque,
1195 dwReceiveDataLength: u32,
1196 dwLocalAddressLength: u32,
1197 dwRemoteAddressLength: u32,
1198 lpdwBytesReceived: *u32,
1199 lpOverlapped: *OVERLAPPED,
1200) callconv(.winapi) BOOL;
1201
1202pub const LPFN_GETACCEPTEXSOCKADDRS = *const fn (
1203 lpOutputBuffer: *anyopaque,
1204 dwReceiveDataLength: u32,
1205 dwLocalAddressLength: u32,
1206 dwRemoteAddressLength: u32,
1207 LocalSockaddr: **sockaddr,
1208 LocalSockaddrLength: *i32,
1209 RemoteSockaddr: **sockaddr,
1210 RemoteSockaddrLength: *i32,
1211) callconv(.winapi) void;
1212
1213pub const LPFN_WSASENDMSG = *const fn (
1214 s: SOCKET,
1215 lpMsg: *const WSAMSG_const,
1216 dwFlags: u32,
1217 lpNumberOfBytesSent: ?*u32,
1218 lpOverlapped: ?*OVERLAPPED,
1219 lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
1220) callconv(.winapi) i32;
1221
1222pub const LPFN_WSARECVMSG = *const fn (
1223 s: SOCKET,
1224 lpMsg: *WSAMSG,
1225 lpdwNumberOfBytesRecv: ?*u32,
1226 lpOverlapped: ?*OVERLAPPED,
1227 lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
1228) callconv(.winapi) i32;
1229
1230pub const LPSERVICE_CALLBACK_PROC = *const fn (
1231 lParam: LPARAM,
1232 hAsyncTaskHandle: HANDLE,
1233) callconv(.winapi) void;
1234
1235pub const SERVICE_ASYNC_INFO = extern struct {
1236 lpServiceCallbackProc: LPSERVICE_CALLBACK_PROC,
1237 lParam: LPARAM,
1238 hAsyncTaskHandle: HANDLE,
1239};
1240
1241pub const LPLOOKUPSERVICE_COMPLETION_ROUTINE = *const fn (
1242 dwError: u32,
1243 dwBytes: u32,
1244 lpOverlapped: *OVERLAPPED,
1245) callconv(.winapi) void;
1246
1247pub const fd_set = extern struct {
1248 fd_count: u32,
1249 fd_array: [64]SOCKET,
1250};
1251
1252pub const hostent = extern struct {
1253 h_name: [*]u8,
1254 h_aliases: **i8,
1255 h_addrtype: i16,
1256 h_length: i16,
1257 h_addr_list: **i8,
1258};
1259
1260pub const timeval = extern struct {
1261 sec: LONG,
1262 usec: LONG,
1263};
1264
1265/// https://docs.microsoft.com/en-au/windows/win32/winsock/windows-sockets-error-codes-2
1266pub const WinsockError = enum(u16) {
1267 /// Specified event object handle is invalid.
1268 /// An application attempts to use an event object, but the specified handle is not valid.
1269 INVALID_HANDLE = 6,
1270 /// Insufficient memory available.
1271 /// An application used a Windows Sockets function that directly maps to a Windows function.
1272 /// The Windows function is indicating a lack of required memory resources.
1273 NOT_ENOUGH_MEMORY = 8,
1274 /// One or more parameters are invalid.
1275 /// An application used a Windows Sockets function which directly maps to a Windows function.
1276 /// The Windows function is indicating a problem with one or more parameters.
1277 INVALID_PARAMETER = 87,
1278 /// Overlapped operation aborted.
1279 /// An overlapped operation was canceled due to the closure of the socket, or the execution of the SIO_FLUSH command in WSAIoctl.
1280 OPERATION_ABORTED = 995,
1281 /// Overlapped I/O event object not in signaled state.
1282 /// The application has tried to determine the status of an overlapped operation which is not yet completed.
1283 /// Applications that use WSAGetOverlappedResult (with the fWait flag set to FALSE) in a polling mode to determine when an overlapped operation has completed, get this error code until the operation is complete.
1284 IO_INCOMPLETE = 996,
1285 /// The application has initiated an overlapped operation that cannot be completed immediately.
1286 /// A completion indication will be given later when the operation has been completed.
1287 IO_PENDING = 997,
1288 /// Interrupted function call.
1289 /// A blocking operation was interrupted by a call to WSACancelBlockingCall.
1290 EINTR = 10004,
1291 /// File handle is not valid.
1292 /// The file handle supplied is not valid.
1293 EBADF = 10009,
1294 /// Permission denied.
1295 /// An attempt was made to access a socket in a way forbidden by its access permissions.
1296 /// An example is using a broadcast address for sendto without broadcast permission being set using setsockopt(SO.BROADCAST).
1297 /// Another possible reason for the WSAEACCES error is that when the bind function is called (on Windows NT 4.0 with SP4 and later), another application, service, or kernel mode driver is bound to the same address with exclusive access.
1298 /// Such exclusive access is a new feature of Windows NT 4.0 with SP4 and later, and is implemented by using the SO.EXCLUSIVEADDRUSE option.
1299 EACCES = 10013,
1300 /// Bad address.
1301 /// The system detected an invalid pointer address in attempting to use a pointer argument of a call.
1302 /// This error occurs if an application passes an invalid pointer value, or if the length of the buffer is too small.
1303 /// For instance, if the length of an argument, which is a sockaddr structure, is smaller than the sizeof(sockaddr).
1304 EFAULT = 10014,
1305 /// Invalid argument.
1306 /// Some invalid argument was supplied (for example, specifying an invalid level to the setsockopt function).
1307 /// In some instances, it also refers to the current state of the socket—for instance, calling accept on a socket that is not listening.
1308 EINVAL = 10022,
1309 /// Too many open files.
1310 /// Too many open sockets. Each implementation may have a maximum number of socket handles available, either globally, per process, or per thread.
1311 EMFILE = 10024,
1312 /// Resource temporarily unavailable.
1313 /// This error is returned from operations on nonblocking sockets that cannot be completed immediately, for example recv when no data is queued to be read from the socket.
1314 /// It is a nonfatal error, and the operation should be retried later.
1315 /// It is normal for WSAEWOULDBLOCK to be reported as the result from calling connect on a nonblocking SOCK.STREAM socket, since some time must elapse for the connection to be established.
1316 EWOULDBLOCK = 10035,
1317 /// Operation now in progress.
1318 /// A blocking operation is currently executing.
1319 /// Windows Sockets only allows a single blocking operation—per- task or thread—to be outstanding, and if any other function call is made (whether or not it references that or any other socket) the function fails with the WSAEINPROGRESS error.
1320 EINPROGRESS = 10036,
1321 /// Operation already in progress.
1322 /// An operation was attempted on a nonblocking socket with an operation already in progress—that is, calling connect a second time on a nonblocking socket that is already connecting, or canceling an asynchronous request (WSAAsyncGetXbyY) that has already been canceled or completed.
1323 EALREADY = 10037,
1324 /// Socket operation on nonsocket.
1325 /// An operation was attempted on something that is not a socket.
1326 /// Either the socket handle parameter did not reference a valid socket, or for select, a member of an fd_set was not valid.
1327 ENOTSOCK = 10038,
1328 /// Destination address required.
1329 /// A required address was omitted from an operation on a socket.
1330 /// For example, this error is returned if sendto is called with the remote address of ADDR_ANY.
1331 EDESTADDRREQ = 10039,
1332 /// Message too long.
1333 /// A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram was smaller than the datagram itself.
1334 EMSGSIZE = 10040,
1335 /// Protocol wrong type for socket.
1336 /// A protocol was specified in the socket function call that does not support the semantics of the socket type requested.
1337 /// For example, the ARPA Internet UDP protocol cannot be specified with a socket type of SOCK.STREAM.
1338 EPROTOTYPE = 10041,
1339 /// Bad protocol option.
1340 /// An unknown, invalid or unsupported option or level was specified in a getsockopt or setsockopt call.
1341 ENOPROTOOPT = 10042,
1342 /// Protocol not supported.
1343 /// The requested protocol has not been configured into the system, or no implementation for it exists.
1344 /// For example, a socket call requests a SOCK.DGRAM socket, but specifies a stream protocol.
1345 EPROTONOSUPPORT = 10043,
1346 /// Socket type not supported.
1347 /// The support for the specified socket type does not exist in this address family.
1348 /// For example, the optional type SOCK.RAW might be selected in a socket call, and the implementation does not support SOCK.RAW sockets at all.
1349 ESOCKTNOSUPPORT = 10044,
1350 /// Operation not supported.
1351 /// The attempted operation is not supported for the type of object referenced.
1352 /// Usually this occurs when a socket descriptor to a socket that cannot support this operation is trying to accept a connection on a datagram socket.
1353 EOPNOTSUPP = 10045,
1354 /// Protocol family not supported.
1355 /// The protocol family has not been configured into the system or no implementation for it exists.
1356 /// This message has a slightly different meaning from WSAEAFNOSUPPORT.
1357 /// However, it is interchangeable in most cases, and all Windows Sockets functions that return one of these messages also specify WSAEAFNOSUPPORT.
1358 EPFNOSUPPORT = 10046,
1359 /// Address family not supported by protocol family.
1360 /// An address incompatible with the requested protocol was used.
1361 /// All sockets are created with an associated address family (that is, AF.INET for Internet Protocols) and a generic protocol type (that is, SOCK.STREAM).
1362 /// This error is returned if an incorrect protocol is explicitly requested in the socket call, or if an address of the wrong family is used for a socket, for example, in sendto.
1363 EAFNOSUPPORT = 10047,
1364 /// Address already in use.
1365 /// Typically, only one usage of each socket address (protocol/IP address/port) is permitted.
1366 /// This error occurs if an application attempts to bind a socket to an IP address/port that has already been used for an existing socket, or a socket that was not closed properly, or one that is still in the process of closing.
1367 /// For server applications that need to bind multiple sockets to the same port number, consider using setsockopt (SO.REUSEADDR).
1368 /// Client applications usually need not call bind at all—connect chooses an unused port automatically.
1369 /// When bind is called with a wildcard address (involving ADDR_ANY), a WSAEADDRINUSE error could be delayed until the specific address is committed.
1370 /// This could happen with a call to another function later, including connect, listen, WSAConnect, or WSAJoinLeaf.
1371 EADDRINUSE = 10048,
1372 /// Cannot assign requested address.
1373 /// The requested address is not valid in its context.
1374 /// This normally results from an attempt to bind to an address that is not valid for the local computer.
1375 /// This can also result from connect, sendto, WSAConnect, WSAJoinLeaf, or WSASendTo when the remote address or port is not valid for a remote computer (for example, address or port 0).
1376 EADDRNOTAVAIL = 10049,
1377 /// Network is down.
1378 /// A socket operation encountered a dead network.
1379 /// This could indicate a serious failure of the network system (that is, the protocol stack that the Windows Sockets DLL runs over), the network interface, or the local network itself.
1380 ENETDOWN = 10050,
1381 /// Network is unreachable.
1382 /// A socket operation was attempted to an unreachable network.
1383 /// This usually means the local software knows no route to reach the remote host.
1384 ENETUNREACH = 10051,
1385 /// Network dropped connection on reset.
1386 /// The connection has been broken due to keep-alive activity detecting a failure while the operation was in progress.
1387 /// It can also be returned by setsockopt if an attempt is made to set SO.KEEPALIVE on a connection that has already failed.
1388 ENETRESET = 10052,
1389 /// Software caused connection abort.
1390 /// An established connection was aborted by the software in your host computer, possibly due to a data transmission time-out or protocol error.
1391 ECONNABORTED = 10053,
1392 /// Connection reset by peer.
1393 /// An existing connection was forcibly closed by the remote host.
1394 /// This normally results if the peer application on the remote host is suddenly stopped, the host is rebooted, the host or remote network interface is disabled, or the remote host uses a hard close (see setsockopt for more information on the SO.LINGER option on the remote socket).
1395 /// This error may also result if a connection was broken due to keep-alive activity detecting a failure while one or more operations are in progress.
1396 /// Operations that were in progress fail with WSAENETRESET. Subsequent operations fail with WSAECONNRESET.
1397 ECONNRESET = 10054,
1398 /// No buffer space available.
1399 /// An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.
1400 ENOBUFS = 10055,
1401 /// Socket is already connected.
1402 /// A connect request was made on an already-connected socket.
1403 /// Some implementations also return this error if sendto is called on a connected SOCK.DGRAM socket (for SOCK.STREAM sockets, the to parameter in sendto is ignored) although other implementations treat this as a legal occurrence.
1404 EISCONN = 10056,
1405 /// Socket is not connected.
1406 /// A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using sendto) no address was supplied.
1407 /// Any other type of operation might also return this error—for example, setsockopt setting SO.KEEPALIVE if the connection has been reset.
1408 ENOTCONN = 10057,
1409 /// Cannot send after socket shutdown.
1410 /// A request to send or receive data was disallowed because the socket had already been shut down in that direction with a previous shutdown call.
1411 /// By calling shutdown a partial close of a socket is requested, which is a signal that sending or receiving, or both have been discontinued.
1412 ESHUTDOWN = 10058,
1413 /// Too many references.
1414 /// Too many references to some kernel object.
1415 ETOOMANYREFS = 10059,
1416 /// Connection timed out.
1417 /// A connection attempt failed because the connected party did not properly respond after a period of time, or the established connection failed because the connected host has failed to respond.
1418 ETIMEDOUT = 10060,
1419 /// Connection refused.
1420 /// No connection could be made because the target computer actively refused it.
1421 /// This usually results from trying to connect to a service that is inactive on the foreign host—that is, one with no server application running.
1422 ECONNREFUSED = 10061,
1423 /// Cannot translate name.
1424 /// Cannot translate a name.
1425 ELOOP = 10062,
1426 /// Name too long.
1427 /// A name component or a name was too long.
1428 ENAMETOOLONG = 10063,
1429 /// Host is down.
1430 /// A socket operation failed because the destination host is down. A socket operation encountered a dead host.
1431 /// Networking activity on the local host has not been initiated.
1432 /// These conditions are more likely to be indicated by the error WSAETIMEDOUT.
1433 EHOSTDOWN = 10064,
1434 /// No route to host.
1435 /// A socket operation was attempted to an unreachable host. See WSAENETUNREACH.
1436 EHOSTUNREACH = 10065,
1437 /// Directory not empty.
1438 /// Cannot remove a directory that is not empty.
1439 ENOTEMPTY = 10066,
1440 /// Too many processes.
1441 /// A Windows Sockets implementation may have a limit on the number of applications that can use it simultaneously.
1442 /// WSAStartup may fail with this error if the limit has been reached.
1443 EPROCLIM = 10067,
1444 /// User quota exceeded.
1445 /// Ran out of user quota.
1446 EUSERS = 10068,
1447 /// Disk quota exceeded.
1448 /// Ran out of disk quota.
1449 EDQUOT = 10069,
1450 /// Stale file handle reference.
1451 /// The file handle reference is no longer available.
1452 ESTALE = 10070,
1453 /// Item is remote.
1454 /// The item is not available locally.
1455 EREMOTE = 10071,
1456 /// Network subsystem is unavailable.
1457 /// This error is returned by WSAStartup if the Windows Sockets implementation cannot function at this time because the underlying system it uses to provide network services is currently unavailable.
1458 /// Users should check:
1459 /// - That the appropriate Windows Sockets DLL file is in the current path.
1460 /// - That they are not trying to use more than one Windows Sockets implementation simultaneously.
1461 /// - If there is more than one Winsock DLL on your system, be sure the first one in the path is appropriate for the network subsystem currently loaded.
1462 /// - The Windows Sockets implementation documentation to be sure all necessary components are currently installed and configured correctly.
1463 SYSNOTREADY = 10091,
1464 /// Winsock.dll version out of range.
1465 /// The current Windows Sockets implementation does not support the Windows Sockets specification version requested by the application.
1466 /// Check that no old Windows Sockets DLL files are being accessed.
1467 VERNOTSUPPORTED = 10092,
1468 /// Successful WSAStartup not yet performed.
1469 /// Either the application has not called WSAStartup or WSAStartup failed.
1470 /// The application may be accessing a socket that the current active task does not own (that is, trying to share a socket between tasks), or WSACleanup has been called too many times.
1471 NOTINITIALISED = 10093,
1472 /// Graceful shutdown in progress.
1473 /// Returned by WSARecv and WSARecvFrom to indicate that the remote party has initiated a graceful shutdown sequence.
1474 EDISCON = 10101,
1475 /// No more results.
1476 /// No more results can be returned by the WSALookupServiceNext function.
1477 ENOMORE = 10102,
1478 /// Call has been canceled.
1479 /// A call to the WSALookupServiceEnd function was made while this call was still processing. The call has been canceled.
1480 ECANCELLED = 10103,
1481 /// Procedure call table is invalid.
1482 /// The service provider procedure call table is invalid.
1483 /// A service provider returned a bogus procedure table to Ws2_32.dll.
1484 /// This is usually caused by one or more of the function pointers being NULL.
1485 EINVALIDPROCTABLE = 10104,
1486 /// Service provider is invalid.
1487 /// The requested service provider is invalid.
1488 /// This error is returned by the WSCGetProviderInfo and WSCGetProviderInfo32 functions if the protocol entry specified could not be found.
1489 /// This error is also returned if the service provider returned a version number other than 2.0.
1490 EINVALIDPROVIDER = 10105,
1491 /// Service provider failed to initialize.
1492 /// The requested service provider could not be loaded or initialized.
1493 /// This error is returned if either a service provider's DLL could not be loaded (LoadLibrary failed) or the provider's WSPStartup or NSPStartup function failed.
1494 EPROVIDERFAILEDINIT = 10106,
1495 /// System call failure.
1496 /// A system call that should never fail has failed.
1497 /// This is a generic error code, returned under various conditions.
1498 /// Returned when a system call that should never fail does fail.
1499 /// For example, if a call to WaitForMultipleEvents fails or one of the registry functions fails trying to manipulate the protocol/namespace catalogs.
1500 /// Returned when a provider does not return SUCCESS and does not provide an extended error code.
1501 /// Can indicate a service provider implementation error.
1502 SYSCALLFAILURE = 10107,
1503 /// Service not found.
1504 /// No such service is known. The service cannot be found in the specified name space.
1505 SERVICE_NOT_FOUND = 10108,
1506 /// Class type not found.
1507 /// The specified class was not found.
1508 TYPE_NOT_FOUND = 10109,
1509 /// No more results.
1510 /// No more results can be returned by the WSALookupServiceNext function.
1511 E_NO_MORE = 10110,
1512 /// Call was canceled.
1513 /// A call to the WSALookupServiceEnd function was made while this call was still processing. The call has been canceled.
1514 E_CANCELLED = 10111,
1515 /// Database query was refused.
1516 /// A database query failed because it was actively refused.
1517 EREFUSED = 10112,
1518 /// Host not found.
1519 /// No such host is known. The name is not an official host name or alias, or it cannot be found in the database(s) being queried.
1520 /// This error may also be returned for protocol and service queries, and means that the specified name could not be found in the relevant database.
1521 HOST_NOT_FOUND = 11001,
1522 /// Nonauthoritative host not found.
1523 /// This is usually a temporary error during host name resolution and means that the local server did not receive a response from an authoritative server. A retry at some time later may be successful.
1524 TRY_AGAIN = 11002,
1525 /// This is a nonrecoverable error.
1526 /// This indicates that some sort of nonrecoverable error occurred during a database lookup.
1527 /// This may be because the database files (for example, BSD-compatible HOSTS, SERVICES, or PROTOCOLS files) could not be found, or a DNS request was returned by the server with a severe error.
1528 NO_RECOVERY = 11003,
1529 /// Valid name, no data record of requested type.
1530 /// The requested name is valid and was found in the database, but it does not have the correct associated data being resolved for.
1531 /// The usual example for this is a host name-to-address translation attempt (using gethostbyname or WSAAsyncGetHostByName) which uses the DNS (Domain Name Server).
1532 /// An MX record is returned but no A record—indicating the host itself exists, but is not directly reachable.
1533 NO_DATA = 11004,
1534 /// QoS receivers.
1535 /// At least one QoS reserve has arrived.
1536 QOS_RECEIVERS = 11005,
1537 /// QoS senders.
1538 /// At least one QoS send path has arrived.
1539 QOS_SENDERS = 11006,
1540 /// No QoS senders.
1541 /// There are no QoS senders.
1542 QOS_NO_SENDERS = 11007,
1543 /// QoS no receivers.
1544 /// There are no QoS receivers.
1545 QOS_NO_RECEIVERS = 11008,
1546 /// QoS request confirmed.
1547 /// The QoS reserve request has been confirmed.
1548 QOS_REQUEST_CONFIRMED = 11009,
1549 /// QoS admission error.
1550 /// A QoS error occurred due to lack of resources.
1551 QOS_ADMISSION_FAILURE = 11010,
1552 /// QoS policy failure.
1553 /// The QoS request was rejected because the policy system couldn't allocate the requested resource within the existing policy.
1554 QOS_POLICY_FAILURE = 11011,
1555 /// QoS bad style.
1556 /// An unknown or conflicting QoS style was encountered.
1557 QOS_BAD_STYLE = 11012,
1558 /// QoS bad object.
1559 /// A problem was encountered with some part of the filterspec or the provider-specific buffer in general.
1560 QOS_BAD_OBJECT = 11013,
1561 /// QoS traffic control error.
1562 /// An error with the underlying traffic control (TC) API as the generic QoS request was converted for local enforcement by the TC API.
1563 /// This could be due to an out of memory error or to an internal QoS provider error.
1564 QOS_TRAFFIC_CTRL_ERROR = 11014,
1565 /// QoS generic error.
1566 /// A general QoS error.
1567 QOS_GENERIC_ERROR = 11015,
1568 /// QoS service type error.
1569 /// An invalid or unrecognized service type was found in the QoS flowspec.
1570 QOS_ESERVICETYPE = 11016,
1571 /// QoS flowspec error.
1572 /// An invalid or inconsistent flowspec was found in the QOS structure.
1573 QOS_EFLOWSPEC = 11017,
1574 /// Invalid QoS provider buffer.
1575 /// An invalid QoS provider-specific buffer.
1576 QOS_EPROVSPECBUF = 11018,
1577 /// Invalid QoS filter style.
1578 /// An invalid QoS filter style was used.
1579 QOS_EFILTERSTYLE = 11019,
1580 /// Invalid QoS filter type.
1581 /// An invalid QoS filter type was used.
1582 QOS_EFILTERTYPE = 11020,
1583 /// Incorrect QoS filter count.
1584 /// An incorrect number of QoS FILTERSPECs were specified in the FLOWDESCRIPTOR.
1585 QOS_EFILTERCOUNT = 11021,
1586 /// Invalid QoS object length.
1587 /// An object with an invalid ObjectLength field was specified in the QoS provider-specific buffer.
1588 QOS_EOBJLENGTH = 11022,
1589 /// Incorrect QoS flow count.
1590 /// An incorrect number of flow descriptors was specified in the QoS structure.
1591 QOS_EFLOWCOUNT = 11023,
1592 /// Unrecognized QoS object.
1593 /// An unrecognized object was found in the QoS provider-specific buffer.
1594 QOS_EUNKOWNPSOBJ = 11024,
1595 /// Invalid QoS policy object.
1596 /// An invalid policy object was found in the QoS provider-specific buffer.
1597 QOS_EPOLICYOBJ = 11025,
1598 /// Invalid QoS flow descriptor.
1599 /// An invalid QoS flow descriptor was found in the flow descriptor list.
1600 QOS_EFLOWDESC = 11026,
1601 /// Invalid QoS provider-specific flowspec.
1602 /// An invalid or inconsistent flowspec was found in the QoS provider-specific buffer.
1603 QOS_EPSFLOWSPEC = 11027,
1604 /// Invalid QoS provider-specific filterspec.
1605 /// An invalid FILTERSPEC was found in the QoS provider-specific buffer.
1606 QOS_EPSFILTERSPEC = 11028,
1607 /// Invalid QoS shape discard mode object.
1608 /// An invalid shape discard mode object was found in the QoS provider-specific buffer.
1609 QOS_ESDMODEOBJ = 11029,
1610 /// Invalid QoS shaping rate object.
1611 /// An invalid shaping rate object was found in the QoS provider-specific buffer.
1612 QOS_ESHAPERATEOBJ = 11030,
1613 /// Reserved policy QoS element type.
1614 /// A reserved policy element was found in the QoS provider-specific buffer.
1615 QOS_RESERVED_PETYPE = 11031,
1616 _,
1617};
1618
1619pub extern "ws2_32" fn accept(
1620 s: SOCKET,
1621 addr: ?*sockaddr,
1622 addrlen: ?*i32,
1623) callconv(.winapi) SOCKET;
1624
1625pub extern "ws2_32" fn bind(
1626 s: SOCKET,
1627 name: *const sockaddr,
1628 namelen: i32,
1629) callconv(.winapi) i32;
1630
1631pub extern "ws2_32" fn closesocket(
1632 s: SOCKET,
1633) callconv(.winapi) i32;
1634
1635pub extern "ws2_32" fn connect(
1636 s: SOCKET,
1637 name: *const sockaddr,
1638 namelen: i32,
1639) callconv(.winapi) i32;
1640
1641pub extern "ws2_32" fn ioctlsocket(
1642 s: SOCKET,
1643 cmd: i32,
1644 argp: *u32,
1645) callconv(.winapi) i32;
1646
1647pub extern "ws2_32" fn getpeername(
1648 s: SOCKET,
1649 name: *sockaddr,
1650 namelen: *i32,
1651) callconv(.winapi) i32;
1652
1653pub extern "ws2_32" fn getsockname(
1654 s: SOCKET,
1655 name: *sockaddr,
1656 namelen: *i32,
1657) callconv(.winapi) i32;
1658
1659pub extern "ws2_32" fn getsockopt(
1660 s: SOCKET,
1661 level: i32,
1662 optname: i32,
1663 optval: [*]u8,
1664 optlen: *i32,
1665) callconv(.winapi) i32;
1666
1667pub extern "ws2_32" fn htonl(
1668 hostlong: u32,
1669) callconv(.winapi) u32;
1670
1671pub extern "ws2_32" fn htons(
1672 hostshort: u16,
1673) callconv(.winapi) u16;
1674
1675pub extern "ws2_32" fn inet_addr(
1676 cp: ?[*]const u8,
1677) callconv(.winapi) u32;
1678
1679pub extern "ws2_32" fn listen(
1680 s: SOCKET,
1681 backlog: i32,
1682) callconv(.winapi) i32;
1683
1684pub extern "ws2_32" fn ntohl(
1685 netlong: u32,
1686) callconv(.winapi) u32;
1687
1688pub extern "ws2_32" fn ntohs(
1689 netshort: u16,
1690) callconv(.winapi) u16;
1691
1692pub extern "ws2_32" fn recv(
1693 s: SOCKET,
1694 buf: [*]u8,
1695 len: i32,
1696 flags: i32,
1697) callconv(.winapi) i32;
1698
1699pub extern "ws2_32" fn recvfrom(
1700 s: SOCKET,
1701 buf: [*]u8,
1702 len: i32,
1703 flags: i32,
1704 from: ?*sockaddr,
1705 fromlen: ?*i32,
1706) callconv(.winapi) i32;
1707
1708pub extern "ws2_32" fn select(
1709 nfds: i32,
1710 readfds: ?*fd_set,
1711 writefds: ?*fd_set,
1712 exceptfds: ?*fd_set,
1713 timeout: ?*const timeval,
1714) callconv(.winapi) i32;
1715
1716pub extern "ws2_32" fn send(
1717 s: SOCKET,
1718 buf: [*]const u8,
1719 len: i32,
1720 flags: u32,
1721) callconv(.winapi) i32;
1722
1723pub extern "ws2_32" fn sendto(
1724 s: SOCKET,
1725 buf: [*]const u8,
1726 len: i32,
1727 flags: i32,
1728 to: ?*const sockaddr,
1729 tolen: i32,
1730) callconv(.winapi) i32;
1731
1732pub extern "ws2_32" fn setsockopt(
1733 s: SOCKET,
1734 level: i32,
1735 optname: i32,
1736 optval: ?[*]const u8,
1737 optlen: i32,
1738) callconv(.winapi) i32;
1739
1740pub extern "ws2_32" fn shutdown(
1741 s: SOCKET,
1742 how: i32,
1743) callconv(.winapi) i32;
1744
1745pub extern "ws2_32" fn socket(
1746 af: i32,
1747 @"type": i32,
1748 protocol: i32,
1749) callconv(.winapi) SOCKET;
1750
1751pub extern "ws2_32" fn WSAStartup(
1752 wVersionRequired: WORD,
1753 lpWSAData: *WSADATA,
1754) callconv(.winapi) i32;
1755
1756pub extern "ws2_32" fn WSACleanup() callconv(.winapi) i32;
1757
1758pub extern "ws2_32" fn WSASetLastError(iError: i32) callconv(.winapi) void;
1759
1760pub extern "ws2_32" fn WSAGetLastError() callconv(.winapi) WinsockError;
1761
1762pub extern "ws2_32" fn WSAIsBlocking() callconv(.winapi) BOOL;
1763
1764pub extern "ws2_32" fn WSAUnhookBlockingHook() callconv(.winapi) i32;
1765
1766pub extern "ws2_32" fn WSASetBlockingHook(lpBlockFunc: FARPROC) callconv(.winapi) FARPROC;
1767
1768pub extern "ws2_32" fn WSACancelBlockingCall() callconv(.winapi) i32;
1769
1770pub extern "ws2_32" fn WSAAsyncGetServByName(
1771 hWnd: HWND,
1772 wMsg: u32,
1773 name: [*:0]const u8,
1774 proto: ?[*:0]const u8,
1775 buf: [*]u8,
1776 buflen: i32,
1777) callconv(.winapi) HANDLE;
1778
1779pub extern "ws2_32" fn WSAAsyncGetServByPort(
1780 hWnd: HWND,
1781 wMsg: u32,
1782 port: i32,
1783 proto: ?[*:0]const u8,
1784 buf: [*]u8,
1785 buflen: i32,
1786) callconv(.winapi) HANDLE;
1787
1788pub extern "ws2_32" fn WSAAsyncGetProtoByName(
1789 hWnd: HWND,
1790 wMsg: u32,
1791 name: [*:0]const u8,
1792 buf: [*]u8,
1793 buflen: i32,
1794) callconv(.winapi) HANDLE;
1795
1796pub extern "ws2_32" fn WSAAsyncGetProtoByNumber(
1797 hWnd: HWND,
1798 wMsg: u32,
1799 number: i32,
1800 buf: [*]u8,
1801 buflen: i32,
1802) callconv(.winapi) HANDLE;
1803
1804pub extern "ws2_32" fn WSACancelAsyncRequest(hAsyncTaskHandle: HANDLE) callconv(.winapi) i32;
1805
1806pub extern "ws2_32" fn WSAAsyncSelect(
1807 s: SOCKET,
1808 hWnd: HWND,
1809 wMsg: u32,
1810 lEvent: i32,
1811) callconv(.winapi) i32;
1812
1813pub extern "ws2_32" fn WSAAccept(
1814 s: SOCKET,
1815 addr: ?*sockaddr,
1816 addrlen: ?*i32,
1817 lpfnCondition: ?LPCONDITIONPROC,
1818 dwCallbackData: usize,
1819) callconv(.winapi) SOCKET;
1820
1821pub extern "ws2_32" fn WSACloseEvent(hEvent: HANDLE) callconv(.winapi) BOOL;
1822
1823pub extern "ws2_32" fn WSAConnect(
1824 s: SOCKET,
1825 name: *const sockaddr,
1826 namelen: i32,
1827 lpCallerData: ?*WSABUF,
1828 lpCalleeData: ?*WSABUF,
1829 lpSQOS: ?*QOS,
1830 lpGQOS: ?*QOS,
1831) callconv(.winapi) i32;
1832
1833pub extern "ws2_32" fn WSAConnectByNameW(
1834 s: SOCKET,
1835 nodename: [*:0]const u16,
1836 servicename: [*:0]const u16,
1837 LocalAddressLength: ?*u32,
1838 LocalAddress: ?*sockaddr,
1839 RemoteAddressLength: ?*u32,
1840 RemoteAddress: ?*sockaddr,
1841 timeout: ?*const timeval,
1842 Reserved: *OVERLAPPED,
1843) callconv(.winapi) BOOL;
1844
1845pub extern "ws2_32" fn WSAConnectByList(
1846 s: SOCKET,
1847 SocketAddress: *SOCKET_ADDRESS_LIST,
1848 LocalAddressLength: ?*u32,
1849 LocalAddress: ?*sockaddr,
1850 RemoteAddressLength: ?*u32,
1851 RemoteAddress: ?*sockaddr,
1852 timeout: ?*const timeval,
1853 Reserved: *OVERLAPPED,
1854) callconv(.winapi) BOOL;
1855
1856pub extern "ws2_32" fn WSACreateEvent() callconv(.winapi) HANDLE;
1857
1858pub extern "ws2_32" fn WSADuplicateSocketW(
1859 s: SOCKET,
1860 dwProcessId: u32,
1861 lpProtocolInfo: *WSAPROTOCOL_INFOW,
1862) callconv(.winapi) i32;
1863
1864pub extern "ws2_32" fn WSAEnumNetworkEvents(
1865 s: SOCKET,
1866 hEventObject: HANDLE,
1867 lpNetworkEvents: *WSANETWORKEVENTS,
1868) callconv(.winapi) i32;
1869
1870pub extern "ws2_32" fn WSAEnumProtocolsW(
1871 lpiProtocols: ?*i32,
1872 lpProtocolBuffer: ?*WSAPROTOCOL_INFOW,
1873 lpdwBufferLength: *u32,
1874) callconv(.winapi) i32;
1875
1876pub extern "ws2_32" fn WSAEventSelect(
1877 s: SOCKET,
1878 hEventObject: HANDLE,
1879 lNetworkEvents: i32,
1880) callconv(.winapi) i32;
1881
1882pub extern "ws2_32" fn WSAGetOverlappedResult(
1883 s: SOCKET,
1884 lpOverlapped: *OVERLAPPED,
1885 lpcbTransfer: *u32,
1886 fWait: BOOL,
1887 lpdwFlags: *u32,
1888) callconv(.winapi) BOOL;
1889
1890pub extern "ws2_32" fn WSAGetQOSByName(
1891 s: SOCKET,
1892 lpQOSName: *WSABUF,
1893 lpQOS: *QOS,
1894) callconv(.winapi) BOOL;
1895
1896pub extern "ws2_32" fn WSAHtonl(
1897 s: SOCKET,
1898 hostlong: u32,
1899 lpnetlong: *u32,
1900) callconv(.winapi) i32;
1901
1902pub extern "ws2_32" fn WSAHtons(
1903 s: SOCKET,
1904 hostshort: u16,
1905 lpnetshort: *u16,
1906) callconv(.winapi) i32;
1907
1908pub extern "ws2_32" fn WSAIoctl(
1909 s: SOCKET,
1910 dwIoControlCode: u32,
1911 lpvInBuffer: ?*const anyopaque,
1912 cbInBuffer: u32,
1913 lpvOutbuffer: ?*anyopaque,
1914 cbOutbuffer: u32,
1915 lpcbBytesReturned: *u32,
1916 lpOverlapped: ?*OVERLAPPED,
1917 lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
1918) callconv(.winapi) i32;
1919
1920pub extern "ws2_32" fn WSAJoinLeaf(
1921 s: SOCKET,
1922 name: *const sockaddr,
1923 namelen: i32,
1924 lpCallerdata: ?*WSABUF,
1925 lpCalleeData: ?*WSABUF,
1926 lpSQOS: ?*QOS,
1927 lpGQOS: ?*QOS,
1928 dwFlags: u32,
1929) callconv(.winapi) SOCKET;
1930
1931pub extern "ws2_32" fn WSANtohl(
1932 s: SOCKET,
1933 netlong: u32,
1934 lphostlong: *u32,
1935) callconv(.winapi) u32;
1936
1937pub extern "ws2_32" fn WSANtohs(
1938 s: SOCKET,
1939 netshort: u16,
1940 lphostshort: *u16,
1941) callconv(.winapi) i32;
1942
1943pub extern "ws2_32" fn WSARecv(
1944 s: SOCKET,
1945 lpBuffers: [*]WSABUF,
1946 dwBufferCouynt: u32,
1947 lpNumberOfBytesRecv: ?*u32,
1948 lpFlags: *u32,
1949 lpOverlapped: ?*OVERLAPPED,
1950 lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
1951) callconv(.winapi) i32;
1952
1953pub extern "ws2_32" fn WSARecvDisconnect(
1954 s: SOCKET,
1955 lpInboundDisconnectData: ?*WSABUF,
1956) callconv(.winapi) i32;
1957
1958pub extern "ws2_32" fn WSARecvFrom(
1959 s: SOCKET,
1960 lpBuffers: [*]WSABUF,
1961 dwBuffercount: u32,
1962 lpNumberOfBytesRecvd: ?*u32,
1963 lpFlags: *u32,
1964 lpFrom: ?*sockaddr,
1965 lpFromlen: ?*i32,
1966 lpOverlapped: ?*OVERLAPPED,
1967 lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
1968) callconv(.winapi) i32;
1969
1970pub extern "ws2_32" fn WSAResetEvent(hEvent: HANDLE) callconv(.winapi) i32;
1971
1972pub extern "ws2_32" fn WSASend(
1973 s: SOCKET,
1974 lpBuffers: [*]WSABUF,
1975 dwBufferCount: u32,
1976 lpNumberOfBytesSent: ?*u32,
1977 dwFlags: u32,
1978 lpOverlapped: ?*OVERLAPPED,
1979 lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
1980) callconv(.winapi) i32;
1981
1982pub extern "ws2_32" fn WSASendMsg(
1983 s: SOCKET,
1984 lpMsg: *WSAMSG_const,
1985 dwFlags: u32,
1986 lpNumberOfBytesSent: ?*u32,
1987 lpOverlapped: ?*OVERLAPPED,
1988 lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
1989) callconv(.winapi) i32;
1990
1991pub extern "ws2_32" fn WSASendDisconnect(
1992 s: SOCKET,
1993 lpOutboundDisconnectData: ?*WSABUF,
1994) callconv(.winapi) i32;
1995
1996pub extern "ws2_32" fn WSASendTo(
1997 s: SOCKET,
1998 lpBuffers: [*]WSABUF,
1999 dwBufferCount: u32,
2000 lpNumberOfBytesSent: ?*u32,
2001 dwFlags: u32,
2002 lpTo: ?*const sockaddr,
2003 iToLen: i32,
2004 lpOverlapped: ?*OVERLAPPED,
2005 lpCompletionRounte: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
2006) callconv(.winapi) i32;
2007
2008pub extern "ws2_32" fn WSASetEvent(
2009 hEvent: HANDLE,
2010) callconv(.winapi) BOOL;
2011
2012pub extern "ws2_32" fn WSASocketW(
2013 af: i32,
2014 @"type": i32,
2015 protocol: i32,
2016 lpProtocolInfo: ?*WSAPROTOCOL_INFOW,
2017 g: u32,
2018 dwFlags: u32,
2019) callconv(.winapi) SOCKET;
2020
2021pub extern "ws2_32" fn WSAWaitForMultipleEvents(
2022 cEvents: u32,
2023 lphEvents: [*]const HANDLE,
2024 fWaitAll: BOOL,
2025 dwTimeout: u32,
2026 fAlertable: BOOL,
2027) callconv(.winapi) u32;
2028
2029pub extern "ws2_32" fn WSAAddressToStringW(
2030 lpsaAddress: *sockaddr,
2031 dwAddressLength: u32,
2032 lpProtocolInfo: ?*WSAPROTOCOL_INFOW,
2033 lpszAddressString: [*]u16,
2034 lpdwAddressStringLength: *u32,
2035) callconv(.winapi) i32;
2036
2037pub extern "ws2_32" fn WSAStringToAddressW(
2038 AddressString: [*:0]const u16,
2039 AddressFamily: i32,
2040 lpProtocolInfo: ?*WSAPROTOCOL_INFOW,
2041 lpAddrses: *sockaddr,
2042 lpAddressLength: *i32,
2043) callconv(.winapi) i32;
2044
2045pub extern "ws2_32" fn WSAProviderConfigChange(
2046 lpNotificationHandle: *HANDLE,
2047 lpOverlapped: ?*OVERLAPPED,
2048 lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
2049) callconv(.winapi) i32;
2050
2051pub extern "ws2_32" fn WSAPoll(
2052 fdArray: [*]WSAPOLLFD,
2053 fds: u32,
2054 timeout: i32,
2055) callconv(.winapi) i32;
2056
2057pub extern "mswsock" fn WSARecvEx(
2058 s: SOCKET,
2059 buf: [*]u8,
2060 len: i32,
2061 flags: *i32,
2062) callconv(.winapi) i32;
2063
2064pub extern "mswsock" fn TransmitFile(
2065 hSocket: SOCKET,
2066 hFile: HANDLE,
2067 nNumberOfBytesToWrite: u32,
2068 nNumberOfBytesPerSend: u32,
2069 lpOverlapped: ?*OVERLAPPED,
2070 lpTransmitBuffers: ?*TRANSMIT_FILE_BUFFERS,
2071 dwReserved: u32,
2072) callconv(.winapi) BOOL;
2073
2074pub extern "mswsock" fn AcceptEx(
2075 sListenSocket: SOCKET,
2076 sAcceptSocket: SOCKET,
2077 lpOutputBuffer: *anyopaque,
2078 dwReceiveDataLength: u32,
2079 dwLocalAddressLength: u32,
2080 dwRemoteAddressLength: u32,
2081 lpdwBytesReceived: *u32,
2082 lpOverlapped: *OVERLAPPED,
2083) callconv(.winapi) BOOL;
2084
2085pub extern "mswsock" fn GetAcceptExSockaddrs(
2086 lpOutputBuffer: *anyopaque,
2087 dwReceiveDataLength: u32,
2088 dwLocalAddressLength: u32,
2089 dwRemoteAddressLength: u32,
2090 LocalSockaddr: **sockaddr,
2091 LocalSockaddrLength: *i32,
2092 RemoteSockaddr: **sockaddr,
2093 RemoteSockaddrLength: *i32,
2094) callconv(.winapi) void;
2095
2096pub extern "ws2_32" fn WSAProviderCompleteAsyncCall(
2097 hAsyncCall: HANDLE,
2098 iRetCode: i32,
2099) callconv(.winapi) i32;
2100
2101pub extern "mswsock" fn EnumProtocolsW(
2102 lpiProtocols: ?*i32,
2103 lpProtocolBuffer: *anyopaque,
2104 lpdwBufferLength: *u32,
2105) callconv(.winapi) i32;
2106
2107pub extern "mswsock" fn GetAddressByNameW(
2108 dwNameSpace: NS,
2109 lpServiceType: *GUID,
2110 lpServiceName: ?[*:0]u16,
2111 lpiProtocols: ?*i32,
2112 dwResolution: u32,
2113 lpServiceAsyncInfo: ?*SERVICE_ASYNC_INFO,
2114 lpCsaddrBuffer: *anyopaque,
2115 ldwBufferLEngth: *u32,
2116 lpAliasBuffer: ?[*:0]u16,
2117 lpdwAliasBufferLength: *u32,
2118) callconv(.winapi) i32;
2119
2120pub extern "mswsock" fn GetTypeByNameW(
2121 lpServiceName: [*:0]u16,
2122 lpServiceType: *GUID,
2123) callconv(.winapi) i32;
2124
2125pub extern "mswsock" fn GetNameByTypeW(
2126 lpServiceType: *GUID,
2127 lpServiceName: [*:0]u16,
2128 dwNameLength: u32,
2129) callconv(.winapi) i32;
2130
2131pub extern "ws2_32" fn GetAddrInfoExW(
2132 pName: ?[*:0]const u16,
2133 pServiceName: ?[*:0]const u16,
2134 dwNameSpace: NS,
2135 lpNspId: ?*GUID,
2136 hints: ?*const ADDRINFOEXW,
2137 ppResult: **ADDRINFOEXW,
2138 timeout: ?*timeval,
2139 lpOverlapped: ?*OVERLAPPED,
2140 lpCompletionRoutine: ?LPLOOKUPSERVICE_COMPLETION_ROUTINE,
2141 lpNameHandle: ?*HANDLE,
2142) callconv(.winapi) i32;
2143
2144pub extern "ws2_32" fn GetAddrInfoExCancel(
2145 lpHandle: *HANDLE,
2146) callconv(.winapi) i32;
2147
2148pub extern "ws2_32" fn GetAddrInfoExOverlappedResult(
2149 lpOverlapped: *OVERLAPPED,
2150) callconv(.winapi) i32;
2151
2152pub extern "ws2_32" fn FreeAddrInfoExW(
2153 pAddrInfoEx: ?*ADDRINFOEXW,
2154) callconv(.winapi) void;
2155
2156pub extern "ws2_32" fn getnameinfo(
2157 pSockaddr: *const sockaddr,
2158 SockaddrLength: i32,
2159 pNodeBuffer: ?[*]u8,
2160 NodeBufferSize: u32,
2161 pServiceBuffer: ?[*]u8,
2162 ServiceBufferName: u32,
2163 Flags: i32,
2164) callconv(.winapi) i32;