Update /src/subversion/release.sh to fetch Subversion 1.6.3
[msysgit.git] / include / winsock2.h
blob1af69337e355003cd6da57c7df9c58fb13dd1740
1 /*
3 Definitions for winsock 2
5 Initially taken from 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 #define _GNU_H_WINDOWS32_SOCKETS
18 #include <windows.h>
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 /* Names common to Winsock1.1 and Winsock2 */
24 #if !defined ( _BSDTYPES_DEFINED )
25 /* also defined in gmon.h and in cygwin's sys/types */
26 typedef unsigned char u_char;
27 typedef unsigned short u_short;
28 typedef unsigned int u_int;
29 typedef unsigned long u_long;
30 #define _BSDTYPES_DEFINED
31 #endif /* ! def _BSDTYPES_DEFINED */
32 typedef u_int SOCKET;
33 #ifndef FD_SETSIZE
34 #define FD_SETSIZE 64
35 #endif
37 /* shutdown() how types */
38 #define SD_RECEIVE 0x00
39 #define SD_SEND 0x01
40 #define SD_BOTH 0x02
42 #ifndef _SYS_TYPES_FD_SET
43 /* fd_set may be defined by the newlib <sys/types.h>
44 * if __USE_W32_SOCKETS not defined.
46 #ifdef fd_set
47 #undef fd_set
48 #endif
49 typedef struct fd_set {
50 u_int fd_count;
51 SOCKET fd_array[FD_SETSIZE];
52 } fd_set;
53 int PASCAL __WSAFDIsSet(SOCKET,fd_set*);
54 #ifndef FD_CLR
55 #define FD_CLR(fd,set) do { u_int __i;\
56 for (__i = 0; __i < ((fd_set *)(set))->fd_count ; __i++) {\
57 if (((fd_set *)(set))->fd_array[__i] == (fd)) {\
58 while (__i < ((fd_set *)(set))->fd_count-1) {\
59 ((fd_set*)(set))->fd_array[__i] = ((fd_set*)(set))->fd_array[__i+1];\
60 __i++;\
62 ((fd_set*)(set))->fd_count--;\
63 break;\
66 } while (0)
67 #endif
68 #ifndef FD_SET
69 /* this differs from the define in winsock.h and in cygwin sys/types.h */
70 #define FD_SET(fd, set) do { u_int __i;\
71 for (__i = 0; __i < ((fd_set *)(set))->fd_count ; __i++) {\
72 if (((fd_set *)(set))->fd_array[__i] == (fd)) {\
73 break;\
76 if (__i == ((fd_set *)(set))->fd_count) {\
77 if (((fd_set *)(set))->fd_count < FD_SETSIZE) {\
78 ((fd_set *)(set))->fd_array[__i] = (fd);\
79 ((fd_set *)(set))->fd_count++;\
82 } while(0)
83 #endif
84 #ifndef FD_ZERO
85 #define FD_ZERO(set) (((fd_set *)(set))->fd_count=0)
86 #endif
87 #ifndef FD_ISSET
88 #define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (fd_set *)(set))
89 #endif
90 #elif !defined (USE_SYS_TYPES_FD_SET)
91 #warning "fd_set and associated macros have been defined in sys/types. \
92 This may cause runtime problems with W32 sockets"
93 #endif /* ndef _SYS_TYPES_FD_SET */
94 #if !(defined (__INSIDE_CYGWIN__) || (__INSIDE_MSYS__))
95 struct timeval {
96 long tv_sec;
97 long tv_usec;
99 struct hostent {
100 char *h_name;
101 char **h_aliases;
102 short h_addrtype;
103 short h_length;
104 char **h_addr_list;
105 #define h_addr h_addr_list[0]
107 struct linger {
108 u_short l_onoff;
109 u_short l_linger;
111 #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
112 #define timercmp(tvp, uvp, cmp) \
113 (((tvp)->tv_sec != (uvp)->tv_sec) ? \
114 ((tvp)->tv_sec cmp (uvp)->tv_sec) : \
115 ((tvp)->tv_usec cmp (uvp)->tv_usec))
116 #define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
117 #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
118 #define IOCPARM_MASK 0x7f
119 #define IOC_VOID 0x20000000
120 #define IOC_OUT 0x40000000
121 #define IOC_IN 0x80000000
122 #define IOC_INOUT (IOC_IN|IOC_OUT)
124 #if ! (defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
125 #define _IO(x,y) (IOC_VOID|((x)<<8)|(y))
126 #define _IOR(x,y,t) (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
127 #define _IOW(x,y,t) (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
128 #define FIONBIO _IOW('f', 126, u_long)
129 #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
131 #define FIONREAD _IOR('f', 127, u_long)
132 #define FIOASYNC _IOW('f', 125, u_long)
133 #define SIOCSHIWAT _IOW('s', 0, u_long)
134 #define SIOCGHIWAT _IOR('s', 1, u_long)
135 #define SIOCSLOWAT _IOW('s', 2, u_long)
136 #define SIOCGLOWAT _IOR('s', 3, u_long)
137 #define SIOCATMARK _IOR('s', 7, u_long)
139 #if ! (defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
140 struct netent {
141 char * n_name;
142 char **n_aliases;
143 short n_addrtype;
144 u_long n_net;
146 struct servent {
147 char *s_name;
148 char **s_aliases;
149 short s_port;
150 char *s_proto;
152 struct protoent {
153 char *p_name;
154 char **p_aliases;
155 short p_proto;
157 #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
159 #define IPPROTO_IP 0
160 #define IPPROTO_ICMP 1
161 #define IPPROTO_IGMP 2
162 #define IPPROTO_GGP 3
163 #define IPPROTO_TCP 6
164 #define IPPROTO_PUP 12
165 #define IPPROTO_UDP 17
166 #define IPPROTO_IDP 22
167 #define IPPROTO_ND 77
168 #define IPPROTO_RAW 255
169 #define IPPROTO_MAX 256
170 #define IPPORT_ECHO 7
171 #define IPPORT_DISCARD 9
172 #define IPPORT_SYSTAT 11
173 #define IPPORT_DAYTIME 13
174 #define IPPORT_NETSTAT 15
175 #define IPPORT_FTP 21
176 #define IPPORT_TELNET 23
177 #define IPPORT_SMTP 25
178 #define IPPORT_TIMESERVER 37
179 #define IPPORT_NAMESERVER 42
180 #define IPPORT_WHOIS 43
181 #define IPPORT_MTP 57
182 #define IPPORT_TFTP 69
183 #define IPPORT_RJE 77
184 #define IPPORT_FINGER 79
185 #define IPPORT_TTYLINK 87
186 #define IPPORT_SUPDUP 95
187 #define IPPORT_EXECSERVER 512
188 #define IPPORT_LOGINSERVER 513
189 #define IPPORT_CMDSERVER 514
190 #define IPPORT_EFSSERVER 520
191 #define IPPORT_BIFFUDP 512
192 #define IPPORT_WHOSERVER 513
193 #define IPPORT_ROUTESERVER 520
194 #define IPPORT_RESERVED 1024
195 #define IMPLINK_IP 155
196 #define IMPLINK_LOWEXPER 156
197 #define IMPLINK_HIGHEXPER 158
198 struct in_addr {
199 union {
200 struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
201 struct { u_short s_w1,s_w2; } S_un_w;
202 u_long S_addr;
203 } S_un;
204 #define s_addr S_un.S_addr
205 #define s_host S_un.S_un_b.s_b2
206 #define s_net S_un.S_un_b.s_b1
207 #define s_imp S_un.S_un_w.s_w2
208 #define s_impno S_un.S_un_b.s_b4
209 #define s_lh S_un.S_un_b.s_b3
211 #define IN_CLASSA(i) ((long)(i)&0x80000000)
212 #define IN_CLASSA_NET 0xff000000
213 #define IN_CLASSA_NSHIFT 24
214 #define IN_CLASSA_HOST 0x00ffffff
215 #define IN_CLASSA_MAX 128
216 #define IN_CLASSB(i) (((long)(i)&0xc0000000)==0x80000000)
217 #define IN_CLASSB_NET 0xffff0000
218 #define IN_CLASSB_NSHIFT 16
219 #define IN_CLASSB_HOST 0x0000ffff
220 #define IN_CLASSB_MAX 65536
221 #define IN_CLASSC(i) (((long)(i)&0xe0000000)==0xc0000000)
222 #define IN_CLASSC_NET 0xffffff00
223 #define IN_CLASSC_NSHIFT 8
224 #define IN_CLASSC_HOST 0xff
225 #define INADDR_ANY (u_long)0
226 #define INADDR_LOOPBACK 0x7f000001
227 #define INADDR_BROADCAST (u_long)0xffffffff
228 #define INADDR_NONE 0xffffffff
229 struct sockaddr_in {
230 short sin_family;
231 u_short sin_port;
232 struct in_addr sin_addr;
233 char sin_zero[8];
235 #define WSADESCRIPTION_LEN 256
236 #define WSASYS_STATUS_LEN 128
237 typedef struct WSAData {
238 WORD wVersion;
239 WORD wHighVersion;
240 char szDescription[WSADESCRIPTION_LEN+1];
241 char szSystemStatus[WSASYS_STATUS_LEN+1];
242 unsigned short iMaxSockets;
243 unsigned short iMaxUdpDg;
244 char * lpVendorInfo;
245 } WSADATA;
246 typedef WSADATA *LPWSADATA;
248 #if ! (defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
249 #define IP_OPTIONS 1
250 #define SO_DEBUG 1
251 #define SO_ACCEPTCONN 2
252 #define SO_REUSEADDR 4
253 #define SO_KEEPALIVE 8
254 #define SO_DONTROUTE 16
255 #define SO_BROADCAST 32
256 #define SO_USELOOPBACK 64
257 #define SO_LINGER 128
258 #define SO_OOBINLINE 256
259 #define SO_DONTLINGER (u_int)(~SO_LINGER)
260 #define SO_SNDBUF 0x1001
261 #define SO_RCVBUF 0x1002
262 #define SO_SNDLOWAT 0x1003
263 #define SO_RCVLOWAT 0x1004
264 #define SO_SNDTIMEO 0x1005
265 #define SO_RCVTIMEO 0x1006
266 #define SO_ERROR 0x1007
267 #define SO_TYPE 0x1008
268 #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
270 #define INVALID_SOCKET (SOCKET)(~0)
271 #define SOCKET_ERROR (-1)
272 #define SOCK_STREAM 1
273 #define SOCK_DGRAM 2
274 #define SOCK_RAW 3
275 #define SOCK_RDM 4
276 #define SOCK_SEQPACKET 5
277 #define TCP_NODELAY 0x0001
278 #define AF_UNSPEC 0
279 #define AF_UNIX 1
280 #define AF_INET 2
281 #define AF_IMPLINK 3
282 #define AF_PUP 4
283 #define AF_CHAOS 5
284 #define AF_IPX 6
285 #define AF_NS 6
286 #define AF_ISO 7
287 #define AF_OSI AF_ISO
288 #define AF_ECMA 8
289 #define AF_DATAKIT 9
290 #define AF_CCITT 10
291 #define AF_SNA 11
292 #define AF_DECnet 12
293 #define AF_DLI 13
294 #define AF_LAT 14
295 #define AF_HYLINK 15
296 #define AF_APPLETALK 16
297 #define AF_NETBIOS 17
298 #define AF_VOICEVIEW 18
299 #define AF_FIREFOX 19
300 #define AF_UNKNOWN1 20
301 #define AF_BAN 21
302 #define AF_ATM 22
303 #define AF_INET6 23
304 #define AF_CLUSTER 24
305 #define AF_12844 25
306 #define AF_IRDA 26
307 #define AF_NETDES 28
308 #if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
309 #define AF_MAX 29
310 struct sockaddr {
311 u_short sa_family;
312 char sa_data[14];
314 #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
316 struct sockproto {
317 u_short sp_family;
318 u_short sp_protocol;
320 #define PF_UNSPEC AF_UNSPEC
321 #define PF_UNIX AF_UNIX
322 #define PF_INET AF_INET
323 #define PF_IMPLINK AF_IMPLINK
324 #define PF_PUP AF_PUP
325 #define PF_CHAOS AF_CHAOS
326 #define PF_NS AF_NS
327 #define PF_IPX AF_IPX
328 #define PF_ISO AF_ISO
329 #define PF_OSI AF_OSI
330 #define PF_ECMA AF_ECMA
331 #define PF_DATAKIT AF_DATAKIT
332 #define PF_CCITT AF_CCITT
333 #define PF_SNA AF_SNA
334 #define PF_DECnet AF_DECnet
335 #define PF_DLI AF_DLI
336 #define PF_LAT AF_LAT
337 #define PF_HYLINK AF_HYLINK
338 #define PF_APPLETALK AF_APPLETALK
339 #define PF_VOICEVIEW AF_VOICEVIEW
340 #define PF_FIREFOX AF_FIREFOX
341 #define PF_UNKNOWN1 AF_UNKNOWN1
342 #define PF_BAN AF_BAN
343 #define PF_ATM AF_ATM
344 #define PF_INET6 AF_INET6
345 #define PF_MAX AF_MAX
346 #define SOL_SOCKET 0xffff
347 #if ! (defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
348 #define SOMAXCONN 0x7fffffff /* (5) in WinSock1.1 */
349 #define MSG_OOB 1
350 #define MSG_PEEK 2
351 #define MSG_DONTROUTE 4
352 #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
353 #define MSG_MAXIOVLEN 16
354 #define MSG_PARTIAL 0x8000
355 #define MAXGETHOSTSTRUCT 1024
357 #define FD_READ_BIT 0
358 #define FD_READ (1 << FD_READ_BIT)
359 #define FD_WRITE_BIT 1
360 #define FD_WRITE (1 << FD_WRITE_BIT)
361 #define FD_OOB_BIT 2
362 #define FD_OOB (1 << FD_OOB_BIT)
363 #define FD_ACCEPT_BIT 3
364 #define FD_ACCEPT (1 << FD_ACCEPT_BIT)
365 #define FD_CONNECT_BIT 4
366 #define FD_CONNECT (1 << FD_CONNECT_BIT)
367 #define FD_CLOSE_BIT 5
368 #define FD_CLOSE (1 << FD_CLOSE_BIT)
369 /* winsock1.1 defines stop at FD_CLOSE (32) */
370 #define FD_QOS_BIT 6
371 #define FD_QOS (1 << FD_QOS_BIT)
372 #define FD_GROUP_QOS_BIT 7
373 #define FD_GROUP_QOS (1 << FD_GROUP_QOS_BIT)
374 #define FD_ROUTING_INTERFACE_CHANGE_BIT 8
375 #define FD_ROUTING_INTERFACE_CHANGE (1 << FD_ROUTING_INTERFACE_CHANGE_BIT)
376 #define FD_ADDRESS_LIST_CHANGE_BIT 9
377 #define FD_ADDRESS_LIST_CHANGE (1 << FD_ADDRESS_LIST_CHANGE_BIT)
378 #define FD_MAX_EVENTS 10
379 #define FD_ALL_EVENTS ((1 << FD_MAX_EVENTS) - 1)
381 #define WSABASEERR 10000
382 #define WSAEINTR (WSABASEERR+4)
383 #define WSAEBADF (WSABASEERR+9)
384 #define WSAEACCES (WSABASEERR+13)
385 #define WSAEFAULT (WSABASEERR+14)
386 #define WSAEINVAL (WSABASEERR+22)
387 #define WSAEMFILE (WSABASEERR+24)
388 #define WSAEWOULDBLOCK (WSABASEERR+35)
389 #define WSAEINPROGRESS (WSABASEERR+36) /* deprecated on WinSock2 */
390 #define WSAEALREADY (WSABASEERR+37)
391 #define WSAENOTSOCK (WSABASEERR+38)
392 #define WSAEDESTADDRREQ (WSABASEERR+39)
393 #define WSAEMSGSIZE (WSABASEERR+40)
394 #define WSAEPROTOTYPE (WSABASEERR+41)
395 #define WSAENOPROTOOPT (WSABASEERR+42)
396 #define WSAEPROTONOSUPPORT (WSABASEERR+43)
397 #define WSAESOCKTNOSUPPORT (WSABASEERR+44)
398 #define WSAEOPNOTSUPP (WSABASEERR+45)
399 #define WSAEPFNOSUPPORT (WSABASEERR+46)
400 #define WSAEAFNOSUPPORT (WSABASEERR+47)
401 #define WSAEADDRINUSE (WSABASEERR+48)
402 #define WSAEADDRNOTAVAIL (WSABASEERR+49)
403 #define WSAENETDOWN (WSABASEERR+50)
404 #define WSAENETUNREACH (WSABASEERR+51)
405 #define WSAENETRESET (WSABASEERR+52)
406 #define WSAECONNABORTED (WSABASEERR+53)
407 #define WSAECONNRESET (WSABASEERR+54)
408 #define WSAENOBUFS (WSABASEERR+55)
409 #define WSAEISCONN (WSABASEERR+56)
410 #define WSAENOTCONN (WSABASEERR+57)
411 #define WSAESHUTDOWN (WSABASEERR+58)
412 #define WSAETOOMANYREFS (WSABASEERR+59)
413 #define WSAETIMEDOUT (WSABASEERR+60)
414 #define WSAECONNREFUSED (WSABASEERR+61)
415 #define WSAELOOP (WSABASEERR+62)
416 #define WSAENAMETOOLONG (WSABASEERR+63)
417 #define WSAEHOSTDOWN (WSABASEERR+64)
418 #define WSAEHOSTUNREACH (WSABASEERR+65)
419 #define WSAENOTEMPTY (WSABASEERR+66)
420 #define WSAEPROCLIM (WSABASEERR+67)
421 #define WSAEUSERS (WSABASEERR+68)
422 #define WSAEDQUOT (WSABASEERR+69)
423 #define WSAESTALE (WSABASEERR+70)
424 #define WSAEREMOTE (WSABASEERR+71)
425 #define WSAEDISCON (WSABASEERR+101)
426 #define WSASYSNOTREADY (WSABASEERR+91)
427 #define WSAVERNOTSUPPORTED (WSABASEERR+92)
428 #define WSANOTINITIALISED (WSABASEERR+93)
429 #define WSAHOST_NOT_FOUND (WSABASEERR+1001)
430 #define WSATRY_AGAIN (WSABASEERR+1002)
431 #define WSANO_RECOVERY (WSABASEERR+1003)
432 #define WSANO_DATA (WSABASEERR+1004)
433 #define WSANO_ADDRESS WSANO_DATA
434 #if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
435 #define h_errno WSAGetLastError()
436 #define HOST_NOT_FOUND WSAHOST_NOT_FOUND
437 #define TRY_AGAIN WSATRY_AGAIN
438 #define NO_RECOVERY WSANO_RECOVERY
439 #define NO_DATA WSANO_DATA
440 #define NO_ADDRESS WSANO_ADDRESS
441 #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
442 SOCKET PASCAL accept(SOCKET,struct sockaddr*,int*);
443 int PASCAL bind(SOCKET,const struct sockaddr*,int);
444 int PASCAL closesocket(SOCKET);
445 int PASCAL connect(SOCKET,const struct sockaddr*,int);
446 int PASCAL ioctlsocket(SOCKET,long,u_long *);
447 int PASCAL getpeername(SOCKET,struct sockaddr*,int*);
448 int PASCAL getsockname(SOCKET,struct sockaddr*,int*);
449 int PASCAL getsockopt(SOCKET,int,int,char*,int*);
450 unsigned long PASCAL inet_addr(const char*);
451 DECLARE_STDCALL_P(char *) inet_ntoa(struct in_addr);
452 int PASCAL listen(SOCKET,int);
453 int PASCAL recv(SOCKET,char*,int,int);
454 int PASCAL recvfrom(SOCKET,char*,int,int,struct sockaddr*,int*);
455 int PASCAL send(SOCKET,const char*,int,int);
456 int PASCAL sendto(SOCKET,const char*,int,int,const struct sockaddr*,int);
457 int PASCAL setsockopt(SOCKET,int,int,const char*,int);
458 int PASCAL shutdown(SOCKET,int);
459 SOCKET PASCAL socket(int,int,int);
460 DECLARE_STDCALL_P(struct hostent *) gethostbyaddr(const char*,int,int);
461 DECLARE_STDCALL_P(struct hostent *) gethostbyname(const char*);
462 DECLARE_STDCALL_P(struct servent *) getservbyport(int,const char*);
463 DECLARE_STDCALL_P(struct servent *) getservbyname(const char*,const char*);
464 DECLARE_STDCALL_P(struct protoent *) getprotobynumber(int);
465 DECLARE_STDCALL_P(struct protoent *) getprotobyname(const char*);
466 int PASCAL WSAStartup(WORD,LPWSADATA);
467 int PASCAL WSACleanup(void);
468 void PASCAL WSASetLastError(int);
469 int PASCAL WSAGetLastError(void);
471 * Pesudo-blocking functions N/A in ws2_32.dll (use threads instead)
473 #if 0
474 BOOL PASCAL WSAIsBlocking(void);
475 int PASCAL WSAUnhookBlockingHook(void);
476 FARPROC PASCAL WSASetBlockingHook(FARPROC);
477 int PASCAL WSACancelBlockingCall(void);
478 #endif
479 HANDLE PASCAL WSAAsyncGetServByName(HWND,u_int,const char*,const char*,char*,int);
480 HANDLE PASCAL WSAAsyncGetServByPort(HWND,u_int,int,const char*,char*,int);
481 HANDLE PASCAL WSAAsyncGetProtoByName(HWND,u_int,const char*,char*,int);
482 HANDLE PASCAL WSAAsyncGetProtoByNumber(HWND,u_int,int,char*,int);
483 HANDLE PASCAL WSAAsyncGetHostByName(HWND,u_int,const char*,char*,int);
484 HANDLE PASCAL WSAAsyncGetHostByAddr(HWND,u_int,const char*,int,int,char*,int);
485 int PASCAL WSACancelAsyncRequest(HANDLE);
486 int PASCAL WSAAsyncSelect(SOCKET,HWND,u_int,long);
487 #if ! (defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
488 u_long PASCAL htonl(u_long);
489 u_long PASCAL ntohl(u_long);
490 u_short PASCAL htons(u_short);
491 u_short PASCAL ntohs(u_short);
492 int PASCAL select(int nfds,fd_set*,fd_set*,fd_set*,const struct timeval*);
493 int PASCAL gethostname(char*,int);
494 #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
496 #define WSAMAKEASYNCREPLY(b,e) MAKELONG(b,e)
497 #define WSAMAKESELECTREPLY(e,error) MAKELONG(e,error)
498 #define WSAGETASYNCBUFLEN(l) LOWORD(l)
499 #define WSAGETASYNCERROR(l) HIWORD(l)
500 #define WSAGETSELECTEVENT(l) LOWORD(l)
501 #define WSAGETSELECTERROR(l) HIWORD(l)
503 typedef struct sockaddr SOCKADDR;
504 typedef struct sockaddr *PSOCKADDR;
505 typedef struct sockaddr *LPSOCKADDR;
506 typedef struct sockaddr_in SOCKADDR_IN;
507 typedef struct sockaddr_in *PSOCKADDR_IN;
508 typedef struct sockaddr_in *LPSOCKADDR_IN;
509 typedef struct linger LINGER;
510 typedef struct linger *PLINGER;
511 typedef struct linger *LPLINGER;
512 typedef struct in_addr IN_ADDR;
513 typedef struct in_addr *PIN_ADDR;
514 typedef struct in_addr *LPIN_ADDR;
515 typedef struct fd_set FD_SET;
516 typedef struct fd_set *PFD_SET;
517 typedef struct fd_set *LPFD_SET;
518 typedef struct hostent HOSTENT;
519 typedef struct hostent *PHOSTENT;
520 typedef struct hostent *LPHOSTENT;
521 typedef struct servent SERVENT;
522 typedef struct servent *PSERVENT;
523 typedef struct servent *LPSERVENT;
524 typedef struct protoent PROTOENT;
525 typedef struct protoent *PPROTOENT;
526 typedef struct protoent *LPPROTOENT;
527 typedef struct timeval TIMEVAL;
528 typedef struct timeval *PTIMEVAL;
529 typedef struct timeval *LPTIMEVAL;
531 /* winsock2 additions */
532 #define ADDR_ANY INADDR_ANY
534 #define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000)
535 #define IN_CLASSD_NET 0xf0000000
536 #define IN_CLASSD_NSHIFT 28
537 #define IN_CLASSD_HOST 0x0fffffff
538 #define IN_MULTICAST(i) IN_CLASSD(i)
540 #define FROM_PROTOCOL_INFO (-1)
542 #define SO_DONTLINGER (u_int)(~SO_LINGER)
543 #define SO_GROUP_ID 0x2001
544 #define SO_GROUP_PRIORITY 0x2002
545 #define SO_MAX_MSG_SIZE 0x2003
546 #define SO_PROTOCOL_INFOA 0x2004
547 #define SO_PROTOCOL_INFOW 0x2005
548 #ifdef UNICODE
549 #define SO_PROTOCOL_INFO SO_PROTOCOL_INFOW
550 #else
551 #define SO_PROTOCOL_INFO SO_PROTOCOL_INFOA
552 #endif
553 #define PVD_CONFIG 0x3001
555 #define MSG_INTERRUPT 0x10
556 #define MSG_MAXIOVLEN 16
558 /* WinSock2 specific error codes */
559 #define WSAEDISCON (WSABASEERR+101)
560 #define WSAENOMORE (WSABASEERR+102)
561 #define WSAECANCELLED (WSABASEERR+103)
562 #define WSAEINVALIDPROCTABLE (WSABASEERR+104)
563 #define WSAEINVALIDPROVIDER (WSABASEERR+105)
564 #define WSAEPROVIDERFAILEDINIT (WSABASEERR+106)
565 #define WSASYSCALLFAILURE (WSABASEERR+107)
566 #define WSASERVICE_NOT_FOUND (WSABASEERR+108)
567 #define WSATYPE_NOT_FOUND (WSABASEERR+109)
568 #define WSA_E_NO_MORE (WSABASEERR+110)
569 #define WSA_E_CANCELLED (WSABASEERR+111)
570 #define WSAEREFUSED (WSABASEERR+112)
572 /* WS QualityofService errors */
573 #define WSA_QOS_RECEIVERS (WSABASEERR + 1005)
574 #define WSA_QOS_SENDERS (WSABASEERR + 1006)
575 #define WSA_QOS_NO_SENDERS (WSABASEERR + 1007)
576 #define WSA_QOS_NO_RECEIVERS (WSABASEERR + 1008)
577 #define WSA_QOS_REQUEST_CONFIRMED (WSABASEERR + 1009)
578 #define WSA_QOS_ADMISSION_FAILURE (WSABASEERR + 1010)
579 #define WSA_QOS_POLICY_FAILURE (WSABASEERR + 1011)
580 #define WSA_QOS_BAD_STYLE (WSABASEERR + 1012)
581 #define WSA_QOS_BAD_OBJECT (WSABASEERR + 1013)
582 #define WSA_QOS_TRAFFIC_CTRL_ERROR (WSABASEERR + 1014)
583 #define WSA_QOS_GENERIC_ERROR (WSABASEERR + 1015)
584 #define WSA_QOS_ESERVICETYPE (WSABASEERR + 1016)
585 #define WSA_QOS_EFLOWSPEC (WSABASEERR + 1017)
586 #define WSA_QOS_EPROVSPECBUF (WSABASEERR + 1018)
587 #define WSA_QOS_EFILTERSTYLE (WSABASEERR + 1019)
588 #define WSA_QOS_EFILTERTYPE (WSABASEERR + 1020)
589 #define WSA_QOS_EFILTERCOUNT (WSABASEERR + 1021)
590 #define WSA_QOS_EOBJLENGTH (WSABASEERR + 1022)
591 #define WSA_QOS_EFLOWCOUNT (WSABASEERR + 1023)
592 #define WSA_QOS_EUNKOWNPSOBJ (WSABASEERR + 1024)
593 #define WSA_QOS_EPOLICYOBJ (WSABASEERR + 1025)
594 #define WSA_QOS_EFLOWDESC (WSABASEERR + 1026)
595 #define WSA_QOS_EPSFLOWSPEC (WSABASEERR + 1027)
596 #define WSA_QOS_EPSFILTERSPEC (WSABASEERR + 1028)
597 #define WSA_QOS_ESDMODEOBJ (WSABASEERR + 1029)
598 #define WSA_QOS_ESHAPERATEOBJ (WSABASEERR + 1030)
599 #define WSA_QOS_RESERVED_PETYPE (WSABASEERR + 1031)
602 #define WSAAPI WINAPI
603 #define WSAEVENT HANDLE
604 #define LPWSAEVENT LPHANDLE
605 #define WSAOVERLAPPED OVERLAPPED
606 typedef struct _OVERLAPPED *LPWSAOVERLAPPED;
608 #define WSA_IO_PENDING (ERROR_IO_PENDING)
609 #define WSA_IO_INCOMPLETE (ERROR_IO_INCOMPLETE)
610 #define WSA_INVALID_HANDLE (ERROR_INVALID_HANDLE)
611 #define WSA_INVALID_PARAMETER (ERROR_INVALID_PARAMETER)
612 #define WSA_NOT_ENOUGH_MEMORY (ERROR_NOT_ENOUGH_MEMORY)
613 #define WSA_OPERATION_ABORTED (ERROR_OPERATION_ABORTED)
615 #define WSA_INVALID_EVENT ((WSAEVENT)NULL)
616 #define WSA_MAXIMUM_WAIT_EVENTS (MAXIMUM_WAIT_OBJECTS)
617 #define WSA_WAIT_FAILED ((DWORD)-1L)
618 #define WSA_WAIT_EVENT_0 (WAIT_OBJECT_0)
619 #define WSA_WAIT_IO_COMPLETION (WAIT_IO_COMPLETION)
620 #define WSA_WAIT_TIMEOUT (WAIT_TIMEOUT)
621 #define WSA_INFINITE (INFINITE)
623 typedef struct _WSABUF {
624 unsigned long len;
625 char *buf;
626 } WSABUF, *LPWSABUF;
628 typedef enum
630 BestEffortService,
631 ControlledLoadService,
632 PredictiveService,
633 GuaranteedDelayService,
634 GuaranteedService
635 } GUARANTEE;
637 typedef long int32;
639 typedef struct _flowspec
641 int32 TokenRate;
642 int32 TokenBucketSize;
643 int32 PeakBandwidth;
644 int32 Latency;
645 int32 DelayVariation;
646 GUARANTEE LevelOfGuarantee;
647 int32 CostOfCall;
648 int32 NetworkAvailability;
649 } FLOWSPEC, *LPFLOWSPEC;
651 typedef struct _QualityOfService
653 FLOWSPEC SendingFlowspec;
654 FLOWSPEC ReceivingFlowspec;
655 WSABUF ProviderSpecific;
656 } QOS, *LPQOS;
658 #define CF_ACCEPT 0x0000
659 #define CF_REJECT 0x0001
660 #define CF_DEFER 0x0002
661 #define SD_RECEIVE 0x00
662 #define SD_SEND 0x01
663 #define SD_BOTH 0x02
664 typedef unsigned int GROUP;
666 #define SG_UNCONSTRAINED_GROUP 0x01
667 #define SG_CONSTRAINED_GROUP 0x02
668 typedef struct _WSANETWORKEVENTS {
669 long lNetworkEvents;
670 int iErrorCode[FD_MAX_EVENTS];
671 } WSANETWORKEVENTS, *LPWSANETWORKEVENTS;
673 #define MAX_PROTOCOL_CHAIN 7
675 #define BASE_PROTOCOL 1
676 #define LAYERED_PROTOCOL 0
678 typedef enum _WSAESETSERVICEOP
680 RNRSERVICE_REGISTER=0,
681 RNRSERVICE_DEREGISTER,
682 RNRSERVICE_DELETE
683 } WSAESETSERVICEOP, *PWSAESETSERVICEOP, *LPWSAESETSERVICEOP;
685 typedef struct _AFPROTOCOLS {
686 INT iAddressFamily;
687 INT iProtocol;
688 } AFPROTOCOLS, *PAFPROTOCOLS, *LPAFPROTOCOLS;
691 typedef enum _WSAEcomparator
693 COMP_EQUAL = 0,
694 COMP_NOTLESS
695 } WSAECOMPARATOR, *PWSAECOMPARATOR, *LPWSAECOMPARATOR;
697 typedef struct _WSAVersion
699 DWORD dwVersion;
700 WSAECOMPARATOR ecHow;
701 } WSAVERSION, *PWSAVERSION, *LPWSAVERSION;
704 * nspapi.h has definition of LPCSADDR_INFO, needed in WSAQuery
705 * but itself needs LPSOCKADDR which is defined earlier in this file
707 #include <nspapi.h>
708 #ifndef __BLOB_T_DEFINED /* also in wtypes.h */
709 #define __BLOB_T_DEFINED
710 typedef struct _BLOB {
711 ULONG cbSize;
712 BYTE *pBlobData;
713 } BLOB,*PBLOB,*LPBLOB;
714 #endif
716 typedef struct _WSAQuerySetA
718 DWORD dwSize;
719 LPSTR lpszServiceInstanceName;
720 LPGUID lpServiceClassId;
721 LPWSAVERSION lpVersion;
722 LPSTR lpszComment;
723 DWORD dwNameSpace;
724 LPGUID lpNSProviderId;
725 LPSTR lpszContext;
726 DWORD dwNumberOfProtocols;
727 LPAFPROTOCOLS lpafpProtocols;
728 LPSTR lpszQueryString;
729 DWORD dwNumberOfCsAddrs;
730 LPCSADDR_INFO lpcsaBuffer;
731 DWORD dwOutputFlags;
732 LPBLOB lpBlob;
733 } WSAQUERYSETA, *PWSAQUERYSETA, *LPWSAQUERYSETA;
735 typedef struct _WSAQuerySetW
737 DWORD dwSize;
738 LPWSTR lpszServiceInstanceName;
739 LPGUID lpServiceClassId;
740 LPWSAVERSION lpVersion;
741 LPWSTR lpszComment;
742 DWORD dwNameSpace;
743 LPGUID lpNSProviderId;
744 LPWSTR lpszContext;
745 DWORD dwNumberOfProtocols;
746 LPAFPROTOCOLS lpafpProtocols;
747 LPWSTR lpszQueryString;
748 DWORD dwNumberOfCsAddrs;
749 LPCSADDR_INFO lpcsaBuffer;
750 DWORD dwOutputFlags;
751 LPBLOB lpBlob;
752 } WSAQUERYSETW, *PWSAQUERYSETW, *LPWSAQUERYSETW;
754 #ifdef UNICODE
755 typedef WSAQUERYSETW WSAQUERYSET;
756 typedef PWSAQUERYSETW PWSAQUERYSET;
757 typedef LPWSAQUERYSETW LPWSAQUERYSET;
758 #else
759 typedef WSAQUERYSETA WSAQUERYSET;
760 typedef PWSAQUERYSETA PWSAQUERYSET;
761 typedef LPWSAQUERYSETA LPWSAQUERYSET;
762 #endif
764 typedef struct _WSANSClassInfoA
766 LPSTR lpszName;
767 DWORD dwNameSpace;
768 DWORD dwValueType;
769 DWORD dwValueSize;
770 LPVOID lpValue;
771 } WSANSCLASSINFOA, *PWSANSCLASSINFOA, *LPWSANSCLASSINFOA;
773 typedef struct _WSANSClassInfoW
775 LPWSTR lpszName;
776 DWORD dwNameSpace;
777 DWORD dwValueType;
778 DWORD dwValueSize;
779 LPVOID lpValue;
780 } WSANSCLASSINFOW, *PWSANSCLASSINFOW, *LPWSANSCLASSINFOW;
782 #ifdef UNICODE
783 typedef WSANSCLASSINFOW WSANSCLASSINFO;
784 typedef PWSANSCLASSINFOW PWSANSCLASSINFO;
785 typedef LPWSANSCLASSINFOW LPWSANSCLASSINFO;
786 #else
787 typedef WSANSCLASSINFOA WSANSCLASSINFO;
788 typedef PWSANSCLASSINFOA PWSANSCLASSINFO;
789 typedef LPWSANSCLASSINFOA LPWSANSCLASSINFO;
790 #endif
792 typedef struct _WSAServiceClassInfoA
794 LPGUID lpServiceClassId;
795 LPSTR lpszServiceClassName;
796 DWORD dwCount;
797 LPWSANSCLASSINFOA lpClassInfos;
798 } WSASERVICECLASSINFOA, *PWSASERVICECLASSINFOA, *LPWSASERVICECLASSINFOA;
800 typedef struct _WSAServiceClassInfoW
802 LPGUID lpServiceClassId;
803 LPWSTR lpszServiceClassName;
804 DWORD dwCount;
805 LPWSANSCLASSINFOW lpClassInfos;
806 } WSASERVICECLASSINFOW, *PWSASERVICECLASSINFOW, *LPWSASERVICECLASSINFOW;
808 #ifdef UNICODE
809 typedef WSASERVICECLASSINFOW WSASERVICECLASSINFO;
810 typedef PWSASERVICECLASSINFOW PWSASERVICECLASSINFO;
811 typedef LPWSASERVICECLASSINFOW LPWSASERVICECLASSINFO;
812 #else
813 typedef WSASERVICECLASSINFOA WSASERVICECLASSINFO;
814 typedef PWSASERVICECLASSINFOA PWSASERVICECLASSINFO;
815 typedef LPWSASERVICECLASSINFOA LPWSASERVICECLASSINFO;
816 #endif
818 typedef struct _WSANAMESPACE_INFOA {
819 GUID NSProviderId;
820 DWORD dwNameSpace;
821 BOOL fActive;
822 DWORD dwVersion;
823 LPSTR lpszIdentifier;
824 } WSANAMESPACE_INFOA, *PWSANAMESPACE_INFOA, *LPWSANAMESPACE_INFOA;
826 typedef struct _WSANAMESPACE_INFOW {
827 GUID NSProviderId;
828 DWORD dwNameSpace;
829 BOOL fActive;
830 DWORD dwVersion;
831 LPWSTR lpszIdentifier;
832 } WSANAMESPACE_INFOW, *PWSANAMESPACE_INFOW, *LPWSANAMESPACE_INFOW;
834 #ifdef UNICODE
835 typedef WSANAMESPACE_INFOW WSANAMESPACE_INFO;
836 typedef PWSANAMESPACE_INFOW PWSANAMESPACE_INFO;
837 typedef LPWSANAMESPACE_INFOW LPWSANAMESPACE_INFO;
838 #else
839 typedef WSANAMESPACE_INFOA WSANAMESPACE_INFO;
840 typedef PWSANAMESPACE_INFOA PWSANAMESPACE_INFO;
841 typedef LPWSANAMESPACE_INFOA LPWSANAMESPACE_INFO;
842 #endif
844 typedef struct _WSAPROTOCOLCHAIN {
845 int ChainLen;
846 DWORD ChainEntries[MAX_PROTOCOL_CHAIN];
847 } WSAPROTOCOLCHAIN, *LPWSAPROTOCOLCHAIN;
849 #define WSAPROTOCOL_LEN 255
851 typedef struct _WSAPROTOCOL_INFOA {
852 DWORD dwServiceFlags1;
853 DWORD dwServiceFlags2;
854 DWORD dwServiceFlags3;
855 DWORD dwServiceFlags4;
856 DWORD dwProviderFlags;
857 GUID ProviderId;
858 DWORD dwCatalogEntryId;
859 WSAPROTOCOLCHAIN ProtocolChain;
860 int iVersion;
861 int iAddressFamily;
862 int iMaxSockAddr;
863 int iMinSockAddr;
864 int iSocketType;
865 int iProtocol;
866 int iProtocolMaxOffset;
867 int iNetworkByteOrder;
868 int iSecurityScheme;
869 DWORD dwMessageSize;
870 DWORD dwProviderReserved;
871 CHAR szProtocol[WSAPROTOCOL_LEN+1];
872 } WSAPROTOCOL_INFOA, *LPWSAPROTOCOL_INFOA;
874 typedef struct _WSAPROTOCOL_INFOW {
875 DWORD dwServiceFlags1;
876 DWORD dwServiceFlags2;
877 DWORD dwServiceFlags3;
878 DWORD dwServiceFlags4;
879 DWORD dwProviderFlags;
880 GUID ProviderId;
881 DWORD dwCatalogEntryId;
882 WSAPROTOCOLCHAIN ProtocolChain;
883 int iVersion;
884 int iAddressFamily;
885 int iMaxSockAddr;
886 int iMinSockAddr;
887 int iSocketType;
888 int iProtocol;
889 int iProtocolMaxOffset;
890 int iNetworkByteOrder;
891 int iSecurityScheme;
892 DWORD dwMessageSize;
893 DWORD dwProviderReserved;
894 WCHAR szProtocol[WSAPROTOCOL_LEN+1];
895 } WSAPROTOCOL_INFOW, * LPWSAPROTOCOL_INFOW;
897 typedef int (CALLBACK *LPCONDITIONPROC)(LPWSABUF, LPWSABUF, LPQOS, LPQOS, LPWSABUF, LPWSABUF, GROUP *, DWORD);
898 typedef void (WINAPI *LPWSAOVERLAPPED_COMPLETION_ROUTINE)(DWORD, DWORD, LPWSAOVERLAPPED, DWORD);
901 #ifdef UNICODE
902 typedef WSAPROTOCOL_INFOW WSAPROTOCOL_INFO;
903 typedef LPWSAPROTOCOL_INFOW LPWSAPROTOCOL_INFO;
904 #else
905 typedef WSAPROTOCOL_INFOA WSAPROTOCOL_INFO;
906 typedef LPWSAPROTOCOL_INFOA LPWSAPROTOCOL_INFO;
907 #endif
909 #define PFL_MULTIPLE_PROTO_ENTRIES 0x00000001
910 #define PFL_RECOMMENDED_PROTO_ENTRY 0x00000002
911 #define PFL_HIDDEN 0x00000004
912 #define PFL_MATCHES_PROTOCOL_ZERO 0x00000008
913 #define XP1_CONNECTIONLESS 0x00000001
914 #define XP1_GUARANTEED_DELIVERY 0x00000002
915 #define XP1_GUARANTEED_ORDER 0x00000004
916 #define XP1_MESSAGE_ORIENTED 0x00000008
917 #define XP1_PSEUDO_STREAM 0x00000010
918 #define XP1_GRACEFUL_CLOSE 0x00000020
919 #define XP1_EXPEDITED_DATA 0x00000040
920 #define XP1_CONNECT_DATA 0x00000080
921 #define XP1_DISCONNECT_DATA 0x00000100
922 #define XP1_SUPPORT_BROADCAST 0x00000200
923 #define XP1_SUPPORT_MULTIPOINT 0x00000400
924 #define XP1_MULTIPOINT_CONTROL_PLANE 0x00000800
925 #define XP1_MULTIPOINT_DATA_PLANE 0x00001000
926 #define XP1_QOS_SUPPORTED 0x00002000
927 #define XP1_INTERRUPT 0x00004000
928 #define XP1_UNI_SEND 0x00008000
929 #define XP1_UNI_RECV 0x00010000
930 #define XP1_IFS_HANDLES 0x00020000
931 #define XP1_PARTIAL_MESSAGE 0x00040000
933 #define BIGENDIAN 0x0000
934 #define LITTLEENDIAN 0x0001
936 #define SECURITY_PROTOCOL_NONE 0x0000
937 #define JL_SENDER_ONLY 0x01
938 #define JL_RECEIVER_ONLY 0x02
939 #define JL_BOTH 0x04
940 #define WSA_FLAG_OVERLAPPED 0x01
941 #define WSA_FLAG_MULTIPOINT_C_ROOT 0x02
942 #define WSA_FLAG_MULTIPOINT_C_LEAF 0x04
943 #define WSA_FLAG_MULTIPOINT_D_ROOT 0x08
944 #define WSA_FLAG_MULTIPOINT_D_LEAF 0x10
945 #define IOC_UNIX 0x00000000
946 #define IOC_WS2 0x08000000
947 #define IOC_PROTOCOL 0x10000000
948 #define IOC_VENDOR 0x18000000
950 #define _WSAIO(x,y) (IOC_VOID|(x)|(y))
951 #define _WSAIOR(x,y) (IOC_OUT|(x)|(y))
952 #define _WSAIOW(x,y) (IOC_IN|(x)|(y))
953 #define _WSAIORW(x,y) (IOC_INOUT|(x)|(y))
955 #define SIO_ASSOCIATE_HANDLE _WSAIOW(IOC_WS2,1)
956 #define SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(IOC_WS2,2)
957 #define SIO_FIND_ROUTE _WSAIOR(IOC_WS2,3)
958 #define SIO_FLUSH _WSAIO(IOC_WS2,4)
959 #define SIO_GET_BROADCAST_ADDRESS _WSAIOR(IOC_WS2,5)
960 #define SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(IOC_WS2,6)
961 #define SIO_GET_QOS _WSAIORW(IOC_WS2,7)
962 #define SIO_GET_GROUP_QOS _WSAIORW(IOC_WS2,8)
963 #define SIO_MULTIPOINT_LOOPBACK _WSAIOW(IOC_WS2,9)
964 #define SIO_MULTICAST_SCOPE _WSAIOW(IOC_WS2,10)
965 #define SIO_SET_QOS _WSAIOW(IOC_WS2,11)
966 #define SIO_SET_GROUP_QOS _WSAIOW(IOC_WS2,12)
967 #define SIO_TRANSLATE_HANDLE _WSAIORW(IOC_WS2,13)
968 #define SIO_ROUTING_INTERFACE_QUERY _WSAIORW(IOC_WS2,20)
969 #define SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(IOC_WS2,21)
970 #define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22)
971 #define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23)
972 #define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_WS2,24)
973 #define TH_NETDEV 0x00000001
974 #define TH_TAPI 0x00000002
976 SOCKET WINAPI WSAAccept(SOCKET, struct sockaddr *, LPINT, LPCONDITIONPROC, DWORD);
977 INT WINAPI WSAAddressToStringA(LPSOCKADDR, DWORD, LPWSAPROTOCOL_INFOA, LPSTR, LPDWORD);
978 INT WINAPI WSAAddressToStringW(LPSOCKADDR, DWORD, LPWSAPROTOCOL_INFOW, LPWSTR, LPDWORD);
979 BOOL WINAPI WSACloseEvent(WSAEVENT);
980 int WINAPI WSAConnect(SOCKET, const struct sockaddr *, int, LPWSABUF, LPWSABUF, LPQOS, LPQOS);
981 WSAEVENT WINAPI WSACreateEvent(void);
982 int WINAPI WSADuplicateSocketA(SOCKET, DWORD, LPWSAPROTOCOL_INFOA);
983 int WINAPI WSADuplicateSocketW(SOCKET, DWORD, LPWSAPROTOCOL_INFOW);
984 INT WINAPI WSAEnumNameSpaceProvidersA(LPDWORD, LPWSANAMESPACE_INFOA);
985 INT WINAPI WSAEnumNameSpaceProvidersW(LPDWORD, LPWSANAMESPACE_INFOW);
986 int WINAPI WSAEnumNetworkEvents(SOCKET, WSAEVENT, LPWSANETWORKEVENTS);
987 int WINAPI WSAEnumProtocolsA(LPINT, LPWSAPROTOCOL_INFOA, LPDWORD);
988 int WINAPI WSAEnumProtocolsW(LPINT, LPWSAPROTOCOL_INFOW, LPDWORD);
989 int WINAPI WSAEventSelect(SOCKET, WSAEVENT, long);
990 BOOL WINAPI WSAGetOverlappedResult(SOCKET, LPWSAOVERLAPPED, LPDWORD, BOOL, LPDWORD);
991 BOOL WINAPI WSAGetQOSByName(SOCKET, LPWSABUF, LPQOS);
992 INT WINAPI WSAGetServiceClassInfoA(LPGUID, LPGUID, LPDWORD, LPWSASERVICECLASSINFOA);
993 INT WINAPI WSAGetServiceClassInfoW(LPGUID, LPGUID, LPDWORD, LPWSASERVICECLASSINFOW);
994 INT WINAPI WSAGetServiceClassNameByClassIdA(LPGUID, LPSTR, LPDWORD);
995 INT WINAPI WSAGetServiceClassNameByClassIdW(LPGUID, LPWSTR, LPDWORD);
996 int WINAPI WSAHtonl(SOCKET, unsigned long, unsigned long *);
997 int WINAPI WSAHtons(SOCKET, unsigned short, unsigned short *);
998 INT WINAPI WSAInstallServiceClassA(LPWSASERVICECLASSINFOA);
999 INT WINAPI WSAInstallServiceClassW(LPWSASERVICECLASSINFOW);
1000 int WINAPI WSAIoctl(SOCKET, DWORD, LPVOID, DWORD, LPVOID, DWORD, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1001 SOCKET WINAPI WSAJoinLeaf(SOCKET, const struct sockaddr *, int, LPWSABUF, LPWSABUF, LPQOS, LPQOS, DWORD);
1002 INT WINAPI WSALookupServiceBeginA(LPWSAQUERYSETA, DWORD, LPHANDLE);
1003 INT WINAPI WSALookupServiceBeginW(LPWSAQUERYSETW lpqsRestrictions, DWORD, LPHANDLE);
1004 INT WINAPI WSALookupServiceNextA(HANDLE, DWORD, LPDWORD, LPWSAQUERYSETA);
1005 INT WINAPI WSALookupServiceNextW(HANDLE, DWORD, LPDWORD, LPWSAQUERYSETW);
1006 INT WINAPI WSALookupServiceEnd(HANDLE);
1007 int WINAPI WSANtohl(SOCKET, unsigned long, unsigned long *);
1008 int WINAPI WSANtohs(SOCKET, unsigned short, unsigned short *);
1009 int WINAPI WSARecv(SOCKET, LPWSABUF, DWORD, LPDWORD, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1010 int WINAPI WSARecvDisconnect(SOCKET, LPWSABUF);
1011 int WINAPI WSARecvFrom(SOCKET, LPWSABUF, DWORD, LPDWORD, LPDWORD, struct sockaddr *, LPINT, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1012 INT WINAPI WSARemoveServiceClass(LPGUID);
1013 BOOL WINAPI WSAResetEvent(WSAEVENT);
1014 int WINAPI WSASend(SOCKET, LPWSABUF, DWORD, LPDWORD, DWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1015 int WINAPI WSASendDisconnect(SOCKET, LPWSABUF);
1016 int WINAPI WSASendTo(SOCKET, LPWSABUF, DWORD, LPDWORD, DWORD, const struct sockaddr *, int, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1017 BOOL WINAPI WSASetEvent(WSAEVENT);
1018 INT WSAAPI WSASetServiceA(LPWSAQUERYSETA, WSAESETSERVICEOP, DWORD);
1019 INT WINAPI WSASetServiceW(LPWSAQUERYSETW, WSAESETSERVICEOP, DWORD);
1020 SOCKET WINAPI WSASocketA(int, int, int, LPWSAPROTOCOL_INFOA, GROUP, DWORD);
1021 SOCKET WINAPI WSASocketW(int, int, int, LPWSAPROTOCOL_INFOW, GROUP, DWORD);
1022 INT WINAPI WSAStringToAddressA(LPSTR, INT, LPWSAPROTOCOL_INFOA, LPSOCKADDR, LPINT);
1023 INT WINAPI WSAStringToAddressW(LPWSTR, INT, LPWSAPROTOCOL_INFOW, LPSOCKADDR, LPINT);
1024 DWORD WINAPI WSAWaitForMultipleEvents(DWORD, const WSAEVENT *, BOOL, DWORD, BOOL);
1026 typedef SOCKET (WINAPI *LPFN_WSAACCEPT)(SOCKET, struct sockaddr *, LPINT, LPCONDITIONPROC, DWORD);
1027 typedef INT (WINAPI *LPFN_WSAADDRESSTOSTRINGA)(LPSOCKADDR, DWORD, LPWSAPROTOCOL_INFOA, LPSTR, LPDWORD);
1028 typedef INT (WINAPI *LPFN_WSAADDRESSTOSTRINGW)(LPSOCKADDR, DWORD, LPWSAPROTOCOL_INFOW, LPWSTR, LPDWORD);
1029 typedef BOOL (WINAPI *LPFN_WSACLOSEEVENT)(WSAEVENT);
1030 typedef int (WINAPI *LPFN_WSACONNECT)(SOCKET, const struct sockaddr *, int, LPWSABUF, LPWSABUF, LPQOS, LPQOS);
1031 typedef WSAEVENT (WINAPI *LPFN_WSACREATEEVENT)(void);
1032 typedef int (WINAPI *LPFN_WSADUPLICATESOCKETA)(SOCKET, DWORD, LPWSAPROTOCOL_INFOA);
1033 typedef int (WINAPI *LPFN_WSADUPLICATESOCKETW)(SOCKET, DWORD, LPWSAPROTOCOL_INFOW);
1034 typedef INT (WINAPI *LPFN_WSAENUMNAMESPACEPROVIDERSA)(LPDWORD, LPWSANAMESPACE_INFOA);
1035 typedef INT (WINAPI *LPFN_WSAENUMNAMESPACEPROVIDERSW)(LPDWORD, LPWSANAMESPACE_INFOW);
1036 typedef int (WINAPI *LPFN_WSAENUMNETWORKEVENTS)(SOCKET, WSAEVENT, LPWSANETWORKEVENTS);
1037 typedef int (WINAPI *LPFN_WSAENUMPROTOCOLSA)(LPINT, LPWSAPROTOCOL_INFOA, LPDWORD);
1038 typedef int (WINAPI *LPFN_WSAENUMPROTOCOLSW)(LPINT, LPWSAPROTOCOL_INFOW, LPDWORD);
1039 typedef int (WINAPI *LPFN_WSAEVENTSELECT)(SOCKET, WSAEVENT, long);
1040 typedef BOOL (WINAPI *LPFN_WSAGETOVERLAPPEDRESULT)(SOCKET, LPWSAOVERLAPPED, LPDWORD, BOOL, LPDWORD);
1041 typedef BOOL (WINAPI *LPFN_WSAGETQOSBYNAME)(SOCKET, LPWSABUF, LPQOS);
1042 typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSINFOA)(LPGUID, LPGUID, LPDWORD, LPWSASERVICECLASSINFOA);
1043 typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSINFOW)(LPGUID, LPGUID, LPDWORD, LPWSASERVICECLASSINFOW);
1044 typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA)(LPGUID, LPSTR, LPDWORD);
1045 typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW)(LPGUID, LPWSTR, LPDWORD);
1046 typedef int (WINAPI *LPFN_WSAHTONL)(SOCKET, unsigned long, unsigned long *);
1047 typedef int (WINAPI *LPFN_WSAHTONS)(SOCKET, unsigned short, unsigned short *);
1048 typedef INT (WINAPI *LPFN_WSAINSTALLSERVICECLASSA)(LPWSASERVICECLASSINFOA);
1049 typedef INT (WINAPI *LPFN_WSAINSTALLSERVICECLASSW)(LPWSASERVICECLASSINFOW);
1050 typedef int (WINAPI *LPFN_WSAIOCTL)(SOCKET, DWORD, LPVOID, DWORD, LPVOID, DWORD, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1051 typedef SOCKET (WINAPI *LPFN_WSAJOINLEAF)(SOCKET, const struct sockaddr *, int, LPWSABUF, LPWSABUF, LPQOS, LPQOS, DWORD);
1052 typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEBEGINA)(LPWSAQUERYSETA, DWORD, LPHANDLE);
1053 typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEBEGINW)(LPWSAQUERYSETW, DWORD, LPHANDLE);
1054 typedef INT (WINAPI *LPFN_WSALOOKUPSERVICENEXTA)(HANDLE, DWORD, LPDWORD, LPWSAQUERYSETA);
1055 typedef INT (WINAPI *LPFN_WSALOOKUPSERVICENEXTW)(HANDLE, DWORD, LPDWORD, LPWSAQUERYSETW);
1056 typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEEND)(HANDLE);
1057 typedef int (WINAPI *LPFN_WSANTOHL)(SOCKET, unsigned long, unsigned long *);
1058 typedef int (WINAPI *LPFN_WSANTOHS)(SOCKET, unsigned short, unsigned short *);
1059 typedef int (WINAPI *LPFN_WSARECV)(SOCKET, LPWSABUF, DWORD, LPDWORD, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1060 typedef int (WINAPI *LPFN_WSARECVDISCONNECT)(SOCKET, LPWSABUF);
1061 typedef int (WINAPI *LPFN_WSARECVFROM)(SOCKET, LPWSABUF, DWORD, LPDWORD, LPDWORD, struct sockaddr *, LPINT, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1062 typedef INT (WINAPI *LPFN_WSAREMOVESERVICECLASS)(LPGUID);
1063 typedef BOOL (WINAPI *LPFN_WSARESETEVENT)(WSAEVENT);
1064 typedef int (WINAPI *LPFN_WSASEND)(SOCKET, LPWSABUF, DWORD, LPDWORD, DWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1065 typedef int (WINAPI *LPFN_WSASENDDISCONNECT)(SOCKET, LPWSABUF);
1066 typedef int (WINAPI *LPFN_WSASENDTO)(SOCKET, LPWSABUF, DWORD, LPDWORD, DWORD, const struct sockaddr *, int, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1067 typedef BOOL (WINAPI *LPFN_WSASETEVENT)(WSAEVENT);
1068 typedef INT (WINAPI *LPFN_WSASETSERVICEA)(LPWSAQUERYSETA, WSAESETSERVICEOP, DWORD);
1069 typedef INT (WINAPI *LPFN_WSASETSERVICEW)(LPWSAQUERYSETW, WSAESETSERVICEOP, DWORD);
1070 typedef SOCKET (WINAPI *LPFN_WSASOCKETA)(int, int, int, LPWSAPROTOCOL_INFOA, GROUP, DWORD);
1071 typedef SOCKET (WINAPI *LPFN_WSASOCKETW)(int, int, int, LPWSAPROTOCOL_INFOW, GROUP, DWORD);
1072 typedef INT (WINAPI *LPFN_WSASTRINGTOADDRESSA)(LPSTR, INT, LPWSAPROTOCOL_INFOA, LPSOCKADDR, LPINT);
1073 typedef INT (WINAPI *LPFN_WSASTRINGTOADDRESSW)(LPWSTR, INT, LPWSAPROTOCOL_INFOW, LPSOCKADDR, LPINT);
1074 typedef DWORD (WINAPI *LPFN_WSAWAITFORMULTIPLEEVENTS)(DWORD, const WSAEVENT *, BOOL, DWORD, BOOL);
1076 #ifdef UNICODE
1077 #define LPFN_WSAADDRESSTOSTRING LPFN_WSAADDRESSTOSTRINGW
1078 #define LPFN_WSADUPLICATESOCKET LPFN_WSADUPLICATESOCKETW
1079 #define LPFN_WSAENUMNAMESPACEPROVIDERS LPFN_WSAENUMNAMESPACEPROVIDERSW
1080 #define LPFN_WSAENUMPROTOCOLS LPFN_WSAENUMPROTOCOLSW
1081 #define LPFN_WSAGETSERVICECLASSINFO LPFN_WSAGETSERVICECLASSINFOW
1082 #define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW
1083 #define LPFN_WSAINSTALLSERVICECLASS LPFN_WSAINSTALLSERVICECLASSW
1084 #define LPFN_WSALOOKUPSERVICEBEGIN LPFN_WSALOOKUPSERVICEBEGINW
1085 #define LPFN_WSALOOKUPSERVICENEXT LPFN_WSALOOKUPSERVICENEXTW
1086 #define LPFN_WSASETSERVICE LPFN_WSASETSERVICEW
1087 #define LPFN_WSASOCKET LPFN_WSASOCKETW
1088 #define LPFN_WSASTRINGTOADDRESS LPFN_WSASTRINGTOADDRESSW
1089 #define WSAAddressToString WSAAddressToStringW
1090 #define WSADuplicateSocket WSADuplicateSocketW
1091 #define WSAEnumNameSpaceProviders WSAEnumNameSpaceProvidersW
1092 #define WSAEnumProtocols WSAEnumProtocolsW
1093 #define WSAGetServiceClassInfo WSAGetServiceClassInfoW
1094 #define WSAGetServiceClassNameByClassId WSAGetServiceClassNameByClassIdW
1095 #define WSASetService WSASetServiceW
1096 #define WSASocket WSASocketW
1097 #define WSAStringToAddress WSAStringToAddressW
1098 #define WSALookupServiceBegin WSALookupServiceBeginW
1099 #define WSALookupServiceNext WSALookupServiceNextW
1100 #define WSAInstallServiceClass WSAInstallServiceClassW
1101 #else
1102 #define LPFN_WSAADDRESSTOSTRING LPFN_WSAADDRESSTOSTRINGA
1103 #define LPFN_WSADUPLICATESOCKET LPFN_WSADUPLICATESOCKETW
1104 #define LPFN_WSAENUMNAMESPACEPROVIDERS LPFN_WSAENUMNAMESPACEPROVIDERSA
1105 #define LPFN_WSAENUMPROTOCOLS LPFN_WSAENUMPROTOCOLSA
1106 #define LPFN_WSAGETSERVICECLASSINFO LPFN_WSAGETSERVICECLASSINFOA
1107 #define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA
1108 #define LPFN_WSAINSTALLSERVICECLASS LPFN_WSAINSTALLSERVICECLASSA
1109 #define LPFN_WSALOOKUPSERVICEBEGIN LPFN_WSALOOKUPSERVICEBEGINA
1110 #define LPFN_WSALOOKUPSERVICENEXT LPFN_WSALOOKUPSERVICENEXTA
1111 #define LPFN_WSASETSERVICE LPFN_WSASETSERVICEA
1112 #define LPFN_WSASOCKET LPFN_WSASOCKETA
1113 #define LPFN_WSASTRINGTOADDRESS LPFN_WSASTRINGTOADDRESSA
1114 #define WSAAddressToString WSAAddressToStringA
1115 #define WSADuplicateSocket WSADuplicateSocketA
1116 #define WSAEnumNameSpaceProviders WSAEnumNameSpaceProvidersA
1117 #define WSAEnumProtocols WSAEnumProtocolsA
1118 #define WSAGetServiceClassInfo WSAGetServiceClassInfoA
1119 #define WSAGetServiceClassNameByClassId WSAGetServiceClassNameByClassIdA
1120 #define WSAInstallServiceClass WSAInstallServiceClassA
1121 #define WSALookupServiceBegin WSALookupServiceBeginA
1122 #define WSALookupServiceNext WSALookupServiceNextA
1123 #define WSASocket WSASocketA
1124 #define WSAStringToAddress WSAStringToAddressA
1125 #define WSASetService WSASetServiceA
1126 #endif
1128 #ifdef __cplusplus
1130 #endif
1131 #endif