Use the source dir as the documentation root dir.
[wine/hacks.git] / include / winsock2.h
blob64cc433ef2f45c2cfa2f06e688291757627f81aa
1 /*
2 * Winsock 2 definitions - used for ws2_32.dll
4 * Copyright (C) 1999 Ove Kaaven
5 * Copyright (C) 2001 Francois Gouget
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 * FIXME: Still missing required Winsock 2 definitions.
24 #ifndef _WINSOCK2API_
25 #define _WINSOCK2API_
28 * Setup phase
31 /* Everything common between winsock.h and winsock2.h */
32 #ifndef INCL_WINSOCK_API_PROTOTYPES
33 #define INCL_WINSOCK_API_PROTOTYPES 1
34 #define WS_API_PROTOTYPES 1
35 #else
36 #define WS_API_PROTOTYPES INCL_WINSOCK_API_PROTOTYPES
37 #endif
39 #ifndef INCL_WINSOCK_API_TYPEDEFS
40 #define INCL_WINSOCK_API_TYPEDEFS 0
41 #define WS_API_TYPEDEFS 0
42 #else
43 #define WS_API_TYPEDEFS INCL_WINSOCK_API_TYPEDEFS
44 #endif
46 #define __WINE_WINSOCK2__
47 #include <winsock.h>
48 #undef __WINE_WINSOCK2__
51 #ifdef __cplusplus
52 extern "C" {
53 #endif /* defined(__cplusplus) */
55 /* proper 4-byte packing */
56 #include <pshpack4.h>
59 #ifndef USE_WS_PREFIX
60 #define SO_GROUP_ID 0x2001
61 #define SO_GROUP_PRIORITY 0x2002
62 #define SO_MAX_MSG_SIZE 0x2003
63 #define SO_PROTOCOL_INFOA 0x2004
64 #define SO_PROTOCOL_INFOW 0x2005
65 #define SO_PROTOCOL_INFO WINELIB_NAME_AW(WS_SO_PROTOCOL_INFO)
66 #define PVD_CONFIG 0x3001
67 #define SO_CONDITIONAL_ACCEPT 0x3002
68 #else
69 #define WS_SO_GROUP_ID 0x2001
70 #define WS_SO_GROUP_PRIORITY 0x2002
71 #define WS_SO_MAX_MSG_SIZE 0x2003
72 #define WS_SO_PROTOCOL_INFOA 0x2004
73 #define WS_SO_PROTOCOL_INFOW 0x2005
74 #define WS_SO_PROTOCOL_INFO WINELIB_NAME_AW(WS_SO_PROTOCOL_INFO)
75 #define WS_PVD_CONFIG 0x3001
76 #define WS_SO_CONDITIONAL_ACCEPT 0x3002
77 #endif
79 /* protocol types */
81 #ifndef USE_WS_PREFIX
82 #define SOCK_STREAM 1
83 #define SOCK_DGRAM 2
84 #define SOCK_RAW 3
85 #define SOCK_RDM 4
86 #define SOCK_SEQPACKET 5
87 #else /* USE_WS_PREFIX */
88 #define WS_SOCK_STREAM 1
89 #define WS_SOCK_DGRAM 2
90 #define WS_SOCK_RAW 3
91 #define WS_SOCK_RDM 4
92 #define WS_SOCK_SEQPACKET 5
93 #endif /* USE_WS_PREFIX */
95 /* option flags per socket */
97 #define FD_MAX_EVENTS 10
98 #define FD_READ_BIT 0
99 #define FD_WRITE_BIT 1
100 #define FD_OOB_BIT 2
101 #define FD_ACCEPT_BIT 3
102 #define FD_CONNECT_BIT 4
103 #define FD_CLOSE_BIT 5
105 /* Constants for LPCONDITIONPROC */
106 #define CF_ACCEPT 0x0000
107 #define CF_REJECT 0x0001
108 #define CF_DEFER 0x0002
110 /* Constants for shutdown() */
111 #define SD_RECEIVE 0x00
112 #define SD_SEND 0x01
113 #define SD_BOTH 0x02
115 /* Constants for WSAIoctl() */
116 #define IOC_UNIX 0x00000000
117 #define IOC_WS2 0x08000000
118 #define IOC_PROTOCOL 0x10000000
119 #define IOC_VENDOR 0x18000000
120 #define IOC_VOID 0x20000000
121 #define _WSAIO(x,y) (IOC_VOID|(x)|(y))
122 #define _WSAIOR(x,y) (IOC_OUT|(x)|(y))
123 #define _WSAIOW(x,y) (IOC_IN|(x)|(y))
124 #define _WSAIORW(x,y) (IOC_INOUT|(x)|(y))
125 #define SIO_ASSOCIATE_HANDLE _WSAIOW(IOC_WS2,1)
126 #define SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(IOC_WS2,2)
127 #define SIO_FIND_ROUTE _WSAIOR(IOC_WS2,3)
128 #define SIO_FLUSH _WSAIO(IOC_WS2,4)
129 #define SIO_GET_BROADCAST_ADDRESS _WSAIOR(IOC_WS2,5)
130 #define SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(IOC_WS2,6)
131 #define SIO_GET_QOS _WSAIORW(IOC_WS2,7)
132 #define SIO_GET_GROUP_QOS _WSAIORW(IOC_WS2,8)
133 #define SIO_MULTIPOINT_LOOPBACK _WSAIOW(IOC_WS2,9)
134 #define SIO_MULTICAST_SCOPE _WSAIOW(IOC_WS2,10)
135 #define SIO_SET_QOS _WSAIOW(IOC_WS2,11)
136 #define SIO_SET_GROUP_QOS _WSAIOW(IOC_WS2,12)
137 #define SIO_TRANSLATE_HANDLE _WSAIORW(IOC_WS2,13)
138 #define SIO_ROUTING_INTERFACE_QUERY _WSAIORW(IOC_WS2,20)
139 #define SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(IOC_WS2,21)
140 #define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22)
141 #define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23)
142 #define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_WS2,24)
143 #ifndef USE_WS_PREFIX
144 #define SIO_GET_INTERFACE_LIST _IOR ('t', 127, u_long)
145 #else
146 #define SIO_GET_INTERFACE_LIST WS__IOR ('t', 127, u_long)
147 #endif
149 /* Constants for WSAIoctl() */
150 #define WSA_FLAG_OVERLAPPED 0x01
151 #define WSA_FLAG_MULTIPOINT_C_ROOT 0x02
152 #define WSA_FLAG_MULTIPOINT_C_LEAF 0x04
153 #define WSA_FLAG_MULTIPOINT_D_ROOT 0x08
154 #define WSA_FLAG_MULTIPOINT_D_LEAF 0x10
156 /* Constants for WSAJoinLeaf() */
157 #define JL_SENDER_ONLY 0x01
158 #define JL_RECEIVER_ONLY 0x02
159 #define JL_BOTH 0x04
162 #ifndef GUID_DEFINED
163 #include <guiddef.h>
164 #endif
166 #define MAX_PROTOCOL_CHAIN 7
167 #define BASE_PROTOCOL 1
168 #define LAYERED_PROTOCOL 0
170 typedef struct _WSAPROTOCOLCHAIN
172 int ChainLen; /* the length of the chain, */
173 /* length = 0 means layered protocol, */
174 /* length = 1 means base protocol, */
175 /* length > 1 means protocol chain */
176 DWORD ChainEntries[MAX_PROTOCOL_CHAIN]; /* a list of dwCatalogEntryIds */
177 } WSAPROTOCOLCHAIN, * LPWSAPROTOCOLCHAIN;
179 #define XP1_CONNECTIONLESS 0x00000001
180 #define XP1_GUARANTEED_DELIVERY 0x00000002
181 #define XP1_GUARANTEED_ORDER 0x00000004
182 #define XP1_MESSAGE_ORIENTED 0x00000008
183 #define XP1_PSEUDO_STREAM 0x00000010
184 #define XP1_GRACEFUL_CLOSE 0x00000020
185 #define XP1_EXPEDITED_DATA 0x00000040
186 #define XP1_CONNECT_DATA 0x00000080
187 #define XP1_DISCONNECT_DATA 0x00000100
188 #define XP1_SUPPORT_BROADCAST 0x00000200
189 #define XP1_SUPPORT_MULTIPOINT 0x00000400
190 #define XP1_MULTIPOINT_CONTROL_PLANE 0x00000800
191 #define XP1_MULTIPOINT_DATA_PLANE 0x00001000
192 #define XP1_QOS_SUPPORTED 0x00002000
193 #define XP1_INTERRUPT 0x00004000
194 #define XP1_UNI_SEND 0x00008000
195 #define XP1_UNI_RECV 0x00010000
196 #define XP1_IFS_HANDLES 0x00020000
197 #define XP1_PARTIAL_MESSAGE 0x00040000
199 #define BIGENDIAN 0x0000
200 #define LITTLEENDIAN 0x0001
202 #define SECURITY_PROTOCOL_NONE 0x0000
204 #define WSAPROTOCOL_LEN 255
205 typedef struct _WSAPROTOCOL_INFOA
207 DWORD dwServiceFlags1;
208 DWORD dwServiceFlags2;
209 DWORD dwServiceFlags3;
210 DWORD dwServiceFlags4;
211 DWORD dwProviderFlags;
212 GUID ProviderId;
213 DWORD dwCatalogEntryId;
214 WSAPROTOCOLCHAIN ProtocolChain;
215 int iVersion;
216 int iAddressFamily;
217 int iMaxSockAddr;
218 int iMinSockAddr;
219 int iSocketType;
220 int iProtocol;
221 int iProtocolMaxOffset;
222 int iNetworkByteOrder;
223 int iSecurityScheme;
224 DWORD dwMessageSize;
225 DWORD dwProviderReserved;
226 CHAR szProtocol[WSAPROTOCOL_LEN+1];
227 } WSAPROTOCOL_INFOA, * LPWSAPROTOCOL_INFOA;
229 typedef struct _WSAPROTOCOL_INFOW
231 DWORD dwServiceFlags1;
232 DWORD dwServiceFlags2;
233 DWORD dwServiceFlags3;
234 DWORD dwServiceFlags4;
235 DWORD dwProviderFlags;
236 GUID ProviderId;
237 DWORD dwCatalogEntryId;
238 WSAPROTOCOLCHAIN ProtocolChain;
239 int iVersion;
240 int iAddressFamily;
241 int iMaxSockAddr;
242 int iMinSockAddr;
243 int iSocketType;
244 int iProtocol;
245 int iProtocolMaxOffset;
246 int iNetworkByteOrder;
247 int iSecurityScheme;
248 DWORD dwMessageSize;
249 DWORD dwProviderReserved;
250 WCHAR szProtocol[WSAPROTOCOL_LEN+1];
251 } WSAPROTOCOL_INFOW, *LPWSAPROTOCOL_INFOW;
253 DECL_WINELIB_TYPE_AW(WSAPROTOCOL_INFO)
254 DECL_WINELIB_TYPE_AW(LPWSAPROTOCOL_INFO)
256 typedef struct _WSANETWORKEVENTS
258 long lNetworkEvents;
259 int iErrorCode[FD_MAX_EVENTS];
260 } WSANETWORKEVENTS, *LPWSANETWORKEVENTS;
262 typedef struct _WSANSClassInfoA
264 LPSTR lpszName;
265 DWORD dwNameSpace;
266 DWORD dwValueType;
267 DWORD dwValueSize;
268 LPVOID lpValue;
269 } WSANSCLASSINFOA, *PWSANSCLASSINFOA, *LPWSANSCLASSINFOA;
271 typedef struct _WSANSClassInfoW
273 LPSTR lpszName;
274 DWORD dwNameSpace;
275 DWORD dwValueType;
276 DWORD dwValueSize;
277 LPVOID lpValue;
278 } WSANSCLASSINFOW, *PWSANSCLASSINFOW, *LPWSANSCLASSINFOW;
280 DECL_WINELIB_TYPE_AW(WSANSCLASSINFO)
281 DECL_WINELIB_TYPE_AW(PWSANSCLASSINFO)
282 DECL_WINELIB_TYPE_AW(LPWSANSCLASSINFO)
284 typedef struct _WSAServiceClassInfoA
286 LPGUID lpServiceClassId;
287 LPSTR lpszServiceClassName;
288 DWORD dwCount;
289 LPWSANSCLASSINFOA lpClassInfos;
290 } WSASERVICECLASSINFOA, *PWSASERVICECLASSINFOA, *LPWSASERVICECLASSINFOA;
292 typedef struct _WSAServiceClassInfoW
294 LPGUID lpServiceClassId;
295 LPWSTR lpszServiceClassName;
296 DWORD dwCount;
297 LPWSANSCLASSINFOW lpClassInfos;
298 } WSASERVICECLASSINFOW, *PWSASERVICECLASSINFOW, *LPWSASERVICECLASSINFOW;
301 DECL_WINELIB_TYPE_AW(WSASERVICECLASSINFO)
302 DECL_WINELIB_TYPE_AW(PWSASERVICECLASSINFO)
303 DECL_WINELIB_TYPE_AW(LPWSASERVICECLASSINFO)
305 typedef struct _WSABUF
307 ULONG len;
308 CHAR* buf;
309 } WSABUF, *LPWSABUF;
311 #define WSAEVENT HANDLE
312 #define LPWSAEVENT LPHANDLE
313 #define WSAOVERLAPPED OVERLAPPED
314 typedef struct _OVERLAPPED* LPWSAOVERLAPPED;
316 #define WSA_IO_PENDING (ERROR_IO_PENDING)
317 #define WSA_IO_INCOMPLETE (ERROR_IO_INCOMPLETE)
318 #define WSA_INVALID_HANDLE (ERROR_INVALID_HANDLE)
319 #define WSA_INVALID_PARAMETER (ERROR_INVALID_PARAMETER)
320 #define WSA_NOT_ENOUGH_MEMORY (ERROR_NOT_ENOUGH_MEMORY)
321 #define WSA_OPERATION_ABORTED (ERROR_OPERATION_ABORTED)
323 #define WSA_INVALID_EVENT ((WSAEVENT)NULL)
324 #define WSA_MAXIMUM_WAIT_EVENTS (MAXIMUM_WAIT_OBJECTS)
325 #define WSA_WAIT_FAILED ((DWORD)-1L)
326 #define WSA_WAIT_EVENT_0 (WAIT_OBJECT_0)
327 #define WSA_WAIT_IO_COMPLETION (WAIT_IO_COMPLETION)
328 #define WSA_WAIT_TIMEOUT (WAIT_TIMEOUT)
329 #define WSA_INFINITE (INFINITE)
331 typedef unsigned int GROUP;
332 #define SG_UNCONSTRAINED_GROUP 0x01
333 #define SG_CONSTRAINED_GROUP 0x02
336 * FLOWSPEC and SERVICETYPE should eventually move to qos.h
339 typedef ULONG SERVICETYPE;
341 typedef struct _FLOWSPEC {
342 unsigned int TokenRate;
343 unsigned int TokenBucketSize;
344 unsigned int PeakBandwidth;
345 unsigned int Latency;
346 unsigned int DelayVariation;
347 SERVICETYPE ServiceType;
348 unsigned int MaxSduSize;
349 unsigned int MinimumPolicedSize;
350 } FLOWSPEC, *PFLOWSPEC, *LPFLOWSPEC;
352 typedef struct _QUALITYOFSERVICE {
353 FLOWSPEC SendingFlowspec;
354 FLOWSPEC ReceivingFlowspec;
355 WSABUF ProviderSpecific;
356 } QOS, *LPQOS;
358 typedef int (CALLBACK *LPCONDITIONPROC)
360 LPWSABUF lpCallerId,
361 LPWSABUF lpCallerData,
362 LPQOS lpSQOS,
363 LPQOS lpGQOS,
364 LPWSABUF lpCalleeId,
365 LPWSABUF lpCalleeData,
366 GROUP *g,
367 DWORD dwCallbackData
370 typedef void (CALLBACK *LPWSAOVERLAPPED_COMPLETION_ROUTINE)
372 DWORD dwError,
373 DWORD cbTransferred,
374 LPWSAOVERLAPPED lpOverlapped,
375 DWORD dwFlags
378 #ifndef _tagBLOB_DEFINED
379 #define _tagBLOB_DEFINED
380 #define _BLOB_DEFINED
381 #define _LPBLOB_DEFINED
382 typedef struct _BLOB {
383 ULONG cbSize;
384 BYTE *pBlobData;
385 } BLOB, *LPBLOB;
386 #endif
388 #ifndef __CSADDR_DEFINED__
389 #define __CSADDR_DEFINED__
391 typedef struct _SOCKET_ADDRESS {
392 LPSOCKADDR lpSockaddr;
393 INT iSockaddrLength;
394 } SOCKET_ADDRESS, *PSOCKET_ADDRESS, *LPSOCKET_ADDRESS;
396 typedef struct _CSADDR_INFO {
397 SOCKET_ADDRESS LocalAddr;
398 SOCKET_ADDRESS RemoteAddr;
399 INT iSocketType;
400 INT iProtocol;
401 } CSADDR_INFO, *PCSADDR_INFO, *LPCSADDR_INFO;
402 #endif
404 /*socket address list */
405 typedef struct _SOCKET_ADDRESS_LIST {
406 INT iAddressCount;
407 SOCKET_ADDRESS Address[1];
408 } SOCKET_ADDRESS_LIST, *LPSOCKET_ADDRESS_LIST;
410 /* addressfamily protocol pairs */
411 typedef struct _AFPROTOCOLS {
412 INT iAddressFamily;
413 INT iProtocol;
414 } AFPROTOCOLS, *PAFPROTOCOLS, *LPAFPROTOCOLS;
416 /* client query definitions */
417 typedef enum _WSAEcomparator {
418 COMP_EQUAL = 0,
419 COMP_NOTLESS
420 } WSAECOMPARATOR, *PWSAECOMPARATOR, *LPWSAECOMPARATOR;
422 typedef struct _WSAVersion {
423 DWORD dwVersion;
424 WSAECOMPARATOR ecHow;
425 } WSAVERSION, *PWSAVERSION, *LPWSAVERSION;
428 typedef struct _WSAQuerySetA {
429 DWORD dwSize;
430 LPSTR lpszServiceInstanceName;
431 LPGUID lpServiceClassId;
432 LPWSAVERSION lpVersion;
433 LPSTR lpszComment;
434 DWORD dwNameSpace;
435 LPGUID lpNSProviderId;
436 LPSTR lpszContext;
437 DWORD dwNumberOfProtocols;
438 LPAFPROTOCOLS lpafpProtocols;
439 LPSTR lpszQueryString;
440 DWORD dwNumberOfCsAddrs;
441 LPCSADDR_INFO lpcsaBuffer;
442 DWORD dwOutputFlags;
443 LPBLOB lpBlob;
444 } WSAQUERYSETA, *PWSAQUERYSETA, *LPWSAQUERYSETA;
446 typedef struct _WSAQuerySetW {
447 DWORD dwSize;
448 LPWSTR lpszServiceInstanceName;
449 LPGUID lpServiceClassId;
450 LPWSAVERSION lpVersion;
451 LPWSTR lpszComment;
452 DWORD dwNameSpace;
453 LPGUID lpNSProviderId;
454 LPWSTR lpszContext;
455 DWORD dwNumberOfProtocols;
456 LPAFPROTOCOLS lpafpProtocols;
457 LPWSTR lpszQueryString;
458 DWORD dwNumberOfCsAddrs;
459 LPCSADDR_INFO lpcsaBuffer;
460 DWORD dwOutputFlags;
461 LPBLOB lpBlob;
462 } WSAQUERYSETW, *PWSAQUERYSETW, *LPWSAQUERYSETW;
464 DECL_WINELIB_TYPE_AW(WSAQUERYSET)
465 DECL_WINELIB_TYPE_AW(PWSAQUERYSET)
466 DECL_WINELIB_TYPE_AW(LPWSAQUERYSET)
470 * Winsock Function Typedefs
472 * Remember to keep this section in sync with the
473 * "Prototypes" section in winsock.h.
475 #if WS_API_TYPEDEFS
476 typedef HANDLE (WINAPI *LPFN_WSAASYNCGETHOSTBYADDR)(HWND,u_int,const char*,int,int,char*,int);
477 typedef HANDLE (WINAPI *LPFN_WSAASYNCGETHOSTBYNAME)(HWND,u_int,const char*,char*,int);
478 typedef HANDLE (WINAPI *LPFN_WSAASYNCGETPROTOBYNAME)(HWND,u_int,const char*,char*,int);
479 typedef HANDLE (WINAPI *LPFN_WSAASYNCGETPROTOBYNUMBER)(HWND,u_int,int,char*,int);
480 typedef HANDLE (WINAPI *LPFN_WSAASYNCGETSERVBYNAME)(HWND,u_int,const char*,const char*,char*,int);
481 typedef HANDLE (WINAPI *LPFN_WSAASYNCGETSERVBYPORT)(HWND,u_int,int,const char*,char*,int);
482 typedef int (WINAPI *LPFN_WSAASYNCSELECT)(SOCKET,HWND,u_int,long);
483 typedef int (WINAPI *LPFN_WSACANCELASYNCREQUEST)(HANDLE);
484 typedef int (WINAPI *LPFN_WSACANCELBLOCKINGCALL)(void);
485 typedef int (WINAPI *LPFN_WSACLEANUP)(void);
486 typedef int (WINAPI *LPFN_WSAGETLASTERROR)(void);
487 typedef BOOL (WINAPI *LPFN_WSAISBLOCKING)(void);
488 typedef FARPROC (WINAPI *LPFN_WSASETBLOCKINGHOOK)(FARPROC);
489 typedef void (WINAPI *LPFN_WSASETLASTERROR)(int);
490 typedef int (WINAPI *LPFN_WSASTARTUP)(WORD,LPWSADATA);
491 typedef int (WINAPI *LPFN_WSAUNHOOKBLOCKINGHOOK)(void);
493 typedef SOCKET (WINAPI *LPFN_ACCEPT)(SOCKET,struct WS(sockaddr)*,int*);
494 typedef int (WINAPI *LPFN_BIND)(SOCKET,const struct WS(sockaddr)*,int);
495 typedef int (WINAPI *LPFN_CLOSESOCKET)(SOCKET);
496 typedef int (WINAPI *LPFN_CONNECT)(SOCKET,const struct WS(sockaddr)*,int);
497 typedef struct WS(hostent)* (WINAPI *LPFN_GETHOSTBYADDR)(const char*,int,int);
498 typedef struct WS(hostent)* (WINAPI *LPFN_GETHOSTBYNAME)(const char*);
499 typedef int (WINAPI *LPFN_GETHOSTNAME)(char*,int);
500 typedef int (WINAPI *LPFN_GETPEERNAME)(SOCKET,struct WS(sockaddr)*,int*);
501 typedef struct WS(protoent)* (WINAPI *LPFN_GETPROTOBYNAME)(const char*);
502 typedef struct WS(protoent)* (WINAPI *LPFN_GETPROTOBYNUMBER)(int);
503 #ifdef WS_DEFINE_SELECT
504 typedef int (WINAPI* LPFN_SELECT)(int,WS(fd_set)*,WS(fd_set)*,WS(fd_set)*,const struct WS(timeval)*);
505 #endif
506 typedef struct WS(servent)* (WINAPI *LPFN_GETSERVBYNAME)(const char*,const char*);
507 typedef struct WS(servent)* (WINAPI *LPFN_GETSERVBYPORT)(int,const char*);
508 typedef int (WINAPI *LPFN_GETSOCKNAME)(SOCKET,struct WS(sockaddr)*,int*);
509 typedef int (WINAPI *LPFN_GETSOCKOPT)(SOCKET,int,int,char*,int*);
510 typedef u_long (WINAPI *LPFN_HTONL)(u_long);
511 typedef u_short (WINAPI *LPFN_HTONS)(u_short);
512 typedef unsigned long (WINAPI *LPFN_INET_ADDR)(const char*);
513 typedef char* (WINAPI *LPFN_INET_NTOA)(struct WS(in_addr);
514 typedef int (WINAPI *LPFN_IOCTLSOCKET)(SOCKET,long,u_long*);
515 typedef int (WINAPI *LPFN_LISTEN)(SOCKET,int);
516 typedef u_long (WINAPI *LPFN_NTOHL)(u_long);
517 typedef u_short (WINAPI *LPFN_NTOHS)(u_short);
518 typedef int (WINAPI *LPFN_RECV)(SOCKET,char*,int,int);
519 typedef int (WINAPI *LPFN_RECVFROM)(SOCKET,char*,int,int,struct WS(sockaddr)*,int*);
520 typedef int (WINAPI *LPFN_SEND)(SOCKET,const char*,int,int);
521 typedef int (WINAPI *LPFN_SENDTO)(SOCKET,const char*,int,int,const struct WS(sockaddr)*,int);
522 typedef int (WINAPI *LPFN_SETSOCKOPT)(SOCKET,int,int,const char*,int);
523 typedef int (WINAPI *LPFN_SHUTDOWN)(SOCKET,int);
524 typedef SOCKET (WINAPI *LPFN_SOCKET)(int,int,int);
525 #endif /* WS_API_TYPEDEFS */
530 * Winsock2 Prototypes
532 * Remember to keep this section in sync with the
533 * "Winsock2 Function Typedefs" section below.
535 #if WS_API_PROTOTYPES
536 SOCKET WINAPI WSAAccept(SOCKET,struct WS(sockaddr)*,LPINT,LPCONDITIONPROC,DWORD);
537 INT WINAPI WSAAddressToStringA(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOA,LPSTR,LPDWORD);
538 INT WINAPI WSAAddressToStringW(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOW,LPWSTR,LPDWORD);
539 #define WSAAddressToString WINELIB_NAME_AW(WSAAddressToString)
540 BOOL WINAPI WSACloseEvent(WSAEVENT);
541 int WINAPI WSAConnect(SOCKET,const struct WS(sockaddr)*,int,LPWSABUF,LPWSABUF,LPQOS,LPQOS);
542 WSAEVENT WINAPI WSACreateEvent(void);
543 /* WSADuplicateSocketA */
544 /* WSADuplicateSocketW */
545 /* WSAEnumNameSpaceProvidersA */
546 /* WSAEnumNameSpaceProvidersW */
547 int WINAPI WSAEnumNetworkEvents(SOCKET,WSAEVENT,LPWSANETWORKEVENTS);
548 int WINAPI WSAEnumProtocolsA(LPINT,LPWSAPROTOCOL_INFOA,LPDWORD);
549 int WINAPI WSAEnumProtocolsW(LPINT,LPWSAPROTOCOL_INFOW,LPDWORD);
550 #define WSAEnumProtocols WINELIB_NAME_AW(WSAEnumProtocols)
551 int WINAPI WSAEventSelect(SOCKET,WSAEVENT,long);
552 BOOL WINAPI WSAGetOverlappedResult(SOCKET,LPWSAOVERLAPPED,LPDWORD,BOOL,LPDWORD);
553 /* WSAGetQOSByName */
554 /* WSAGetServiceClassInfoA */
555 /* WSAGetServiceClassInfoW */
556 /* WSAGetServiceClassNameByClassIdA */
557 /* WSAGetServiceClassNameByClassIdW */
558 int WINAPI WSAHtonl(SOCKET,u_long,u_long*);
559 int WINAPI WSAHtons(SOCKET,u_short,u_short*);
560 int WINAPI WSAInstallServiceClassA(LPWSASERVICECLASSINFOA);
561 int WINAPI WSAInstallServiceClassW(LPWSASERVICECLASSINFOW);
562 #define WSAInstallServiceClass WINELIB_NAME_AW(WSAInstallServiceClass)
563 int WINAPI WSAIoctl(SOCKET,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
564 SOCKET WINAPI WSAJoinLeaf(SOCKET,const struct WS(sockaddr)*,int,LPWSABUF,LPWSABUF,LPQOS,LPQOS,DWORD);
565 INT WINAPI WSALookupServiceBeginA( LPWSAQUERYSETA, DWORD, LPHANDLE);
566 INT WINAPI WSALookupServiceBeginW( LPWSAQUERYSETW, DWORD, LPHANDLE);
567 #define WSALookupServiceBegin WINELIB_NAME_AW(WSALookupServiceBegin)
568 /* WSALookupServiceEnd */
569 /* WSALookupServiceNextA */
570 /* WSALookupServiceNextW */
571 int WINAPI WSANtohl(SOCKET,u_long,u_long*);
572 int WINAPI WSANtohs(SOCKET,u_short,u_short*);
573 /* WSAProviderConfigChange */
574 int WINAPI WSARecv(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
575 int WINAPI WSARecvDisconnect(SOCKET,LPWSABUF);
576 int WINAPI WSARecvFrom(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,struct WS(sockaddr)*,LPINT,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
577 /* WSARemoveServiceClass */
578 BOOL WINAPI WSAResetEvent(WSAEVENT);
579 int WINAPI WSASend(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
580 int WINAPI WSASendDisconnect(SOCKET,LPWSABUF);
581 int WINAPI WSASendTo(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,const struct WS(sockaddr)*,int,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
582 BOOL WINAPI WSASetEvent(WSAEVENT);
583 /* WSASetServiceA */
584 /* WSASetServiceW */
585 SOCKET WINAPI WSASocketA(int,int,int,LPWSAPROTOCOL_INFOA,GROUP,DWORD);
586 SOCKET WINAPI WSASocketW(int,int,int,LPWSAPROTOCOL_INFOW,GROUP,DWORD);
587 #define WSASocket WINELIB_NAME_AW(WSASocket)
588 INT WINAPI WSAStringToAddressA(LPSTR,INT,LPWSAPROTOCOL_INFOA,LPSOCKADDR,LPINT);
589 INT WINAPI WSAStringToAddressW(LPWSTR,INT,LPWSAPROTOCOL_INFOW,LPSOCKADDR,LPINT);
590 #define WSAStringToAddress WINELIB_NAME_AW(WSAStringToAddress)
591 DWORD WINAPI WSAWaitForMultipleEvents(DWORD,const WSAEVENT*,BOOL,DWORD,BOOL);
592 #endif /* WS_API_PROTOTYPES */
597 * Winsock2 Function Typedefs
599 * Remember to keep this section in sync with the
600 * "Winsock2 Prototypes" section above.
602 #if WS_API_TYPEDEFS
603 typedef SOCKET (WINAPI *LPFN_WSAACCEPT)(SOCKET,WS(sockaddr)*,LPINT,LPCONDITIONPROC,DWORD);
604 typedef INT (WINAPI *LPFN_WSAADRESSTOSTRINGA)(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOA,LPSTR,LPDWORD);
605 typedef INT (WINAPI *LPFN_WSAADRESSTOSTRINGW)(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOW,LPWSTR,LPDWORD);
606 #define LPFN_WSAADDRESSTOSTRING WINELIB_NAME_AW(LPFN_WSAADDRESSTOSTRING)
607 typedef BOOL (WINAPI *LPFN_WSACLOSEEVENT)(WSAEVENT);
608 typedef int (WINAPI *LPFN_WSACONNECT)(SOCKET,const struct WS(sockaddr)*,int,LPWSABUF,LPWSABUF,LPQOS,LPQOS);
609 typedef WSAEVENT (WINAPI *LPFN_WSACREATEEVENT)(void);
610 /* WSADuplicateSocketA */
611 /* WSADuplicateSocketW */
612 /* WSAEnumNameSpaceProvidersA */
613 /* WSAEnumNameSpaceProvidersW */
614 typedef int (WINAPI *LPFN_WSAENUMNETWORKEVENT)(SOCKET,WSAEVENT,LPWSANETWORKEVENTS);
615 typedef int (WINAPI *LPFN_WSAENUMPROTOCOLSA)(LPINT,LPWSAPROTOCOL_INFOA,LPDWORD);
616 typedef int (WINAPI *LPFN_WSAENUMPROTOCOLSW)(LPINT,LPWSAPROTOCOL_INFOW,LPDWORD);
617 #define LPFN_WSAENUMPROTOCOLS WINELIB_NAME_AW(LPFN_WSAENUMPROTOCOLS)
618 typedef int (WINAPI *LPFN_WSAEVENTSELECT)(SOCKET,WSAEVENT,long);
619 typedef BOOL (WINAPI *LPFN_WSAGETOVERLAPPEDRESULT)(SOCKET,LPWSAOVERLAPPED,LPDWORD,BOOL,LPDWORD);
620 /* WSAGetQOSByName */
621 /* WSAGetServiceClassInfoA */
622 /* WSAGetServiceClassInfoW */
623 /* WSAGetServiceClassNameByClassIdA */
624 /* WSAGetServiceClassNameByClassIdW */
625 typedef int (WINAPI *LPFN_WSAHTONL)(SOCKET,u_long,u_long*);
626 typedef int (WINAPI *LPFN_WSAHTONS)(SOCKET,u_short,u_short*);
627 typedef int (WINAPI LPFN_WSAINSTALLSERVICECLASSA)(LPWSASERVICECLASSINFOA);
628 typedef int (WINAPI LPFN_WSAINSTALLSERVICECLASSW)(LPWSASERVICECLASSINFOW);
629 typedef int (WINAPI *LPFN_WSAIOCTL)(SOCKET,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
630 typedef int (WINAPI *LPFN_WSAJOINLEAF)(SOCKET,const struct WS(sockaddr)*,int,LPWSABUF,LPWSABUF,LPQOS,LPQOS,DWORD);
631 /* WSALookupServiceBeginA */
632 /* WSALookupServiceBeginW */
633 /* WSALookupServiceEnd */
634 /* WSALookupServiceNextA */
635 /* WSALookupServiceNextW */
636 typedef int (WINAPI *LPFN_WSANTOHL)(SOCKET,u_long,u_long*);
637 typedef int (WINAPI *LPFN_WSANTOHS)(SOCKET,u_short,u_short*);
638 /* WSAProviderConfigChange */
639 typedef int (WINAPI *LPFN_WSARECV)(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
640 typedef int (WINAPI *LPFN_WSARECVDISCONNECT)(SOCKET,LPWSABUF);
641 typedef int (WINAPI *LPFN_WSARECVFROM)(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,struct WS(sockaddr)*,LPINT,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
642 /* WSARemoveServiceClass */
643 typedef BOOL (WINAPI *LPFN_WSARESETEVENT)(WSAEVENT);
644 typedef int (WINAPI *LPFN_WSASEND)(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
645 typedef int (WINAPI *LPFN_WSASENDDISCONNECT)(SOCKET,LPWSABUF);
646 typedef int (WINAPI *LPFN_WSASENDTO)(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,const struct WS(sockaddr)*,int,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
647 typedef BOOL (WINAPI *LPFN_WSASETEVENT)(WSAEVENT);
648 /* WSASetServiceA */
649 /* WSASetServiceW */
650 typedef SOCKET (WINAPI *LPFN_WSASOCKETA)(int,int,int,LPWSAPROTOCOL_INFOA,GROUP,DWORD);
651 typedef SOCKET (WINAPI *LPFN_WSASOCKETW)(int,int,int,LPWSAPROTOCOL_INFOW,GROUP,DWORD);
652 typedef INT (WINAPI *LPFN_WSASTRINGTOADDRESSA)(LPSTR,INT,LPWSAPROTOCOL_INFOA,LPSOCKADDR,LPINT);
653 typedef INT (WINAPI *LPFN_WSASTRINGTOADDRESSW)(LPSTR,INT,LPWSAPROTOCOL_INFOA,LPSOCKADDR,LPINT);
654 #define LPFN_WSASOCKET WINELIB_NAME_AW(LPFN_WSASOCKET)
655 #define LPFN_WSASTRINGTOADDRESS WINELIB_NAME_AW(LPFN_WSASTRINGTOADDRESS)
656 typedef DWORD (WINAPI *LPFN_WSAWAITFORMULTIPLEEVENTS)(DWORD,const WSAEVENT*,BOOL,DWORD,BOOL);
657 #endif /* WS_API_TYPEDEFS */
660 /* Condition function return values */
661 #define CF_ACCEPT 0x0000
662 #define CF_REJECT 0x0001
663 #define CF_DEFER 0x0002
665 #include <poppack.h>
667 #ifdef __cplusplus
669 #endif
671 #undef WS
672 #undef WS_API_PROTOTYPES
673 #undef WS_API_TYPEDEFS
675 #endif /* __WINSOCK2API__ */