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