source: Daodan/MinGW/include/winsock2.h@ 1112

Last change on this file since 1112 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 48.5 KB
Line 
1/*
2
3 Definitions for winsock 2
4
5 Contributed by the WINE project.
6
7 Portions Copyright (c) 1980, 1983, 1988, 1993
8 The Regents of the University of California. All rights reserved.
9
10 Portions Copyright (c) 1993 by Digital Equipment Corporation.
11 */
12
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
19
20#define _GNU_H_WINDOWS32_SOCKETS
21
22#include <windows.h>
23
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
31
32#ifdef __cplusplus
33extern "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 */
38typedef unsigned char u_char;
39typedef unsigned short u_short;
40typedef unsigned int u_int;
41typedef unsigned long u_long;
42#define _BSDTYPES_DEFINED
43#endif /* ! def _BSDTYPES_DEFINED */
44typedef u_int SOCKET;
45#ifndef FD_SETSIZE
46#define FD_SETSIZE 64
47#endif
48
49/* shutdown() how types */
50#define SD_RECEIVE 0x00
51#define SD_SEND 0x01
52#define SD_BOTH 0x02
53
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.
57 */
58#ifdef fd_set
59#undef fd_set
60#endif
61typedef struct fd_set {
62 u_int fd_count;
63 SOCKET fd_array[FD_SETSIZE];
64} fd_set;
65int PASCAL __WSAFDIsSet(SOCKET,fd_set*);
66#ifndef FD_CLR
67#define FD_CLR(fd,set) do { u_int __i;\
68for (__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++;\
73 }\
74 ((fd_set*)(set))->fd_count--;\
75 break;\
76 }\
77}\
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;\
83for (__i = 0; __i < ((fd_set *)(set))->fd_count ; __i++) {\
84 if (((fd_set *)(set))->fd_array[__i] == (fd)) {\
85 break;\
86 }\
87}\
88if (__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++;\
92 }\
93}\
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
109struct timeval {
110 long tv_sec;
111 long tv_usec;
112};
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 */
120struct 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]
127};
128struct linger {
129 u_short l_onoff;
130 u_short l_linger;
131};
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)
138
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__) */
145
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)
153
154#if ! (defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
155struct netent {
156 char * n_name;
157 char **n_aliases;
158 short n_addrtype;
159 u_long n_net;
160};
161struct servent {
162 char *s_name;
163 char **s_aliases;
164 short s_port;
165 char *s_proto;
166};
167struct protoent {
168 char *p_name;
169 char **p_aliases;
170 short p_proto;
171};
172#endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
173
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
223struct 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
235};
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
254struct sockaddr_in {
255 short sin_family;
256 u_short sin_port;
257 struct in_addr sin_addr;
258 char sin_zero[8];
259};
260#define WSADESCRIPTION_LEN 256
261#define WSASYS_STATUS_LEN 128
262typedef 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;
271typedef WSADATA *LPWSADATA;
272
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__) */
295
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#ifndef __INSIDE_MSYS__
335#define AF_MAX 29
336struct sockaddr {
337 u_short sa_family;
338 char sa_data[14];
339};
340
341/* Portable IPv6/IPv4 version of sockaddr. Based on RFC 2553.
342 Pad to force 8 byte alignment and maximum size of 128 bytes. */
343
344/*
345 * Desired design of maximum size and alignment
346 */
347#define _SS_MAXSIZE 128
348#define _SS_ALIGNSIZE (sizeof (__int64))
349/*
350 * Definitions used for sockaddr_storage structure paddings design.
351 */
352#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof (short))
353#define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (short) \
354 + _SS_PAD1SIZE \
355 + _SS_ALIGNSIZE))
356struct 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 */
361};
362#endif /* !__INSIDE_MSYS__ */
363
364struct sockproto {
365 u_short sp_family;
366 u_short sp_protocol;
367};
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
404
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)
428
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)
482
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)
495
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)
524
525#endif /* !WSABASEERR */
526
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__) */
536WINSOCK_API_LINKAGE SOCKET PASCAL accept(SOCKET,struct sockaddr*,int*);
537WINSOCK_API_LINKAGE int PASCAL bind(SOCKET,const struct sockaddr*,int);
538WINSOCK_API_LINKAGE int PASCAL closesocket(SOCKET);
539WINSOCK_API_LINKAGE int PASCAL connect(SOCKET,const struct sockaddr*,int);
540WINSOCK_API_LINKAGE int PASCAL ioctlsocket(SOCKET,long,u_long *);
541WINSOCK_API_LINKAGE int PASCAL getpeername(SOCKET,struct sockaddr*,int*);
542WINSOCK_API_LINKAGE int PASCAL getsockname(SOCKET,struct sockaddr*,int*);
543WINSOCK_API_LINKAGE int PASCAL getsockopt(SOCKET,int,int,char*,int*);
544WINSOCK_API_LINKAGE unsigned long PASCAL inet_addr(const char*);
545WINSOCK_API_LINKAGE DECLARE_STDCALL_P(char *) inet_ntoa(struct in_addr);
546WINSOCK_API_LINKAGE int PASCAL listen(SOCKET,int);
547WINSOCK_API_LINKAGE int PASCAL recv(SOCKET,char*,int,int);
548WINSOCK_API_LINKAGE int PASCAL recvfrom(SOCKET,char*,int,int,struct sockaddr*,int*);
549WINSOCK_API_LINKAGE int PASCAL send(SOCKET,const char*,int,int);
550WINSOCK_API_LINKAGE int PASCAL sendto(SOCKET,const char*,int,int,const struct sockaddr*,int);
551WINSOCK_API_LINKAGE int PASCAL setsockopt(SOCKET,int,int,const char*,int);
552WINSOCK_API_LINKAGE int PASCAL shutdown(SOCKET,int);
553WINSOCK_API_LINKAGE SOCKET PASCAL socket(int,int,int);
554WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct hostent *) gethostbyaddr(const char*,int,int);
555WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct hostent *) gethostbyname(const char*);
556WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct servent *) getservbyport(int,const char*);
557WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct servent *) getservbyname(const char*,const char*);
558WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct protoent *) getprotobynumber(int);
559WINSOCK_API_LINKAGE DECLARE_STDCALL_P(struct protoent *) getprotobyname(const char*);
560typedef SOCKET (PASCAL * LPFN_ACCEPT)(SOCKET, struct sockaddr*,int *);
561typedef int (PASCAL * LPFN_BIND)(SOCKET, const struct sockaddr*,int);
562typedef int (PASCAL * LPFN_CLOSESOCKET)(SOCKET);
563typedef int (PASCAL * LPFN_CONNECT)(SOCKET, const struct sockaddr*,int);
564typedef int (PASCAL * LPFN_IOCTLSOCKET)(SOCKET, long, u_long*);
565typedef int (PASCAL * LPFN_GETPEERNAME)(SOCKET, struct sockaddr*, int*);
566typedef int(PASCAL * LPFN_GETSOCKNAME)(SOCKET, struct sockaddr*, int*);
567typedef int(PASCAL * LPFN_GETSOCKOPT)(SOCKET, int, int, char*, int*);
568typedef u_long(PASCAL * LPFN_HTONL)(u_long);
569typedef u_short(PASCAL * LPFN_HTONS)(u_short);
570typedef unsigned long(PASCAL * LPFN_INET_ADDR)(const char*);
571typedef char*(PASCAL * LPFN_INET_NTOA)(struct in_addr);
572typedef int(PASCAL * LPFN_LISTEN)(SOCKET, int);
573typedef u_long(PASCAL * LPFN_NTOHL)(u_long);
574typedef u_short(PASCAL * LPFN_NTOHS)(u_short);
575typedef int(PASCAL * LPFN_RECV)(SOCKET, char*, int, int);
576typedef int(PASCAL * LPFN_RECVFROM)(SOCKET, char*, int, int, struct sockaddr*, int*);
577typedef int(PASCAL * LPFN_SELECT)(int, fd_set*, fd_set*, fd_set*, const struct timeval*);
578typedef int(PASCAL * LPFN_SEND)(SOCKET, const char*, int, int);
579typedef int(PASCAL * LPFN_SENDTO)(SOCKET, const char*, int, int, const struct sockaddr*, int);
580typedef int(PASCAL * LPFN_SETSOCKOPT)(SOCKET, int, int, const char*, int);
581typedef int(PASCAL * LPFN_SHUTDOWN)(SOCKET, int);
582typedef SOCKET(PASCAL * LPFN_SOCKET)(int, int, int);
583typedef struct hostent*(PASCAL * LPFN_GETHOSTBYADDR)( const char*, int, int);
584typedef struct hostent*(PASCAL * LPFN_GETHOSTBYNAME)( const char*);
585typedef int(PASCAL * LPFN_GETHOSTNAME)(char*, int);
586typedef struct servent*(PASCAL * LPFN_GETSERVBYPORT)(int, const char*);
587typedef struct servent*(PASCAL * LPFN_GETSERVBYNAME)(const char*, const char*);
588typedef struct protoent*(PASCAL * LPFN_GETPROTOBYNUMBER)(int);
589typedef struct protoent*(PASCAL * LPFN_GETPROTOBYNAME)(const char*);
590
591WINSOCK_API_LINKAGE int PASCAL WSAStartup(WORD,LPWSADATA);
592WINSOCK_API_LINKAGE int PASCAL WSACleanup(void);
593WINSOCK_API_LINKAGE void PASCAL WSASetLastError(int);
594WINSOCK_API_LINKAGE int PASCAL WSAGetLastError(void);
595WINSOCK_API_LINKAGE typedef int(PASCAL * LPFN_WSASTARTUP)(WORD, LPWSADATA);
596typedef int(PASCAL * LPFN_WSACLEANUP)(void);
597typedef void(PASCAL * LPFN_WSASETLASTERROR)(int);
598typedef int(PASCAL * LPFN_WSAGETLASTERROR)(void);
599/*
600 * Pseudo-blocking functions are deprecated in WinSock2
601 * spec. Use threads instead.
602 */
603WINSOCK_API_LINKAGE BOOL PASCAL WSAIsBlocking(void);
604WINSOCK_API_LINKAGE int PASCAL WSAUnhookBlockingHook(void);
605WINSOCK_API_LINKAGE FARPROC PASCAL WSASetBlockingHook(FARPROC);
606WINSOCK_API_LINKAGE int PASCAL WSACancelBlockingCall(void);
607typedef BOOL(PASCAL * LPFN_WSAISBLOCKING)(void);
608typedef int(PASCAL * LPFN_WSAUNHOOKBLOCKINGHOOK)(void);
609typedef FARPROC (PASCAL * LPFN_WSASETBLOCKINGHOOK)(FARPROC);
610typedef int(PASCAL * LPFN_WSACANCELBLOCKINGCALL)(void);
611
612WINSOCK_API_LINKAGE HANDLE PASCAL WSAAsyncGetServByName(HWND,u_int,const char*,const char*,char*,int);
613WINSOCK_API_LINKAGE HANDLE PASCAL WSAAsyncGetServByPort(HWND,u_int,int,const char*,char*,int);
614WINSOCK_API_LINKAGE HANDLE PASCAL WSAAsyncGetProtoByName(HWND,u_int,const char*,char*,int);
615WINSOCK_API_LINKAGE HANDLE PASCAL WSAAsyncGetProtoByNumber(HWND,u_int,int,char*,int);
616WINSOCK_API_LINKAGE HANDLE PASCAL WSAAsyncGetHostByName(HWND,u_int,const char*,char*,int);
617WINSOCK_API_LINKAGE HANDLE PASCAL WSAAsyncGetHostByAddr(HWND,u_int,const char*,int,int,char*,int);
618WINSOCK_API_LINKAGE int PASCAL WSACancelAsyncRequest(HANDLE);
619WINSOCK_API_LINKAGE int PASCAL WSAAsyncSelect(SOCKET,HWND,u_int,long);
620typedef HANDLE(PASCAL * LPFN_WSAASYNCGETSERVBYNAME)(HWND, u_int, const char *, const char *, char *, int);
621typedef HANDLE(PASCAL * LPFN_WSAASYNCGETSERVBYPORT)(HWND, u_int, int, const char *, char *, int);
622typedef HANDLE(PASCAL * LPFN_WSAASYNCGETPROTOBYNAME)(HWND, u_int, const char*, char*, int);
623typedef HANDLE(PASCAL * LPFN_WSAASYNCGETPROTOBYNUMBER)(HWND, u_int, int, char*, int);
624typedef HANDLE(PASCAL * LPFN_WSAASYNCGETHOSTBYADDR)(HWND, u_int, const char*, int, int, char*, int);
625typedef int(PASCAL * LPFN_WSACANCELASYNCREQUEST)(HANDLE);
626typedef int(PASCAL * LPFN_WSAASYNCSELECT)(SOCKET, HWND, u_int, long);
627#if ! (defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
628WINSOCK_API_LINKAGE u_long PASCAL htonl(u_long);
629WINSOCK_API_LINKAGE u_long PASCAL ntohl(u_long);
630WINSOCK_API_LINKAGE u_short PASCAL htons(u_short);
631WINSOCK_API_LINKAGE u_short PASCAL ntohs(u_short);
632WINSOCK_API_LINKAGE int PASCAL select(int nfds,fd_set*,fd_set*,fd_set*,const struct timeval*);
633#endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
634
635int PASCAL gethostname(char*,int);
636
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)
643
644typedef struct sockaddr SOCKADDR;
645typedef struct sockaddr *PSOCKADDR;
646typedef struct sockaddr *LPSOCKADDR;
647typedef struct sockaddr_storage SOCKADDR_STORAGE, *PSOCKADDR_STORAGE;
648typedef struct sockaddr_in SOCKADDR_IN;
649typedef struct sockaddr_in *PSOCKADDR_IN;
650typedef struct sockaddr_in *LPSOCKADDR_IN;
651typedef struct linger LINGER;
652typedef struct linger *PLINGER;
653typedef struct linger *LPLINGER;
654typedef struct in_addr IN_ADDR;
655typedef struct in_addr *PIN_ADDR;
656typedef struct in_addr *LPIN_ADDR;
657typedef struct fd_set FD_SET;
658typedef struct fd_set *PFD_SET;
659typedef struct fd_set *LPFD_SET;
660typedef struct hostent HOSTENT;
661typedef struct hostent *PHOSTENT;
662typedef struct hostent *LPHOSTENT;
663typedef struct servent SERVENT;
664typedef struct servent *PSERVENT;
665typedef struct servent *LPSERVENT;
666typedef struct protoent PROTOENT;
667typedef struct protoent *PPROTOENT;
668typedef struct protoent *LPPROTOENT;
669typedef struct timeval TIMEVAL;
670typedef struct timeval *PTIMEVAL;
671typedef struct timeval *LPTIMEVAL;
672
673/* winsock2 additions */
674#define ADDR_ANY INADDR_ANY
675
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)
681
682#define FROM_PROTOCOL_INFO (-1)
683
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
696
697#define MSG_INTERRUPT 0x10
698#define MSG_MAXIOVLEN 16
699
700#define WSAAPI WINAPI
701#define WSAEVENT HANDLE
702#define LPWSAEVENT LPHANDLE
703#define WSAOVERLAPPED OVERLAPPED
704typedef struct _OVERLAPPED *LPWSAOVERLAPPED;
705
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)
712
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)
720
721typedef struct _WSABUF {
722 unsigned long len;
723 char *buf;
724} WSABUF, *LPWSABUF;
725
726typedef enum
727{
728 BestEffortService,
729 ControlledLoadService,
730 PredictiveService,
731 GuaranteedDelayService,
732 GuaranteedService
733} GUARANTEE;
734
735/* TODO: FLOWSPEC and related definitions belong in qos.h */
736
737/*
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.
743*/
744
745typedef unsigned int SERVICETYPE;
746typedef struct _flowspec
747{
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;
757
758typedef struct _QualityOfService
759{
760 FLOWSPEC SendingFlowspec;
761 FLOWSPEC ReceivingFlowspec;
762 WSABUF ProviderSpecific;
763} QOS, *LPQOS;
764
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
771typedef unsigned int GROUP;
772
773#define SG_UNCONSTRAINED_GROUP 0x01
774#define SG_CONSTRAINED_GROUP 0x02
775typedef struct _WSANETWORKEVENTS {
776 long lNetworkEvents;
777 int iErrorCode[FD_MAX_EVENTS];
778} WSANETWORKEVENTS, *LPWSANETWORKEVENTS;
779
780#define MAX_PROTOCOL_CHAIN 7
781
782#define BASE_PROTOCOL 1
783#define LAYERED_PROTOCOL 0
784
785typedef enum _WSAESETSERVICEOP
786{
787 RNRSERVICE_REGISTER=0,
788 RNRSERVICE_DEREGISTER,
789 RNRSERVICE_DELETE
790} WSAESETSERVICEOP, *PWSAESETSERVICEOP, *LPWSAESETSERVICEOP;
791
792typedef struct _AFPROTOCOLS {
793 INT iAddressFamily;
794 INT iProtocol;
795} AFPROTOCOLS, *PAFPROTOCOLS, *LPAFPROTOCOLS;
796
797typedef enum _WSAEcomparator
798{
799 COMP_EQUAL = 0,
800 COMP_NOTLESS
801} WSAECOMPARATOR, *PWSAECOMPARATOR, *LPWSAECOMPARATOR;
802
803typedef struct _WSAVersion
804{
805 DWORD dwVersion;
806 WSAECOMPARATOR ecHow;
807} WSAVERSION, *PWSAVERSION, *LPWSAVERSION;
808
809#ifndef __CSADDR_T_DEFINED /* also in nspapi.h */
810#define __CSADDR_T_DEFINED
811typedef struct _SOCKET_ADDRESS {
812 LPSOCKADDR lpSockaddr;
813 INT iSockaddrLength;
814} SOCKET_ADDRESS,*PSOCKET_ADDRESS,*LPSOCKET_ADDRESS;
815typedef 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
822
823typedef struct _SOCKET_ADDRESS_LIST {
824 INT iAddressCount;
825 SOCKET_ADDRESS Address[1];
826} SOCKET_ADDRESS_LIST, * LPSOCKET_ADDRESS_LIST;
827
828#ifndef __BLOB_T_DEFINED /* also in wtypes.h and nspapi.h */
829#define __BLOB_T_DEFINED
830typedef struct _BLOB {
831 ULONG cbSize;
832 BYTE *pBlobData;
833} BLOB,*PBLOB,*LPBLOB;
834#endif
835
836typedef struct _WSAQuerySetA
837{
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;
854
855typedef struct _WSAQuerySetW
856{
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;
873
874#ifdef UNICODE
875typedef WSAQUERYSETW WSAQUERYSET;
876typedef PWSAQUERYSETW PWSAQUERYSET;
877typedef LPWSAQUERYSETW LPWSAQUERYSET;
878#else
879typedef WSAQUERYSETA WSAQUERYSET;
880typedef PWSAQUERYSETA PWSAQUERYSET;
881typedef LPWSAQUERYSETA LPWSAQUERYSET;
882#endif
883
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
900
901typedef struct _WSANSClassInfoA
902{
903 LPSTR lpszName;
904 DWORD dwNameSpace;
905 DWORD dwValueType;
906 DWORD dwValueSize;
907 LPVOID lpValue;
908} WSANSCLASSINFOA, *PWSANSCLASSINFOA, *LPWSANSCLASSINFOA;
909
910typedef struct _WSANSClassInfoW
911{
912 LPWSTR lpszName;
913 DWORD dwNameSpace;
914 DWORD dwValueType;
915 DWORD dwValueSize;
916 LPVOID lpValue;
917} WSANSCLASSINFOW, *PWSANSCLASSINFOW, *LPWSANSCLASSINFOW;
918
919#ifdef UNICODE
920typedef WSANSCLASSINFOW WSANSCLASSINFO;
921typedef PWSANSCLASSINFOW PWSANSCLASSINFO;
922typedef LPWSANSCLASSINFOW LPWSANSCLASSINFO;
923#else
924typedef WSANSCLASSINFOA WSANSCLASSINFO;
925typedef PWSANSCLASSINFOA PWSANSCLASSINFO;
926typedef LPWSANSCLASSINFOA LPWSANSCLASSINFO;
927#endif
928
929typedef struct _WSAServiceClassInfoA
930{
931 LPGUID lpServiceClassId;
932 LPSTR lpszServiceClassName;
933 DWORD dwCount;
934 LPWSANSCLASSINFOA lpClassInfos;
935} WSASERVICECLASSINFOA, *PWSASERVICECLASSINFOA, *LPWSASERVICECLASSINFOA;
936
937typedef struct _WSAServiceClassInfoW
938{
939 LPGUID lpServiceClassId;
940 LPWSTR lpszServiceClassName;
941 DWORD dwCount;
942 LPWSANSCLASSINFOW lpClassInfos;
943} WSASERVICECLASSINFOW, *PWSASERVICECLASSINFOW, *LPWSASERVICECLASSINFOW;
944
945#ifdef UNICODE
946typedef WSASERVICECLASSINFOW WSASERVICECLASSINFO;
947typedef PWSASERVICECLASSINFOW PWSASERVICECLASSINFO;
948typedef LPWSASERVICECLASSINFOW LPWSASERVICECLASSINFO;
949#else
950typedef WSASERVICECLASSINFOA WSASERVICECLASSINFO;
951typedef PWSASERVICECLASSINFOA PWSASERVICECLASSINFO;
952typedef LPWSASERVICECLASSINFOA LPWSASERVICECLASSINFO;
953#endif
954
955typedef 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;
962
963typedef 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;
970
971#ifdef UNICODE
972typedef WSANAMESPACE_INFOW WSANAMESPACE_INFO;
973typedef PWSANAMESPACE_INFOW PWSANAMESPACE_INFO;
974typedef LPWSANAMESPACE_INFOW LPWSANAMESPACE_INFO;
975#else
976typedef WSANAMESPACE_INFOA WSANAMESPACE_INFO;
977typedef PWSANAMESPACE_INFOA PWSANAMESPACE_INFO;
978typedef LPWSANAMESPACE_INFOA LPWSANAMESPACE_INFO;
979#endif
980
981typedef struct _WSAPROTOCOLCHAIN {
982 int ChainLen;
983 DWORD ChainEntries[MAX_PROTOCOL_CHAIN];
984} WSAPROTOCOLCHAIN, *LPWSAPROTOCOLCHAIN;
985
986#define WSAPROTOCOL_LEN 255
987
988typedef 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;
1010
1011typedef 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;
1033
1034typedef int (CALLBACK *LPCONDITIONPROC)(LPWSABUF, LPWSABUF, LPQOS, LPQOS, LPWSABUF, LPWSABUF, GROUP *, DWORD);
1035typedef void (WINAPI *LPWSAOVERLAPPED_COMPLETION_ROUTINE)(DWORD, DWORD, LPWSAOVERLAPPED, DWORD);
1036
1037
1038#ifdef UNICODE
1039typedef WSAPROTOCOL_INFOW WSAPROTOCOL_INFO;
1040typedef LPWSAPROTOCOL_INFOW LPWSAPROTOCOL_INFO;
1041#else
1042typedef WSAPROTOCOL_INFOA WSAPROTOCOL_INFO;
1043typedef LPWSAPROTOCOL_INFOA LPWSAPROTOCOL_INFO;
1044#endif
1045
1046/* Needed for XP & .NET Server function WSANSPIoctl. */
1047typedef 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;
1054typedef 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;
1076
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
1100
1101#define BIGENDIAN 0x0000
1102#define LITTLEENDIAN 0x0001
1103
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
1117
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))
1122
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)
1142#define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12)
1143
1144#define TH_NETDEV 0x00000001
1145#define TH_TAPI 0x00000002
1146
1147WINSOCK_API_LINKAGE SOCKET WINAPI WSAAccept(SOCKET, struct sockaddr *, LPINT, LPCONDITIONPROC, DWORD);
1148WINSOCK_API_LINKAGE INT WINAPI WSAAddressToStringA(LPSOCKADDR, DWORD, LPWSAPROTOCOL_INFOA, LPSTR, LPDWORD);
1149WINSOCK_API_LINKAGE INT WINAPI WSAAddressToStringW(LPSOCKADDR, DWORD, LPWSAPROTOCOL_INFOW, LPWSTR, LPDWORD);
1150WINSOCK_API_LINKAGE BOOL WINAPI WSACloseEvent(WSAEVENT);
1151WINSOCK_API_LINKAGE int WINAPI WSAConnect(SOCKET, const struct sockaddr *, int, LPWSABUF, LPWSABUF, LPQOS, LPQOS);
1152WINSOCK_API_LINKAGE WSAEVENT WINAPI WSACreateEvent(void);
1153WINSOCK_API_LINKAGE int WINAPI WSADuplicateSocketA(SOCKET, DWORD, LPWSAPROTOCOL_INFOA);
1154WINSOCK_API_LINKAGE int WINAPI WSADuplicateSocketW(SOCKET, DWORD, LPWSAPROTOCOL_INFOW);
1155WINSOCK_API_LINKAGE INT WINAPI WSAEnumNameSpaceProvidersA(LPDWORD, LPWSANAMESPACE_INFOA);
1156WINSOCK_API_LINKAGE INT WINAPI WSAEnumNameSpaceProvidersW(LPDWORD, LPWSANAMESPACE_INFOW);
1157WINSOCK_API_LINKAGE int WINAPI WSAEnumNetworkEvents(SOCKET, WSAEVENT, LPWSANETWORKEVENTS);
1158WINSOCK_API_LINKAGE int WINAPI WSAEnumProtocolsA(LPINT, LPWSAPROTOCOL_INFOA, LPDWORD);
1159WINSOCK_API_LINKAGE int WINAPI WSAEnumProtocolsW(LPINT, LPWSAPROTOCOL_INFOW, LPDWORD);
1160WINSOCK_API_LINKAGE int WINAPI WSAEventSelect(SOCKET, WSAEVENT, long);
1161WINSOCK_API_LINKAGE BOOL WINAPI WSAGetOverlappedResult(SOCKET, LPWSAOVERLAPPED, LPDWORD, BOOL, LPDWORD);
1162WINSOCK_API_LINKAGE BOOL WINAPI WSAGetQOSByName(SOCKET, LPWSABUF, LPQOS);
1163WINSOCK_API_LINKAGE INT WINAPI WSAGetServiceClassInfoA(LPGUID, LPGUID, LPDWORD, LPWSASERVICECLASSINFOA);
1164WINSOCK_API_LINKAGE INT WINAPI WSAGetServiceClassInfoW(LPGUID, LPGUID, LPDWORD, LPWSASERVICECLASSINFOW);
1165WINSOCK_API_LINKAGE INT WINAPI WSAGetServiceClassNameByClassIdA(LPGUID, LPSTR, LPDWORD);
1166WINSOCK_API_LINKAGE INT WINAPI WSAGetServiceClassNameByClassIdW(LPGUID, LPWSTR, LPDWORD);
1167WINSOCK_API_LINKAGE int WINAPI WSAHtonl(SOCKET, unsigned long, unsigned long *);
1168WINSOCK_API_LINKAGE int WINAPI WSAHtons(SOCKET, unsigned short, unsigned short *);
1169WINSOCK_API_LINKAGE INT WINAPI WSAInstallServiceClassA(LPWSASERVICECLASSINFOA);
1170WINSOCK_API_LINKAGE INT WINAPI WSAInstallServiceClassW(LPWSASERVICECLASSINFOW);
1171WINSOCK_API_LINKAGE int WINAPI WSAIoctl(SOCKET, DWORD, LPVOID, DWORD, LPVOID, DWORD, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1172WINSOCK_API_LINKAGE SOCKET WINAPI WSAJoinLeaf(SOCKET, const struct sockaddr *, int, LPWSABUF, LPWSABUF, LPQOS, LPQOS, DWORD);
1173WINSOCK_API_LINKAGE INT WINAPI WSALookupServiceBeginA(LPWSAQUERYSETA, DWORD, LPHANDLE);
1174WINSOCK_API_LINKAGE INT WINAPI WSALookupServiceBeginW(LPWSAQUERYSETW lpqsRestrictions, DWORD, LPHANDLE);
1175WINSOCK_API_LINKAGE INT WINAPI WSALookupServiceNextA(HANDLE, DWORD, LPDWORD, LPWSAQUERYSETA);
1176WINSOCK_API_LINKAGE INT WINAPI WSALookupServiceNextW(HANDLE, DWORD, LPDWORD, LPWSAQUERYSETW);
1177WINSOCK_API_LINKAGE INT WINAPI WSALookupServiceEnd(HANDLE);
1178WINSOCK_API_LINKAGE int WINAPI WSANSPIoctl(HANDLE,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPWSACOMPLETION); /* XP or .NET Server */
1179WINSOCK_API_LINKAGE int WINAPI WSANtohl(SOCKET, unsigned long, unsigned long *);
1180WINSOCK_API_LINKAGE int WINAPI WSANtohs(SOCKET, unsigned short, unsigned short *);
1181WINSOCK_API_LINKAGE int WINAPI WSARecv(SOCKET, LPWSABUF, DWORD, LPDWORD, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1182WINSOCK_API_LINKAGE int WINAPI WSARecvDisconnect(SOCKET, LPWSABUF);
1183WINSOCK_API_LINKAGE int WINAPI WSARecvFrom(SOCKET, LPWSABUF, DWORD, LPDWORD, LPDWORD, struct sockaddr *, LPINT, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1184WINSOCK_API_LINKAGE INT WINAPI WSARemoveServiceClass(LPGUID);
1185WINSOCK_API_LINKAGE BOOL WINAPI WSAResetEvent(WSAEVENT);
1186WINSOCK_API_LINKAGE int WINAPI WSASend(SOCKET, LPWSABUF, DWORD, LPDWORD, DWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1187WINSOCK_API_LINKAGE int WINAPI WSASendDisconnect(SOCKET, LPWSABUF);
1188WINSOCK_API_LINKAGE int WINAPI WSASendTo(SOCKET, LPWSABUF, DWORD, LPDWORD, DWORD, const struct sockaddr *, int, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1189WINSOCK_API_LINKAGE BOOL WINAPI WSASetEvent(WSAEVENT);
1190WINSOCK_API_LINKAGE INT WSAAPI WSASetServiceA(LPWSAQUERYSETA, WSAESETSERVICEOP, DWORD);
1191WINSOCK_API_LINKAGE INT WINAPI WSASetServiceW(LPWSAQUERYSETW, WSAESETSERVICEOP, DWORD);
1192WINSOCK_API_LINKAGE SOCKET WINAPI WSASocketA(int, int, int, LPWSAPROTOCOL_INFOA, GROUP, DWORD);
1193WINSOCK_API_LINKAGE SOCKET WINAPI WSASocketW(int, int, int, LPWSAPROTOCOL_INFOW, GROUP, DWORD);
1194WINSOCK_API_LINKAGE INT WINAPI WSAStringToAddressA(LPSTR, INT, LPWSAPROTOCOL_INFOA, LPSOCKADDR, LPINT);
1195WINSOCK_API_LINKAGE INT WINAPI WSAStringToAddressW(LPWSTR, INT, LPWSAPROTOCOL_INFOW, LPSOCKADDR, LPINT);
1196WINSOCK_API_LINKAGE DWORD WINAPI WSAWaitForMultipleEvents(DWORD, const WSAEVENT *, BOOL, DWORD, BOOL);
1197
1198typedef SOCKET (WINAPI *LPFN_WSAACCEPT)(SOCKET, struct sockaddr *, LPINT, LPCONDITIONPROC, DWORD);
1199typedef INT (WINAPI *LPFN_WSAADDRESSTOSTRINGA)(LPSOCKADDR, DWORD, LPWSAPROTOCOL_INFOA, LPSTR, LPDWORD);
1200typedef INT (WINAPI *LPFN_WSAADDRESSTOSTRINGW)(LPSOCKADDR, DWORD, LPWSAPROTOCOL_INFOW, LPWSTR, LPDWORD);
1201typedef BOOL (WINAPI *LPFN_WSACLOSEEVENT)(WSAEVENT);
1202typedef int (WINAPI *LPFN_WSACONNECT)(SOCKET, const struct sockaddr *, int, LPWSABUF, LPWSABUF, LPQOS, LPQOS);
1203typedef WSAEVENT (WINAPI *LPFN_WSACREATEEVENT)(void);
1204typedef int (WINAPI *LPFN_WSADUPLICATESOCKETA)(SOCKET, DWORD, LPWSAPROTOCOL_INFOA);
1205typedef int (WINAPI *LPFN_WSADUPLICATESOCKETW)(SOCKET, DWORD, LPWSAPROTOCOL_INFOW);
1206typedef INT (WINAPI *LPFN_WSAENUMNAMESPACEPROVIDERSA)(LPDWORD, LPWSANAMESPACE_INFOA);
1207typedef INT (WINAPI *LPFN_WSAENUMNAMESPACEPROVIDERSW)(LPDWORD, LPWSANAMESPACE_INFOW);
1208typedef int (WINAPI *LPFN_WSAENUMNETWORKEVENTS)(SOCKET, WSAEVENT, LPWSANETWORKEVENTS);
1209typedef int (WINAPI *LPFN_WSAENUMPROTOCOLSA)(LPINT, LPWSAPROTOCOL_INFOA, LPDWORD);
1210typedef int (WINAPI *LPFN_WSAENUMPROTOCOLSW)(LPINT, LPWSAPROTOCOL_INFOW, LPDWORD);
1211typedef int (WINAPI *LPFN_WSAEVENTSELECT)(SOCKET, WSAEVENT, long);
1212typedef BOOL (WINAPI *LPFN_WSAGETOVERLAPPEDRESULT)(SOCKET, LPWSAOVERLAPPED, LPDWORD, BOOL, LPDWORD);
1213typedef BOOL (WINAPI *LPFN_WSAGETQOSBYNAME)(SOCKET, LPWSABUF, LPQOS);
1214typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSINFOA)(LPGUID, LPGUID, LPDWORD, LPWSASERVICECLASSINFOA);
1215typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSINFOW)(LPGUID, LPGUID, LPDWORD, LPWSASERVICECLASSINFOW);
1216typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA)(LPGUID, LPSTR, LPDWORD);
1217typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW)(LPGUID, LPWSTR, LPDWORD);
1218typedef int (WINAPI *LPFN_WSAHTONL)(SOCKET, unsigned long, unsigned long *);
1219typedef int (WINAPI *LPFN_WSAHTONS)(SOCKET, unsigned short, unsigned short *);
1220typedef INT (WINAPI *LPFN_WSAINSTALLSERVICECLASSA)(LPWSASERVICECLASSINFOA);
1221typedef INT (WINAPI *LPFN_WSAINSTALLSERVICECLASSW)(LPWSASERVICECLASSINFOW);
1222typedef int (WINAPI *LPFN_WSAIOCTL)(SOCKET, DWORD, LPVOID, DWORD, LPVOID, DWORD, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1223typedef SOCKET (WINAPI *LPFN_WSAJOINLEAF)(SOCKET, const struct sockaddr *, int, LPWSABUF, LPWSABUF, LPQOS, LPQOS, DWORD);
1224typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEBEGINA)(LPWSAQUERYSETA, DWORD, LPHANDLE);
1225typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEBEGINW)(LPWSAQUERYSETW, DWORD, LPHANDLE);
1226typedef INT (WINAPI *LPFN_WSALOOKUPSERVICENEXTA)(HANDLE, DWORD, LPDWORD, LPWSAQUERYSETA);
1227typedef INT (WINAPI *LPFN_WSALOOKUPSERVICENEXTW)(HANDLE, DWORD, LPDWORD, LPWSAQUERYSETW);
1228typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEEND)(HANDLE);
1229typedef int (WINAPI *LPFN_WSANSPIoctl)(HANDLE, DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPWSACOMPLETION);
1230typedef int (WINAPI *LPFN_WSANTOHL)(SOCKET, unsigned long, unsigned long *);
1231typedef int (WINAPI *LPFN_WSANTOHS)(SOCKET, unsigned short, unsigned short *);
1232typedef int (WINAPI *LPFN_WSARECV)(SOCKET, LPWSABUF, DWORD, LPDWORD, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1233typedef int (WINAPI *LPFN_WSARECVDISCONNECT)(SOCKET, LPWSABUF);
1234typedef int (WINAPI *LPFN_WSARECVFROM)(SOCKET, LPWSABUF, DWORD, LPDWORD, LPDWORD, struct sockaddr *, LPINT, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1235typedef INT (WINAPI *LPFN_WSAREMOVESERVICECLASS)(LPGUID);
1236typedef BOOL (WINAPI *LPFN_WSARESETEVENT)(WSAEVENT);
1237typedef int (WINAPI *LPFN_WSASEND)(SOCKET, LPWSABUF, DWORD, LPDWORD, DWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1238typedef int (WINAPI *LPFN_WSASENDDISCONNECT)(SOCKET, LPWSABUF);
1239typedef int (WINAPI *LPFN_WSASENDTO)(SOCKET, LPWSABUF, DWORD, LPDWORD, DWORD, const struct sockaddr *, int, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1240typedef BOOL (WINAPI *LPFN_WSASETEVENT)(WSAEVENT);
1241typedef INT (WINAPI *LPFN_WSASETSERVICEA)(LPWSAQUERYSETA, WSAESETSERVICEOP, DWORD);
1242typedef INT (WINAPI *LPFN_WSASETSERVICEW)(LPWSAQUERYSETW, WSAESETSERVICEOP, DWORD);
1243typedef SOCKET (WINAPI *LPFN_WSASOCKETA)(int, int, int, LPWSAPROTOCOL_INFOA, GROUP, DWORD);
1244typedef SOCKET (WINAPI *LPFN_WSASOCKETW)(int, int, int, LPWSAPROTOCOL_INFOW, GROUP, DWORD);
1245typedef INT (WINAPI *LPFN_WSASTRINGTOADDRESSA)(LPSTR, INT, LPWSAPROTOCOL_INFOA, LPSOCKADDR, LPINT);
1246typedef INT (WINAPI *LPFN_WSASTRINGTOADDRESSW)(LPWSTR, INT, LPWSAPROTOCOL_INFOW, LPSOCKADDR, LPINT);
1247typedef DWORD (WINAPI *LPFN_WSAWAITFORMULTIPLEEVENTS)(DWORD, const WSAEVENT *, BOOL, DWORD, BOOL);
1248
1249#ifdef UNICODE
1250#define LPFN_WSAADDRESSTOSTRING LPFN_WSAADDRESSTOSTRINGW
1251#define LPFN_WSADUPLICATESOCKET LPFN_WSADUPLICATESOCKETW
1252#define LPFN_WSAENUMNAMESPACEPROVIDERS LPFN_WSAENUMNAMESPACEPROVIDERSW
1253#define LPFN_WSAENUMPROTOCOLS LPFN_WSAENUMPROTOCOLSW
1254#define LPFN_WSAGETSERVICECLASSINFO LPFN_WSAGETSERVICECLASSINFOW
1255#define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW
1256#define LPFN_WSAINSTALLSERVICECLASS LPFN_WSAINSTALLSERVICECLASSW
1257#define LPFN_WSALOOKUPSERVICEBEGIN LPFN_WSALOOKUPSERVICEBEGINW
1258#define LPFN_WSALOOKUPSERVICENEXT LPFN_WSALOOKUPSERVICENEXTW
1259#define LPFN_WSASETSERVICE LPFN_WSASETSERVICEW
1260#define LPFN_WSASOCKET LPFN_WSASOCKETW
1261#define LPFN_WSASTRINGTOADDRESS LPFN_WSASTRINGTOADDRESSW
1262#define WSAAddressToString WSAAddressToStringW
1263#define WSADuplicateSocket WSADuplicateSocketW
1264#define WSAEnumNameSpaceProviders WSAEnumNameSpaceProvidersW
1265#define WSAEnumProtocols WSAEnumProtocolsW
1266#define WSAGetServiceClassInfo WSAGetServiceClassInfoW
1267#define WSAGetServiceClassNameByClassId WSAGetServiceClassNameByClassIdW
1268#define WSASetService WSASetServiceW
1269#define WSASocket WSASocketW
1270#define WSAStringToAddress WSAStringToAddressW
1271#define WSALookupServiceBegin WSALookupServiceBeginW
1272#define WSALookupServiceNext WSALookupServiceNextW
1273#define WSAInstallServiceClass WSAInstallServiceClassW
1274#else
1275#define LPFN_WSAADDRESSTOSTRING LPFN_WSAADDRESSTOSTRINGA
1276#define LPFN_WSADUPLICATESOCKET LPFN_WSADUPLICATESOCKETW
1277#define LPFN_WSAENUMNAMESPACEPROVIDERS LPFN_WSAENUMNAMESPACEPROVIDERSA
1278#define LPFN_WSAENUMPROTOCOLS LPFN_WSAENUMPROTOCOLSA
1279#define LPFN_WSAGETSERVICECLASSINFO LPFN_WSAGETSERVICECLASSINFOA
1280#define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA
1281#define LPFN_WSAINSTALLSERVICECLASS LPFN_WSAINSTALLSERVICECLASSA
1282#define LPFN_WSALOOKUPSERVICEBEGIN LPFN_WSALOOKUPSERVICEBEGINA
1283#define LPFN_WSALOOKUPSERVICENEXT LPFN_WSALOOKUPSERVICENEXTA
1284#define LPFN_WSASETSERVICE LPFN_WSASETSERVICEA
1285#define LPFN_WSASOCKET LPFN_WSASOCKETA
1286#define LPFN_WSASTRINGTOADDRESS LPFN_WSASTRINGTOADDRESSA
1287#define WSAAddressToString WSAAddressToStringA
1288#define WSADuplicateSocket WSADuplicateSocketA
1289#define WSAEnumNameSpaceProviders WSAEnumNameSpaceProvidersA
1290#define WSAEnumProtocols WSAEnumProtocolsA
1291#define WSAGetServiceClassInfo WSAGetServiceClassInfoA
1292#define WSAGetServiceClassNameByClassId WSAGetServiceClassNameByClassIdA
1293#define WSAInstallServiceClass WSAInstallServiceClassA
1294#define WSALookupServiceBegin WSALookupServiceBeginA
1295#define WSALookupServiceNext WSALookupServiceNextA
1296#define WSASocket WSASocketA
1297#define WSAStringToAddress WSAStringToAddressA
1298#define WSASetService WSASetServiceA
1299#endif
1300
1301#ifdef __cplusplus
1302}
1303#endif
1304#endif
Note: See TracBrowser for help on using the repository browser.