Ignore the SVN perl module which is installed since 1fd8f97
[msysgit.git] / mingw / include / winsock2.h
blobd318eb638573036f882eec84779ca972e515a6be
1 /*
3 Definitions for winsock 2
5 Contributed by the WINE project.
7 Portions Copyright (c) 1980, 1983, 1988, 1993
8 The Regents of the University of California. All rights reserved.
10 Portions Copyright (c) 1993 by Digital Equipment Corporation.
13 #if !(defined _WINSOCK2_H || defined _WINSOCK_H)
14 #define _WINSOCK2_H
15 #define _WINSOCK_H /* to prevent later inclusion of winsock.h */
16 #if __GNUC__ >= 3
17 #pragma GCC system_header
18 #endif
20 #define _GNU_H_WINDOWS32_SOCKETS
22 #include <windows.h>
24 #ifndef WINSOCK_API_LINKAGE
25 #ifdef __W32API_USE_DLLIMPORT__
26 #define WINSOCK_API_LINKAGE DECLSPEC_IMPORT
27 #else
28 #define WINSOCK_API_LINKAGE
29 #endif
30 #endif
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 /* Names common to Winsock1.1 and Winsock2 */
36 #if !defined ( _BSDTYPES_DEFINED )
37 /* also defined in gmon.h and in cygwin's sys/types */
38 typedef unsigned char u_char;
39 typedef unsigned short u_short;
40 typedef unsigned int u_int;
41 typedef unsigned long u_long;
42 #define _BSDTYPES_DEFINED
43 #endif /* ! def _BSDTYPES_DEFINED */
44 typedef u_int SOCKET;
45 #ifndef FD_SETSIZE
46 #define FD_SETSIZE 64
47 #endif
49 /* shutdown() how types */
50 #define SD_RECEIVE 0x00
51 #define SD_SEND 0x01
52 #define SD_BOTH 0x02
54 #ifndef _SYS_TYPES_FD_SET
55 /* fd_set may be defined by the newlib <sys/types.h>
56 * if __USE_W32_SOCKETS not defined.
58 #ifdef fd_set
59 #undef fd_set
60 #endif
61 typedef struct fd_set {
62 u_int fd_count;
63 SOCKET fd_array[FD_SETSIZE];
64 } fd_set;
65 int PASCAL __WSAFDIsSet(SOCKET,fd_set*);
66 #ifndef FD_CLR
67 #define FD_CLR(fd,set) do { u_int __i;\
68 for (__i = 0; __i < ((fd_set *)(set))->fd_count ; __i++) {\
69 if (((fd_set *)(set))->fd_array[__i] == (fd)) {\
70 while (__i < ((fd_set *)(set))->fd_count-1) {\
71 ((fd_set*)(set))->fd_array[__i] = ((fd_set*)(set))->fd_array[__i+1];\
72 __i++;\
74 ((fd_set*)(set))->fd_count--;\
75 break;\
78 } while (0)
79 #endif
80 #ifndef FD_SET
81 /* this differs from the define in winsock.h and in cygwin sys/types.h */
82 #define FD_SET(fd, set) do { u_int __i;\
83 for (__i = 0; __i < ((fd_set *)(set))->fd_count ; __i++) {\
84 if (((fd_set *)(set))->fd_array[__i] == (fd)) {\
85 break;\
88 if (__i == ((fd_set *)(set))->fd_count) {\
89 if (((fd_set *)(set))->fd_count < FD_SETSIZE) {\
90 ((fd_set *)(set))->fd_array[__i] = (fd);\
91 ((fd_set *)(set))->fd_count++;\
94 } while(0)
95 #endif
96 #ifndef FD_ZERO
97 #define FD_ZERO(set) (((fd_set *)(set))->fd_count=0)
98 #endif
99 #ifndef FD_ISSET
100 #define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (fd_set *)(set))
101 #endif
102 #elif !defined (USE_SYS_TYPES_FD_SET)
103 #warning "fd_set and associated macros have been defined in sys/types. \
104 This may cause runtime problems with W32 sockets"
105 #endif /* ndef _SYS_TYPES_FD_SET */
106 #if !(defined (__INSIDE_CYGWIN__) || (__INSIDE_MSYS__))
107 #ifndef _TIMEVAL_DEFINED /* also in sys/time.h */
108 #define _TIMEVAL_DEFINED
109 struct timeval {
110 long tv_sec;
111 long tv_usec;
113 #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
114 #define timercmp(tvp, uvp, cmp) \
115 (((tvp)->tv_sec != (uvp)->tv_sec) ? \
116 ((tvp)->tv_sec cmp (uvp)->tv_sec) : \
117 ((tvp)->tv_usec cmp (uvp)->tv_usec))
118 #define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
119 #endif /* _TIMEVAL_DEFINED */
120 struct hostent {
121 char *h_name;
122 char **h_aliases;
123 short h_addrtype;
124 short h_length;
125 char **h_addr_list;
126 #define h_addr h_addr_list[0]
128 struct linger {
129 u_short l_onoff;
130 u_short l_linger;
132 #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
133 #define IOCPARM_MASK 0x7f
134 #define IOC_VOID 0x20000000
135 #define IOC_OUT 0x40000000
136 #define IOC_IN 0x80000000
137 #define IOC_INOUT (IOC_IN|IOC_OUT)
139 #if ! (defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
140 #define _IO(x,y) (IOC_VOID|((x)<<8)|(y))
141 #define _IOR(x,y,t) (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
142 #define _IOW(x,y,t) (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
143 #define FIONBIO _IOW('f', 126, u_long)
144 #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
146 #define FIONREAD _IOR('f', 127, u_long)
147 #define FIOASYNC _IOW('f', 125, u_long)
148 #define SIOCSHIWAT _IOW('s', 0, u_long)
149 #define SIOCGHIWAT _IOR('s', 1, u_long)
150 #define SIOCSLOWAT _IOW('s', 2, u_long)
151 #define SIOCGLOWAT _IOR('s', 3, u_long)
152 #define SIOCATMARK _IOR('s', 7, u_long)
154 #if ! (defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
155 struct netent {
156 char * n_name;
157 char **n_aliases;
158 short n_addrtype;
159 u_long n_net;
161 struct servent {
162 char *s_name;
163 char **s_aliases;
164 short s_port;
165 char *s_proto;
167 struct protoent {
168 char *p_name;
169 char **p_aliases;
170 short p_proto;
172 #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
174 #define IPPROTO_IP 0
175 #define IPPROTO_ICMP 1
176 #define IPPROTO_IGMP 2
177 #define IPPROTO_GGP 3
178 #define IPPROTO_TCP 6
179 #define IPPROTO_PUP 12
180 #define IPPROTO_UDP 17
181 #define IPPROTO_IDP 22
182 #define IPPROTO_ND 77
183 #define IPPROTO_RAW 255
184 #define IPPROTO_MAX 256
185 /* IPv6 options */
186 #define IPPROTO_HOPOPTS 0 /* IPv6 Hop-by-Hop options */
187 #define IPPROTO_IPV6 41 /* IPv6 header */
188 #define IPPROTO_ROUTING 43 /* IPv6 Routing header */
189 #define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */
190 #define IPPROTO_ESP 50 /* encapsulating security payload */
191 #define IPPROTO_AH 51 /* authentication header */
192 #define IPPROTO_ICMPV6 58 /* ICMPv6 */
193 #define IPPROTO_NONE 59 /* IPv6 no next header */
194 #define IPPROTO_DSTOPTS 60 /* IPv6 Destination options */
195 #define IPPORT_ECHO 7
196 #define IPPORT_DISCARD 9
197 #define IPPORT_SYSTAT 11
198 #define IPPORT_DAYTIME 13
199 #define IPPORT_NETSTAT 15
200 #define IPPORT_FTP 21
201 #define IPPORT_TELNET 23
202 #define IPPORT_SMTP 25
203 #define IPPORT_TIMESERVER 37
204 #define IPPORT_NAMESERVER 42
205 #define IPPORT_WHOIS 43
206 #define IPPORT_MTP 57
207 #define IPPORT_TFTP 69
208 #define IPPORT_RJE 77
209 #define IPPORT_FINGER 79
210 #define IPPORT_TTYLINK 87
211 #define IPPORT_SUPDUP 95
212 #define IPPORT_EXECSERVER 512
213 #define IPPORT_LOGINSERVER 513
214 #define IPPORT_CMDSERVER 514
215 #define IPPORT_EFSSERVER 520
216 #define IPPORT_BIFFUDP 512
217 #define IPPORT_WHOSERVER 513
218 #define IPPORT_ROUTESERVER 520
219 #define IPPORT_RESERVED 1024
220 #define IMPLINK_IP 155
221 #define IMPLINK_LOWEXPER 156
222 #define IMPLINK_HIGHEXPER 158
223 struct in_addr {
224 union {
225 struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
226 struct { u_short s_w1,s_w2; } S_un_w;
227 u_long S_addr;
228 } S_un;
229 #define s_addr S_un.S_addr
230 #define s_host S_un.S_un_b.s_b2
231 #define s_net S_un.S_un_b.s_b1
232 #define s_imp S_un.S_un_w.s_w2
233 #define s_impno S_un.S_un_b.s_b4
234 #define s_lh S_un.S_un_b.s_b3
236 #define IN_CLASSA(i) (((long)(i)&0x80000000) == 0)
237 #define IN_CLASSA_NET 0xff000000
238 #define IN_CLASSA_NSHIFT 24
239 #define IN_CLASSA_HOST 0x00ffffff
240 #define IN_CLASSA_MAX 128
241 #define IN_CLASSB(i) (((long)(i)&0xc0000000)==0x80000000)
242 #define IN_CLASSB_NET 0xffff0000
243 #define IN_CLASSB_NSHIFT 16
244 #define IN_CLASSB_HOST 0x0000ffff
245 #define IN_CLASSB_MAX 65536
246 #define IN_CLASSC(i) (((long)(i)&0xe0000000)==0xc0000000)
247 #define IN_CLASSC_NET 0xffffff00
248 #define IN_CLASSC_NSHIFT 8
249 #define IN_CLASSC_HOST 0xff
250 #define INADDR_ANY (u_long)0
251 #define INADDR_LOOPBACK 0x7f000001
252 #define INADDR_BROADCAST (u_long)0xffffffff
253 #define INADDR_NONE 0xffffffff
254 struct sockaddr_in {
255 short sin_family;
256 u_short sin_port;
257 struct in_addr sin_addr;
258 char sin_zero[8];
260 #define WSADESCRIPTION_LEN 256
261 #define WSASYS_STATUS_LEN 128
262 typedef struct WSAData {
263 WORD wVersion;
264 WORD wHighVersion;
265 char szDescription[WSADESCRIPTION_LEN+1];
266 char szSystemStatus[WSASYS_STATUS_LEN+1];
267 unsigned short iMaxSockets;
268 unsigned short iMaxUdpDg;
269 char * lpVendorInfo;
270 } WSADATA;
271 typedef WSADATA *LPWSADATA;
273 #if ! (defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
274 #define IP_OPTIONS 1
275 #define SO_DEBUG 1
276 #define SO_ACCEPTCONN 2
277 #define SO_REUSEADDR 4
278 #define SO_KEEPALIVE 8
279 #define SO_DONTROUTE 16
280 #define SO_BROADCAST 32
281 #define SO_USELOOPBACK 64
282 #define SO_LINGER 128
283 #define SO_OOBINLINE 256
284 #define SO_DONTLINGER (u_int)(~SO_LINGER)
285 #define SO_EXCLUSIVEADDRUSE ((u_int)(~SO_REUSEADDR))
286 #define SO_SNDBUF 0x1001
287 #define SO_RCVBUF 0x1002
288 #define SO_SNDLOWAT 0x1003
289 #define SO_RCVLOWAT 0x1004
290 #define SO_SNDTIMEO 0x1005
291 #define SO_RCVTIMEO 0x1006
292 #define SO_ERROR 0x1007
293 #define SO_TYPE 0x1008
294 #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
296 #define INVALID_SOCKET (SOCKET)(~0)
297 #define SOCKET_ERROR (-1)
298 #define SOCK_STREAM 1
299 #define SOCK_DGRAM 2
300 #define SOCK_RAW 3
301 #define SOCK_RDM 4
302 #define SOCK_SEQPACKET 5
303 #define TCP_NODELAY 0x0001
304 #define AF_UNSPEC 0
305 #define AF_UNIX 1
306 #define AF_INET 2
307 #define AF_IMPLINK 3
308 #define AF_PUP 4
309 #define AF_CHAOS 5
310 #define AF_IPX 6
311 #define AF_NS 6
312 #define AF_ISO 7
313 #define AF_OSI AF_ISO
314 #define AF_ECMA 8
315 #define AF_DATAKIT 9
316 #define AF_CCITT 10
317 #define AF_SNA 11
318 #define AF_DECnet 12
319 #define AF_DLI 13
320 #define AF_LAT 14
321 #define AF_HYLINK 15
322 #define AF_APPLETALK 16
323 #define AF_NETBIOS 17
324 #define AF_VOICEVIEW 18
325 #define AF_FIREFOX 19
326 #define AF_UNKNOWN1 20
327 #define AF_BAN 21
328 #define AF_ATM 22
329 #define AF_INET6 23
330 #define AF_CLUSTER 24
331 #define AF_12844 25
332 #define AF_IRDA 26
333 #define AF_NETDES 28
334 #if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
335 #define AF_MAX 29
336 struct sockaddr {
337 u_short sa_family;
338 char sa_data[14];
341 /* Portable IPv6/IPv4 version of sockaddr. Based on RFC 2553.
342 Pad to force 8 byte alignment and maximum size of 128 bytes. */
345 * Desired design of maximum size and alignment
347 #define _SS_MAXSIZE 128
348 #define _SS_ALIGNSIZE (sizeof (__int64))
350 * Definitions used for sockaddr_storage structure paddings design.
352 #define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof (short))
353 #define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (short) \
354 + _SS_PAD1SIZE \
355 + _SS_ALIGNSIZE))
356 struct sockaddr_storage {
357 short ss_family;
358 char __ss_pad1[_SS_PAD1SIZE]; /* pad to 8 */
359 __int64 __ss_align; /* force alignment */
360 char __ss_pad2[_SS_PAD2SIZE]; /* pad to 128 */
362 #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
364 struct sockproto {
365 u_short sp_family;
366 u_short sp_protocol;
368 #define PF_UNSPEC AF_UNSPEC
369 #define PF_UNIX AF_UNIX
370 #define PF_INET AF_INET
371 #define PF_IMPLINK AF_IMPLINK
372 #define PF_PUP AF_PUP
373 #define PF_CHAOS AF_CHAOS
374 #define PF_NS AF_NS
375 #define PF_IPX AF_IPX
376 #define PF_ISO AF_ISO
377 #define PF_OSI AF_OSI
378 #define PF_ECMA AF_ECMA
379 #define PF_DATAKIT AF_DATAKIT
380 #define PF_CCITT AF_CCITT
381 #define PF_SNA AF_SNA
382 #define PF_DECnet AF_DECnet
383 #define PF_DLI AF_DLI
384 #define PF_LAT AF_LAT
385 #define PF_HYLINK AF_HYLINK
386 #define PF_APPLETALK AF_APPLETALK
387 #define PF_VOICEVIEW AF_VOICEVIEW
388 #define PF_FIREFOX AF_FIREFOX
389 #define PF_UNKNOWN1 AF_UNKNOWN1
390 #define PF_BAN AF_BAN
391 #define PF_ATM AF_ATM
392 #define PF_INET6 AF_INET6
393 #define PF_MAX AF_MAX
394 #define SOL_SOCKET 0xffff
395 #if ! (defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
396 #define SOMAXCONN 0x7fffffff /* (5) in WinSock1.1 */
397 #define MSG_OOB 1
398 #define MSG_PEEK 2
399 #define MSG_DONTROUTE 4
400 #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
401 #define MSG_MAXIOVLEN 16
402 #define MSG_PARTIAL 0x8000
403 #define MAXGETHOSTSTRUCT 1024
405 #define FD_READ_BIT 0
406 #define FD_READ (1 << FD_READ_BIT)
407 #define FD_WRITE_BIT 1
408 #define FD_WRITE (1 << FD_WRITE_BIT)
409 #define FD_OOB_BIT 2
410 #define FD_OOB (1 << FD_OOB_BIT)
411 #define FD_ACCEPT_BIT 3
412 #define FD_ACCEPT (1 << FD_ACCEPT_BIT)
413 #define FD_CONNECT_BIT 4
414 #define FD_CONNECT (1 << FD_CONNECT_BIT)
415 #define FD_CLOSE_BIT 5
416 #define FD_CLOSE (1 << FD_CLOSE_BIT)
417 /* winsock1.1 defines stop at FD_CLOSE (32) */
418 #define FD_QOS_BIT 6
419 #define FD_QOS (1 << FD_QOS_BIT)
420 #define FD_GROUP_QOS_BIT 7
421 #define FD_GROUP_QOS (1 << FD_GROUP_QOS_BIT)
422 #define FD_ROUTING_INTERFACE_CHANGE_BIT 8
423 #define FD_ROUTING_INTERFACE_CHANGE (1 << FD_ROUTING_INTERFACE_CHANGE_BIT)
424 #define FD_ADDRESS_LIST_CHANGE_BIT 9
425 #define FD_ADDRESS_LIST_CHANGE (1 << FD_ADDRESS_LIST_CHANGE_BIT)
426 #define FD_MAX_EVENTS 10
427 #define FD_ALL_EVENTS ((1 << FD_MAX_EVENTS) - 1)
429 #ifndef WSABASEERR
430 #define WSABASEERR 10000
431 #define WSAEINTR (WSABASEERR+4)
432 #define WSAEBADF (WSABASEERR+9)
433 #define WSAEACCES (WSABASEERR+13)
434 #define WSAEFAULT (WSABASEERR+14)
435 #define WSAEINVAL (WSABASEERR+22)
436 #define WSAEMFILE (WSABASEERR+24)
437 #define WSAEWOULDBLOCK (WSABASEERR+35)
438 #define WSAEINPROGRESS (WSABASEERR+36) /* deprecated on WinSock2 */
439 #define WSAEALREADY (WSABASEERR+37)
440 #define WSAENOTSOCK (WSABASEERR+38)
441 #define WSAEDESTADDRREQ (WSABASEERR+39)
442 #define WSAEMSGSIZE (WSABASEERR+40)
443 #define WSAEPROTOTYPE (WSABASEERR+41)
444 #define WSAENOPROTOOPT (WSABASEERR+42)
445 #define WSAEPROTONOSUPPORT (WSABASEERR+43)
446 #define WSAESOCKTNOSUPPORT (WSABASEERR+44)
447 #define WSAEOPNOTSUPP (WSABASEERR+45)
448 #define WSAEPFNOSUPPORT (WSABASEERR+46)
449 #define WSAEAFNOSUPPORT (WSABASEERR+47)
450 #define WSAEADDRINUSE (WSABASEERR+48)
451 #define WSAEADDRNOTAVAIL (WSABASEERR+49)
452 #define WSAENETDOWN (WSABASEERR+50)
453 #define WSAENETUNREACH (WSABASEERR+51)
454 #define WSAENETRESET (WSABASEERR+52)
455 #define WSAECONNABORTED (WSABASEERR+53)
456 #define WSAECONNRESET (WSABASEERR+54)
457 #define WSAENOBUFS (WSABASEERR+55)
458 #define WSAEISCONN (WSABASEERR+56)
459 #define WSAENOTCONN (WSABASEERR+57)
460 #define WSAESHUTDOWN (WSABASEERR+58)
461 #define WSAETOOMANYREFS (WSABASEERR+59)
462 #define WSAETIMEDOUT (WSABASEERR+60)
463 #define WSAECONNREFUSED (WSABASEERR+61)
464 #define WSAELOOP (WSABASEERR+62)
465 #define WSAENAMETOOLONG (WSABASEERR+63)
466 #define WSAEHOSTDOWN (WSABASEERR+64)
467 #define WSAEHOSTUNREACH (WSABASEERR+65)
468 #define WSAENOTEMPTY (WSABASEERR+66)
469 #define WSAEPROCLIM (WSABASEERR+67)
470 #define WSAEUSERS (WSABASEERR+68)
471 #define WSAEDQUOT (WSABASEERR+69)
472 #define WSAESTALE (WSABASEERR+70)
473 #define WSAEREMOTE (WSABASEERR+71)
474 #define WSAEDISCON (WSABASEERR+101)
475 #define WSASYSNOTREADY (WSABASEERR+91)
476 #define WSAVERNOTSUPPORTED (WSABASEERR+92)
477 #define WSANOTINITIALISED (WSABASEERR+93)
478 #define WSAHOST_NOT_FOUND (WSABASEERR+1001)
479 #define WSATRY_AGAIN (WSABASEERR+1002)
480 #define WSANO_RECOVERY (WSABASEERR+1003)
481 #define WSANO_DATA (WSABASEERR+1004)
483 /* WinSock2 specific error codes */
484 #define WSAENOMORE (WSABASEERR+102)
485 #define WSAECANCELLED (WSABASEERR+103)
486 #define WSAEINVALIDPROCTABLE (WSABASEERR+104)
487 #define WSAEINVALIDPROVIDER (WSABASEERR+105)
488 #define WSAEPROVIDERFAILEDINIT (WSABASEERR+106)
489 #define WSASYSCALLFAILURE (WSABASEERR+107)
490 #define WSASERVICE_NOT_FOUND (WSABASEERR+108)
491 #define WSATYPE_NOT_FOUND (WSABASEERR+109)
492 #define WSA_E_NO_MORE (WSABASEERR+110)
493 #define WSA_E_CANCELLED (WSABASEERR+111)
494 #define WSAEREFUSED (WSABASEERR+112)
496 /* WS QualityofService errors */
497 #define WSA_QOS_RECEIVERS (WSABASEERR + 1005)
498 #define WSA_QOS_SENDERS (WSABASEERR + 1006)
499 #define WSA_QOS_NO_SENDERS (WSABASEERR + 1007)
500 #define WSA_QOS_NO_RECEIVERS (WSABASEERR + 1008)
501 #define WSA_QOS_REQUEST_CONFIRMED (WSABASEERR + 1009)
502 #define WSA_QOS_ADMISSION_FAILURE (WSABASEERR + 1010)
503 #define WSA_QOS_POLICY_FAILURE (WSABASEERR + 1011)
504 #define WSA_QOS_BAD_STYLE (WSABASEERR + 1012)
505 #define WSA_QOS_BAD_OBJECT (WSABASEERR + 1013)
506 #define WSA_QOS_TRAFFIC_CTRL_ERROR (WSABASEERR + 1014)
507 #define WSA_QOS_GENERIC_ERROR (WSABASEERR + 1015)
508 #define WSA_QOS_ESERVICETYPE (WSABASEERR + 1016)
509 #define WSA_QOS_EFLOWSPEC (WSABASEERR + 1017)
510 #define WSA_QOS_EPROVSPECBUF (WSABASEERR + 1018)
511 #define WSA_QOS_EFILTERSTYLE (WSABASEERR + 1019)
512 #define WSA_QOS_EFILTERTYPE (WSABASEERR + 1020)
513 #define WSA_QOS_EFILTERCOUNT (WSABASEERR + 1021)
514 #define WSA_QOS_EOBJLENGTH (WSABASEERR + 1022)
515 #define WSA_QOS_EFLOWCOUNT (WSABASEERR + 1023)
516 #define WSA_QOS_EUNKOWNPSOBJ (WSABASEERR + 1024)
517 #define WSA_QOS_EPOLICYOBJ (WSABASEERR + 1025)
518 #define WSA_QOS_EFLOWDESC (WSABASEERR + 1026)
519 #define WSA_QOS_EPSFLOWSPEC (WSABASEERR + 1027)
520 #define WSA_QOS_EPSFILTERSPEC (WSABASEERR + 1028)
521 #define WSA_QOS_ESDMODEOBJ (WSABASEERR + 1029)
522 #define WSA_QOS_ESHAPERATEOBJ (WSABASEERR + 1030)
523 #define WSA_QOS_RESERVED_PETYPE (WSABASEERR + 1031)
525 #endif /* !WSABASEERR */
527 #define WSANO_ADDRESS WSANO_DATA
528 #if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
529 #define h_errno WSAGetLastError()
530 #define HOST_NOT_FOUND WSAHOST_NOT_FOUND
531 #define TRY_AGAIN WSATRY_AGAIN
532 #define NO_RECOVERY WSANO_RECOVERY
533 #define NO_DATA WSANO_DATA
534 #define NO_ADDRESS WSANO_ADDRESS
535 #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
536 WINSOCK_API_LINKAGE SOCKET PASCAL accept(SOCKET,struct sockaddr*,int*);
537 WINSOCK_API_LINKAGE int PASCAL bind(SOCKET,const struct sockaddr*,int);
538 WINSOCK_API_LINKAGE int PASCAL closesocket(SOCKET);
539 WINSOCK_API_LINKAGE int PASCAL connect(SOCKET,const struct sockaddr*,int);
540 WINSOCK_API_LINKAGE int PASCAL ioctlsocket(SOCKET,long,u_long *);
541 WINSOCK_API_LINKAGE int PASCAL getpeername(SOCKET,struct sockaddr*,int*);
542 WINSOCK_API_LINKAGE int PASCAL getsockname(SOCKET,struct sockaddr*,int*);
543 WINSOCK_API_LINKAGE int PASCAL getsockopt(SOCKET,int,int,char*,int*);
544 WINSOCK_API_LINKAGE unsigned long PASCAL inet_addr(const char*);
545 WINSOCK_API_LINKAGE DECLARE_STDCALL_P(char *) inet_ntoa(struct in_addr);
546 WINSOCK_API_LINKAGE int PASCAL listen(SOCKET,int);
547 WINSOCK_API_LINKAGE int PASCAL recv(SOCKET,char*,int,int);
548 WINSOCK_API_LINKAGE int PASCAL recvfrom(SOCKET,char*,int,int,struct sockaddr*,int*);
549 WINSOCK_API_LINKAGE int PASCAL send(SOCKET,const char*,int,int);
550 WINSOCK_API_LINKAGE int PASCAL sendto(SOCKET,const char*,int,int,const struct sockaddr*,int);
551 WINSOCK_API_LINKAGE int PASCAL setsockopt(SOCKET,int,int,const char*,int);
552 WINSOCK_API_LINKAGE int PASCAL shutdown(SOCKET,int);
553 WINSOCK_API_LINKAGE SOCKET PASCAL socket(int,int,int);
554 WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct hostent *) gethostbyaddr(const char*,int,int);
555 WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct hostent *) gethostbyname(const char*);
556 WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct servent *) getservbyport(int,const char*);
557 WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct servent *) getservbyname(const char*,const char*);
558 WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct protoent *) getprotobynumber(int);
559 WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct protoent *) getprotobyname(const char*);
560 typedef SOCKET (PASCAL * LPFN_ACCEPT)(SOCKET, struct sockaddr*,int *);
561 typedef int (PASCAL * LPFN_BIND)(SOCKET, const struct sockaddr*,int);
562 typedef int (PASCAL * LPFN_CLOSESOCKET)(SOCKET);
563 typedef int (PASCAL * LPFN_CONNECT)(SOCKET, const struct sockaddr*,int);
564 typedef int (PASCAL * LPFN_IOCTLSOCKET)(SOCKET, long, u_long*);
565 typedef int (PASCAL * LPFN_GETPEERNAME)(SOCKET, struct sockaddr*, int*);
566 typedef int(PASCAL * LPFN_GETSOCKNAME)(SOCKET, struct sockaddr*, int*);
567 typedef int(PASCAL * LPFN_GETSOCKOPT)(SOCKET, int, int, char*, int*);
568 typedef u_long(PASCAL * LPFN_HTONL)(u_long);
569 typedef u_short(PASCAL * LPFN_HTONS)(u_short);
570 typedef unsigned long(PASCAL * LPFN_INET_ADDR)(const char*);
571 typedef char*(PASCAL * LPFN_INET_NTOA)(struct in_addr);
572 typedef int(PASCAL * LPFN_LISTEN)(SOCKET, int);
573 typedef u_long(PASCAL * LPFN_NTOHL)(u_long);
574 typedef u_short(PASCAL * LPFN_NTOHS)(u_short);
575 typedef int(PASCAL * LPFN_RECV)(SOCKET, char*, int, int);
576 typedef int(PASCAL * LPFN_RECVFROM)(SOCKET, char*, int, int, struct sockaddr*, int*);
577 typedef int(PASCAL * LPFN_SELECT)(int, fd_set*, fd_set*, fd_set*, const struct timeval*);
578 typedef int(PASCAL * LPFN_SEND)(SOCKET, const char*, int, int);
579 typedef int(PASCAL * LPFN_SENDTO)(SOCKET, const char*, int, int, const struct sockaddr*, int);
580 typedef int(PASCAL * LPFN_SETSOCKOPT)(SOCKET, int, int, const char*, int);
581 typedef int(PASCAL * LPFN_SHUTDOWN)(SOCKET, int);
582 typedef SOCKET(PASCAL * LPFN_SOCKET)(int, int, int);
583 typedef struct hostent*(PASCAL * LPFN_GETHOSTBYADDR)( const char*, int, int);
584 typedef struct hostent*(PASCAL * LPFN_GETHOSTBYNAME)( const char*);
585 typedef int(PASCAL * LPFN_GETHOSTNAME)(char*, int);
586 typedef struct servent*(PASCAL * LPFN_GETSERVBYPORT)(int, const char*);
587 typedef struct servent*(PASCAL * LPFN_GETSERVBYNAME)(const char*, const char*);
588 typedef struct protoent*(PASCAL * LPFN_GETPROTOBYNUMBER)(int);
589 typedef struct protoent*(PASCAL * LPFN_GETPROTOBYNAME)(const char*);
591 WINSOCK_API_LINKAGE int PASCAL WSAStartup(WORD,LPWSADATA);
592 WINSOCK_API_LINKAGE int PASCAL WSACleanup(void);
593 WINSOCK_API_LINKAGE void PASCAL WSASetLastError(int);
594 WINSOCK_API_LINKAGE int PASCAL WSAGetLastError(void);
595 WINSOCK_API_LINKAGE typedef int(PASCAL * LPFN_WSASTARTUP)(WORD, LPWSADATA);
596 typedef int(PASCAL * LPFN_WSACLEANUP)(void);
597 typedef void(PASCAL * LPFN_WSASETLASTERROR)(int);
598 typedef int(PASCAL * LPFN_WSAGETLASTERROR)(void);
600 * Pseudo-blocking functions are deprecated in WinSock2
601 * spec. Use threads instead.
603 WINSOCK_API_LINKAGE BOOL PASCAL WSAIsBlocking(void);
604 WINSOCK_API_LINKAGE int PASCAL WSAUnhookBlockingHook(void);
605 WINSOCK_API_LINKAGE FARPROC PASCAL WSASetBlockingHook(FARPROC);
606 WINSOCK_API_LINKAGE int PASCAL WSACancelBlockingCall(void);
607 typedef BOOL(PASCAL * LPFN_WSAISBLOCKING)(void);
608 typedef int(PASCAL * LPFN_WSAUNHOOKBLOCKINGHOOK)(void);
609 typedef FARPROC (PASCAL * LPFN_WSASETBLOCKINGHOOK)(FARPROC);
610 typedef int(PASCAL * LPFN_WSACANCELBLOCKINGCALL)(void);
612 WINSOCK_API_LINKAGE HANDLE PASCAL WSAAsyncGetServByName(HWND,u_int,const char*,const char*,char*,int);
613 WINSOCK_API_LINKAGE HANDLE PASCAL WSAAsyncGetServByPort(HWND,u_int,int,const char*,char*,int);
614 WINSOCK_API_LINKAGE HANDLE PASCAL WSAAsyncGetProtoByName(HWND,u_int,const char*,char*,int);
615 WINSOCK_API_LINKAGE HANDLE PASCAL WSAAsyncGetProtoByNumber(HWND,u_int,int,char*,int);
616 WINSOCK_API_LINKAGE HANDLE PASCAL WSAAsyncGetHostByName(HWND,u_int,const char*,char*,int);
617 WINSOCK_API_LINKAGE HANDLE PASCAL WSAAsyncGetHostByAddr(HWND,u_int,const char*,int,int,char*,int);
618 WINSOCK_API_LINKAGE int PASCAL WSACancelAsyncRequest(HANDLE);
619 WINSOCK_API_LINKAGE int PASCAL WSAAsyncSelect(SOCKET,HWND,u_int,long);
620 typedef HANDLE(PASCAL * LPFN_WSAASYNCGETSERVBYNAME)(HWND, u_int, const char *, const char *, char *, int);
621 typedef HANDLE(PASCAL * LPFN_WSAASYNCGETSERVBYPORT)(HWND, u_int, int, const char *, char *, int);
622 typedef HANDLE(PASCAL * LPFN_WSAASYNCGETPROTOBYNAME)(HWND, u_int, const char*, char*, int);
623 typedef HANDLE(PASCAL * LPFN_WSAASYNCGETPROTOBYNUMBER)(HWND, u_int, int, char*, int);
624 typedef HANDLE(PASCAL * LPFN_WSAASYNCGETHOSTBYADDR)(HWND, u_int, const char*, int, int, char*, int);
625 typedef int(PASCAL * LPFN_WSACANCELASYNCREQUEST)(HANDLE);
626 typedef int(PASCAL * LPFN_WSAASYNCSELECT)(SOCKET, HWND, u_int, long);
627 #if ! (defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
628 WINSOCK_API_LINKAGE u_long PASCAL htonl(u_long);
629 WINSOCK_API_LINKAGE u_long PASCAL ntohl(u_long);
630 WINSOCK_API_LINKAGE u_short PASCAL htons(u_short);
631 WINSOCK_API_LINKAGE u_short PASCAL ntohs(u_short);
632 WINSOCK_API_LINKAGE int PASCAL select(int nfds,fd_set*,fd_set*,fd_set*,const struct timeval*);
633 #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
635 int PASCAL gethostname(char*,int);
637 #define WSAMAKEASYNCREPLY(b,e) MAKELONG(b,e)
638 #define WSAMAKESELECTREPLY(e,error) MAKELONG(e,error)
639 #define WSAGETASYNCBUFLEN(l) LOWORD(l)
640 #define WSAGETASYNCERROR(l) HIWORD(l)
641 #define WSAGETSELECTEVENT(l) LOWORD(l)
642 #define WSAGETSELECTERROR(l) HIWORD(l)
644 typedef struct sockaddr SOCKADDR;
645 typedef struct sockaddr *PSOCKADDR;
646 typedef struct sockaddr *LPSOCKADDR;
647 typedef struct sockaddr_storage SOCKADDR_STORAGE, *PSOCKADDR_STORAGE;
648 typedef struct sockaddr_in SOCKADDR_IN;
649 typedef struct sockaddr_in *PSOCKADDR_IN;
650 typedef struct sockaddr_in *LPSOCKADDR_IN;
651 typedef struct linger LINGER;
652 typedef struct linger *PLINGER;
653 typedef struct linger *LPLINGER;
654 typedef struct in_addr IN_ADDR;
655 typedef struct in_addr *PIN_ADDR;
656 typedef struct in_addr *LPIN_ADDR;
657 typedef struct fd_set FD_SET;
658 typedef struct fd_set *PFD_SET;
659 typedef struct fd_set *LPFD_SET;
660 typedef struct hostent HOSTENT;
661 typedef struct hostent *PHOSTENT;
662 typedef struct hostent *LPHOSTENT;
663 typedef struct servent SERVENT;
664 typedef struct servent *PSERVENT;
665 typedef struct servent *LPSERVENT;
666 typedef struct protoent PROTOENT;
667 typedef struct protoent *PPROTOENT;
668 typedef struct protoent *LPPROTOENT;
669 typedef struct timeval TIMEVAL;
670 typedef struct timeval *PTIMEVAL;
671 typedef struct timeval *LPTIMEVAL;
673 /* winsock2 additions */
674 #define ADDR_ANY INADDR_ANY
676 #define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000)
677 #define IN_CLASSD_NET 0xf0000000
678 #define IN_CLASSD_NSHIFT 28
679 #define IN_CLASSD_HOST 0x0fffffff
680 #define IN_MULTICAST(i) IN_CLASSD(i)
682 #define FROM_PROTOCOL_INFO (-1)
684 #define SO_DONTLINGER (u_int)(~SO_LINGER)
685 #define SO_GROUP_ID 0x2001
686 #define SO_GROUP_PRIORITY 0x2002
687 #define SO_MAX_MSG_SIZE 0x2003
688 #define SO_PROTOCOL_INFOA 0x2004
689 #define SO_PROTOCOL_INFOW 0x2005
690 #ifdef UNICODE
691 #define SO_PROTOCOL_INFO SO_PROTOCOL_INFOW
692 #else
693 #define SO_PROTOCOL_INFO SO_PROTOCOL_INFOA
694 #endif
695 #define PVD_CONFIG 0x3001
697 #define MSG_INTERRUPT 0x10
698 #define MSG_MAXIOVLEN 16
700 #define WSAAPI WINAPI
701 #define WSAEVENT HANDLE
702 #define LPWSAEVENT LPHANDLE
703 #define WSAOVERLAPPED OVERLAPPED
704 typedef struct _OVERLAPPED *LPWSAOVERLAPPED;
706 #define WSA_IO_PENDING (ERROR_IO_PENDING)
707 #define WSA_IO_INCOMPLETE (ERROR_IO_INCOMPLETE)
708 #define WSA_INVALID_HANDLE (ERROR_INVALID_HANDLE)
709 #define WSA_INVALID_PARAMETER (ERROR_INVALID_PARAMETER)
710 #define WSA_NOT_ENOUGH_MEMORY (ERROR_NOT_ENOUGH_MEMORY)
711 #define WSA_OPERATION_ABORTED (ERROR_OPERATION_ABORTED)
713 #define WSA_INVALID_EVENT ((WSAEVENT)NULL)
714 #define WSA_MAXIMUM_WAIT_EVENTS (MAXIMUM_WAIT_OBJECTS)
715 #define WSA_WAIT_FAILED ((DWORD)-1L)
716 #define WSA_WAIT_EVENT_0 (WAIT_OBJECT_0)
717 #define WSA_WAIT_IO_COMPLETION (WAIT_IO_COMPLETION)
718 #define WSA_WAIT_TIMEOUT (WAIT_TIMEOUT)
719 #define WSA_INFINITE (INFINITE)
721 typedef struct _WSABUF {
722 unsigned long len;
723 char *buf;
724 } WSABUF, *LPWSABUF;
726 typedef enum
728 BestEffortService,
729 ControlledLoadService,
730 PredictiveService,
731 GuaranteedDelayService,
732 GuaranteedService
733 } GUARANTEE;
735 /* TODO: FLOWSPEC and related definitions belong in qos.h */
738 Windows Sockets 2 Application Programming Interface,
739 revision 2.2.2 (1997) uses the type uint32 for SERVICETYPE
740 and the elements of _flowspec, but the type uint32 is not defined
741 or used anywhere else in the w32api. For now, just use
742 unsigned int, which is 32 bits on _WIN32 and _WIN64.
745 typedef unsigned int SERVICETYPE;
746 typedef struct _flowspec
748 unsigned int TokenRate;
749 unsigned int TokenBucketSize;
750 unsigned int PeakBandwidth;
751 unsigned int Latency;
752 unsigned int DelayVariation;
753 SERVICETYPE ServiceType;
754 unsigned int MaxSduSize;
755 unsigned int MinimumPolicedSize;
756 } FLOWSPEC, *PFLOWSPEC, *LPFLOWSPEC;
758 typedef struct _QualityOfService
760 FLOWSPEC SendingFlowspec;
761 FLOWSPEC ReceivingFlowspec;
762 WSABUF ProviderSpecific;
763 } QOS, *LPQOS;
765 #define CF_ACCEPT 0x0000
766 #define CF_REJECT 0x0001
767 #define CF_DEFER 0x0002
768 #define SD_RECEIVE 0x00
769 #define SD_SEND 0x01
770 #define SD_BOTH 0x02
771 typedef unsigned int GROUP;
773 #define SG_UNCONSTRAINED_GROUP 0x01
774 #define SG_CONSTRAINED_GROUP 0x02
775 typedef struct _WSANETWORKEVENTS {
776 long lNetworkEvents;
777 int iErrorCode[FD_MAX_EVENTS];
778 } WSANETWORKEVENTS, *LPWSANETWORKEVENTS;
780 #define MAX_PROTOCOL_CHAIN 7
782 #define BASE_PROTOCOL 1
783 #define LAYERED_PROTOCOL 0
785 typedef enum _WSAESETSERVICEOP
787 RNRSERVICE_REGISTER=0,
788 RNRSERVICE_DEREGISTER,
789 RNRSERVICE_DELETE
790 } WSAESETSERVICEOP, *PWSAESETSERVICEOP, *LPWSAESETSERVICEOP;
792 typedef struct _AFPROTOCOLS {
793 INT iAddressFamily;
794 INT iProtocol;
795 } AFPROTOCOLS, *PAFPROTOCOLS, *LPAFPROTOCOLS;
797 typedef enum _WSAEcomparator
799 COMP_EQUAL = 0,
800 COMP_NOTLESS
801 } WSAECOMPARATOR, *PWSAECOMPARATOR, *LPWSAECOMPARATOR;
803 typedef struct _WSAVersion
805 DWORD dwVersion;
806 WSAECOMPARATOR ecHow;
807 } WSAVERSION, *PWSAVERSION, *LPWSAVERSION;
809 #ifndef __CSADDR_T_DEFINED /* also in nspapi.h */
810 #define __CSADDR_T_DEFINED
811 typedef struct _SOCKET_ADDRESS {
812 LPSOCKADDR lpSockaddr;
813 INT iSockaddrLength;
814 } SOCKET_ADDRESS,*PSOCKET_ADDRESS,*LPSOCKET_ADDRESS;
815 typedef struct _CSADDR_INFO {
816 SOCKET_ADDRESS LocalAddr;
817 SOCKET_ADDRESS RemoteAddr;
818 INT iSocketType;
819 INT iProtocol;
820 } CSADDR_INFO,*PCSADDR_INFO,*LPCSADDR_INFO;
821 #endif
823 typedef struct _SOCKET_ADDRESS_LIST {
824 INT iAddressCount;
825 SOCKET_ADDRESS Address[1];
826 } SOCKET_ADDRESS_LIST, * LPSOCKET_ADDRESS_LIST;
828 #ifndef __BLOB_T_DEFINED /* also in wtypes.h and nspapi.h */
829 #define __BLOB_T_DEFINED
830 typedef struct _BLOB {
831 ULONG cbSize;
832 BYTE *pBlobData;
833 } BLOB,*PBLOB,*LPBLOB;
834 #endif
836 typedef struct _WSAQuerySetA
838 DWORD dwSize;
839 LPSTR lpszServiceInstanceName;
840 LPGUID lpServiceClassId;
841 LPWSAVERSION lpVersion;
842 LPSTR lpszComment;
843 DWORD dwNameSpace;
844 LPGUID lpNSProviderId;
845 LPSTR lpszContext;
846 DWORD dwNumberOfProtocols;
847 LPAFPROTOCOLS lpafpProtocols;
848 LPSTR lpszQueryString;
849 DWORD dwNumberOfCsAddrs;
850 LPCSADDR_INFO lpcsaBuffer;
851 DWORD dwOutputFlags;
852 LPBLOB lpBlob;
853 } WSAQUERYSETA, *PWSAQUERYSETA, *LPWSAQUERYSETA;
855 typedef struct _WSAQuerySetW
857 DWORD dwSize;
858 LPWSTR lpszServiceInstanceName;
859 LPGUID lpServiceClassId;
860 LPWSAVERSION lpVersion;
861 LPWSTR lpszComment;
862 DWORD dwNameSpace;
863 LPGUID lpNSProviderId;
864 LPWSTR lpszContext;
865 DWORD dwNumberOfProtocols;
866 LPAFPROTOCOLS lpafpProtocols;
867 LPWSTR lpszQueryString;
868 DWORD dwNumberOfCsAddrs;
869 LPCSADDR_INFO lpcsaBuffer;
870 DWORD dwOutputFlags;
871 LPBLOB lpBlob;
872 } WSAQUERYSETW, *PWSAQUERYSETW, *LPWSAQUERYSETW;
874 #ifdef UNICODE
875 typedef WSAQUERYSETW WSAQUERYSET;
876 typedef PWSAQUERYSETW PWSAQUERYSET;
877 typedef LPWSAQUERYSETW LPWSAQUERYSET;
878 #else
879 typedef WSAQUERYSETA WSAQUERYSET;
880 typedef PWSAQUERYSETA PWSAQUERYSET;
881 typedef LPWSAQUERYSETA LPWSAQUERYSET;
882 #endif
884 #define LUP_DEEP 0x0001
885 #define LUP_CONTAINERS 0x0002
886 #define LUP_NOCONTAINERS 0x0004
887 #define LUP_NEAREST 0x0008
888 #define LUP_RETURN_NAME 0x0010
889 #define LUP_RETURN_TYPE 0x0020
890 #define LUP_RETURN_VERSION 0x0040
891 #define LUP_RETURN_COMMENT 0x0080
892 #define LUP_RETURN_ADDR 0x0100
893 #define LUP_RETURN_BLOB 0x0200
894 #define LUP_RETURN_ALIASES 0x0400
895 #define LUP_RETURN_QUERY_STRING 0x0800
896 #define LUP_RETURN_ALL 0x0FF0
897 #define LUP_RES_SERVICE 0x8000
898 #define LUP_FLUSHCACHE 0x1000
899 #define LUP_FLUSHPREVIOUS 0x2000
901 typedef struct _WSANSClassInfoA
903 LPSTR lpszName;
904 DWORD dwNameSpace;
905 DWORD dwValueType;
906 DWORD dwValueSize;
907 LPVOID lpValue;
908 } WSANSCLASSINFOA, *PWSANSCLASSINFOA, *LPWSANSCLASSINFOA;
910 typedef struct _WSANSClassInfoW
912 LPWSTR lpszName;
913 DWORD dwNameSpace;
914 DWORD dwValueType;
915 DWORD dwValueSize;
916 LPVOID lpValue;
917 } WSANSCLASSINFOW, *PWSANSCLASSINFOW, *LPWSANSCLASSINFOW;
919 #ifdef UNICODE
920 typedef WSANSCLASSINFOW WSANSCLASSINFO;
921 typedef PWSANSCLASSINFOW PWSANSCLASSINFO;
922 typedef LPWSANSCLASSINFOW LPWSANSCLASSINFO;
923 #else
924 typedef WSANSCLASSINFOA WSANSCLASSINFO;
925 typedef PWSANSCLASSINFOA PWSANSCLASSINFO;
926 typedef LPWSANSCLASSINFOA LPWSANSCLASSINFO;
927 #endif
929 typedef struct _WSAServiceClassInfoA
931 LPGUID lpServiceClassId;
932 LPSTR lpszServiceClassName;
933 DWORD dwCount;
934 LPWSANSCLASSINFOA lpClassInfos;
935 } WSASERVICECLASSINFOA, *PWSASERVICECLASSINFOA, *LPWSASERVICECLASSINFOA;
937 typedef struct _WSAServiceClassInfoW
939 LPGUID lpServiceClassId;
940 LPWSTR lpszServiceClassName;
941 DWORD dwCount;
942 LPWSANSCLASSINFOW lpClassInfos;
943 } WSASERVICECLASSINFOW, *PWSASERVICECLASSINFOW, *LPWSASERVICECLASSINFOW;
945 #ifdef UNICODE
946 typedef WSASERVICECLASSINFOW WSASERVICECLASSINFO;
947 typedef PWSASERVICECLASSINFOW PWSASERVICECLASSINFO;
948 typedef LPWSASERVICECLASSINFOW LPWSASERVICECLASSINFO;
949 #else
950 typedef WSASERVICECLASSINFOA WSASERVICECLASSINFO;
951 typedef PWSASERVICECLASSINFOA PWSASERVICECLASSINFO;
952 typedef LPWSASERVICECLASSINFOA LPWSASERVICECLASSINFO;
953 #endif
955 typedef struct _WSANAMESPACE_INFOA {
956 GUID NSProviderId;
957 DWORD dwNameSpace;
958 BOOL fActive;
959 DWORD dwVersion;
960 LPSTR lpszIdentifier;
961 } WSANAMESPACE_INFOA, *PWSANAMESPACE_INFOA, *LPWSANAMESPACE_INFOA;
963 typedef struct _WSANAMESPACE_INFOW {
964 GUID NSProviderId;
965 DWORD dwNameSpace;
966 BOOL fActive;
967 DWORD dwVersion;
968 LPWSTR lpszIdentifier;
969 } WSANAMESPACE_INFOW, *PWSANAMESPACE_INFOW, *LPWSANAMESPACE_INFOW;
971 #ifdef UNICODE
972 typedef WSANAMESPACE_INFOW WSANAMESPACE_INFO;
973 typedef PWSANAMESPACE_INFOW PWSANAMESPACE_INFO;
974 typedef LPWSANAMESPACE_INFOW LPWSANAMESPACE_INFO;
975 #else
976 typedef WSANAMESPACE_INFOA WSANAMESPACE_INFO;
977 typedef PWSANAMESPACE_INFOA PWSANAMESPACE_INFO;
978 typedef LPWSANAMESPACE_INFOA LPWSANAMESPACE_INFO;
979 #endif
981 typedef struct _WSAPROTOCOLCHAIN {
982 int ChainLen;
983 DWORD ChainEntries[MAX_PROTOCOL_CHAIN];
984 } WSAPROTOCOLCHAIN, *LPWSAPROTOCOLCHAIN;
986 #define WSAPROTOCOL_LEN 255
988 typedef struct _WSAPROTOCOL_INFOA {
989 DWORD dwServiceFlags1;
990 DWORD dwServiceFlags2;
991 DWORD dwServiceFlags3;
992 DWORD dwServiceFlags4;
993 DWORD dwProviderFlags;
994 GUID ProviderId;
995 DWORD dwCatalogEntryId;
996 WSAPROTOCOLCHAIN ProtocolChain;
997 int iVersion;
998 int iAddressFamily;
999 int iMaxSockAddr;
1000 int iMinSockAddr;
1001 int iSocketType;
1002 int iProtocol;
1003 int iProtocolMaxOffset;
1004 int iNetworkByteOrder;
1005 int iSecurityScheme;
1006 DWORD dwMessageSize;
1007 DWORD dwProviderReserved;
1008 CHAR szProtocol[WSAPROTOCOL_LEN+1];
1009 } WSAPROTOCOL_INFOA, *LPWSAPROTOCOL_INFOA;
1011 typedef struct _WSAPROTOCOL_INFOW {
1012 DWORD dwServiceFlags1;
1013 DWORD dwServiceFlags2;
1014 DWORD dwServiceFlags3;
1015 DWORD dwServiceFlags4;
1016 DWORD dwProviderFlags;
1017 GUID ProviderId;
1018 DWORD dwCatalogEntryId;
1019 WSAPROTOCOLCHAIN ProtocolChain;
1020 int iVersion;
1021 int iAddressFamily;
1022 int iMaxSockAddr;
1023 int iMinSockAddr;
1024 int iSocketType;
1025 int iProtocol;
1026 int iProtocolMaxOffset;
1027 int iNetworkByteOrder;
1028 int iSecurityScheme;
1029 DWORD dwMessageSize;
1030 DWORD dwProviderReserved;
1031 WCHAR szProtocol[WSAPROTOCOL_LEN+1];
1032 } WSAPROTOCOL_INFOW, * LPWSAPROTOCOL_INFOW;
1034 typedef int (CALLBACK *LPCONDITIONPROC)(LPWSABUF, LPWSABUF, LPQOS, LPQOS, LPWSABUF, LPWSABUF, GROUP *, DWORD);
1035 typedef void (WINAPI *LPWSAOVERLAPPED_COMPLETION_ROUTINE)(DWORD, DWORD, LPWSAOVERLAPPED, DWORD);
1038 #ifdef UNICODE
1039 typedef WSAPROTOCOL_INFOW WSAPROTOCOL_INFO;
1040 typedef LPWSAPROTOCOL_INFOW LPWSAPROTOCOL_INFO;
1041 #else
1042 typedef WSAPROTOCOL_INFOA WSAPROTOCOL_INFO;
1043 typedef LPWSAPROTOCOL_INFOA LPWSAPROTOCOL_INFO;
1044 #endif
1046 /* Needed for XP & .NET Server function WSANSPIoctl. */
1047 typedef enum _WSACOMPLETIONTYPE {
1048 NSP_NOTIFY_IMMEDIATELY = 0,
1049 NSP_NOTIFY_HWND,
1050 NSP_NOTIFY_EVENT,
1051 NSP_NOTIFY_PORT,
1052 NSP_NOTIFY_APC
1053 } WSACOMPLETIONTYPE, * PWSACOMPLETIONTYPE, * LPWSACOMPLETIONTYPE;
1054 typedef struct _WSACOMPLETION {
1055 WSACOMPLETIONTYPE Type;
1056 union {
1057 struct {
1058 HWND hWnd;
1059 UINT uMsg;
1060 WPARAM context;
1061 } WindowMessage;
1062 struct {
1063 LPWSAOVERLAPPED lpOverlapped;
1064 } Event;
1065 struct {
1066 LPWSAOVERLAPPED lpOverlapped;
1067 LPWSAOVERLAPPED_COMPLETION_ROUTINE lpfnCompletionProc;
1068 } Apc;
1069 struct {
1070 LPWSAOVERLAPPED lpOverlapped;
1071 HANDLE hPort;
1072 ULONG_PTR Key;
1073 } Port;
1074 } Parameters;
1075 } WSACOMPLETION, *PWSACOMPLETION, *LPWSACOMPLETION;
1077 #define PFL_MULTIPLE_PROTO_ENTRIES 0x00000001
1078 #define PFL_RECOMMENDED_PROTO_ENTRY 0x00000002
1079 #define PFL_HIDDEN 0x00000004
1080 #define PFL_MATCHES_PROTOCOL_ZERO 0x00000008
1081 #define XP1_CONNECTIONLESS 0x00000001
1082 #define XP1_GUARANTEED_DELIVERY 0x00000002
1083 #define XP1_GUARANTEED_ORDER 0x00000004
1084 #define XP1_MESSAGE_ORIENTED 0x00000008
1085 #define XP1_PSEUDO_STREAM 0x00000010
1086 #define XP1_GRACEFUL_CLOSE 0x00000020
1087 #define XP1_EXPEDITED_DATA 0x00000040
1088 #define XP1_CONNECT_DATA 0x00000080
1089 #define XP1_DISCONNECT_DATA 0x00000100
1090 #define XP1_SUPPORT_BROADCAST 0x00000200
1091 #define XP1_SUPPORT_MULTIPOINT 0x00000400
1092 #define XP1_MULTIPOINT_CONTROL_PLANE 0x00000800
1093 #define XP1_MULTIPOINT_DATA_PLANE 0x00001000
1094 #define XP1_QOS_SUPPORTED 0x00002000
1095 #define XP1_INTERRUPT 0x00004000
1096 #define XP1_UNI_SEND 0x00008000
1097 #define XP1_UNI_RECV 0x00010000
1098 #define XP1_IFS_HANDLES 0x00020000
1099 #define XP1_PARTIAL_MESSAGE 0x00040000
1101 #define BIGENDIAN 0x0000
1102 #define LITTLEENDIAN 0x0001
1104 #define SECURITY_PROTOCOL_NONE 0x0000
1105 #define JL_SENDER_ONLY 0x01
1106 #define JL_RECEIVER_ONLY 0x02
1107 #define JL_BOTH 0x04
1108 #define WSA_FLAG_OVERLAPPED 0x01
1109 #define WSA_FLAG_MULTIPOINT_C_ROOT 0x02
1110 #define WSA_FLAG_MULTIPOINT_C_LEAF 0x04
1111 #define WSA_FLAG_MULTIPOINT_D_ROOT 0x08
1112 #define WSA_FLAG_MULTIPOINT_D_LEAF 0x10
1113 #define IOC_UNIX 0x00000000
1114 #define IOC_WS2 0x08000000
1115 #define IOC_PROTOCOL 0x10000000
1116 #define IOC_VENDOR 0x18000000
1118 #define _WSAIO(x,y) (IOC_VOID|(x)|(y))
1119 #define _WSAIOR(x,y) (IOC_OUT|(x)|(y))
1120 #define _WSAIOW(x,y) (IOC_IN|(x)|(y))
1121 #define _WSAIORW(x,y) (IOC_INOUT|(x)|(y))
1123 #define SIO_ASSOCIATE_HANDLE _WSAIOW(IOC_WS2,1)
1124 #define SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(IOC_WS2,2)
1125 #define SIO_FIND_ROUTE _WSAIOR(IOC_WS2,3)
1126 #define SIO_FLUSH _WSAIO(IOC_WS2,4)
1127 #define SIO_GET_BROADCAST_ADDRESS _WSAIOR(IOC_WS2,5)
1128 #define SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(IOC_WS2,6)
1129 #define SIO_GET_QOS _WSAIORW(IOC_WS2,7)
1130 #define SIO_GET_GROUP_QOS _WSAIORW(IOC_WS2,8)
1131 #define SIO_MULTIPOINT_LOOPBACK _WSAIOW(IOC_WS2,9)
1132 #define SIO_MULTICAST_SCOPE _WSAIOW(IOC_WS2,10)
1133 #define SIO_SET_QOS _WSAIOW(IOC_WS2,11)
1134 #define SIO_SET_GROUP_QOS _WSAIOW(IOC_WS2,12)
1135 #define SIO_TRANSLATE_HANDLE _WSAIORW(IOC_WS2,13)
1136 #define SIO_ROUTING_INTERFACE_QUERY _WSAIORW(IOC_WS2,20)
1137 #define SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(IOC_WS2,21)
1138 #define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22)
1139 #define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23)
1140 #define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_WS2,24)
1141 #define SIO_NSP_NOTIFY_CHANGE _WSAIOW(IOC_WS2,25)
1143 #define TH_NETDEV 0x00000001
1144 #define TH_TAPI 0x00000002
1146 WINSOCK_API_LINKAGE SOCKET WINAPI WSAAccept(SOCKET, struct sockaddr *, LPINT, LPCONDITIONPROC, DWORD);
1147 WINSOCK_API_LINKAGE INT WINAPI WSAAddressToStringA(LPSOCKADDR, DWORD, LPWSAPROTOCOL_INFOA, LPSTR, LPDWORD);
1148 WINSOCK_API_LINKAGE INT WINAPI WSAAddressToStringW(LPSOCKADDR, DWORD, LPWSAPROTOCOL_INFOW, LPWSTR, LPDWORD);
1149 WINSOCK_API_LINKAGE BOOL WINAPI WSACloseEvent(WSAEVENT);
1150 WINSOCK_API_LINKAGE int WINAPI WSAConnect(SOCKET, const struct sockaddr *, int, LPWSABUF, LPWSABUF, LPQOS, LPQOS);
1151 WINSOCK_API_LINKAGE WSAEVENT WINAPI WSACreateEvent(void);
1152 WINSOCK_API_LINKAGE int WINAPI WSADuplicateSocketA(SOCKET, DWORD, LPWSAPROTOCOL_INFOA);
1153 WINSOCK_API_LINKAGE int WINAPI WSADuplicateSocketW(SOCKET, DWORD, LPWSAPROTOCOL_INFOW);
1154 WINSOCK_API_LINKAGE INT WINAPI WSAEnumNameSpaceProvidersA(LPDWORD, LPWSANAMESPACE_INFOA);
1155 WINSOCK_API_LINKAGE INT WINAPI WSAEnumNameSpaceProvidersW(LPDWORD, LPWSANAMESPACE_INFOW);
1156 WINSOCK_API_LINKAGE int WINAPI WSAEnumNetworkEvents(SOCKET, WSAEVENT, LPWSANETWORKEVENTS);
1157 WINSOCK_API_LINKAGE int WINAPI WSAEnumProtocolsA(LPINT, LPWSAPROTOCOL_INFOA, LPDWORD);
1158 WINSOCK_API_LINKAGE int WINAPI WSAEnumProtocolsW(LPINT, LPWSAPROTOCOL_INFOW, LPDWORD);
1159 WINSOCK_API_LINKAGE int WINAPI WSAEventSelect(SOCKET, WSAEVENT, long);
1160 WINSOCK_API_LINKAGE BOOL WINAPI WSAGetOverlappedResult(SOCKET, LPWSAOVERLAPPED, LPDWORD, BOOL, LPDWORD);
1161 WINSOCK_API_LINKAGE BOOL WINAPI WSAGetQOSByName(SOCKET, LPWSABUF, LPQOS);
1162 WINSOCK_API_LINKAGE INT WINAPI WSAGetServiceClassInfoA(LPGUID, LPGUID, LPDWORD, LPWSASERVICECLASSINFOA);
1163 WINSOCK_API_LINKAGE INT WINAPI WSAGetServiceClassInfoW(LPGUID, LPGUID, LPDWORD, LPWSASERVICECLASSINFOW);
1164 WINSOCK_API_LINKAGE INT WINAPI WSAGetServiceClassNameByClassIdA(LPGUID, LPSTR, LPDWORD);
1165 WINSOCK_API_LINKAGE INT WINAPI WSAGetServiceClassNameByClassIdW(LPGUID, LPWSTR, LPDWORD);
1166 WINSOCK_API_LINKAGE int WINAPI WSAHtonl(SOCKET, unsigned long, unsigned long *);
1167 WINSOCK_API_LINKAGE int WINAPI WSAHtons(SOCKET, unsigned short, unsigned short *);
1168 WINSOCK_API_LINKAGE INT WINAPI WSAInstallServiceClassA(LPWSASERVICECLASSINFOA);
1169 WINSOCK_API_LINKAGE INT WINAPI WSAInstallServiceClassW(LPWSASERVICECLASSINFOW);
1170 WINSOCK_API_LINKAGE int WINAPI WSAIoctl(SOCKET, DWORD, LPVOID, DWORD, LPVOID, DWORD, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1171 WINSOCK_API_LINKAGE SOCKET WINAPI WSAJoinLeaf(SOCKET, const struct sockaddr *, int, LPWSABUF, LPWSABUF, LPQOS, LPQOS, DWORD);
1172 WINSOCK_API_LINKAGE INT WINAPI WSALookupServiceBeginA(LPWSAQUERYSETA, DWORD, LPHANDLE);
1173 WINSOCK_API_LINKAGE INT WINAPI WSALookupServiceBeginW(LPWSAQUERYSETW lpqsRestrictions, DWORD, LPHANDLE);
1174 WINSOCK_API_LINKAGE INT WINAPI WSALookupServiceNextA(HANDLE, DWORD, LPDWORD, LPWSAQUERYSETA);
1175 WINSOCK_API_LINKAGE INT WINAPI WSALookupServiceNextW(HANDLE, DWORD, LPDWORD, LPWSAQUERYSETW);
1176 WINSOCK_API_LINKAGE INT WINAPI WSALookupServiceEnd(HANDLE);
1177 WINSOCK_API_LINKAGE int WINAPI WSANSPIoctl(HANDLE,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPWSACOMPLETION); /* XP or .NET Server */
1178 WINSOCK_API_LINKAGE int WINAPI WSANtohl(SOCKET, unsigned long, unsigned long *);
1179 WINSOCK_API_LINKAGE int WINAPI WSANtohs(SOCKET, unsigned short, unsigned short *);
1180 WINSOCK_API_LINKAGE int WINAPI WSARecv(SOCKET, LPWSABUF, DWORD, LPDWORD, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1181 WINSOCK_API_LINKAGE int WINAPI WSARecvDisconnect(SOCKET, LPWSABUF);
1182 WINSOCK_API_LINKAGE int WINAPI WSARecvFrom(SOCKET, LPWSABUF, DWORD, LPDWORD, LPDWORD, struct sockaddr *, LPINT, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1183 WINSOCK_API_LINKAGE INT WINAPI WSARemoveServiceClass(LPGUID);
1184 WINSOCK_API_LINKAGE BOOL WINAPI WSAResetEvent(WSAEVENT);
1185 WINSOCK_API_LINKAGE int WINAPI WSASend(SOCKET, LPWSABUF, DWORD, LPDWORD, DWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1186 WINSOCK_API_LINKAGE int WINAPI WSASendDisconnect(SOCKET, LPWSABUF);
1187 WINSOCK_API_LINKAGE int WINAPI WSASendTo(SOCKET, LPWSABUF, DWORD, LPDWORD, DWORD, const struct sockaddr *, int, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1188 WINSOCK_API_LINKAGE BOOL WINAPI WSASetEvent(WSAEVENT);
1189 WINSOCK_API_LINKAGE INT WSAAPI WSASetServiceA(LPWSAQUERYSETA, WSAESETSERVICEOP, DWORD);
1190 WINSOCK_API_LINKAGE INT WINAPI WSASetServiceW(LPWSAQUERYSETW, WSAESETSERVICEOP, DWORD);
1191 WINSOCK_API_LINKAGE SOCKET WINAPI WSASocketA(int, int, int, LPWSAPROTOCOL_INFOA, GROUP, DWORD);
1192 WINSOCK_API_LINKAGE SOCKET WINAPI WSASocketW(int, int, int, LPWSAPROTOCOL_INFOW, GROUP, DWORD);
1193 WINSOCK_API_LINKAGE INT WINAPI WSAStringToAddressA(LPSTR, INT, LPWSAPROTOCOL_INFOA, LPSOCKADDR, LPINT);
1194 WINSOCK_API_LINKAGE INT WINAPI WSAStringToAddressW(LPWSTR, INT, LPWSAPROTOCOL_INFOW, LPSOCKADDR, LPINT);
1195 WINSOCK_API_LINKAGE DWORD WINAPI WSAWaitForMultipleEvents(DWORD, const WSAEVENT *, BOOL, DWORD, BOOL);
1197 typedef SOCKET (WINAPI *LPFN_WSAACCEPT)(SOCKET, struct sockaddr *, LPINT, LPCONDITIONPROC, DWORD);
1198 typedef INT (WINAPI *LPFN_WSAADDRESSTOSTRINGA)(LPSOCKADDR, DWORD, LPWSAPROTOCOL_INFOA, LPSTR, LPDWORD);
1199 typedef INT (WINAPI *LPFN_WSAADDRESSTOSTRINGW)(LPSOCKADDR, DWORD, LPWSAPROTOCOL_INFOW, LPWSTR, LPDWORD);
1200 typedef BOOL (WINAPI *LPFN_WSACLOSEEVENT)(WSAEVENT);
1201 typedef int (WINAPI *LPFN_WSACONNECT)(SOCKET, const struct sockaddr *, int, LPWSABUF, LPWSABUF, LPQOS, LPQOS);
1202 typedef WSAEVENT (WINAPI *LPFN_WSACREATEEVENT)(void);
1203 typedef int (WINAPI *LPFN_WSADUPLICATESOCKETA)(SOCKET, DWORD, LPWSAPROTOCOL_INFOA);
1204 typedef int (WINAPI *LPFN_WSADUPLICATESOCKETW)(SOCKET, DWORD, LPWSAPROTOCOL_INFOW);
1205 typedef INT (WINAPI *LPFN_WSAENUMNAMESPACEPROVIDERSA)(LPDWORD, LPWSANAMESPACE_INFOA);
1206 typedef INT (WINAPI *LPFN_WSAENUMNAMESPACEPROVIDERSW)(LPDWORD, LPWSANAMESPACE_INFOW);
1207 typedef int (WINAPI *LPFN_WSAENUMNETWORKEVENTS)(SOCKET, WSAEVENT, LPWSANETWORKEVENTS);
1208 typedef int (WINAPI *LPFN_WSAENUMPROTOCOLSA)(LPINT, LPWSAPROTOCOL_INFOA, LPDWORD);
1209 typedef int (WINAPI *LPFN_WSAENUMPROTOCOLSW)(LPINT, LPWSAPROTOCOL_INFOW, LPDWORD);
1210 typedef int (WINAPI *LPFN_WSAEVENTSELECT)(SOCKET, WSAEVENT, long);
1211 typedef BOOL (WINAPI *LPFN_WSAGETOVERLAPPEDRESULT)(SOCKET, LPWSAOVERLAPPED, LPDWORD, BOOL, LPDWORD);
1212 typedef BOOL (WINAPI *LPFN_WSAGETQOSBYNAME)(SOCKET, LPWSABUF, LPQOS);
1213 typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSINFOA)(LPGUID, LPGUID, LPDWORD, LPWSASERVICECLASSINFOA);
1214 typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSINFOW)(LPGUID, LPGUID, LPDWORD, LPWSASERVICECLASSINFOW);
1215 typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA)(LPGUID, LPSTR, LPDWORD);
1216 typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW)(LPGUID, LPWSTR, LPDWORD);
1217 typedef int (WINAPI *LPFN_WSAHTONL)(SOCKET, unsigned long, unsigned long *);
1218 typedef int (WINAPI *LPFN_WSAHTONS)(SOCKET, unsigned short, unsigned short *);
1219 typedef INT (WINAPI *LPFN_WSAINSTALLSERVICECLASSA)(LPWSASERVICECLASSINFOA);
1220 typedef INT (WINAPI *LPFN_WSAINSTALLSERVICECLASSW)(LPWSASERVICECLASSINFOW);
1221 typedef int (WINAPI *LPFN_WSAIOCTL)(SOCKET, DWORD, LPVOID, DWORD, LPVOID, DWORD, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1222 typedef SOCKET (WINAPI *LPFN_WSAJOINLEAF)(SOCKET, const struct sockaddr *, int, LPWSABUF, LPWSABUF, LPQOS, LPQOS, DWORD);
1223 typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEBEGINA)(LPWSAQUERYSETA, DWORD, LPHANDLE);
1224 typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEBEGINW)(LPWSAQUERYSETW, DWORD, LPHANDLE);
1225 typedef INT (WINAPI *LPFN_WSALOOKUPSERVICENEXTA)(HANDLE, DWORD, LPDWORD, LPWSAQUERYSETA);
1226 typedef INT (WINAPI *LPFN_WSALOOKUPSERVICENEXTW)(HANDLE, DWORD, LPDWORD, LPWSAQUERYSETW);
1227 typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEEND)(HANDLE);
1228 typedef int (WINAPI *LPFN_WSANSPIoctl)(HANDLE, DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPWSACOMPLETION);
1229 typedef int (WINAPI *LPFN_WSANTOHL)(SOCKET, unsigned long, unsigned long *);
1230 typedef int (WINAPI *LPFN_WSANTOHS)(SOCKET, unsigned short, unsigned short *);
1231 typedef int (WINAPI *LPFN_WSARECV)(SOCKET, LPWSABUF, DWORD, LPDWORD, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1232 typedef int (WINAPI *LPFN_WSARECVDISCONNECT)(SOCKET, LPWSABUF);
1233 typedef int (WINAPI *LPFN_WSARECVFROM)(SOCKET, LPWSABUF, DWORD, LPDWORD, LPDWORD, struct sockaddr *, LPINT, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1234 typedef INT (WINAPI *LPFN_WSAREMOVESERVICECLASS)(LPGUID);
1235 typedef BOOL (WINAPI *LPFN_WSARESETEVENT)(WSAEVENT);
1236 typedef int (WINAPI *LPFN_WSASEND)(SOCKET, LPWSABUF, DWORD, LPDWORD, DWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1237 typedef int (WINAPI *LPFN_WSASENDDISCONNECT)(SOCKET, LPWSABUF);
1238 typedef int (WINAPI *LPFN_WSASENDTO)(SOCKET, LPWSABUF, DWORD, LPDWORD, DWORD, const struct sockaddr *, int, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1239 typedef BOOL (WINAPI *LPFN_WSASETEVENT)(WSAEVENT);
1240 typedef INT (WINAPI *LPFN_WSASETSERVICEA)(LPWSAQUERYSETA, WSAESETSERVICEOP, DWORD);
1241 typedef INT (WINAPI *LPFN_WSASETSERVICEW)(LPWSAQUERYSETW, WSAESETSERVICEOP, DWORD);
1242 typedef SOCKET (WINAPI *LPFN_WSASOCKETA)(int, int, int, LPWSAPROTOCOL_INFOA, GROUP, DWORD);
1243 typedef SOCKET (WINAPI *LPFN_WSASOCKETW)(int, int, int, LPWSAPROTOCOL_INFOW, GROUP, DWORD);
1244 typedef INT (WINAPI *LPFN_WSASTRINGTOADDRESSA)(LPSTR, INT, LPWSAPROTOCOL_INFOA, LPSOCKADDR, LPINT);
1245 typedef INT (WINAPI *LPFN_WSASTRINGTOADDRESSW)(LPWSTR, INT, LPWSAPROTOCOL_INFOW, LPSOCKADDR, LPINT);
1246 typedef DWORD (WINAPI *LPFN_WSAWAITFORMULTIPLEEVENTS)(DWORD, const WSAEVENT *, BOOL, DWORD, BOOL);
1248 #ifdef UNICODE
1249 #define LPFN_WSAADDRESSTOSTRING LPFN_WSAADDRESSTOSTRINGW
1250 #define LPFN_WSADUPLICATESOCKET LPFN_WSADUPLICATESOCKETW
1251 #define LPFN_WSAENUMNAMESPACEPROVIDERS LPFN_WSAENUMNAMESPACEPROVIDERSW
1252 #define LPFN_WSAENUMPROTOCOLS LPFN_WSAENUMPROTOCOLSW
1253 #define LPFN_WSAGETSERVICECLASSINFO LPFN_WSAGETSERVICECLASSINFOW
1254 #define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW
1255 #define LPFN_WSAINSTALLSERVICECLASS LPFN_WSAINSTALLSERVICECLASSW
1256 #define LPFN_WSALOOKUPSERVICEBEGIN LPFN_WSALOOKUPSERVICEBEGINW
1257 #define LPFN_WSALOOKUPSERVICENEXT LPFN_WSALOOKUPSERVICENEXTW
1258 #define LPFN_WSASETSERVICE LPFN_WSASETSERVICEW
1259 #define LPFN_WSASOCKET LPFN_WSASOCKETW
1260 #define LPFN_WSASTRINGTOADDRESS LPFN_WSASTRINGTOADDRESSW
1261 #define WSAAddressToString WSAAddressToStringW
1262 #define WSADuplicateSocket WSADuplicateSocketW
1263 #define WSAEnumNameSpaceProviders WSAEnumNameSpaceProvidersW
1264 #define WSAEnumProtocols WSAEnumProtocolsW
1265 #define WSAGetServiceClassInfo WSAGetServiceClassInfoW
1266 #define WSAGetServiceClassNameByClassId WSAGetServiceClassNameByClassIdW
1267 #define WSASetService WSASetServiceW
1268 #define WSASocket WSASocketW
1269 #define WSAStringToAddress WSAStringToAddressW
1270 #define WSALookupServiceBegin WSALookupServiceBeginW
1271 #define WSALookupServiceNext WSALookupServiceNextW
1272 #define WSAInstallServiceClass WSAInstallServiceClassW
1273 #else
1274 #define LPFN_WSAADDRESSTOSTRING LPFN_WSAADDRESSTOSTRINGA
1275 #define LPFN_WSADUPLICATESOCKET LPFN_WSADUPLICATESOCKETW
1276 #define LPFN_WSAENUMNAMESPACEPROVIDERS LPFN_WSAENUMNAMESPACEPROVIDERSA
1277 #define LPFN_WSAENUMPROTOCOLS LPFN_WSAENUMPROTOCOLSA
1278 #define LPFN_WSAGETSERVICECLASSINFO LPFN_WSAGETSERVICECLASSINFOA
1279 #define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA
1280 #define LPFN_WSAINSTALLSERVICECLASS LPFN_WSAINSTALLSERVICECLASSA
1281 #define LPFN_WSALOOKUPSERVICEBEGIN LPFN_WSALOOKUPSERVICEBEGINA
1282 #define LPFN_WSALOOKUPSERVICENEXT LPFN_WSALOOKUPSERVICENEXTA
1283 #define LPFN_WSASETSERVICE LPFN_WSASETSERVICEA
1284 #define LPFN_WSASOCKET LPFN_WSASOCKETA
1285 #define LPFN_WSASTRINGTOADDRESS LPFN_WSASTRINGTOADDRESSA
1286 #define WSAAddressToString WSAAddressToStringA
1287 #define WSADuplicateSocket WSADuplicateSocketA
1288 #define WSAEnumNameSpaceProviders WSAEnumNameSpaceProvidersA
1289 #define WSAEnumProtocols WSAEnumProtocolsA
1290 #define WSAGetServiceClassInfo WSAGetServiceClassInfoA
1291 #define WSAGetServiceClassNameByClassId WSAGetServiceClassNameByClassIdA
1292 #define WSAInstallServiceClass WSAInstallServiceClassA
1293 #define WSALookupServiceBegin WSALookupServiceBeginA
1294 #define WSALookupServiceNext WSALookupServiceNextA
1295 #define WSASocket WSASocketA
1296 #define WSAStringToAddress WSAStringToAddressA
1297 #define WSASetService WSASetServiceA
1298 #endif
1300 #ifdef __cplusplus
1302 #endif
1303 #endif