[PSDK]
[reactos.git] / include / psdk / winsock2.h
1 #pragma once
2
3 #if !(defined _WINSOCK2API_ || defined _WINSOCK_H)
4 #define _WINSOCK2API_
5 #define _WINSOCKAPI_ /* to prevent later inclusion of winsock.h */
6
7 #define _GNU_H_WINDOWS32_SOCKETS
8
9 #if (!defined(_WIN64) && !defined(WIN32))
10 #include <pshpack4.h>
11 #define _NEED_POPPACK
12 #endif
13
14 #ifndef INCL_WINSOCK_API_PROTOTYPES
15 #define INCL_WINSOCK_API_PROTOTYPES 1
16 #endif
17
18 #ifndef INCL_WINSOCK_API_TYPEDEFS
19 #define INCL_WINSOCK_API_TYPEDEFS 0
20 #endif
21
22 #ifndef _INC_WINDOWS
23 #include <windows.h>
24 #endif
25
26 #if !defined(MAKEWORD)
27 #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
28 #endif
29
30 #ifndef WINSOCK_VERSION
31 #define WINSOCK_VERSION MAKEWORD(2,2)
32 #endif
33
34 #ifndef WINSOCK_API_LINKAGE
35 #ifdef DECLSPEC_IMPORT
36 #define WINSOCK_API_LINKAGE DECLSPEC_IMPORT
37 #else
38 #define WINSOCK_API_LINKAGE
39 #endif
40 #endif
41
42 #ifndef _M_AMD64
43 #if !defined(__ROS_LONG64__)
44 #ifdef __WINESRC__
45 #define __ROS_LONG64__
46 #endif
47 #endif
48 #endif
49
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53
54 /* Names common to Winsock1.1 and Winsock2 */
55 #if !defined ( _BSDTYPES_DEFINED )
56 /* also defined in gmon.h and in cygwin's sys/types */
57 typedef unsigned char u_char;
58 typedef unsigned short u_short;
59 typedef unsigned int u_int;
60 #ifndef __ROS_LONG64__
61 typedef unsigned long u_long;
62 #else
63 typedef unsigned int u_long;
64 #endif
65 #define _BSDTYPES_DEFINED
66 #endif /* ! def _BSDTYPES_DEFINED */
67
68 #if(_WIN32_WINNT >= 0x0501)
69 typedef unsigned __int64 u_int64;
70 #endif /* (_WIN32_WINNT >= 0x0501) */
71
72 #include <ws2def.h>
73
74 typedef UINT_PTR SOCKET;
75
76 #ifndef FD_SETSIZE
77 #define FD_SETSIZE 64
78 #endif
79
80 #ifndef _SYS_TYPES_FD_SET
81
82 /* fd_set may be defined by the newlib <sys/types.h>
83 * if __USE_W32_SOCKETS not defined.
84 */
85 #ifdef fd_set
86 #undef fd_set
87 #endif
88
89 typedef struct fd_set {
90 u_int fd_count;
91 SOCKET fd_array[FD_SETSIZE];
92 } fd_set;
93
94 extern int PASCAL FAR __WSAFDIsSet(SOCKET,fd_set FAR*);
95
96 #ifndef FD_CLR
97 #define FD_CLR(fd, set) do { \
98 u_int __i; \
99 for (__i = 0; __i < ((fd_set FAR*)(set))->fd_count ; __i++) { \
100 if (((fd_set FAR*)(set))->fd_array[__i] == fd) { \
101 while (__i < ((fd_set FAR*)(set))->fd_count-1) { \
102 ((fd_set FAR*)(set))->fd_array[__i] = \
103 ((fd_set FAR*)(set))->fd_array[__i+1]; \
104 __i++; \
105 } \
106 ((fd_set FAR*)(set))->fd_count--; \
107 break; \
108 } \
109 } \
110 } while(0)
111 #endif
112
113 #ifndef FD_SET
114 /* this differs from the define in winsock.h and in cygwin sys/types.h */
115 #define FD_SET(fd, set) do { \
116 u_int __i; \
117 for (__i = 0; __i < ((fd_set FAR *)(set))->fd_count; __i++) { \
118 if (((fd_set FAR *)(set))->fd_array[__i] == (fd)) { \
119 break; \
120 } \
121 } \
122 if (__i == ((fd_set FAR *)(set))->fd_count) { \
123 if (((fd_set FAR *)(set))->fd_count < FD_SETSIZE) { \
124 ((fd_set FAR *)(set))->fd_array[__i] = (fd); \
125 ((fd_set FAR *)(set))->fd_count++; \
126 } \
127 } \
128 } while(0)
129 #endif
130
131 #ifndef FD_ZERO
132 #define FD_ZERO(set) (((fd_set FAR*)(set))->fd_count=0)
133 #endif
134
135 #ifndef FD_ISSET
136 #define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (fd_set FAR*)(set))
137 #endif
138
139 #elif !defined (USE_SYS_TYPES_FD_SET)
140 #warning "fd_set and associated macros have been defined in sys/types. \
141 This may cause runtime problems with W32 sockets"
142 #endif /* ndef _SYS_TYPES_FD_SET */
143
144 #if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
145
146 #ifndef _TIMEVAL_DEFINED
147
148 /* also in sys/time.h */
149 #define _TIMEVAL_DEFINED
150 #define _STRUCT_TIMEVAL
151 struct timeval {
152 LONG tv_sec;
153 LONG tv_usec;
154 };
155
156 #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
157
158 #define timercmp(tvp, uvp, cmp) \
159 (((tvp)->tv_sec != (uvp)->tv_sec) ? \
160 ((tvp)->tv_sec cmp (uvp)->tv_sec) : \
161 ((tvp)->tv_usec cmp (uvp)->tv_usec))
162
163 #define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
164
165 #endif /* _TIMEVAL_DEFINED */
166
167 #define h_addr h_addr_list[0]
168
169 struct hostent {
170 char *h_name;
171 char **h_aliases;
172 short h_addrtype;
173 short h_length;
174 char **h_addr_list;
175 };
176
177 struct linger {
178 u_short l_onoff;
179 u_short l_linger;
180 };
181
182 #define _IO(x,y) (IOC_VOID|((x)<<8)|(y))
183 #define _IOR(x,y,t) (IOC_OUT|(((LONG)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
184 #define _IOW(x,y,t) (IOC_IN|(((LONG)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
185 #define FIONBIO _IOW('f', 126, u_long)
186
187 struct netent {
188 char * n_name;
189 char **n_aliases;
190 short n_addrtype;
191 u_long n_net;
192 };
193
194 struct servent {
195 char *s_name;
196 char **s_aliases;
197 #ifdef _WIN64
198 char *s_proto;
199 short s_port;
200 #else
201 short s_port;
202 char *s_proto;
203 };
204
205 struct protoent {
206 char *p_name;
207 char **p_aliases;
208 short p_proto;
209 };
210
211 #define SO_CONDITIONAL_ACCEPT 0x3002
212
213 #define SOMAXCONN 0x7fffffff
214 #define MSG_OOB 1
215 #define MSG_PEEK 2
216 #define MSG_DONTROUTE 4
217 #if(_WIN32_WINNT >= 0x0502)
218 #define MSG_WAITALL 8
219 #endif
220
221 #define h_errno WSAGetLastError()
222 #define HOST_NOT_FOUND WSAHOST_NOT_FOUND
223 #define TRY_AGAIN WSATRY_AGAIN
224 #define NO_RECOVERY WSANO_RECOVERY
225 #define NO_DATA WSANO_DATA
226 #define NO_ADDRESS WSANO_ADDRESS
227
228 #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
229
230 #define IOCPARM_MASK 0x7f
231 #define IOC_VOID 0x20000000
232 #define IOC_OUT 0x40000000
233 #define IOC_IN 0x80000000
234 #define IOC_INOUT (IOC_IN|IOC_OUT)
235
236 #define FIONREAD _IOR('f', 127, u_long)
237 #define FIOASYNC _IOW('f', 125, u_long)
238 #define SIOCSHIWAT _IOW('s', 0, u_long)
239 #define SIOCGHIWAT _IOR('s', 1, u_long)
240 #define SIOCSLOWAT _IOW('s', 2, u_long)
241 #define SIOCGLOWAT _IOR('s', 3, u_long)
242 #define SIOCATMARK _IOR('s', 7, u_long)
243
244 #define IPPORT_ECHO 7
245 #define IPPORT_DISCARD 9
246 #define IPPORT_SYSTAT 11
247 #define IPPORT_DAYTIME 13
248 #define IPPORT_NETSTAT 15
249 #define IPPORT_FTP 21
250 #define IPPORT_TELNET 23
251 #define IPPORT_SMTP 25
252 #define IPPORT_TIMESERVER 37
253 #define IPPORT_NAMESERVER 42
254 #define IPPORT_WHOIS 43
255 #define IPPORT_MTP 57
256 #define IPPORT_TFTP 69
257 #define IPPORT_RJE 77
258 #define IPPORT_FINGER 79
259 #define IPPORT_TTYLINK 87
260 #define IPPORT_SUPDUP 95
261 #define IPPORT_EXECSERVER 512
262 #define IPPORT_LOGINSERVER 513
263 #define IPPORT_CMDSERVER 514
264 #define IPPORT_EFSSERVER 520
265 #define IPPORT_BIFFUDP 512
266 #define IPPORT_WHOSERVER 513
267 #define IPPORT_ROUTESERVER 520
268 #define IPPORT_RESERVED 1024
269 #define IMPLINK_IP 155
270 #define IMPLINK_LOWEXPER 156
271 #define IMPLINK_HIGHEXPER 158
272
273 #ifndef s_addr
274
275 #define s_addr S_un.S_addr
276 #define s_host S_un.S_un_b.s_b2
277 #define s_net S_un.S_un_b.s_b1
278 #define s_imp S_un.S_un_w.s_w2
279 #define s_impno S_un.S_un_b.s_b4
280 #define s_lh S_un.S_un_b.s_b3
281
282 typedef struct in_addr {
283 union {
284 struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
285 struct { u_short s_w1,s_w2; } S_un_w;
286 u_long S_addr;
287 } S_un;
288 } IN_ADDR, *PIN_ADDR;
289
290 #endif /* s_addr */
291
292 #define ADDR_ANY INADDR_ANY
293
294 #define WSADESCRIPTION_LEN 256
295 #define WSASYS_STATUS_LEN 128
296
297 typedef struct WSAData {
298 WORD wVersion;
299 WORD wHighVersion;
300 #ifdef _WIN64
301 unsigned short iMaxSockets;
302 unsigned short iMaxUdpDg;
303 char *lpVendorInfo;
304 char szDescription[WSADESCRIPTION_LEN+1];
305 char szSystemStatus[WSASYS_STATUS_LEN+1];
306 #else
307 char szDescription[WSADESCRIPTION_LEN+1];
308 char szSystemStatus[WSASYS_STATUS_LEN+1];
309 unsigned short iMaxSockets;
310 unsigned short iMaxUdpDg;
311 char *lpVendorInfo;
312 } WSADATA, FAR *LPWSADATA;
313
314 #define INVALID_SOCKET (SOCKET)(~0)
315
316 #define SOCKET_ERROR (-1)
317
318 #define FROM_PROTOCOL_INFO (-1)
319
320 #define SOCK_STREAM 1
321 #define SOCK_DGRAM 2
322 #define SOCK_RAW 3
323 #define SOCK_RDM 4
324 #define SOCK_SEQPACKET 5
325
326 #define SO_DEBUG 1
327 #define SO_ACCEPTCONN 2
328 #define SO_REUSEADDR 4
329 #define SO_KEEPALIVE 8
330 #define SO_DONTROUTE 16
331 #define SO_BROADCAST 32
332 #define SO_USELOOPBACK 64
333 #define SO_LINGER 128
334 #define SO_OOBINLINE 256
335 #define SO_DONTLINGER (int)(~SO_LINGER)
336 #define SO_EXCLUSIVEADDRUSE ((int)(~SO_REUSEADDR))
337
338 #define SO_SNDBUF 0x1001
339 #define SO_RCVBUF 0x1002
340 #define SO_SNDLOWAT 0x1003
341 #define SO_RCVLOWAT 0x1004
342 #define SO_SNDTIMEO 0x1005
343 #define SO_RCVTIMEO 0x1006
344 #define SO_ERROR 0x1007
345 #define SO_TYPE 0x1008
346
347 #define SO_GROUP_ID 0x2001
348 #define SO_GROUP_PRIORITY 0x2002
349 #define SO_MAX_MSG_SIZE 0x2003
350 #define SO_PROTOCOL_INFOA 0x2004
351 #define SO_PROTOCOL_INFOW 0x2005
352 #ifdef UNICODE
353 #define SO_PROTOCOL_INFO SO_PROTOCOL_INFOW
354 #else
355 #define SO_PROTOCOL_INFO SO_PROTOCOL_INFOA
356 #endif
357 #define PVD_CONFIG 0x3001
358
359 struct sockproto {
360 u_short sp_family;
361 u_short sp_protocol;
362 };
363
364 #define PF_UNSPEC AF_UNSPEC
365 #define PF_UNIX AF_UNIX
366 #define PF_INET AF_INET
367 #define PF_IMPLINK AF_IMPLINK
368 #define PF_PUP AF_PUP
369 #define PF_CHAOS AF_CHAOS
370 #define PF_NS AF_NS
371 #define PF_IPX AF_IPX
372 #define PF_ISO AF_ISO
373 #define PF_OSI AF_OSI
374 #define PF_ECMA AF_ECMA
375 #define PF_DATAKIT AF_DATAKIT
376 #define PF_CCITT AF_CCITT
377 #define PF_SNA AF_SNA
378 #define PF_DECnet AF_DECnet
379 #define PF_DLI AF_DLI
380 #define PF_LAT AF_LAT
381 #define PF_HYLINK AF_HYLINK
382 #define PF_APPLETALK AF_APPLETALK
383 #define PF_VOICEVIEW AF_VOICEVIEW
384 #define PF_FIREFOX AF_FIREFOX
385 #define PF_UNKNOWN1 AF_UNKNOWN1
386 #define PF_BAN AF_BAN
387 #define PF_ATM AF_ATM
388 #define PF_INET6 AF_INET6
389 #if(_WIN32_WINNT >= 0x0600)
390 #define PF_BTH AF_BTH
391 #endif
392 #define PF_MAX AF_MAX
393
394 #define SOL_SOCKET 0xffff
395
396 #define MSG_PARTIAL 0x8000
397 #define MSG_INTERRUPT 0x10
398 #define MSG_MAXIOVLEN 16
399
400 #define MAXGETHOSTSTRUCT 1024
401
402 #define FD_READ_BIT 0
403 #define FD_READ (1 << FD_READ_BIT)
404 #define FD_WRITE_BIT 1
405 #define FD_WRITE (1 << FD_WRITE_BIT)
406 #define FD_OOB_BIT 2
407 #define FD_OOB (1 << FD_OOB_BIT)
408 #define FD_ACCEPT_BIT 3
409 #define FD_ACCEPT (1 << FD_ACCEPT_BIT)
410 #define FD_CONNECT_BIT 4
411 #define FD_CONNECT (1 << FD_CONNECT_BIT)
412 #define FD_CLOSE_BIT 5
413 #define FD_CLOSE (1 << FD_CLOSE_BIT)
414 #define FD_QOS_BIT 6
415 #define FD_QOS (1 << FD_QOS_BIT)
416 #define FD_GROUP_QOS_BIT 7
417 #define FD_GROUP_QOS (1 << FD_GROUP_QOS_BIT)
418 #define FD_ROUTING_INTERFACE_CHANGE_BIT 8
419 #define FD_ROUTING_INTERFACE_CHANGE (1 << FD_ROUTING_INTERFACE_CHANGE_BIT)
420 #define FD_ADDRESS_LIST_CHANGE_BIT 9
421 #define FD_ADDRESS_LIST_CHANGE (1 << FD_ADDRESS_LIST_CHANGE_BIT)
422 #define FD_MAX_EVENTS 10
423 #define FD_ALL_EVENTS ((1 << FD_MAX_EVENTS) - 1)
424
425 #ifndef WSABASEERR
426
427 #define WSABASEERR 10000
428 #define WSAEINTR (WSABASEERR+4)
429 #define WSAEBADF (WSABASEERR+9)
430 #define WSAEACCES (WSABASEERR+13)
431 #define WSAEFAULT (WSABASEERR+14)
432 #define WSAEINVAL (WSABASEERR+22)
433 #define WSAEMFILE (WSABASEERR+24)
434 #define WSAEWOULDBLOCK (WSABASEERR+35)
435 #define WSAEINPROGRESS (WSABASEERR+36)
436 #define WSAEALREADY (WSABASEERR+37)
437 #define WSAENOTSOCK (WSABASEERR+38)
438 #define WSAEDESTADDRREQ (WSABASEERR+39)
439 #define WSAEMSGSIZE (WSABASEERR+40)
440 #define WSAEPROTOTYPE (WSABASEERR+41)
441 #define WSAENOPROTOOPT (WSABASEERR+42)
442 #define WSAEPROTONOSUPPORT (WSABASEERR+43)
443 #define WSAESOCKTNOSUPPORT (WSABASEERR+44)
444 #define WSAEOPNOTSUPP (WSABASEERR+45)
445 #define WSAEPFNOSUPPORT (WSABASEERR+46)
446 #define WSAEAFNOSUPPORT (WSABASEERR+47)
447 #define WSAEADDRINUSE (WSABASEERR+48)
448 #define WSAEADDRNOTAVAIL (WSABASEERR+49)
449 #define WSAENETDOWN (WSABASEERR+50)
450 #define WSAENETUNREACH (WSABASEERR+51)
451 #define WSAENETRESET (WSABASEERR+52)
452 #define WSAECONNABORTED (WSABASEERR+53)
453 #define WSAECONNRESET (WSABASEERR+54)
454 #define WSAENOBUFS (WSABASEERR+55)
455 #define WSAEISCONN (WSABASEERR+56)
456 #define WSAENOTCONN (WSABASEERR+57)
457 #define WSAESHUTDOWN (WSABASEERR+58)
458 #define WSAETOOMANYREFS (WSABASEERR+59)
459 #define WSAETIMEDOUT (WSABASEERR+60)
460 #define WSAECONNREFUSED (WSABASEERR+61)
461 #define WSAELOOP (WSABASEERR+62)
462 #define WSAENAMETOOLONG (WSABASEERR+63)
463 #define WSAEHOSTDOWN (WSABASEERR+64)
464 #define WSAEHOSTUNREACH (WSABASEERR+65)
465 #define WSAENOTEMPTY (WSABASEERR+66)
466 #define WSAEPROCLIM (WSABASEERR+67)
467 #define WSAEUSERS (WSABASEERR+68)
468 #define WSAEDQUOT (WSABASEERR+69)
469 #define WSAESTALE (WSABASEERR+70)
470 #define WSAEREMOTE (WSABASEERR+71)
471 #define WSASYSNOTREADY (WSABASEERR+91)
472 #define WSAVERNOTSUPPORTED (WSABASEERR+92)
473 #define WSANOTINITIALISED (WSABASEERR+93)
474 #define WSAEDISCON (WSABASEERR+101)
475 #define WSAENOMORE (WSABASEERR+102)
476 #define WSAECANCELLED (WSABASEERR+103)
477 #define WSAEINVALIDPROCTABLE (WSABASEERR+104)
478 #define WSAEINVALIDPROVIDER (WSABASEERR+105)
479 #define WSAEPROVIDERFAILEDINIT (WSABASEERR+106)
480 #define WSASYSCALLFAILURE (WSABASEERR+107)
481 #define WSASERVICE_NOT_FOUND (WSABASEERR+108)
482 #define WSATYPE_NOT_FOUND (WSABASEERR+109)
483 #define WSA_E_NO_MORE (WSABASEERR+110)
484 #define WSA_E_CANCELLED (WSABASEERR+111)
485 #define WSAEREFUSED (WSABASEERR+112)
486 #define WSAHOST_NOT_FOUND (WSABASEERR+1001)
487 #define WSATRY_AGAIN (WSABASEERR+1002)
488 #define WSANO_RECOVERY (WSABASEERR+1003)
489 #define WSANO_DATA (WSABASEERR+1004)
490 #define WSA_QOS_RECEIVERS (WSABASEERR + 1005)
491 #define WSA_QOS_SENDERS (WSABASEERR + 1006)
492 #define WSA_QOS_NO_SENDERS (WSABASEERR + 1007)
493 #define WSA_QOS_NO_RECEIVERS (WSABASEERR + 1008)
494 #define WSA_QOS_REQUEST_CONFIRMED (WSABASEERR + 1009)
495 #define WSA_QOS_ADMISSION_FAILURE (WSABASEERR + 1010)
496 #define WSA_QOS_POLICY_FAILURE (WSABASEERR + 1011)
497 #define WSA_QOS_BAD_STYLE (WSABASEERR + 1012)
498 #define WSA_QOS_BAD_OBJECT (WSABASEERR + 1013)
499 #define WSA_QOS_TRAFFIC_CTRL_ERROR (WSABASEERR + 1014)
500 #define WSA_QOS_GENERIC_ERROR (WSABASEERR + 1015)
501 #define WSA_QOS_ESERVICETYPE (WSABASEERR + 1016)
502 #define WSA_QOS_EFLOWSPEC (WSABASEERR + 1017)
503 #define WSA_QOS_EPROVSPECBUF (WSABASEERR + 1018)
504 #define WSA_QOS_EFILTERSTYLE (WSABASEERR + 1019)
505 #define WSA_QOS_EFILTERTYPE (WSABASEERR + 1020)
506 #define WSA_QOS_EFILTERCOUNT (WSABASEERR + 1021)
507 #define WSA_QOS_EOBJLENGTH (WSABASEERR + 1022)
508 #define WSA_QOS_EFLOWCOUNT (WSABASEERR + 1023)
509 #define WSA_QOS_EUNKOWNPSOBJ (WSABASEERR + 1024)
510 #define WSA_QOS_EPOLICYOBJ (WSABASEERR + 1025)
511 #define WSA_QOS_EFLOWDESC (WSABASEERR + 1026)
512 #define WSA_QOS_EPSFLOWSPEC (WSABASEERR + 1027)
513 #define WSA_QOS_EPSFILTERSPEC (WSABASEERR + 1028)
514 #define WSA_QOS_ESDMODEOBJ (WSABASEERR + 1029)
515 #define WSA_QOS_ESHAPERATEOBJ (WSABASEERR + 1030)
516 #define WSA_QOS_RESERVED_PETYPE (WSABASEERR + 1031)
517
518 #endif /* !WSABASEERR */
519
520 #ifdef WIN32
521
522 #define WSAAPI FAR PASCAL
523 #define WSAEVENT HANDLE
524 #define LPWSAEVENT LPHANDLE
525 #define WSAOVERLAPPED OVERLAPPED
526 typedef struct _OVERLAPPED *LPWSAOVERLAPPED;
527 #define WSA_IO_PENDING (ERROR_IO_PENDING)
528 #define WSA_IO_INCOMPLETE (ERROR_IO_INCOMPLETE)
529 #define WSA_INVALID_HANDLE (ERROR_INVALID_HANDLE)
530 #define WSA_INVALID_PARAMETER (ERROR_INVALID_PARAMETER)
531 #define WSA_NOT_ENOUGH_MEMORY (ERROR_NOT_ENOUGH_MEMORY)
532 #define WSA_OPERATION_ABORTED (ERROR_OPERATION_ABORTED)
533 #define WSA_INVALID_EVENT ((WSAEVENT)NULL)
534 #define WSA_MAXIMUM_WAIT_EVENTS (MAXIMUM_WAIT_OBJECTS)
535 #define WSA_WAIT_FAILED ((DWORD)-1L)
536 #define WSA_WAIT_EVENT_0 (WAIT_OBJECT_0)
537 #define WSA_WAIT_IO_COMPLETION (WAIT_IO_COMPLETION)
538 #define WSA_WAIT_TIMEOUT (WAIT_TIMEOUT)
539 #define WSA_INFINITE (INFINITE)
540
541 #else /* WIN16 */
542
543 #define WSAAPI FAR PASCAL
544 typedef DWORD WSAEVENT, FAR * LPWSAEVENT;
545
546 typedef struct _WSAOVERLAPPED {
547 DWORD Internal;
548 DWORD InternalHigh;
549 DWORD Offset;
550 DWORD OffsetHigh;
551 WSAEVENT hEvent;
552 } WSAOVERLAPPED, FAR * LPWSAOVERLAPPED;
553
554 #define WSA_IO_PENDING (WSAEWOULDBLOCK)
555 #define WSA_IO_INCOMPLETE (WSAEWOULDBLOCK)
556 #define WSA_INVALID_HANDLE (WSAENOTSOCK)
557 #define WSA_INVALID_PARAMETER (WSAEINVAL)
558 #define WSA_NOT_ENOUGH_MEMORY (WSAENOBUFS)
559 #define WSA_OPERATION_ABORTED (WSAEINTR)
560
561 #define WSA_INVALID_EVENT ((WSAEVENT)NULL)
562 #define WSA_MAXIMUM_WAIT_EVENTS (MAXIMUM_WAIT_OBJECTS)
563 #define WSA_WAIT_FAILED ((DWORD)-1L)
564 #define WSA_WAIT_EVENT_0 ((DWORD)0)
565 #define WSA_WAIT_TIMEOUT ((DWORD)0x102L)
566 #define WSA_INFINITE ((DWORD)-1L)
567
568 #endif /* WIN32 */
569
570 #include <qos.h>
571
572 typedef struct _QualityOfService {
573 FLOWSPEC SendingFlowspec;
574 FLOWSPEC ReceivingFlowspec;
575 WSABUF ProviderSpecific;
576 } QOS, *LPQOS;
577
578 #define CF_ACCEPT 0x0000
579 #define CF_REJECT 0x0001
580 #define CF_DEFER 0x0002
581 #define SD_RECEIVE 0x00
582 #define SD_SEND 0x01
583 #define SD_BOTH 0x02
584
585 typedef unsigned int GROUP;
586
587 #define SG_UNCONSTRAINED_GROUP 0x01
588 #define SG_CONSTRAINED_GROUP 0x02
589
590 typedef struct _WSANETWORKEVENTS {
591 LONG lNetworkEvents;
592 int iErrorCode[FD_MAX_EVENTS];
593 } WSANETWORKEVENTS, *LPWSANETWORKEVENTS;
594
595 #ifndef GUID_DEFINED
596 #include <guiddef.h>
597 #endif
598
599 #define MAX_PROTOCOL_CHAIN 7
600
601 #define BASE_PROTOCOL 1
602 #define LAYERED_PROTOCOL 0
603
604 typedef struct _WSAPROTOCOLCHAIN {
605 int ChainLen;
606 DWORD ChainEntries[MAX_PROTOCOL_CHAIN];
607 } WSAPROTOCOLCHAIN, *LPWSAPROTOCOLCHAIN;
608
609 #define WSAPROTOCOL_LEN 255
610
611 typedef struct _WSAPROTOCOL_INFOA {
612 DWORD dwServiceFlags1;
613 DWORD dwServiceFlags2;
614 DWORD dwServiceFlags3;
615 DWORD dwServiceFlags4;
616 DWORD dwProviderFlags;
617 GUID ProviderId;
618 DWORD dwCatalogEntryId;
619 WSAPROTOCOLCHAIN ProtocolChain;
620 int iVersion;
621 int iAddressFamily;
622 int iMaxSockAddr;
623 int iMinSockAddr;
624 int iSocketType;
625 int iProtocol;
626 int iProtocolMaxOffset;
627 int iNetworkByteOrder;
628 int iSecurityScheme;
629 DWORD dwMessageSize;
630 DWORD dwProviderReserved;
631 CHAR szProtocol[WSAPROTOCOL_LEN+1];
632 } WSAPROTOCOL_INFOA, *LPWSAPROTOCOL_INFOA;
633
634 typedef struct _WSAPROTOCOL_INFOW {
635 DWORD dwServiceFlags1;
636 DWORD dwServiceFlags2;
637 DWORD dwServiceFlags3;
638 DWORD dwServiceFlags4;
639 DWORD dwProviderFlags;
640 GUID ProviderId;
641 DWORD dwCatalogEntryId;
642 WSAPROTOCOLCHAIN ProtocolChain;
643 int iVersion;
644 int iAddressFamily;
645 int iMaxSockAddr;
646 int iMinSockAddr;
647 int iSocketType;
648 int iProtocol;
649 int iProtocolMaxOffset;
650 int iNetworkByteOrder;
651 int iSecurityScheme;
652 DWORD dwMessageSize;
653 DWORD dwProviderReserved;
654 WCHAR szProtocol[WSAPROTOCOL_LEN+1];
655 } WSAPROTOCOL_INFOW, * LPWSAPROTOCOL_INFOW;
656
657 #ifdef UNICODE
658 typedef WSAPROTOCOL_INFOW WSAPROTOCOL_INFO;
659 typedef LPWSAPROTOCOL_INFOW LPWSAPROTOCOL_INFO;
660 #else
661 typedef WSAPROTOCOL_INFOA WSAPROTOCOL_INFO;
662 typedef LPWSAPROTOCOL_INFOA LPWSAPROTOCOL_INFO;
663 #endif
664
665 #define PFL_MULTIPLE_PROTO_ENTRIES 0x00000001
666 #define PFL_RECOMMENDED_PROTO_ENTRY 0x00000002
667 #define PFL_HIDDEN 0x00000004
668 #define PFL_MATCHES_PROTOCOL_ZERO 0x00000008
669 #define PFL_NETWORKDIRECT_PROVIDER 0x00000010
670
671 #define XP1_CONNECTIONLESS 0x00000001
672 #define XP1_GUARANTEED_DELIVERY 0x00000002
673 #define XP1_GUARANTEED_ORDER 0x00000004
674 #define XP1_MESSAGE_ORIENTED 0x00000008
675 #define XP1_PSEUDO_STREAM 0x00000010
676 #define XP1_GRACEFUL_CLOSE 0x00000020
677 #define XP1_EXPEDITED_DATA 0x00000040
678 #define XP1_CONNECT_DATA 0x00000080
679 #define XP1_DISCONNECT_DATA 0x00000100
680 #define XP1_SUPPORT_BROADCAST 0x00000200
681 #define XP1_SUPPORT_MULTIPOINT 0x00000400
682 #define XP1_MULTIPOINT_CONTROL_PLANE 0x00000800
683 #define XP1_MULTIPOINT_DATA_PLANE 0x00001000
684 #define XP1_QOS_SUPPORTED 0x00002000
685 #define XP1_INTERRUPT 0x00004000
686 #define XP1_UNI_SEND 0x00008000
687 #define XP1_UNI_RECV 0x00010000
688 #define XP1_IFS_HANDLES 0x00020000
689 #define XP1_PARTIAL_MESSAGE 0x00040000
690 #define XP1_SAN_SUPPORT_SDP 0x00080000
691
692 #define BIGENDIAN 0x0000
693 #define LITTLEENDIAN 0x0001
694
695 #define SECURITY_PROTOCOL_NONE 0x0000
696
697 #define JL_SENDER_ONLY 0x01
698 #define JL_RECEIVER_ONLY 0x02
699 #define JL_BOTH 0x04
700
701 #define WSA_FLAG_OVERLAPPED 0x01
702 #define WSA_FLAG_MULTIPOINT_C_ROOT 0x02
703 #define WSA_FLAG_MULTIPOINT_C_LEAF 0x04
704 #define WSA_FLAG_MULTIPOINT_D_ROOT 0x08
705 #define WSA_FLAG_MULTIPOINT_D_LEAF 0x10
706 #define WSA_FLAG_ACCESS_SYSTEM_SECURITY 0x40
707
708 typedef int
709 (CALLBACK *LPCONDITIONPROC)(
710 IN LPWSABUF lpCallerId,
711 IN LPWSABUF lpCallerData,
712 IN OUT LPQOS lpSQOS,
713 IN OUT LPQOS lpGQOS,
714 IN LPWSABUF lpCalleeId,
715 IN LPWSABUF lpCalleeData,
716 OUT GROUP FAR *g,
717 IN DWORD_PTR dwCallbackData);
718
719 typedef void
720 (CALLBACK *LPWSAOVERLAPPED_COMPLETION_ROUTINE)(
721 IN DWORD dwError,
722 IN DWORD cbTransferred,
723 IN LPWSAOVERLAPPED lpOverlapped,
724 IN DWORD dwFlags);
725
726 #if(_WIN32_WINNT >= 0x0501)
727
728 #define SIO_NSP_NOTIFY_CHANGE _WSAIOW(IOC_WS2,25)
729
730 typedef enum _WSACOMPLETIONTYPE {
731 NSP_NOTIFY_IMMEDIATELY = 0,
732 NSP_NOTIFY_HWND,
733 NSP_NOTIFY_EVENT,
734 NSP_NOTIFY_PORT,
735 NSP_NOTIFY_APC
736 } WSACOMPLETIONTYPE, * PWSACOMPLETIONTYPE, *LPWSACOMPLETIONTYPE;
737
738 typedef struct _WSACOMPLETION {
739 WSACOMPLETIONTYPE Type;
740 union {
741 struct {
742 HWND hWnd;
743 UINT uMsg;
744 WPARAM context;
745 } WindowMessage;
746 struct {
747 LPWSAOVERLAPPED lpOverlapped;
748 } Event;
749 struct {
750 LPWSAOVERLAPPED lpOverlapped;
751 LPWSAOVERLAPPED_COMPLETION_ROUTINE lpfnCompletionProc;
752 } Apc;
753 struct {
754 LPWSAOVERLAPPED lpOverlapped;
755 HANDLE hPort;
756 ULONG_PTR Key;
757 } Port;
758 } Parameters;
759 } WSACOMPLETION, *PWSACOMPLETION, *LPWSACOMPLETION;
760
761 #endif /* (_WIN32_WINNT >= 0x0501) */
762
763 #define TH_NETDEV 0x00000001
764 #define TH_TAPI 0x00000002
765
766 #ifndef __BLOB_T_DEFINED /* also in wtypes.h and nspapi.h */
767 #define __BLOB_T_DEFINED
768 /* wine is using a diff define */
769 #ifndef _tagBLOB_DEFINED
770 #define _tagBLOB_DEFINED
771 #define _BLOB_DEFINED
772 #define _LPBLOB_DEFINED
773
774 typedef struct _BLOB {
775 ULONG cbSize;
776 BYTE *pBlobData;
777 } BLOB,*PBLOB,*LPBLOB;
778
779 #endif /* _tagBLOB_DEFINED */
780
781 #endif /* __BLOB_T_DEFINED */
782
783 #define SERVICE_MULTIPLE 0x00000001
784
785 #define NS_ALL 0
786 #define NS_SAP 1
787 #define NS_NDS 2
788 #define NS_PEER_BROWSE 3
789 #define NS_SLP 5
790 #define NS_DHCP 6
791 #define NS_TCPIP_LOCAL 10
792 #define NS_TCPIP_HOSTS 11
793 #define NS_DNS 12
794 #define NS_NETBT 13
795 #define NS_WINS 14
796 #if(_WIN32_WINNT >= 0x0501)
797 #define NS_NLA 15
798 #endif
799 #if(_WIN32_WINNT >= 0x0600)
800 #define NS_BTH 16
801 #endif
802 #define NS_NBP 20
803 #define NS_MS 30
804 #define NS_STDA 31
805 #define NS_NTDS 32
806 #if(_WIN32_WINNT >= 0x0600)
807 #define NS_EMAIL 37
808 #define NS_PNRPNAME 38
809 #define NS_PNRPCLOUD 39
810 #endif
811 #define NS_X500 40
812 #define NS_NIS 41
813 #define NS_NISPLUS 42
814 #define NS_WRQ 50
815 #define NS_NETDES 60
816
817 #define RES_UNUSED_1 0x00000001
818 #define RES_FLUSH_CACHE 0x00000002
819 #ifndef RES_SERVICE
820 #define RES_SERVICE 0x00000004
821 #endif
822
823 #define SERVICE_TYPE_VALUE_IPXPORTA "IpxSocket"
824 #define SERVICE_TYPE_VALUE_IPXPORTW L"IpxSocket"
825 #define SERVICE_TYPE_VALUE_SAPIDA "SapId"
826 #define SERVICE_TYPE_VALUE_SAPIDW L"SapId"
827
828 #define SERVICE_TYPE_VALUE_TCPPORTA "TcpPort"
829 #define SERVICE_TYPE_VALUE_TCPPORTW L"TcpPort"
830
831 #define SERVICE_TYPE_VALUE_UDPPORTA "UdpPort"
832 #define SERVICE_TYPE_VALUE_UDPPORTW L"UdpPort"
833
834 #define SERVICE_TYPE_VALUE_OBJECTIDA "ObjectId"
835 #define SERVICE_TYPE_VALUE_OBJECTIDW L"ObjectId"
836
837 #ifdef UNICODE
838 #define SERVICE_TYPE_VALUE_SAPID SERVICE_TYPE_VALUE_SAPIDW
839 #define SERVICE_TYPE_VALUE_TCPPORT SERVICE_TYPE_VALUE_TCPPORTW
840 #define SERVICE_TYPE_VALUE_UDPPORT SERVICE_TYPE_VALUE_UDPPORTW
841 #define SERVICE_TYPE_VALUE_OBJECTID SERVICE_TYPE_VALUE_OBJECTIDW
842 #else
843 #define SERVICE_TYPE_VALUE_SAPID SERVICE_TYPE_VALUE_SAPIDA
844 #define SERVICE_TYPE_VALUE_TCPPORT SERVICE_TYPE_VALUE_TCPPORTA
845 #define SERVICE_TYPE_VALUE_UDPPORT SERVICE_TYPE_VALUE_UDPPORTA
846 #define SERVICE_TYPE_VALUE_OBJECTID SERVICE_TYPE_VALUE_OBJECTIDA
847 #endif
848
849 typedef struct _AFPROTOCOLS {
850 INT iAddressFamily;
851 INT iProtocol;
852 } AFPROTOCOLS, *PAFPROTOCOLS, *LPAFPROTOCOLS;
853
854 typedef enum _WSAEcomparator {
855 COMP_EQUAL = 0,
856 COMP_NOTLESS
857 } WSAECOMPARATOR, *PWSAECOMPARATOR, *LPWSAECOMPARATOR;
858
859 typedef struct _WSAVersion {
860 DWORD dwVersion;
861 WSAECOMPARATOR ecHow;
862 } WSAVERSION, *PWSAVERSION, *LPWSAVERSION;
863
864 typedef struct _WSAQuerySetA {
865 DWORD dwSize;
866 LPSTR lpszServiceInstanceName;
867 LPGUID lpServiceClassId;
868 LPWSAVERSION lpVersion;
869 LPSTR lpszComment;
870 DWORD dwNameSpace;
871 LPGUID lpNSProviderId;
872 LPSTR lpszContext;
873 DWORD dwNumberOfProtocols;
874 LPAFPROTOCOLS lpafpProtocols;
875 LPSTR lpszQueryString;
876 DWORD dwNumberOfCsAddrs;
877 LPCSADDR_INFO lpcsaBuffer;
878 DWORD dwOutputFlags;
879 LPBLOB lpBlob;
880 } WSAQUERYSETA, *PWSAQUERYSETA, *LPWSAQUERYSETA;
881
882 typedef struct _WSAQuerySetW {
883 DWORD dwSize;
884 LPWSTR lpszServiceInstanceName;
885 LPGUID lpServiceClassId;
886 LPWSAVERSION lpVersion;
887 LPWSTR lpszComment;
888 DWORD dwNameSpace;
889 LPGUID lpNSProviderId;
890 LPWSTR lpszContext;
891 DWORD dwNumberOfProtocols;
892 LPAFPROTOCOLS lpafpProtocols;
893 LPWSTR lpszQueryString;
894 DWORD dwNumberOfCsAddrs;
895 LPCSADDR_INFO lpcsaBuffer;
896 DWORD dwOutputFlags;
897 LPBLOB lpBlob;
898 } WSAQUERYSETW, *PWSAQUERYSETW, *LPWSAQUERYSETW;
899
900 typedef struct _WSAQuerySet2A {
901 DWORD dwSize;
902 LPSTR lpszServiceInstanceName;
903 LPWSAVERSION lpVersion;
904 LPSTR lpszComment;
905 DWORD dwNameSpace;
906 LPGUID lpNSProviderId;
907 LPSTR lpszContext;
908 DWORD dwNumberOfProtocols;
909 LPAFPROTOCOLS lpafpProtocols;
910 LPSTR lpszQueryString;
911 DWORD dwNumberOfCsAddrs;
912 LPCSADDR_INFO lpcsaBuffer;
913 DWORD dwOutputFlags;
914 LPBLOB lpBlob;
915 } WSAQUERYSET2A, *PWSAQUERYSET2A, *LPWSAQUERYSET2A;
916
917 typedef struct _WSAQuerySet2W {
918 DWORD dwSize;
919 LPWSTR lpszServiceInstanceName;
920 LPWSAVERSION lpVersion;
921 LPWSTR lpszComment;
922 DWORD dwNameSpace;
923 LPGUID lpNSProviderId;
924 LPWSTR lpszContext;
925 DWORD dwNumberOfProtocols;
926 LPAFPROTOCOLS lpafpProtocols;
927 LPWSTR lpszQueryString;
928 DWORD dwNumberOfCsAddrs;
929 LPCSADDR_INFO lpcsaBuffer;
930 DWORD dwOutputFlags;
931 LPBLOB lpBlob;
932 } WSAQUERYSET2W, *PWSAQUERYSET2W, *LPWSAQUERYSET2W;
933
934 #ifdef UNICODE
935 typedef WSAQUERYSETW WSAQUERYSET;
936 typedef PWSAQUERYSETW PWSAQUERYSET;
937 typedef LPWSAQUERYSETW LPWSAQUERYSET;
938 typedef WSAQUERYSET2W WSAQUERYSET2;
939 typedef PWSAQUERYSET2W PWSAQUERYSET2;
940 typedef LPWSAQUERYSET2W LPWSAQUERYSET2;
941 #else
942 typedef WSAQUERYSETA WSAQUERYSET;
943 typedef PWSAQUERYSETA PWSAQUERYSET;
944 typedef LPWSAQUERYSETA LPWSAQUERYSET;
945 typedef WSAQUERYSET2A WSAQUERYSET2;
946 typedef PWSAQUERYSET2A PWSAQUERYSET2;
947 typedef LPWSAQUERYSET2A LPWSAQUERYSET2;
948 #endif /* UNICODE */
949
950 #define LUP_DEEP 0x0001
951 #define LUP_CONTAINERS 0x0002
952 #define LUP_NOCONTAINERS 0x0004
953 #define LUP_NEAREST 0x0008
954 #define LUP_RETURN_NAME 0x0010
955 #define LUP_RETURN_TYPE 0x0020
956 #define LUP_RETURN_VERSION 0x0040
957 #define LUP_RETURN_COMMENT 0x0080
958 #define LUP_RETURN_ADDR 0x0100
959 #define LUP_RETURN_BLOB 0x0200
960 #define LUP_RETURN_ALIASES 0x0400
961 #define LUP_RETURN_QUERY_STRING 0x0800
962 #define LUP_RETURN_ALL 0x0FF0
963 #define LUP_RES_SERVICE 0x8000
964 #define LUP_FLUSHCACHE 0x1000
965 #define LUP_FLUSHPREVIOUS 0x2000
966 #define LUP_NON_AUTHORITATIVE 0x4000
967 #define LUP_SECURE 0x8000
968 #define LUP_RETURN_PREFERRED_NAMES 0x10000
969 #define LUP_ADDRCONFIG 0x00100000
970 #define LUP_DUAL_ADDR 0x00200000
971 #define LUP_FILESERVER 0x00400000
972
973 #define RESULT_IS_ALIAS 0x0001
974 #if(_WIN32_WINNT >= 0x0501)
975 #define RESULT_IS_ADDED 0x0010
976 #define RESULT_IS_CHANGED 0x0020
977 #define RESULT_IS_DELETED 0x0040
978 #endif
979
980 typedef enum _WSAESETSERVICEOP {
981 RNRSERVICE_REGISTER=0,
982 RNRSERVICE_DEREGISTER,
983 RNRSERVICE_DELETE
984 } WSAESETSERVICEOP, *PWSAESETSERVICEOP, *LPWSAESETSERVICEOP;
985
986 typedef struct _WSANSClassInfoA {
987 LPSTR lpszName;
988 DWORD dwNameSpace;
989 DWORD dwValueType;
990 DWORD dwValueSize;
991 LPVOID lpValue;
992 } WSANSCLASSINFOA, *PWSANSCLASSINFOA, *LPWSANSCLASSINFOA;
993
994 typedef struct _WSANSClassInfoW {
995 LPWSTR lpszName;
996 DWORD dwNameSpace;
997 DWORD dwValueType;
998 DWORD dwValueSize;
999 LPVOID lpValue;
1000 } WSANSCLASSINFOW, *PWSANSCLASSINFOW, *LPWSANSCLASSINFOW;
1001
1002 #ifdef UNICODE
1003 typedef WSANSCLASSINFOW WSANSCLASSINFO;
1004 typedef PWSANSCLASSINFOW PWSANSCLASSINFO;
1005 typedef LPWSANSCLASSINFOW LPWSANSCLASSINFO;
1006 #else
1007 typedef WSANSCLASSINFOA WSANSCLASSINFO;
1008 typedef PWSANSCLASSINFOA PWSANSCLASSINFO;
1009 typedef LPWSANSCLASSINFOA LPWSANSCLASSINFO;
1010 #endif
1011
1012 typedef struct _WSAServiceClassInfoA {
1013 LPGUID lpServiceClassId;
1014 LPSTR lpszServiceClassName;
1015 DWORD dwCount;
1016 LPWSANSCLASSINFOA lpClassInfos;
1017 } WSASERVICECLASSINFOA, *PWSASERVICECLASSINFOA, *LPWSASERVICECLASSINFOA;
1018
1019 typedef struct _WSAServiceClassInfoW {
1020 LPGUID lpServiceClassId;
1021 LPWSTR lpszServiceClassName;
1022 DWORD dwCount;
1023 LPWSANSCLASSINFOW lpClassInfos;
1024 } WSASERVICECLASSINFOW, *PWSASERVICECLASSINFOW, *LPWSASERVICECLASSINFOW;
1025
1026 #ifdef UNICODE
1027 typedef WSASERVICECLASSINFOW WSASERVICECLASSINFO;
1028 typedef PWSASERVICECLASSINFOW PWSASERVICECLASSINFO;
1029 typedef LPWSASERVICECLASSINFOW LPWSASERVICECLASSINFO;
1030 #else
1031 typedef WSASERVICECLASSINFOA WSASERVICECLASSINFO;
1032 typedef PWSASERVICECLASSINFOA PWSASERVICECLASSINFO;
1033 typedef LPWSASERVICECLASSINFOA LPWSASERVICECLASSINFO;
1034 #endif
1035
1036 typedef struct _WSANAMESPACE_INFOA {
1037 GUID NSProviderId;
1038 DWORD dwNameSpace;
1039 BOOL fActive;
1040 DWORD dwVersion;
1041 LPSTR lpszIdentifier;
1042 } WSANAMESPACE_INFOA, *PWSANAMESPACE_INFOA, *LPWSANAMESPACE_INFOA;
1043
1044 typedef struct _WSANAMESPACE_INFOW {
1045 GUID NSProviderId;
1046 DWORD dwNameSpace;
1047 BOOL fActive;
1048 DWORD dwVersion;
1049 LPWSTR lpszIdentifier;
1050 } WSANAMESPACE_INFOW, *PWSANAMESPACE_INFOW, *LPWSANAMESPACE_INFOW;
1051
1052 typedef struct _WSANAMESPACE_INFOEXA {
1053 GUID NSProviderId;
1054 DWORD dwNameSpace;
1055 BOOL fActive;
1056 DWORD dwVersion;
1057 LPSTR lpszIdentifier;
1058 BLOB ProviderSpecific;
1059 } WSANAMESPACE_INFOEXA, *PWSANAMESPACE_INFOEXA, *LPWSANAMESPACE_INFOEXA;
1060
1061 typedef struct _WSANAMESPACE_INFOEXW {
1062 GUID NSProviderId;
1063 DWORD dwNameSpace;
1064 BOOL fActive;
1065 DWORD dwVersion;
1066 LPWSTR lpszIdentifier;
1067 BLOB ProviderSpecific;
1068 } WSANAMESPACE_INFOEXW, *PWSANAMESPACE_INFOEXW, *LPWSANAMESPACE_INFOEXW;
1069
1070 #ifdef UNICODE
1071 typedef WSANAMESPACE_INFOW WSANAMESPACE_INFO;
1072 typedef PWSANAMESPACE_INFOW PWSANAMESPACE_INFO;
1073 typedef LPWSANAMESPACE_INFOW LPWSANAMESPACE_INFO;
1074 typedef WSANAMESPACE_INFOEXW WSANAMESPACE_INFOEX;
1075 typedef PWSANAMESPACE_INFOEXW PWSANAMESPACE_INFOEX;
1076 typedef LPWSANAMESPACE_INFOEXW LPWSANAMESPACE_INFOEX;
1077 #else
1078 typedef WSANAMESPACE_INFOA WSANAMESPACE_INFO;
1079 typedef PWSANAMESPACE_INFOA PWSANAMESPACE_INFO;
1080 typedef LPWSANAMESPACE_INFOA LPWSANAMESPACE_INFO;
1081 typedef WSANAMESPACE_INFOEXA WSANAMESPACE_INFOEX;
1082 typedef PWSANAMESPACE_INFOEXA PWSANAMESPACE_INFOEX;
1083 typedef LPWSANAMESPACE_INFOEXA LPWSANAMESPACE_INFOEX;
1084 #endif /* UNICODE */
1085
1086 #if(_WIN32_WINNT >= 0x0600)
1087
1088 #define POLLRDNORM 0x0100
1089 #define POLLRDBAND 0x0200
1090 #define POLLIN (POLLRDNORM | POLLRDBAND)
1091 #define POLLPRI 0x0400
1092
1093 #define POLLWRNORM 0x0010
1094 #define POLLOUT (POLLWRNORM)
1095 #define POLLWRBAND 0x0020
1096
1097 #define POLLERR 0x0001
1098 #define POLLHUP 0x0002
1099 #define POLLNVAL 0x0004
1100
1101 typedef struct pollfd {
1102 SOCKET fd;
1103 SHORT events;
1104 SHORT revents;
1105 } WSAPOLLFD, *PWSAPOLLFD, FAR *LPWSAPOLLFD;
1106
1107 #endif /* (_WIN32_WINNT >= 0x0600) */
1108
1109 #if INCL_WINSOCK_API_TYPEDEFS
1110
1111 typedef SOCKET
1112 (WSAAPI *LPFN_ACCEPT)(
1113 IN SOCKET s,
1114 OUT struct sockaddr FAR *addr OPTIONAL,
1115 IN OUT int FAR *addrlen OPTIONAL);
1116
1117 typedef int
1118 (WSAAPI *LPFN_BIND)(
1119 IN SOCKET s,
1120 IN const struct sockaddr FAR *name,
1121 IN int namelen);
1122
1123 typedef int
1124 (WSAAPI *LPFN_CLOSESOCKET)(
1125 IN SOCKET s);
1126
1127 typedef int
1128 (WSAAPI *LPFN_CONNECT)(
1129 IN SOCKET s,
1130 IN const struct sockaddr FAR *name,
1131 IN int namelen);
1132
1133 typedef int
1134 (WSAAPI *LPFN_IOCTLSOCKET)(
1135 IN SOCKET s,
1136 IN long cmd,
1137 IN OUT u_long FAR *argp);
1138
1139 typedef int
1140 (WSAAPI *LPFN_GETPEERNAME)(
1141 IN SOCKET s,
1142 OUT struct sockaddr FAR *name,
1143 IN OUT int FAR *namelen);
1144
1145 typedef int
1146 (WSAAPI *LPFN_GETSOCKNAME)(
1147 IN SOCKET s,
1148 OUT struct sockaddr FAR *name,
1149 IN OUT int FAR *namelen);
1150
1151 typedef int
1152 (WSAAPI *LPFN_GETSOCKOPT)(
1153 IN SOCKET s,
1154 IN int level,
1155 IN int optname,
1156 OUT char FAR *optval,
1157 IN OUT int FAR *optlen);
1158
1159 typedef u_long
1160 (WSAAPI *LPFN_HTONL)(
1161 IN u_long hostlong);
1162
1163 typedef u_short
1164 (WSAAPI *LPFN_HTONS)(
1165 IN u_short hostshort);
1166
1167 typedef unsigned long
1168 (WSAAPI *LPFN_INET_ADDR)(
1169 IN const char FAR *cp);
1170
1171 typedef char FAR *
1172 (WSAAPI *LPFN_INET_NTOA)(
1173 IN struct in_addr in);
1174
1175 typedef int
1176 (WSAAPI *LPFN_LISTEN)(
1177 IN SOCKET s,
1178 IN int backlog);
1179
1180 typedef u_long
1181 (WSAAPI *LPFN_NTOHL)(
1182 IN u_long netlong);
1183
1184 typedef u_short
1185 (WSAAPI *LPFN_NTOHS)(
1186 IN u_short netshort);
1187
1188 typedef int
1189 (WSAAPI *LPFN_RECV)(
1190 IN SOCKET s,
1191 OUT char FAR *buf,
1192 IN int len,
1193 IN int flags);
1194
1195 typedef int
1196 (WSAAPI *LPFN_RECVFROM)(
1197 IN SOCKET s,
1198 OUT char FAR *buf,
1199 IN int len,
1200 IN int flags,
1201 OUT struct sockaddr FAR *from OPTIONAL,
1202 IN OUY int FAR * fromlen OPTIONAL);
1203
1204 typedef int
1205 (WSAAPI *LPFN_SELECT)(
1206 IN int nfds,
1207 IN OUT fd_set FAR *readfds OPTIONAL,
1208 IN OUT fd_set FAR *writefds OPTIONAL,
1209 IN OUT fd_set FAR *exceptfds OPTIONAL,
1210 IN const struct timeval FAR *timeout OPTIONAL);
1211
1212 typedef int
1213 (WSAAPI *LPFN_SEND)(
1214 IN SOCKET s,
1215 IN const char FAR *buf,
1216 IN int len,
1217 IN int flags);
1218
1219 typedef int
1220 (WSAAPI *LPFN_SENDTO)(
1221 IN SOCKET s,
1222 IN const char FAR *buf,
1223 IN int len,
1224 IN int flags,
1225 IN const struct sockaddr FAR *to OPTIONAL,
1226 IN int tolen);
1227
1228 typedef int
1229 (WSAAPI *LPFN_SETSOCKOPT)(
1230 IN SOCKET s,
1231 IN int level,
1232 IN int optname,
1233 IN const char FAR *optval OPTIONAL,
1234 IN int optlen);
1235
1236 typedef int
1237 (WSAAPI *LPFN_SHUTDOWN)(
1238 IN SOCKET s,
1239 IN int how);
1240
1241 typedef SOCKET
1242 (WSAAPI *LPFN_SOCKET)(
1243 IN int af,
1244 IN int type,
1245 IN int protocol);
1246
1247 typedef struct hostent FAR *
1248 (WSAAPI *LPFN_GETHOSTBYADDR)(
1249 IN const char FAR *addr,
1250 IN int len,
1251 IN int type);
1252
1253 typedef struct hostent FAR *
1254 (WSAAPI *LPFN_GETHOSTBYNAME)(
1255 IN const char FAR *name);
1256
1257 typedef int
1258 (WSAAPI *LPFN_GETHOSTNAME)(
1259 OUT char FAR *name,
1260 IN int namelen);
1261
1262 typedef struct servent FAR *
1263 (WSAAPI *LPFN_GETSERVBYPORT)(
1264 IN int port,
1265 IN const char FAR *proto);
1266
1267 typedef struct servent FAR *
1268 (WSAAPI *LPFN_GETSERVBYNAME)(
1269 IN const char FAR *name,
1270 IN const char FAR *proto);
1271
1272 typedef struct protoent FAR *
1273 (WSAAPI *LPFN_GETPROTOBYNUMBER)(
1274 IN int number);
1275
1276 typedef struct protoent FAR *
1277 (WSAAPI *LPFN_GETPROTOBYNAME)(
1278 IN const char FAR *name);
1279
1280 typedef int
1281 (WSAAPI *LPFN_WSASTARTUP)(
1282 IN WORD wVersionRequired,
1283 OUT LPWSADATA lpWSAData);
1284
1285 typedef int
1286 (WSAAPI *LPFN_WSACLEANUP)(void);
1287
1288 typedef void
1289 (WSAAPI *LPFN_WSASETLASTERROR)(
1290 IN int iError);
1291
1292 typedef int
1293 (WSAAPI *LPFN_WSAGETLASTERROR)(void);
1294
1295 typedef BOOL
1296 (WSAAPI *LPFN_WSAISBLOCKING)(void);
1297
1298 typedef int
1299 (WSAAPI *LPFN_WSAUNHOOKBLOCKINGHOOK)(void);
1300
1301 typedef FARPROC
1302 (WSAAPI *LPFN_WSASETBLOCKINGHOOK)(
1303 IN FARPROC lpBlockFunc);
1304
1305 typedef int
1306 (WSAAPI *LPFN_WSACANCELBLOCKINGCALL)(void);
1307
1308 typedef HANDLE
1309 (WSAAPI *LPFN_WSAASYNCGETSERVBYNAME)(
1310 IN HWND hWnd,
1311 IN u_int wMsg,
1312 IN const char FAR *name,
1313 IN const char FAR *proto,
1314 OUT char FAR *buf,
1315 IN int buflen);
1316
1317 typedef HANDLE
1318 (WSAAPI *LPFN_WSAASYNCGETSERVBYPORT)(
1319 IN HWND hWnd,
1320 IN u_int wMsg,
1321 IN int port,
1322 IN const char FAR *proto,
1323 OUT char FAR *buf,
1324 IN int buflen);
1325
1326 typedef HANDLE
1327 (WSAAPI *LPFN_WSAASYNCGETPROTOBYNAME)(
1328 IN HWND hWnd,
1329 IN u_int wMsg,
1330 IN const char FAR *name,
1331 OUT char FAR *buf,
1332 IN int buflen);
1333
1334 typedef HANDLE
1335 (WSAAPI *LPFN_WSAASYNCGETPROTOBYNUMBER)(
1336 IN HWND hWnd,
1337 IN u_int wMsg,
1338 IN int number,
1339 OUT char FAR *buf,
1340 IN int buflen);
1341
1342 typedef HANDLE
1343 (WSAAPI *LPFN_WSAASYNCGETHOSTBYNAME)(
1344 IN HWND hWnd,
1345 IN u_int wMsg,
1346 IN const char FAR *name,
1347 OUT char FAR *buf,
1348 IN int buflen);
1349
1350 typedef HANDLE
1351 (WSAAPI *LPFN_WSAASYNCGETHOSTBYADDR)(
1352 IN HWND hWnd,
1353 IN u_int wMsg,
1354 IN const char FAR *addr,
1355 IN int len,
1356 IN int type,
1357 OUT char FAR *buf,
1358 IN int buflen);
1359
1360 typedef int
1361 (WSAAPI *LPFN_WSACANCELASYNCREQUEST)(
1362 IN HANDLE hAsyncTaskHandle);
1363
1364 typedef int
1365 (WSAAPI *LPFN_WSAASYNCSELECT)(
1366 IN SOCKET s,
1367 IN HWND hWnd,
1368 IN u_int wMsg,
1369 IN long lEvent);
1370
1371 typedef SOCKET
1372 (WSAAPI *LPFN_WSAACCEPT)(
1373 IN SOCKET s,
1374 OUT struct sockaddr FAR *addr OPTIONAL,
1375 IN OUT LPINT addrlen OPTIONAL,
1376 IN LPCONDITIONPROC lpfnCondition OPTIONAL,
1377 IN DWORD_PTR dwCallbackData OPTIONAL);
1378
1379 typedef BOOL
1380 (WSAAPI *LPFN_WSACLOSEEVENT)(
1381 IN WSAEVENT hEvent);
1382
1383 typedef int
1384 (WSAAPI *LPFN_WSACONNECT)(
1385 IN SOCKET s,
1386 IN const struct sockaddr FAR *name,
1387 IN int namelen,
1388 IN LPWSABUF lpCallerData OPTIONAL,
1389 OUT LPWSABUF lpCalleeData OPTIONAL,
1390 IN LPQOS lpSQOS OPTIONAL,
1391 IN LPQOS lpGQOS OPTIONAL);
1392
1393 typedef WSAEVENT
1394 (WSAAPI *LPFN_WSACREATEEVENT)(void);
1395
1396 typedef int
1397 (WSAAPI *LPFN_WSADUPLICATESOCKETA)(
1398 IN SOCKET s,
1399 IN DWORD dwProcessId,
1400 OUT LPWSAPROTOCOL_INFOA lpProtocolInfo);
1401
1402 typedef int
1403 (WSAAPI *LPFN_WSADUPLICATESOCKETW)(
1404 IN SOCKET s,
1405 IN DWORD dwProcessId,
1406 OUT LPWSAPROTOCOL_INFOW lpProtocolInfo);
1407
1408 #ifdef UNICODE
1409 #define LPFN_WSADUPLICATESOCKET LPFN_WSADUPLICATESOCKETW
1410 #else
1411 #define LPFN_WSADUPLICATESOCKET LPFN_WSADUPLICATESOCKETA
1412 #endif
1413
1414 typedef int
1415 (WSAAPI *LPFN_WSAENUMNETWORKEVENTS)(
1416 IN SOCKET s,
1417 IN WSAEVENT hEventObject,
1418 OUT LPWSANETWORKEVENTS lpNetworkEvents);
1419
1420 typedef int
1421 (WSAAPI *LPFN_WSAENUMPROTOCOLSA)(
1422 IN LPINT lpiProtocols OPTIONAL,
1423 OUT LPWSAPROTOCOL_INFOA lpProtocolBuffer OPTIONAL,
1424 IN OUT LPDWORD lpdwBufferLength);
1425
1426 typedef int
1427 (WSAAPI *LPFN_WSAENUMPROTOCOLSW)(
1428 IN LPINT lpiProtocols OPTIONAL,
1429 OUT LPWSAPROTOCOL_INFOW lpProtocolBuffer OPTIONAL,
1430 IN OUT LPDWORD lpdwBufferLength);
1431
1432 #ifdef UNICODE
1433 #define LPFN_WSAENUMPROTOCOLS LPFN_WSAENUMPROTOCOLSW
1434 #else
1435 #define LPFN_WSAENUMPROTOCOLS LPFN_WSAENUMPROTOCOLSA
1436 #endif
1437
1438 typedef int
1439 (WSAAPI *LPFN_WSAEVENTSELECT)(
1440 IN SOCKET s,
1441 IN WSAEVENT hEventObject,
1442 IN long lNetworkEvents);
1443
1444 typedef BOOL
1445 (WSAAPI *LPFN_WSAGETOVERLAPPEDRESULT)(
1446 IN SOCKET s,
1447 IN LPWSAOVERLAPPED lpOverlapped,
1448 OUT LPDWORD lpcbTransfer,
1449 IN BOOL fWait,
1450 OUT LPDWORD lpdwFlags);
1451
1452 typedef BOOL
1453 (WSAAPI *LPFN_WSAGETQOSBYNAME)(
1454 IN SOCKET s,
1455 IN LPWSABUF lpQOSName,
1456 OUT LPQOS lpQOS);
1457
1458 typedef int
1459 (WSAAPI *LPFN_WSAHTONL)(
1460 IN SOCKET s,
1461 IN u_long hostlong,
1462 OUT u_long FAR *lpnetlong);
1463
1464 typedef int
1465 (WSAAPI *LPFN_WSAHTONS)(
1466 IN SOCKET s,
1467 IN u_short hostshort,
1468 OUT u_short FAR *lpnetshort);
1469
1470 typedef int
1471 (WSAAPI *LPFN_WSAIOCTL)(
1472 IN SOCKET s,
1473 IN DWORD dwIoControlCode,
1474 IN LPVOID lpvInBuffer OPTIONAL,
1475 IN DWORD cbInBuffer,
1476 OUT LPVOID lpvOutBuffer OPTIONAL,
1477 IN DWORD cbOutBuffer,
1478 OUT LPDWORD lpcbBytesReturned,
1479 IN OUT LPWSAOVERLAPPED lpOverlapped OPTIONAL,
1480 IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL);
1481
1482 typedef SOCKET
1483 (WSAAPI *LPFN_WSAJOINLEAF)(
1484 IN SOCKET s,
1485 IN const struct sockaddr FAR *name,
1486 IN int namelen,
1487 IN LPWSABUF lpCallerData OPTIONAL,
1488 OUT LPWSABUF lpCalleeData OPTIONAL,
1489 IN LPQOS lpSQOS OPTIONAL,
1490 IN LPQOS lpGQOS OPTIONAL,
1491 IN DWORD dwFlags);
1492
1493 typedef int
1494 (WSAAPI *LPFN_WSANTOHL)(
1495 IN SOCKET s,
1496 IN u_long netlong,
1497 OUT u_long FAR *lphostlong);
1498
1499 typedef int
1500 (WSAAPI *LPFN_WSANTOHS)(
1501 IN SOCKET s,
1502 IN u_short netshort,
1503 OUT u_short FAR *lphostshort);
1504
1505 typedef int
1506 (WSAAPI *LPFN_WSARECV)(
1507 IN SOCKET s,
1508 IN LPWSABUF lpBuffers,
1509 IN DWORD dwBufferCount,
1510 OUT LPDWORD lpNumberOfBytesRecvd OPTIONAL,
1511 IN OUT LPDWORD lpFlags,
1512 IN OUT LPWSAOVERLAPPED lpOverlapped OPTIONAL,
1513 IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL);
1514
1515 typedef int
1516 (WSAAPI *LPFN_WSARECVDISCONNECT)(
1517 IN SOCKET s,
1518 OUT LPWSABUF lpInboundDisconnectData);
1519
1520 typedef int
1521 (WSAAPI *LPFN_WSARECVFROM)(
1522 IN SOCKET s,
1523 IN LPWSABUF lpBuffers,
1524 IN DWORD dwBufferCount,
1525 OUT LPDWORD lpNumberOfBytesRecvd OPTIONAL,
1526 IN OUT LPDWORD lpFlags,
1527 OUT struct sockaddr FAR *lpFrom OPTIONAL,
1528 IN OUT LPINT lpFromlen OPTIONAL,
1529 IN OUT LPWSAOVERLAPPED lpOverlapped OPTIONAL,
1530 IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL);
1531
1532 typedef BOOL
1533 (WSAAPI *LPFN_WSARESETEVENT)(
1534 IN WSAEVENT hEvent);
1535
1536 typedef int
1537 (WSAAPI *LPFN_WSASEND)(
1538 IN SOCKET s,
1539 IN LPWSABUF lpBuffers,
1540 IN DWORD dwBufferCount,
1541 OUT LPDWORD lpNumberOfBytesSent OPTIONAL,
1542 IN DWORD dwFlags,
1543 IN OUT LPWSAOVERLAPPED lpOverlapped OPTIONAL,
1544 IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL);
1545
1546 typedef int
1547 (WSAAPI *LPFN_WSASENDDISCONNECT)(
1548 IN SOCKET s,
1549 IN LPWSABUF lpOutboundDisconnectData OPTIONAL);
1550
1551 typedef int
1552 (WSAAPI *LPFN_WSASENDTO)(
1553 IN SOCKET s,
1554 IN LPWSABUF lpBuffers,
1555 IN DWORD dwBufferCount,
1556 OUT LPDWORD lpNumberOfBytesSent OPTIONAL,
1557 IN DWORD dwFlags,
1558 IN const struct sockaddr FAR *lpTo,
1559 IN int iTolen,
1560 IN OUT LPWSAOVERLAPPED lpOverlapped OPTIONAL,
1561 IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL);
1562
1563 typedef BOOL
1564 (WSAAPI *LPFN_WSASETEVENT)(
1565 IN WSAEVENT hEvent);
1566
1567 typedef SOCKET
1568 (WSAAPI *LPFN_WSASOCKETA)(
1569 IN int af,
1570 IN int type,
1571 IN int protocol,
1572 IN LPWSAPROTOCOL_INFOA lpProtocolInfo OPTIONAL,
1573 IN GROUP g,
1574 IN DWORD dwFlags);
1575
1576 typedef SOCKET
1577 (WSAAPI *LPFN_WSASOCKETW)(
1578 IN int af,
1579 IN int type,
1580 IN int protocol,
1581 IN LPWSAPROTOCOL_INFOW lpProtocolInfo OPTIONAL,
1582 IN GROUP g,
1583 IN DWORD dwFlags);
1584
1585 #ifdef UNICODE
1586 #define LPFN_WSASOCKET LPFN_WSASOCKETW
1587 #else
1588 #define LPFN_WSASOCKET LPFN_WSASOCKETA
1589 #endif
1590
1591 typedef DWORD
1592 (WSAAPI *LPFN_WSAWAITFORMULTIPLEEVENTS)(
1593 IN DWORD cEvents,
1594 IN const WSAEVENT FAR *lphEvents,
1595 IN BOOL fWaitAll,
1596 IN DWORD dwTimeout,
1597 IN BOOL fAlertable);
1598
1599 typedef INT
1600 (WSAAPI *LPFN_WSAADDRESSTOSTRINGA)(
1601 IN LPSOCKADDR lpsaAddress,
1602 IN DWORD dwAddressLength,
1603 IN LPWSAPROTOCOL_INFOA lpProtocolInfo OPTIONAL,
1604 OUT LPSTR lpszAddressString,
1605 IN OUT LPDWORD lpdwAddressStringLength);
1606
1607 typedef INT
1608 (WSAAPI *LPFN_WSAADDRESSTOSTRINGW)(
1609 IN LPSOCKADDR lpsaAddress,
1610 IN DWORD dwAddressLength,
1611 IN LPWSAPROTOCOL_INFOW lpProtocolInfo OPTIONAL,
1612 OUT LPWSTR lpszAddressString,
1613 IN OUT LPDWORD lpdwAddressStringLength);
1614
1615 #ifdef UNICODE
1616 #define LPFN_WSAADDRESSTOSTRING LPFN_WSAADDRESSTOSTRINGW
1617 #else
1618 #define LPFN_WSAADDRESSTOSTRING LPFN_WSAADDRESSTOSTRINGA
1619 #endif
1620
1621 typedef INT
1622 (WSAAPI *LPFN_WSASTRINGTOADDRESSA)(
1623 IN LPSTR AddressString,
1624 IN INT AddressFamily,
1625 IN LPWSAPROTOCOL_INFOA lpProtocolInfo OPTIONAL,
1626 OUT LPSOCKADDR lpAddress,
1627 IN OUT LPINT lpAddressLength);
1628
1629 typedef INT
1630 (WSAAPI *LPFN_WSASTRINGTOADDRESSW)(
1631 IN LPWSTR AddressString,
1632 IN INT AddressFamily,
1633 IN LPWSAPROTOCOL_INFOW lpProtocolInfo OPTIONAL,
1634 OUT LPSOCKADDR lpAddress,
1635 IN OUT LPINT lpAddressLength);
1636
1637 #ifdef UNICODE
1638 #define LPFN_WSASTRINGTOADDRESS LPFN_WSASTRINGTOADDRESSW
1639 #else
1640 #define LPFN_WSASTRINGTOADDRESS LPFN_WSASTRINGTOADDRESSA
1641 #endif
1642
1643 typedef INT
1644 (WSAAPI *LPFN_WSALOOKUPSERVICEBEGINA)(
1645 IN LPWSAQUERYSETA lpqsRestrictions,
1646 IN DWORD dwControlFlags,
1647 OUT LPHANDLE lphLookup);
1648
1649 typedef INT
1650 (WSAAPI *LPFN_WSALOOKUPSERVICEBEGINW)(
1651 IN LPWSAQUERYSETW lpqsRestrictions,
1652 IN DWORD dwControlFlags,
1653 OUT LPHANDLE lphLookup);
1654
1655 #ifdef UNICODE
1656 #define LPFN_WSALOOKUPSERVICEBEGIN LPFN_WSALOOKUPSERVICEBEGINW
1657 #else
1658 #define LPFN_WSALOOKUPSERVICEBEGIN LPFN_WSALOOKUPSERVICEBEGINA
1659 #endif
1660
1661 typedef INT
1662 (WSAAPI *LPFN_WSALOOKUPSERVICENEXTA)(
1663 IN HANDLE hLookup,
1664 IN DWORD dwControlFlags,
1665 IN OUT LPDWORD lpdwBufferLength,
1666 OUT LPWSAQUERYSETA lpqsResults);
1667
1668 typedef INT
1669 (WSAAPI *LPFN_WSALOOKUPSERVICENEXTW)(
1670 IN HANDLE hLookup,
1671 IN DWORD dwControlFlags,
1672 IN OUT LPDWORD lpdwBufferLength,
1673 OUT LPWSAQUERYSETW lpqsResults OPTIONAL);
1674
1675 #ifdef UNICODE
1676 #define LPFN_WSALOOKUPSERVICENEXT LPFN_WSALOOKUPSERVICENEXTW
1677 #else
1678 #define LPFN_WSALOOKUPSERVICENEXT LPFN_WSALOOKUPSERVICENEXTA
1679 #endif
1680
1681 typedef INT
1682 (WSAAPI *LPFN_WSALOOKUPSERVICEEND)(
1683 IN HANDLE hLookup);
1684
1685 typedef INT
1686 (WSAAPI *LPFN_WSAINSTALLSERVICECLASSA)(
1687 IN LPWSASERVICECLASSINFOA lpServiceClassInfo);
1688
1689 typedef INT
1690 (WSAAPI *LPFN_WSAINSTALLSERVICECLASSW)(
1691 IN LPWSASERVICECLASSINFOW lpServiceClassInfo);
1692
1693 #ifdef UNICODE
1694 #define LPFN_WSAINSTALLSERVICECLASS LPFN_WSAINSTALLSERVICECLASSW
1695 #else
1696 #define LPFN_WSAINSTALLSERVICECLASS LPFN_WSAINSTALLSERVICECLASSA
1697 #endif
1698
1699 typedef INT
1700 (WSAAPI *LPFN_WSAREMOVESERVICECLASS)(
1701 IN LPGUID lpServiceClassId);
1702
1703 typedef INT
1704 (WSAAPI *LPFN_WSAGETSERVICECLASSINFOA)(
1705 IN LPGUID lpProviderId,
1706 IN LPGUID lpServiceClassId,
1707 IN OUT LPDWORD lpdwBufSize,
1708 OUT LPWSASERVICECLASSINFOA lpServiceClassInfo);
1709
1710 typedef INT
1711 (WSAAPI *LPFN_WSAGETSERVICECLASSINFOW)(
1712 IN LPGUID lpProviderId,
1713 IN LPGUID lpServiceClassId,
1714 IN OUT LPDWORD lpdwBufSize,
1715 OUT LPWSASERVICECLASSINFOW lpServiceClassInfo);
1716
1717 #ifdef UNICODE
1718 #define LPFN_WSAGETSERVICECLASSINFO LPFN_WSAGETSERVICECLASSINFOW
1719 #else
1720 #define LPFN_WSAGETSERVICECLASSINFO LPFN_WSAGETSERVICECLASSINFOA
1721 #endif
1722
1723 typedef INT
1724 (WSAAPI *LPFN_WSAENUMNAMESPACEPROVIDERSA)(
1725 IN OUT LPDWORD lpdwBufferLength,
1726 OUT LPWSANAMESPACE_INFOA lpnspBuffer);
1727
1728 typedef INT
1729 (WSAAPI *LPFN_WSAENUMNAMESPACEPROVIDERSW)(
1730 IN OUT LPDWORD lpdwBufferLength,
1731 OUT LPWSANAMESPACE_INFOW lpnspBuffer);
1732
1733 #ifdef UNICODE
1734 #define LPFN_WSAENUMNAMESPACEPROVIDERS LPFN_WSAENUMNAMESPACEPROVIDERSW
1735 #else
1736 #define LPFN_WSAENUMNAMESPACEPROVIDERS LPFN_WSAENUMNAMESPACEPROVIDERSA
1737 #endif
1738
1739 typedef INT
1740 (WSAAPI *LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA)(
1741 IN LPGUID lpServiceClassId,
1742 OUT LPSTR lpszServiceClassName,
1743 IN OUT LPDWORD lpdwBufferLength);
1744
1745 typedef INT
1746 (WSAAPI *LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW)(
1747 IN LPGUID lpServiceClassId,
1748 OUT LPWSTR lpszServiceClassName,
1749 IN OUT LPDWORD lpdwBufferLength);
1750
1751 #ifdef UNICODE
1752 #define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW
1753 #else
1754 #define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA
1755 #endif
1756
1757 typedef INT
1758 (WSAAPI *LPFN_WSASETSERVICEA)(
1759 IN LPWSAQUERYSETA lpqsRegInfo,
1760 IN WSAESETSERVICEOP essoperation,
1761 IN DWORD dwControlFlags);
1762
1763 typedef INT
1764 (WSAAPI *LPFN_WSASETSERVICEW)(
1765 IN LPWSAQUERYSETW lpqsRegInfo,
1766 IN WSAESETSERVICEOP essoperation,
1767 IN DWORD dwControlFlags);
1768
1769 #ifdef UNICODE
1770 #define LPFN_WSASETSERVICE LPFN_WSASETSERVICEW
1771 #else
1772 #define LPFN_WSASETSERVICE LPFN_WSASETSERVICEA
1773 #endif
1774
1775 typedef INT
1776 (WSAAPI *LPFN_WSAPROVIDERCONFIGCHANGE)(
1777 IN OUT LPHANDLE lpNotificationHandle OPTIONAL,
1778 IN OUT LPWSAOVERLAPPED lpOverlapped OPTIONAL,
1779 IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL);
1780
1781 #if(_WIN32_WINNT >= 0x0501)
1782 typedef INT
1783 (WSAAPI *LPFN_WSANSPIOCTL)(
1784 IN HANDLE hLookup,
1785 IN DWORD dwControlCode,
1786 IN LPVOID lpvInBuffer OPTIONAL,
1787 IN DWORD cbInBuffer,
1788 OUT LPVOID lpvOutBuffer OPTIONAL,
1789 IN DWORD cbOutBuffer,
1790 OUT LPDWORD lpcbBytesReturned,
1791 IN LPWSACOMPLETION lpCompletion OPTIONAL);
1792 #endif /* (_WIN32_WINNT >= 0x0501) */
1793
1794 #if (_WIN32_WINNT >= 0x0600)
1795
1796 typedef INT
1797 (WSAAPI *LPFN_WSAENUMNAMESPACEPROVIDERSEXA)(
1798 IN OUT LPDWORD lpdwBufferLength,
1799 OUT LPWSANAMESPACE_INFOEXA lpnspBuffer);
1800
1801 typedef INT
1802 (WSAAPI *LPFN_WSAENUMNAMESPACEPROVIDERSEXW)(
1803 IN OUT LPDWORD lpdwBufferLength,
1804 OUT LPWSANAMESPACE_INFOEXW lpnspBuffer);
1805
1806 #ifdef UNICODE
1807 #define LPFN_WSAENUMNAMESPACEPROVIDERSEX LPFN_WSAENUMNAMESPACEPROVIDERSEXW
1808 #else
1809 #define LPFN_WSAENUMNAMESPACEPROVIDERSEX LPFN_WSAENUMNAMESPACEPROVIDERSEXA
1810 #endif
1811
1812 #endif /* (_WIN32_WINNT >= 0x600) */
1813
1814 #endif /* INCL_WINSOCK_API_TYPEDEFS */
1815
1816 #if INCL_WINSOCK_API_PROTOTYPES
1817
1818
1819 WINSOCK_API_LINKAGE
1820 SOCKET
1821 WSAAPI
1822 accept(
1823 IN SOCKET s,
1824 OUT struct sockaddr FAR *addr OPTIONAL,
1825 IN OUT int FAR *addrlen OPTIONAL);
1826
1827 WINSOCK_API_LINKAGE
1828 int
1829 WSAAPI
1830 bind(
1831 IN SOCKET s,
1832 IN const struct sockaddr FAR *addr,
1833 IN int namelen);
1834
1835 WINSOCK_API_LINKAGE
1836 int
1837 WSAAPI
1838 closesocket(
1839 IN SOCKET s);
1840
1841 WINSOCK_API_LINKAGE
1842 int
1843 WSAAPI
1844 connect(
1845 IN SOCKET s,
1846 IN const struct sockaddr FAR *name,
1847 IN int namelen);
1848
1849 WINSOCK_API_LINKAGE
1850 int
1851 WSAAPI
1852 ioctlsocket(
1853 IN SOCKET s,
1854 IN long cmd,
1855 IN OUT u_long FAR *argp);
1856
1857 WINSOCK_API_LINKAGE
1858 int
1859 WSAAPI
1860 getpeername(
1861 IN SOCKET s,
1862 OUT struct sockaddr FAR *name,
1863 IN OUT int FAR *namelen);
1864
1865 WINSOCK_API_LINKAGE
1866 int
1867 WSAAPI
1868 getsockname(
1869 IN SOCKET s,
1870 OUT struct sockaddr FAR *name,
1871 IN OUT int FAR *namelen);
1872
1873 WINSOCK_API_LINKAGE
1874 int
1875 WSAAPI
1876 getsockopt(
1877 IN SOCKET s,
1878 IN int level,
1879 IN int optname,
1880 OUT char FAR *optval,
1881 IN OUT int FAR *optlen);
1882
1883 WINSOCK_API_LINKAGE
1884 u_long
1885 WSAAPI
1886 htonl(
1887 IN u_long hostlong);
1888
1889 WINSOCK_API_LINKAGE
1890 u_short
1891 WSAAPI
1892 htons(
1893 IN u_short hostshort);
1894
1895 WINSOCK_API_LINKAGE
1896 unsigned long
1897 WSAAPI
1898 inet_addr(
1899 IN const char FAR *cp);
1900
1901 WINSOCK_API_LINKAGE
1902 char FAR *
1903 WSAAPI
1904 inet_ntoa(
1905 IN struct in_addr in);
1906
1907 WINSOCK_API_LINKAGE
1908 int
1909 WSAAPI
1910 listen(
1911 IN SOCKET s,
1912 IN int backlog);
1913
1914 WINSOCK_API_LINKAGE
1915 u_long
1916 WSAAPI
1917 ntohl(
1918 IN u_long netlong);
1919
1920 WINSOCK_API_LINKAGE
1921 u_short
1922 WSAAPI
1923 ntohs(
1924 IN u_short netshort);
1925
1926 WINSOCK_API_LINKAGE
1927 int
1928 WSAAPI
1929 recv(
1930 IN SOCKET s,
1931 OUT char FAR *buf,
1932 IN int len,
1933 IN int flags);
1934
1935 WINSOCK_API_LINKAGE
1936 int
1937 WSAAPI
1938 recvfrom(
1939 IN SOCKET s,
1940 OUT char FAR *buf,
1941 IN int len,
1942 IN int flags,
1943 OUT struct sockaddr FAR *from OPTIONAL,
1944 IN OUY int FAR *fromlen OPTIONAL);
1945
1946 WINSOCK_API_LINKAGE
1947 int
1948 WSAAPI
1949 select(
1950 IN int nfds,
1951 IN OUT fd_set FAR *readfds OPTIONAL,
1952 IN OUT fd_set FAR *writefds OPTIONAL,
1953 IN OUT fd_set FAR *exceptfds OPTIONAL,
1954 IN const struct timeval FAR *timeout OPTIONAL);
1955
1956 WINSOCK_API_LINKAGE
1957 int
1958 WSAAPI
1959 send(
1960 IN SOCKET s,
1961 IN const char FAR *buf,
1962 IN int len,
1963 IN int flags);
1964
1965 WINSOCK_API_LINKAGE
1966 int
1967 WSAAPI
1968 sendto(
1969 IN SOCKET s,
1970 IN const char FAR *buf,
1971 IN int len,
1972 IN int flags,
1973 IN const struct sockaddr FAR *to OPTIONAL,
1974 IN int tolen);
1975
1976 WINSOCK_API_LINKAGE
1977 int
1978 WSAAPI
1979 setsockopt(
1980 IN SOCKET s,
1981 IN int level,
1982 IN int optname,
1983 IN const char FAR *optval OPTIONAL,
1984 IN int optlen);
1985
1986 WINSOCK_API_LINKAGE
1987 int
1988 WSAAPI
1989 shutdown(
1990 IN SOCKET s,
1991 IN int how);
1992
1993 WINSOCK_API_LINKAGE
1994 SOCKET
1995 WSAAPI
1996 socket(
1997 IN int af,
1998 IN int type,
1999 IN int protocol);
2000
2001 WINSOCK_API_LINKAGE
2002 struct hostent FAR *
2003 WSAAPI
2004 gethostbyaddr(
2005 IN const char FAR *addr,
2006 IN int len,
2007 IN int type);
2008
2009 WINSOCK_API_LINKAGE
2010 struct hostent FAR *
2011 WSAAPI
2012 gethostbyname(
2013 IN const char FAR *name);
2014
2015 WINSOCK_API_LINKAGE
2016 int
2017 WSAAPI
2018 gethostname(
2019 OUT char FAR *name,
2020 IN int namelen);
2021
2022 WINSOCK_API_LINKAGE
2023 struct servent FAR *
2024 WSAAPI
2025 getservbyport(
2026 IN int port,
2027 IN const char FAR *proto);
2028
2029 WINSOCK_API_LINKAGE
2030 struct servent FAR *
2031 WSAAPI
2032 getservbyname(
2033 IN const char FAR *name,
2034 IN const char FAR *proto);
2035
2036 WINSOCK_API_LINKAGE
2037 struct protoent FAR *
2038 WSAAPI
2039 getprotobynumber(
2040 IN int number);
2041
2042 WINSOCK_API_LINKAGE
2043 struct protoent FAR *
2044 WSAAPI
2045 getprotobyname(
2046 IN const char FAR *name);
2047
2048 WINSOCK_API_LINKAGE
2049 int
2050 WSAAPI
2051 WSAStartup(
2052 IN WORD wVersionRequired,
2053 OUT LPWSADATA lpWSAData);
2054
2055 WINSOCK_API_LINKAGE
2056 int
2057 WSAAPI
2058 WSACleanup(void);
2059
2060 WINSOCK_API_LINKAGE
2061 void
2062 WSAAPI
2063 WSASetLastError(
2064 IN int iError);
2065
2066 WINSOCK_API_LINKAGE
2067 int
2068 WSAAPI
2069 WSAGetLastError(void);
2070
2071 WINSOCK_API_LINKAGE
2072 BOOL
2073 WSAAPI
2074 WSAIsBlocking(void);
2075
2076 WINSOCK_API_LINKAGE
2077 int
2078 WSAAPI
2079 WSAUnhookBlockingHook(void);
2080
2081 WINSOCK_API_LINKAGE
2082 FARPROC
2083 WSAAPI
2084 WSASetBlockingHook(
2085 IN FARPROC lpBlockFunc);
2086
2087 WINSOCK_API_LINKAGE
2088 int
2089 WSAAPI
2090 WSACancelBlockingCall(void);
2091
2092 WINSOCK_API_LINKAGE
2093 HANDLE
2094 WSAAPI
2095 WSAAsyncGetServByName(
2096 IN HWND hWnd,
2097 IN u_int wMsg,
2098 IN const char FAR *name,
2099 IN const char FAR *proto,
2100 OUT char FAR *buf,
2101 IN int buflen);
2102
2103 WINSOCK_API_LINKAGE
2104 HANDLE
2105 WSAAPI
2106 WSAAsyncGetServByPort(
2107 IN HWND hWnd,
2108 IN u_int wMsg,
2109 IN int port,
2110 IN const char FAR *proto,
2111 OUT char FAR *buf,
2112 IN int buflen);
2113
2114 WINSOCK_API_LINKAGE
2115 HANDLE
2116 WSAAPI
2117 WSAAsyncGetProtoByName(
2118 IN HWND hWnd,
2119 IN u_int wMsg,
2120 IN const char FAR *name,
2121 OUT char FAR *buf,
2122 IN int buflen);
2123
2124 WINSOCK_API_LINKAGE
2125 HANDLE
2126 WSAAPI
2127 WSAAsyncGetProtoByNumber(
2128 IN HWND hWnd,
2129 IN u_int wMsg,
2130 IN int number,
2131 OUT char FAR *buf,
2132 IN int buflen);
2133
2134 WINSOCK_API_LINKAGE
2135 HANDLE
2136 WSAAPI
2137 WSAAsyncGetHostByName(
2138 IN HWND hWnd,
2139 IN u_int wMsg,
2140 IN const char FAR *name,
2141 OUT char FAR *buf,
2142 IN int buflen);
2143
2144 WINSOCK_API_LINKAGE
2145 HANDLE
2146 WSAAPI
2147 WSAAsyncGetHostByAddr(
2148 IN HWND hWnd,
2149 IN u_int wMsg,
2150 IN const char FAR *addr,
2151 IN int len,
2152 IN int type,
2153 OUT char FAR *buf,
2154 IN int buflen);
2155
2156 WINSOCK_API_LINKAGE
2157 int
2158 WSAAPI
2159 WSACancelAsyncRequest(
2160 IN HANDLE hAsyncTaskHandle);
2161
2162 WINSOCK_API_LINKAGE
2163 int
2164 WSAAPI
2165 WSAAsyncSelect(
2166 IN SOCKET s,
2167 IN HWND hWnd,
2168 IN u_int wMsg,
2169 IN long lEvent);
2170
2171 WINSOCK_API_LINKAGE
2172 SOCKET
2173 WSAAPI
2174 WSAAccept(
2175 IN SOCKET s,
2176 OUT struct sockaddr FAR *addr OPTIONAL,
2177 IN OUT LPINT addrlen OPTIONAL,
2178 IN LPCONDITIONPROC lpfnCondition OPTIONAL,
2179 IN DWORD_PTR dwCallbackData OPTIONAL);
2180
2181 WINSOCK_API_LINKAGE
2182 BOOL
2183 WSAAPI
2184 WSACloseEvent(
2185 IN WSAEVENT hEvent);
2186
2187 WINSOCK_API_LINKAGE
2188 int
2189 WSAAPI
2190 WSAConnect(
2191 IN SOCKET s,
2192 IN const struct sockaddr FAR *name,
2193 IN int namelen,
2194 IN LPWSABUF lpCallerData OPTIONAL,
2195 OUT LPWSABUF lpCalleeData OPTIONAL,
2196 IN LPQOS lpSQOS OPTIONAL,
2197 IN LPQOS lpGQOS OPTIONAL);
2198
2199 #ifdef UNICODE
2200 #define WSAConnectByName WSAConnectByNameW
2201 #else
2202 #define WSAConnectByName WSAConnectByNameA
2203 #endif
2204
2205 BOOL
2206 PASCAL
2207 WSAConnectByNameW(
2208 IN SOCKET s,
2209 IN LPWSTR nodename,
2210 IN LPWSTR servicename,
2211 IN OUT LPDWORD LocalAddressLength,
2212 OUT LPSOCKADDR LocalAddress,
2213 IN OUT LPDWORD RemoteAddressLength,
2214 OUT LPSOCKADDR RemoteAddress,
2215 IN const struct timeval *timeout,
2216 IN LPWSAOVERLAPPED Reserved OPTIONAL);
2217
2218 BOOL
2219 PASCAL
2220 WSAConnectByNameA(
2221 IN SOCKET s,
2222 IN LPCSTR nodename,
2223 IN LPCSTR servicename,
2224 IN OUT LPDWORD LocalAddressLength,
2225 OUT LPSOCKADDR LocalAddress,
2226 IN OUT LPDWORD RemoteAddressLength,
2227 OUT LPSOCKADDR RemoteAddress,
2228 IN const struct timeval *timeout,
2229 IN LPWSAOVERLAPPED Reserved OPTIONAL);
2230
2231 BOOL
2232 PASCAL
2233 WSAConnectByList(
2234 IN SOCKET s,
2235 IN PSOCKET_ADDRESS_LIST SocketAddress,
2236 IN OUT LPDWORD LocalAddressLength,
2237 OUT LPSOCKADDR LocalAddress,
2238 IN OUT LPDWORD RemoteAddressLength,
2239 OUT LPSOCKADDR RemoteAddress,
2240 IN const struct timeval *timeout,
2241 IN LPWSAOVERLAPPED Reserved OPTIONAL);
2242
2243 WINSOCK_API_LINKAGE
2244 WSAEVENT
2245 WSAAPI
2246 WSACreateEvent(void);
2247
2248 WINSOCK_API_LINKAGE
2249 int
2250 WSAAPI
2251 WSADuplicateSocketA(
2252 IN SOCKET s,
2253 IN DWORD dwProcessId,
2254 OUT LPWSAPROTOCOL_INFOA lpProtocolInfo);
2255
2256 WINSOCK_API_LINKAGE
2257 int
2258 WSAAPI
2259 WSADuplicateSocketW(
2260 IN SOCKET s,
2261 IN DWORD dwProcessId,
2262 OUT LPWSAPROTOCOL_INFOW lpProtocolInfo);
2263
2264 #ifdef UNICODE
2265 #define WSADuplicateSocket WSADuplicateSocketW
2266 #else
2267 #define WSADuplicateSocket WSADuplicateSocketA
2268 #endif
2269
2270 WINSOCK_API_LINKAGE
2271 int
2272 WSAAPI
2273 WSAEnumNetworkEvents(
2274 IN SOCKET s,
2275 IN WSAEVENT hEventObject,
2276 OUT LPWSANETWORKEVENTS lpNetworkEvents);
2277
2278 WINSOCK_API_LINKAGE
2279 int
2280 WSAAPI
2281 WSAEnumProtocolsA(
2282 IN LPINT lpiProtocols OPTIONAL,
2283 OUT LPWSAPROTOCOL_INFOA lpProtocolBuffer OPTIONAL,
2284 IN OUT LPDWORD lpdwBufferLength);
2285
2286 WINSOCK_API_LINKAGE
2287 int
2288 WSAAPI
2289 WSAEnumProtocolsW(
2290 IN LPINT lpiProtocols OPTIONAL,
2291 OUT LPWSAPROTOCOL_INFOW lpProtocolBuffer OPTIONAL,
2292 IN OUT LPDWORD lpdwBufferLength);
2293
2294 #ifdef UNICODE
2295 #define WSAEnumProtocols WSAEnumProtocolsW
2296 #else
2297 #define WSAEnumProtocols WSAEnumProtocolsA
2298 #endif
2299
2300 WINSOCK_API_LINKAGE
2301 int
2302 WSAAPI
2303 WSAEventSelect(
2304 IN SOCKET s,
2305 IN WSAEVENT hEventObject,
2306 IN long lNetworkEvents);
2307
2308 WINSOCK_API_LINKAGE
2309 BOOL
2310 WSAAPI
2311 WSAGetOverlappedResult(
2312 IN SOCKET s,
2313 IN LPWSAOVERLAPPED lpOverlapped,
2314 OUT LPDWORD lpcbTransfer,
2315 IN BOOL fWait,
2316 OUT LPDWORD lpdwFlags);
2317
2318 WINSOCK_API_LINKAGE
2319 BOOL
2320 WSAAPI
2321 WSAGetQOSByName(
2322 IN SOCKET s,
2323 IN LPWSABUF lpQOSName,
2324 OUT LPQOS lpQOS);
2325
2326 WINSOCK_API_LINKAGE
2327 int
2328 WSAAPI
2329 WSAHtonl(
2330 IN SOCKET s,
2331 IN u_long hostlong,
2332 OUT u_long FAR *lpnetlong);
2333
2334 WINSOCK_API_LINKAGE
2335 int
2336 WSAAPI
2337 WSAHtons(
2338 IN SOCKET s,
2339 IN u_short hostshort,
2340 OUT u_short FAR *lpnetshort);
2341
2342 WINSOCK_API_LINKAGE
2343 int
2344 WSAAPI
2345 WSAIoctl(
2346 IN SOCKET s,
2347 IN DWORD dwIoControlCode,
2348 IN LPVOID lpvInBuffer OPTIONAL,
2349 IN DWORD cbInBuffer,
2350 OUT LPVOID lpvOutBuffer OPTIONAL,
2351 IN DWORD cbOutBuffer,
2352 OUT LPDWORD lpcbBytesReturned,
2353 IN OUT LPWSAOVERLAPPED lpOverlapped OPTIONAL,
2354 IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL);
2355
2356 WINSOCK_API_LINKAGE
2357 SOCKET
2358 WSAAPI
2359 WSAJoinLeaf(
2360 IN SOCKET s,
2361 IN const struct sockaddr FAR *name,
2362 IN int namelen,
2363 IN LPWSABUF lpCallerData OPTIONAL,
2364 OUT LPWSABUF lpCalleeData OPTIONAL,
2365 IN LPQOS lpSQOS OPTIONAL,
2366 IN LPQOS lpGQOS OPTIONAL,
2367 IN DWORD dwFlags);
2368
2369 WINSOCK_API_LINKAGE
2370 int
2371 WSAAPI
2372 WSANtohl(
2373 IN SOCKET s,
2374 IN u_long netlong,
2375 OUT u_long FAR *lphostlong);
2376
2377 WINSOCK_API_LINKAGE
2378 int
2379 WSAAPI
2380 WSANtohs(
2381 IN SOCKET s,
2382 IN u_short netshort,
2383 OUT u_short FAR *lphostshort);
2384
2385 WINSOCK_API_LINKAGE
2386 int
2387 WSAAPI
2388 WSARecv(
2389 IN SOCKET s,
2390 IN LPWSABUF lpBuffers,
2391 IN DWORD dwBufferCount,
2392 OUT LPDWORD lpNumberOfBytesRecvd OPTIONAL,
2393 IN OUT LPDWORD lpFlags,
2394 IN OUT LPWSAOVERLAPPED lpOverlapped OPTIONAL,
2395 IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL);
2396
2397 WINSOCK_API_LINKAGE
2398 int
2399 WSAAPI
2400 WSARecvDisconnect(
2401 IN SOCKET s,
2402 IN LPWSABUF lpInboundDisconnectData OPTIONAL);
2403
2404 WINSOCK_API_LINKAGE
2405 int
2406 WSAAPI
2407 WSARecvFrom(
2408 IN SOCKET s,
2409 IN OUT LPWSABUF lpBuffers,
2410 IN DWORD dwBufferCount,
2411 OUT LPDWORD lpNumberOfBytesRecvd OPTIONAL,
2412 IN OUT LPDWORD lpFlags,
2413 OUT struct sockaddr FAR *lpFrom,
2414 IN OUT LPINT lpFromlen OPTIONAL,
2415 IN OUT LPWSAOVERLAPPED lpOverlapped OPTIONAL,
2416 IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL);
2417
2418 WINSOCK_API_LINKAGE
2419 BOOL
2420 WSAAPI
2421 WSAResetEvent(
2422 IN WSAEVENT hEvent);
2423
2424 WINSOCK_API_LINKAGE
2425 int
2426 WSAAPI
2427 WSASendDisconnect(
2428 IN SOCKET s,
2429 IN LPWSABUF lpOutboundDisconnectData OPTIONAL);
2430
2431 WINSOCK_API_LINKAGE
2432 int
2433 WSAAPI
2434 WSASend(
2435 IN SOCKET s,
2436 IN LPWSABUF lpBuffers,
2437 IN DWORD dwBufferCount,
2438 OUT LPDWORD lpNumberOfBytesSent OPTIONAL,
2439 IN DWORD dwFlags,
2440 IN OUT LPWSAOVERLAPPED lpOverlapped OPTIONAL,
2441 IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL);
2442
2443 WINSOCK_API_LINKAGE
2444 int
2445 WSAAPI
2446 WSASendTo(
2447 IN SOCKET s,
2448 IN LPWSABUF lpBuffers,
2449 IN DWORD dwBufferCount,
2450 OUT LPDWORD lpNumberOfBytesSent OPTIONAL,
2451 IN DWORD dwFlags,
2452 IN const struct sockaddr FAR *lpTo OPTIONAL,
2453 IN int iTolen,
2454 IN OUT LPWSAOVERLAPPED lpOverlapped OPTIONAL,
2455 IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL);
2456
2457 WINSOCK_API_LINKAGE
2458 BOOL
2459 WSAAPI
2460 WSASetEvent(
2461 IN WSAEVENT hEvent);
2462
2463 WINSOCK_API_LINKAGE
2464 SOCKET
2465 WSAAPI
2466 WSASocketA(
2467 IN int af,
2468 IN int type,
2469 IN int protocol,
2470 IN LPWSAPROTOCOL_INFOA lpProtocolInfo OPTIONAL,
2471 IN GROUP g,
2472 IN DWORD dwFlags);
2473
2474 WINSOCK_API_LINKAGE
2475 SOCKET
2476 WSAAPI
2477 WSASocketW(
2478 IN int af,
2479 IN int type,
2480 IN int protocol,
2481 IN LPWSAPROTOCOL_INFOW lpProtocolInfo OPTIONAL,
2482 IN GROUP g,
2483 IN DWORD dwFlags);
2484
2485 #ifdef UNICODE
2486 #define WSASocket WSASocketW
2487 #else
2488 #define WSASocket WSASocketA
2489 #endif
2490
2491 WINSOCK_API_LINKAGE
2492 DWORD
2493 WSAAPI
2494 WSAWaitForMultipleEvents(
2495 IN DWORD cEvents,
2496 IN const WSAEVENT FAR *lphEvents,
2497 IN BOOL fWaitAll,
2498 IN DWORD dwTimeout,
2499 IN BOOL fAlertable);
2500
2501 WINSOCK_API_LINKAGE
2502 INT
2503 WSAAPI
2504 WSAAddressToStringA(
2505 IN LPSOCKADDR lpsaAddress,
2506 IN DWORD dwAddressLength,
2507 IN LPWSAPROTOCOL_INFOA lpProtocolInfo OPTIONAL,
2508 OUT LPSTR lpszAddressString,
2509 IN OUT LPDWORD lpdwAddressStringLength);
2510
2511 WINSOCK_API_LINKAGE
2512 INT
2513 WSAAPI
2514 WSAAddressToStringW(
2515 IN LPSOCKADDR lpsaAddress,
2516 IN DWORD dwAddressLength,
2517 IN LPWSAPROTOCOL_INFOW lpProtocolInfo OPTIONAL,
2518 OUT LPWSTR lpszAddressString,
2519 IN OUT LPDWORD lpdwAddressStringLength);
2520
2521 #ifdef UNICODE
2522 #define WSAAddressToString WSAAddressToStringW
2523 #else
2524 #define WSAAddressToString WSAAddressToStringA
2525 #endif
2526
2527 WINSOCK_API_LINKAGE
2528 INT
2529 WSAAPI
2530 WSAStringToAddressA(
2531 IN LPSTR AddressString,
2532 IN INT AddressFamily,
2533 IN LPWSAPROTOCOL_INFOA lpProtocolInfo OPTIONAL,
2534 OUT LPSOCKADDR lpAddress,
2535 IN OUT LPINT lpAddressLength);
2536
2537 WINSOCK_API_LINKAGE
2538 INT
2539 WSAAPI
2540 WSAStringToAddressW(
2541 IN LPWSTR AddressString,
2542 IN INT AddressFamily,
2543 IN LPWSAPROTOCOL_INFOW lpProtocolInfo OPTIONAL,
2544 OUT LPSOCKADDR lpAddress,
2545 IN OUT LPINT lpAddressLength);
2546
2547 #ifdef UNICODE
2548 #define WSAStringToAddress WSAStringToAddressW
2549 #else
2550 #define WSAStringToAddress WSAStringToAddressA
2551 #endif
2552
2553 WINSOCK_API_LINKAGE
2554 INT
2555 WSAAPI
2556 WSALookupServiceBeginA(
2557 IN LPWSAQUERYSETA lpqsRestrictions,
2558 IN DWORD dwControlFlags,
2559 OUT LPHANDLE lphLookup);
2560
2561 WINSOCK_API_LINKAGE
2562 INT
2563 WSAAPI
2564 WSALookupServiceBeginW(
2565 IN LPWSAQUERYSETW lpqsRestrictions,
2566 IN DWORD dwControlFlags,
2567 OUT LPHANDLE lphLookup);
2568
2569 #ifdef UNICODE
2570 #define WSALookupServiceBegin WSALookupServiceBeginW
2571 #else
2572 #define WSALookupServiceBegin WSALookupServiceBeginA
2573 #endif
2574
2575 WINSOCK_API_LINKAGE
2576 INT
2577 WSAAPI
2578 WSALookupServiceNextA(
2579 IN HANDLE hLookup,
2580 IN DWORD dwControlFlags,
2581 IN OUT LPDWORD lpdwBufferLength,
2582 OUT LPWSAQUERYSETA lpqsResults);
2583
2584 WINSOCK_API_LINKAGE
2585 INT
2586 WSAAPI
2587 WSALookupServiceNextW(
2588 IN HANDLE hLookup,
2589 IN DWORD dwControlFlags,
2590 IN OUT LPDWORD lpdwBufferLength,
2591 OUT LPWSAQUERYSETW lpqsResults OPTIONAL);
2592
2593 #ifdef UNICODE
2594 #define WSALookupServiceNext WSALookupServiceNextW
2595 #else
2596 #define WSALookupServiceNext WSALookupServiceNextA
2597 #endif
2598
2599 WINSOCK_API_LINKAGE
2600 INT
2601 WSAAPI
2602 WSALookupServiceEnd(
2603 IN HANDLE hLookup);
2604
2605 WINSOCK_API_LINKAGE
2606 INT
2607 WSAAPI
2608 WSAInstallServiceClassA(
2609 IN LPWSASERVICECLASSINFOA lpServiceClassInfo);
2610
2611 WINSOCK_API_LINKAGE
2612 INT
2613 WSAAPI
2614 WSAInstallServiceClassW(
2615 IN LPWSASERVICECLASSINFOW lpServiceClassInfo);
2616
2617 #ifdef UNICODE
2618 #define WSAInstallServiceClass WSAInstallServiceClassW
2619 #else
2620 #define WSAInstallServiceClass WSAInstallServiceClassA
2621 #endif
2622
2623 WINSOCK_API_LINKAGE
2624 INT
2625 WSAAPI
2626 WSARemoveServiceClass(
2627 IN LPGUID lpServiceClassId);
2628
2629 WINSOCK_API_LINKAGE
2630 INT
2631 WSAAPI
2632 WSAGetServiceClassInfoA(
2633 IN LPGUID lpProviderId,
2634 IN LPGUID lpServiceClassId,
2635 IN OUT LPDWORD lpdwBufSize,
2636 OUT LPWSASERVICECLASSINFOA lpServiceClassInfo);
2637
2638 WINSOCK_API_LINKAGE
2639 INT
2640 WSAAPI
2641 WSAGetServiceClassInfoW(
2642 IN LPGUID lpProviderId,
2643 IN LPGUID lpServiceClassId,
2644 IN OUT LPDWORD lpdwBufSize,
2645 OUT LPWSASERVICECLASSINFOW lpServiceClassInfo);
2646
2647 #ifdef UNICODE
2648 #define WSAGetServiceClassInfo WSAGetServiceClassInfoW
2649 #else
2650 #define WSAGetServiceClassInfo WSAGetServiceClassInfoA
2651 #endif
2652
2653 WINSOCK_API_LINKAGE
2654 INT
2655 WSAAPI
2656 WSAEnumNameSpaceProvidersA(
2657 IN OUT LPDWORD lpdwBufferLength,
2658 OUT LPWSANAMESPACE_INFOA lpnspBuffer);
2659
2660 WINSOCK_API_LINKAGE
2661 INT
2662 WSAAPI
2663 WSAEnumNameSpaceProvidersW(
2664 IN OUT LPDWORD lpdwBufferLength,
2665 OUT LPWSANAMESPACE_INFOW lpnspBuffer);
2666
2667 #ifdef UNICODE
2668 #define WSAEnumNameSpaceProviders WSAEnumNameSpaceProvidersW
2669 #else
2670 #define WSAEnumNameSpaceProviders WSAEnumNameSpaceProvidersA
2671 #endif
2672
2673 WINSOCK_API_LINKAGE
2674 INT
2675 WSAAPI
2676 WSAGetServiceClassNameByClassIdA(
2677 IN LPGUID lpServiceClassId,
2678 OUT LPSTR lpszServiceClassName,
2679 IN OUT LPDWORD lpdwBufferLength);
2680
2681 WINSOCK_API_LINKAGE
2682 INT
2683 WSAAPI
2684 WSAGetServiceClassNameByClassIdW(
2685 IN LPGUID lpServiceClassId,
2686 OUT LPWSTR lpszServiceClassName,
2687 IN OUT LPDWORD lpdwBufferLength);
2688
2689 #ifdef UNICODE
2690 #define WSAGetServiceClassNameByClassId WSAGetServiceClassNameByClassIdW
2691 #else
2692 #define WSAGetServiceClassNameByClassId WSAGetServiceClassNameByClassIdA
2693 #endif
2694
2695 WINSOCK_API_LINKAGE
2696 INT
2697 WSAAPI
2698 WSASetServiceA(
2699 IN LPWSAQUERYSETA lpqsRegInfo,
2700 IN WSAESETSERVICEOP essoperation,
2701 IN DWORD dwControlFlags);
2702
2703 WINSOCK_API_LINKAGE
2704 INT
2705 WSAAPI
2706 WSASetServiceW(
2707 IN LPWSAQUERYSETW lpqsRegInfo,
2708 IN WSAESETSERVICEOP essoperation,
2709 IN DWORD dwControlFlags);
2710
2711 #ifdef UNICODE
2712 #define WSASetService WSASetServiceW
2713 #else
2714 #define WSASetService WSASetServiceA
2715 #endif
2716
2717 WINSOCK_API_LINKAGE
2718 INT
2719 WSAAPI
2720 WSAProviderConfigChange(
2721 IN OUT LPHANDLE lpNotificationHandle OPTIONAL,
2722 IN OUT LPWSAOVERLAPPED lpOverlapped OPTIONAL,
2723 IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL);
2724
2725 #if(_WIN32_WINNT >= 0x0501)
2726 WINSOCK_API_LINKAGE
2727 INT
2728 WSAAPI
2729 WSANSPIoctl(
2730 IN HANDLE hLookup,
2731 IN DWORD dwControlCode,
2732 IN LPVOID lpvInBuffer OPTIONAL,
2733 IN DWORD cbInBuffer,
2734 OUT LPVOID lpvOutBuffer OPTIONAL,
2735 IN DWORD cbOutBuffer,
2736 OUT LPDWORD lpcbBytesReturned,
2737 IN LPWSACOMPLETION lpCompletion OPTIONAL);
2738 #endif /* (_WIN32_WINNT >= 0x0501) */
2739
2740 #if(_WIN32_WINNT >= 0x0600)
2741
2742 WINSOCK_API_LINKAGE
2743 int
2744 WSAAPI
2745 WSASendMsg(
2746 IN SOCKET Handle,
2747 IN LPWSAMSG lpMsg,
2748 IN DWORD dwFlags,
2749 OUT LPDWORD lpNumberOfBytesSent OPTIONAL,
2750 IN OUT LPWSAOVERLAPPED lpOverlapped OPTIONAL,
2751 IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL);
2752
2753 WINSOCK_API_LINKAGE
2754 INT
2755 WSAAPI
2756 WSAEnumNameSpaceProvidersExA(
2757 IN OUT LPDWORD lpdwBufferLength,
2758 OUT LPWSANAMESPACE_INFOEXA lpnspBuffer);
2759
2760 WINSOCK_API_LINKAGE
2761 INT
2762 WSAAPI
2763 WSAEnumNameSpaceProvidersExW(
2764 IN OUT LPDWORD lpdwBufferLength,
2765 OUT LPWSANAMESPACE_INFOEXW lpnspBuffer);
2766
2767 #ifdef UNICODE
2768 #define WSAEnumNameSpaceProvidersEx WSAEnumNameSpaceProvidersExW
2769 #else
2770 #define WSAEnumNameSpaceProvidersEx WSAEnumNameSpaceProvidersExA
2771 #endif
2772
2773 WINSOCK_API_LINKAGE
2774 int
2775 WSAAPI
2776 WSAPoll(
2777 IN OUT LPWSAPOLLFD fdArray,
2778 IN ULONG fds,
2779 IN INT timeout);
2780
2781 #endif /* (_WIN32_WINNT >= 0x0600) */
2782
2783 #endif /* INCL_WINSOCK_API_PROTOTYPES */
2784
2785 typedef struct sockaddr_in FAR *LPSOCKADDR_IN;
2786 typedef struct linger LINGER;
2787 typedef struct linger *PLINGER;
2788 typedef struct linger FAR *LPLINGER;
2789 typedef struct fd_set FD_SET;
2790 typedef struct fd_set *PFD_SET;
2791 typedef struct fd_set FAR *LPFD_SET;
2792 typedef struct hostent HOSTENT;
2793 typedef struct hostent *PHOSTENT;
2794 typedef struct hostent FAR *LPHOSTENT;
2795 typedef struct servent SERVENT;
2796 typedef struct servent *PSERVENT;
2797 typedef struct servent FAR *LPSERVENT;
2798 typedef struct protoent PROTOENT;
2799 typedef struct protoent *PPROTOENT;
2800 typedef struct protoent FAR *LPPROTOENT;
2801 typedef struct timeval TIMEVAL;
2802 typedef struct timeval *PTIMEVAL;
2803 typedef struct timeval FAR *LPTIMEVAL;
2804
2805 #define WSAMAKEASYNCREPLY(buflen,error) MAKELONG(buflen,error)
2806 #define WSAMAKESELECTREPLY(event,error) MAKELONG(event,error)
2807 #define WSAGETASYNCBUFLEN(lParam) LOWORD(lParam)
2808 #define WSAGETASYNCERROR(lParam) HIWORD(lParam)
2809 #define WSAGETSELECTEVENT(lParam) LOWORD(lParam)
2810 #define WSAGETSELECTERROR(lParam) HIWORD(lParam)
2811
2812 #ifdef __cplusplus
2813 }
2814 #endif
2815
2816 #ifdef _NEED_POPPACK
2817 #include <poppack.h>
2818 #endif
2819
2820 /* FIXME :
2821 #if(_WIN32_WINNT >= 0x0501)
2822 #ifdef IPV6STRICT
2823 #include <wsipv6ok.h>
2824 #endif
2825 #endif */