ole32/tests: Replace some '#if 0's with 'if (0)'s.
[wine.git] / include / winsock2.h
blob8b75342d074f274e09eb79e460251492633ea689
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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) */
56 #ifndef USE_WS_PREFIX
57 #define SO_GROUP_ID 0x2001
58 #define SO_GROUP_PRIORITY 0x2002
59 #define SO_MAX_MSG_SIZE 0x2003
60 #define SO_PROTOCOL_INFOA 0x2004
61 #define SO_PROTOCOL_INFOW 0x2005
62 #define SO_PROTOCOL_INFO WINELIB_NAME_AW(WS_SO_PROTOCOL_INFO)
63 #define PVD_CONFIG 0x3001
64 #define SO_CONDITIONAL_ACCEPT 0x3002
65 #else
66 #define WS_SO_GROUP_ID 0x2001
67 #define WS_SO_GROUP_PRIORITY 0x2002
68 #define WS_SO_MAX_MSG_SIZE 0x2003
69 #define WS_SO_PROTOCOL_INFOA 0x2004
70 #define WS_SO_PROTOCOL_INFOW 0x2005
71 #define WS_SO_PROTOCOL_INFO WINELIB_NAME_AW(WS_SO_PROTOCOL_INFO)
72 #define WS_PVD_CONFIG 0x3001
73 #define WS_SO_CONDITIONAL_ACCEPT 0x3002
74 #endif
76 /* protocol types */
78 #ifndef USE_WS_PREFIX
79 #define SOCK_STREAM 1
80 #define SOCK_DGRAM 2
81 #define SOCK_RAW 3
82 #define SOCK_RDM 4
83 #define SOCK_SEQPACKET 5
84 #else /* USE_WS_PREFIX */
85 #define WS_SOCK_STREAM 1
86 #define WS_SOCK_DGRAM 2
87 #define WS_SOCK_RAW 3
88 #define WS_SOCK_RDM 4
89 #define WS_SOCK_SEQPACKET 5
90 #endif /* USE_WS_PREFIX */
92 /* option flags per socket */
94 #define FD_MAX_EVENTS 10
95 #define FD_READ_BIT 0
96 #define FD_WRITE_BIT 1
97 #define FD_OOB_BIT 2
98 #define FD_ACCEPT_BIT 3
99 #define FD_CONNECT_BIT 4
100 #define FD_CLOSE_BIT 5
102 /* Constants for LPCONDITIONPROC */
103 #define CF_ACCEPT 0x0000
104 #define CF_REJECT 0x0001
105 #define CF_DEFER 0x0002
107 /* Constants for shutdown() */
108 #define SD_RECEIVE 0x00
109 #define SD_SEND 0x01
110 #define SD_BOTH 0x02
112 /* Constants for WSAIoctl() */
113 #ifdef USE_WS_PREFIX
114 #define WS_IOC_UNIX 0x00000000
115 #define WS_IOC_WS2 0x08000000
116 #define WS_IOC_PROTOCOL 0x10000000
117 #define WS_IOC_VENDOR 0x18000000
118 #define WS_IOC_VOID 0x20000000
119 #define WS_IOC_OUT 0x40000000
120 #define WS_IOC_IN 0x80000000
121 #define WS_IOC_INOUT (WS_IOC_IN|WS_IOC_OUT)
122 #define _WSAIO(x,y) (WS_IOC_VOID|(x)|(y))
123 #define _WSAIOR(x,y) (WS_IOC_OUT|(x)|(y))
124 #define _WSAIOW(x,y) (WS_IOC_IN|(x)|(y))
125 #define _WSAIORW(x,y) (WS_IOC_INOUT|(x)|(y))
126 #define WS_SIO_ASSOCIATE_HANDLE _WSAIOW(WS_IOC_WS2,1)
127 #define WS_SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(WS_IOC_WS2,2)
128 #define WS_SIO_FIND_ROUTE _WSAIOR(WS_IOC_WS2,3)
129 #define WS_SIO_FLUSH _WSAIO(WS_IOC_WS2,4)
130 #define WS_SIO_GET_BROADCAST_ADDRESS _WSAIOR(WS_IOC_WS2,5)
131 #define WS_SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(WS_IOC_WS2,6)
132 #define WS_SIO_GET_QOS _WSAIORW(WS_IOC_WS2,7)
133 #define WS_SIO_GET_GROUP_QOS _WSAIORW(WS_IOC_WS2,8)
134 #define WS_SIO_MULTIPOINT_LOOPBACK _WSAIOW(WS_IOC_WS2,9)
135 #define WS_SIO_MULTICAST_SCOPE _WSAIOW(WS_IOC_WS2,10)
136 #define WS_SIO_SET_QOS _WSAIOW(WS_IOC_WS2,11)
137 #define WS_SIO_SET_GROUP_QOS _WSAIOW(WS_IOC_WS2,12)
138 #define WS_SIO_TRANSLATE_HANDLE _WSAIORW(WS_IOC_WS2,13)
139 #define WS_SIO_ROUTING_INTERFACE_QUERY _WSAIORW(WS_IOC_WS2,20)
140 #define WS_SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(WS_IOC_WS2,21)
141 #define WS_SIO_ADDRESS_LIST_QUERY _WSAIOR(WS_IOC_WS2,22)
142 #define WS_SIO_ADDRESS_LIST_CHANGE _WSAIO(WS_IOC_WS2,23)
143 #define WS_SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(WS_IOC_WS2,24)
144 #define WS_SIO_GET_INTERFACE_LIST WS__IOR('t', 127, WS_u_long)
145 #else /* USE_WS_PREFIX */
146 #undef IOC_VOID
147 #undef IOC_IN
148 #undef IOC_OUT
149 #undef IOC_INOUT
150 #define IOC_UNIX 0x00000000
151 #define IOC_WS2 0x08000000
152 #define IOC_PROTOCOL 0x10000000
153 #define IOC_VENDOR 0x18000000
154 #define IOC_VOID 0x20000000
155 #define IOC_OUT 0x40000000
156 #define IOC_IN 0x80000000
157 #define IOC_INOUT (IOC_IN|IOC_OUT)
158 #define _WSAIO(x,y) (IOC_VOID|(x)|(y))
159 #define _WSAIOR(x,y) (IOC_OUT|(x)|(y))
160 #define _WSAIOW(x,y) (IOC_IN|(x)|(y))
161 #define _WSAIORW(x,y) (IOC_INOUT|(x)|(y))
162 #define SIO_ASSOCIATE_HANDLE _WSAIOW(IOC_WS2,1)
163 #define SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(IOC_WS2,2)
164 #define SIO_FIND_ROUTE _WSAIOR(IOC_WS2,3)
165 #define SIO_FLUSH _WSAIO(IOC_WS2,4)
166 #define SIO_GET_BROADCAST_ADDRESS _WSAIOR(IOC_WS2,5)
167 #define SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(IOC_WS2,6)
168 #define SIO_GET_QOS _WSAIORW(IOC_WS2,7)
169 #define SIO_GET_GROUP_QOS _WSAIORW(IOC_WS2,8)
170 #define SIO_MULTIPOINT_LOOPBACK _WSAIOW(IOC_WS2,9)
171 #define SIO_MULTICAST_SCOPE _WSAIOW(IOC_WS2,10)
172 #define SIO_SET_QOS _WSAIOW(IOC_WS2,11)
173 #define SIO_SET_GROUP_QOS _WSAIOW(IOC_WS2,12)
174 #define SIO_TRANSLATE_HANDLE _WSAIORW(IOC_WS2,13)
175 #define SIO_ROUTING_INTERFACE_QUERY _WSAIORW(IOC_WS2,20)
176 #define SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(IOC_WS2,21)
177 #define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22)
178 #define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23)
179 #define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_WS2,24)
180 #define SIO_GET_INTERFACE_LIST _IOR ('t', 127, u_long)
181 #endif /* USE_WS_PREFIX */
183 /* Constants for WSAIoctl() */
184 #define WSA_FLAG_OVERLAPPED 0x01
185 #define WSA_FLAG_MULTIPOINT_C_ROOT 0x02
186 #define WSA_FLAG_MULTIPOINT_C_LEAF 0x04
187 #define WSA_FLAG_MULTIPOINT_D_ROOT 0x08
188 #define WSA_FLAG_MULTIPOINT_D_LEAF 0x10
190 /* Constants for WSAJoinLeaf() */
191 #define JL_SENDER_ONLY 0x01
192 #define JL_RECEIVER_ONLY 0x02
193 #define JL_BOTH 0x04
196 #ifndef GUID_DEFINED
197 #include <guiddef.h>
198 #endif
200 #define MAX_PROTOCOL_CHAIN 7
201 #define BASE_PROTOCOL 1
202 #define LAYERED_PROTOCOL 0
204 typedef struct _WSAPROTOCOLCHAIN
206 int ChainLen; /* the length of the chain, */
207 /* length = 0 means layered protocol, */
208 /* length = 1 means base protocol, */
209 /* length > 1 means protocol chain */
210 DWORD ChainEntries[MAX_PROTOCOL_CHAIN]; /* a list of dwCatalogEntryIds */
211 } WSAPROTOCOLCHAIN, * LPWSAPROTOCOLCHAIN;
213 #define XP1_CONNECTIONLESS 0x00000001
214 #define XP1_GUARANTEED_DELIVERY 0x00000002
215 #define XP1_GUARANTEED_ORDER 0x00000004
216 #define XP1_MESSAGE_ORIENTED 0x00000008
217 #define XP1_PSEUDO_STREAM 0x00000010
218 #define XP1_GRACEFUL_CLOSE 0x00000020
219 #define XP1_EXPEDITED_DATA 0x00000040
220 #define XP1_CONNECT_DATA 0x00000080
221 #define XP1_DISCONNECT_DATA 0x00000100
222 #define XP1_SUPPORT_BROADCAST 0x00000200
223 #define XP1_SUPPORT_MULTIPOINT 0x00000400
224 #define XP1_MULTIPOINT_CONTROL_PLANE 0x00000800
225 #define XP1_MULTIPOINT_DATA_PLANE 0x00001000
226 #define XP1_QOS_SUPPORTED 0x00002000
227 #define XP1_INTERRUPT 0x00004000
228 #define XP1_UNI_SEND 0x00008000
229 #define XP1_UNI_RECV 0x00010000
230 #define XP1_IFS_HANDLES 0x00020000
231 #define XP1_PARTIAL_MESSAGE 0x00040000
233 #define BIGENDIAN 0x0000
234 #define LITTLEENDIAN 0x0001
236 #define SECURITY_PROTOCOL_NONE 0x0000
238 #define WSAPROTOCOL_LEN 255
239 typedef struct _WSAPROTOCOL_INFOA
241 DWORD dwServiceFlags1;
242 DWORD dwServiceFlags2;
243 DWORD dwServiceFlags3;
244 DWORD dwServiceFlags4;
245 DWORD dwProviderFlags;
246 GUID ProviderId;
247 DWORD dwCatalogEntryId;
248 WSAPROTOCOLCHAIN ProtocolChain;
249 int iVersion;
250 int iAddressFamily;
251 int iMaxSockAddr;
252 int iMinSockAddr;
253 int iSocketType;
254 int iProtocol;
255 int iProtocolMaxOffset;
256 int iNetworkByteOrder;
257 int iSecurityScheme;
258 DWORD dwMessageSize;
259 DWORD dwProviderReserved;
260 CHAR szProtocol[WSAPROTOCOL_LEN+1];
261 } WSAPROTOCOL_INFOA, * LPWSAPROTOCOL_INFOA;
263 typedef struct _WSAPROTOCOL_INFOW
265 DWORD dwServiceFlags1;
266 DWORD dwServiceFlags2;
267 DWORD dwServiceFlags3;
268 DWORD dwServiceFlags4;
269 DWORD dwProviderFlags;
270 GUID ProviderId;
271 DWORD dwCatalogEntryId;
272 WSAPROTOCOLCHAIN ProtocolChain;
273 int iVersion;
274 int iAddressFamily;
275 int iMaxSockAddr;
276 int iMinSockAddr;
277 int iSocketType;
278 int iProtocol;
279 int iProtocolMaxOffset;
280 int iNetworkByteOrder;
281 int iSecurityScheme;
282 DWORD dwMessageSize;
283 DWORD dwProviderReserved;
284 WCHAR szProtocol[WSAPROTOCOL_LEN+1];
285 } WSAPROTOCOL_INFOW, *LPWSAPROTOCOL_INFOW;
287 DECL_WINELIB_TYPE_AW(WSAPROTOCOL_INFO)
288 DECL_WINELIB_TYPE_AW(LPWSAPROTOCOL_INFO)
290 typedef struct _WSANETWORKEVENTS
292 long lNetworkEvents;
293 int iErrorCode[FD_MAX_EVENTS];
294 } WSANETWORKEVENTS, *LPWSANETWORKEVENTS;
296 typedef struct _WSANSClassInfoA
298 LPSTR lpszName;
299 DWORD dwNameSpace;
300 DWORD dwValueType;
301 DWORD dwValueSize;
302 LPVOID lpValue;
303 } WSANSCLASSINFOA, *PWSANSCLASSINFOA, *LPWSANSCLASSINFOA;
305 typedef struct _WSANSClassInfoW
307 LPSTR lpszName;
308 DWORD dwNameSpace;
309 DWORD dwValueType;
310 DWORD dwValueSize;
311 LPVOID lpValue;
312 } WSANSCLASSINFOW, *PWSANSCLASSINFOW, *LPWSANSCLASSINFOW;
314 DECL_WINELIB_TYPE_AW(WSANSCLASSINFO)
315 DECL_WINELIB_TYPE_AW(PWSANSCLASSINFO)
316 DECL_WINELIB_TYPE_AW(LPWSANSCLASSINFO)
318 typedef struct _WSAServiceClassInfoA
320 LPGUID lpServiceClassId;
321 LPSTR lpszServiceClassName;
322 DWORD dwCount;
323 LPWSANSCLASSINFOA lpClassInfos;
324 } WSASERVICECLASSINFOA, *PWSASERVICECLASSINFOA, *LPWSASERVICECLASSINFOA;
326 typedef struct _WSAServiceClassInfoW
328 LPGUID lpServiceClassId;
329 LPWSTR lpszServiceClassName;
330 DWORD dwCount;
331 LPWSANSCLASSINFOW lpClassInfos;
332 } WSASERVICECLASSINFOW, *PWSASERVICECLASSINFOW, *LPWSASERVICECLASSINFOW;
335 DECL_WINELIB_TYPE_AW(WSASERVICECLASSINFO)
336 DECL_WINELIB_TYPE_AW(PWSASERVICECLASSINFO)
337 DECL_WINELIB_TYPE_AW(LPWSASERVICECLASSINFO)
339 typedef struct _WSABUF
341 ULONG len;
342 CHAR* buf;
343 } WSABUF, *LPWSABUF;
345 #define WSAEVENT HANDLE
346 #define LPWSAEVENT LPHANDLE
347 #define WSAOVERLAPPED OVERLAPPED
348 typedef struct _OVERLAPPED* LPWSAOVERLAPPED;
350 #define WSA_IO_PENDING (ERROR_IO_PENDING)
351 #define WSA_IO_INCOMPLETE (ERROR_IO_INCOMPLETE)
352 #define WSA_INVALID_HANDLE (ERROR_INVALID_HANDLE)
353 #define WSA_INVALID_PARAMETER (ERROR_INVALID_PARAMETER)
354 #define WSA_NOT_ENOUGH_MEMORY (ERROR_NOT_ENOUGH_MEMORY)
355 #define WSA_OPERATION_ABORTED (ERROR_OPERATION_ABORTED)
357 #define WSA_INVALID_EVENT ((WSAEVENT)NULL)
358 #define WSA_MAXIMUM_WAIT_EVENTS (MAXIMUM_WAIT_OBJECTS)
359 #define WSA_WAIT_FAILED ((DWORD)-1L)
360 #define WSA_WAIT_EVENT_0 (WAIT_OBJECT_0)
361 #define WSA_WAIT_IO_COMPLETION (WAIT_IO_COMPLETION)
362 #define WSA_WAIT_TIMEOUT (WAIT_TIMEOUT)
363 #define WSA_INFINITE (INFINITE)
365 typedef unsigned int GROUP;
366 #define SG_UNCONSTRAINED_GROUP 0x01
367 #define SG_CONSTRAINED_GROUP 0x02
370 * FLOWSPEC and SERVICETYPE should eventually move to qos.h
373 typedef ULONG SERVICETYPE;
375 typedef struct _FLOWSPEC {
376 unsigned int TokenRate;
377 unsigned int TokenBucketSize;
378 unsigned int PeakBandwidth;
379 unsigned int Latency;
380 unsigned int DelayVariation;
381 SERVICETYPE ServiceType;
382 unsigned int MaxSduSize;
383 unsigned int MinimumPolicedSize;
384 } FLOWSPEC, *PFLOWSPEC, *LPFLOWSPEC;
386 typedef struct _QUALITYOFSERVICE {
387 FLOWSPEC SendingFlowspec;
388 FLOWSPEC ReceivingFlowspec;
389 WSABUF ProviderSpecific;
390 } QOS, *LPQOS;
392 typedef int (CALLBACK *LPCONDITIONPROC)
394 LPWSABUF lpCallerId,
395 LPWSABUF lpCallerData,
396 LPQOS lpSQOS,
397 LPQOS lpGQOS,
398 LPWSABUF lpCalleeId,
399 LPWSABUF lpCalleeData,
400 GROUP *g,
401 DWORD dwCallbackData
404 typedef void (CALLBACK *LPWSAOVERLAPPED_COMPLETION_ROUTINE)
406 DWORD dwError,
407 DWORD cbTransferred,
408 LPWSAOVERLAPPED lpOverlapped,
409 DWORD dwFlags
412 #ifndef _tagBLOB_DEFINED
413 #define _tagBLOB_DEFINED
414 #define _BLOB_DEFINED
415 #define _LPBLOB_DEFINED
416 typedef struct _BLOB {
417 ULONG cbSize;
418 BYTE *pBlobData;
419 } BLOB, *LPBLOB;
420 #endif
422 #ifndef __CSADDR_DEFINED__
423 #define __CSADDR_DEFINED__
425 typedef struct _SOCKET_ADDRESS {
426 LPSOCKADDR lpSockaddr;
427 INT iSockaddrLength;
428 } SOCKET_ADDRESS, *PSOCKET_ADDRESS, *LPSOCKET_ADDRESS;
430 typedef struct _CSADDR_INFO {
431 SOCKET_ADDRESS LocalAddr;
432 SOCKET_ADDRESS RemoteAddr;
433 INT iSocketType;
434 INT iProtocol;
435 } CSADDR_INFO, *PCSADDR_INFO, *LPCSADDR_INFO;
436 #endif
438 /*socket address list */
439 typedef struct _SOCKET_ADDRESS_LIST {
440 INT iAddressCount;
441 SOCKET_ADDRESS Address[1];
442 } SOCKET_ADDRESS_LIST, *LPSOCKET_ADDRESS_LIST;
444 /* addressfamily protocol pairs */
445 typedef struct _AFPROTOCOLS {
446 INT iAddressFamily;
447 INT iProtocol;
448 } AFPROTOCOLS, *PAFPROTOCOLS, *LPAFPROTOCOLS;
450 /* client query definitions */
451 typedef enum _WSAEcomparator {
452 COMP_EQUAL = 0,
453 COMP_NOTLESS
454 } WSAECOMPARATOR, *PWSAECOMPARATOR, *LPWSAECOMPARATOR;
456 typedef struct _WSAVersion {
457 DWORD dwVersion;
458 WSAECOMPARATOR ecHow;
459 } WSAVERSION, *PWSAVERSION, *LPWSAVERSION;
462 typedef struct _WSAQuerySetA {
463 DWORD dwSize;
464 LPSTR lpszServiceInstanceName;
465 LPGUID lpServiceClassId;
466 LPWSAVERSION lpVersion;
467 LPSTR lpszComment;
468 DWORD dwNameSpace;
469 LPGUID lpNSProviderId;
470 LPSTR lpszContext;
471 DWORD dwNumberOfProtocols;
472 LPAFPROTOCOLS lpafpProtocols;
473 LPSTR lpszQueryString;
474 DWORD dwNumberOfCsAddrs;
475 LPCSADDR_INFO lpcsaBuffer;
476 DWORD dwOutputFlags;
477 LPBLOB lpBlob;
478 } WSAQUERYSETA, *PWSAQUERYSETA, *LPWSAQUERYSETA;
480 typedef struct _WSAQuerySetW {
481 DWORD dwSize;
482 LPWSTR lpszServiceInstanceName;
483 LPGUID lpServiceClassId;
484 LPWSAVERSION lpVersion;
485 LPWSTR lpszComment;
486 DWORD dwNameSpace;
487 LPGUID lpNSProviderId;
488 LPWSTR lpszContext;
489 DWORD dwNumberOfProtocols;
490 LPAFPROTOCOLS lpafpProtocols;
491 LPWSTR lpszQueryString;
492 DWORD dwNumberOfCsAddrs;
493 LPCSADDR_INFO lpcsaBuffer;
494 DWORD dwOutputFlags;
495 LPBLOB lpBlob;
496 } WSAQUERYSETW, *PWSAQUERYSETW, *LPWSAQUERYSETW;
498 DECL_WINELIB_TYPE_AW(WSAQUERYSET)
499 DECL_WINELIB_TYPE_AW(PWSAQUERYSET)
500 DECL_WINELIB_TYPE_AW(LPWSAQUERYSET)
502 typedef enum _WSAESETSERVICEOP {
503 RNRSERVICE_REGISTER = 0,
504 RNRSERVICE_DEREGISTER,
505 RNRSERVICE_DELETE
506 } WSAESETSERVICEOP, *PWSAESETSERVICEOP, *LPWSAESETSERVICEOP;
508 typedef struct _WSANAMESPACE_INFOA {
509 GUID NSProviderId;
510 DWORD dwNameSpace;
511 BOOL fActive;
512 DWORD dwVersion;
513 LPSTR lpszIdentifier;
514 } WSANAMESPACE_INFOA, *PWSANAMESPACE_INFOA, *LPWSANAMESPACE_INFOA;
516 typedef struct _WSANAMESPACE_INFOW {
517 GUID NSProviderId;
518 DWORD dwNameSpace;
519 BOOL fActive;
520 DWORD dwVersion;
521 LPWSTR lpszIdentifier;
522 } WSANAMESPACE_INFOW, *PWSANAMESPACE_INFOW, *LPWSANAMESPACE_INFOW;
524 DECL_WINELIB_TYPE_AW(WSANAMESPACE_INFO)
525 DECL_WINELIB_TYPE_AW(PWSANAMESPACE_INFO)
526 DECL_WINELIB_TYPE_AW(LPWSANAMESPACE_INFO)
529 * Winsock Function Typedefs
531 * Remember to keep this section in sync with the
532 * "Prototypes" section in winsock.h.
534 #if WS_API_TYPEDEFS
535 typedef HANDLE (WINAPI *LPFN_WSAASYNCGETHOSTBYADDR)(HWND,WS(u_int),const char*,int,int,char*,int);
536 typedef HANDLE (WINAPI *LPFN_WSAASYNCGETHOSTBYNAME)(HWND,WS(u_int),const char*,char*,int);
537 typedef HANDLE (WINAPI *LPFN_WSAASYNCGETPROTOBYNAME)(HWND,WS(u_int),const char*,char*,int);
538 typedef HANDLE (WINAPI *LPFN_WSAASYNCGETPROTOBYNUMBER)(HWND,WS(u_int),int,char*,int);
539 typedef HANDLE (WINAPI *LPFN_WSAASYNCGETSERVBYNAME)(HWND,WS(u_int),const char*,const char*,char*,int);
540 typedef HANDLE (WINAPI *LPFN_WSAASYNCGETSERVBYPORT)(HWND,WS(u_int),int,const char*,char*,int);
541 typedef int (WINAPI *LPFN_WSAASYNCSELECT)(SOCKET,HWND,WS(u_int),long);
542 typedef int (WINAPI *LPFN_WSACANCELASYNCREQUEST)(HANDLE);
543 typedef int (WINAPI *LPFN_WSACANCELBLOCKINGCALL)(void);
544 typedef int (WINAPI *LPFN_WSACLEANUP)(void);
545 typedef int (WINAPI *LPFN_WSAGETLASTERROR)(void);
546 typedef BOOL (WINAPI *LPFN_WSAISBLOCKING)(void);
547 typedef FARPROC (WINAPI *LPFN_WSASETBLOCKINGHOOK)(FARPROC);
548 typedef void (WINAPI *LPFN_WSASETLASTERROR)(int);
549 typedef int (WINAPI *LPFN_WSASTARTUP)(WORD,LPWSADATA);
550 typedef int (WINAPI *LPFN_WSAUNHOOKBLOCKINGHOOK)(void);
552 typedef SOCKET (WINAPI *LPFN_ACCEPT)(SOCKET,struct WS(sockaddr)*,int*);
553 typedef int (WINAPI *LPFN_BIND)(SOCKET,const struct WS(sockaddr)*,int);
554 typedef int (WINAPI *LPFN_CLOSESOCKET)(SOCKET);
555 typedef int (WINAPI *LPFN_CONNECT)(SOCKET,const struct WS(sockaddr)*,int);
556 typedef struct WS(hostent)* (WINAPI *LPFN_GETHOSTBYADDR)(const char*,int,int);
557 typedef struct WS(hostent)* (WINAPI *LPFN_GETHOSTBYNAME)(const char*);
558 typedef int (WINAPI *LPFN_GETHOSTNAME)(char*,int);
559 typedef int (WINAPI *LPFN_GETPEERNAME)(SOCKET,struct WS(sockaddr)*,int*);
560 typedef struct WS(protoent)* (WINAPI *LPFN_GETPROTOBYNAME)(const char*);
561 typedef struct WS(protoent)* (WINAPI *LPFN_GETPROTOBYNUMBER)(int);
562 #ifdef WS_DEFINE_SELECT
563 typedef int (WINAPI* LPFN_SELECT)(int,WS(fd_set)*,WS(fd_set)*,WS(fd_set)*,const struct WS(timeval)*);
564 #endif
565 typedef struct WS(servent)* (WINAPI *LPFN_GETSERVBYNAME)(const char*,const char*);
566 typedef struct WS(servent)* (WINAPI *LPFN_GETSERVBYPORT)(int,const char*);
567 typedef int (WINAPI *LPFN_GETSOCKNAME)(SOCKET,struct WS(sockaddr)*,int*);
568 typedef int (WINAPI *LPFN_GETSOCKOPT)(SOCKET,int,int,char*,int*);
569 typedef WS(u_long) (WINAPI *LPFN_HTONL)(WS(u_long));
570 typedef WS(u_short) (WINAPI *LPFN_HTONS)(WS(u_short));
571 typedef unsigned long (WINAPI *LPFN_INET_ADDR)(const char*);
572 typedef char* (WINAPI *LPFN_INET_NTOA)(struct WS(in_addr);
573 typedef int (WINAPI *LPFN_IOCTLSOCKET)(SOCKET,long,WS(u_long)*);
574 typedef int (WINAPI *LPFN_LISTEN)(SOCKET,int);
575 typedef WS(u_long) (WINAPI *LPFN_NTOHL)(WS(u_long));
576 typedef WS(u_short) (WINAPI *LPFN_NTOHS)(WS(u_short));
577 typedef int (WINAPI *LPFN_RECV)(SOCKET,char*,int,int);
578 typedef int (WINAPI *LPFN_RECVFROM)(SOCKET,char*,int,int,struct WS(sockaddr)*,int*);
579 typedef int (WINAPI *LPFN_SEND)(SOCKET,const char*,int,int);
580 typedef int (WINAPI *LPFN_SENDTO)(SOCKET,const char*,int,int,const struct WS(sockaddr)*,int);
581 typedef int (WINAPI *LPFN_SETSOCKOPT)(SOCKET,int,int,const char*,int);
582 typedef int (WINAPI *LPFN_SHUTDOWN)(SOCKET,int);
583 typedef SOCKET (WINAPI *LPFN_SOCKET)(int,int,int);
584 #endif /* WS_API_TYPEDEFS */
589 * Winsock2 Prototypes
591 * Remember to keep this section in sync with the
592 * "Winsock2 Function Typedefs" section below.
594 #if WS_API_PROTOTYPES
595 SOCKET WINAPI WSAAccept(SOCKET,struct WS(sockaddr)*,LPINT,LPCONDITIONPROC,DWORD);
596 INT WINAPI WSAAddressToStringA(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOA,LPSTR,LPDWORD);
597 INT WINAPI WSAAddressToStringW(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOW,LPWSTR,LPDWORD);
598 #define WSAAddressToString WINELIB_NAME_AW(WSAAddressToString)
599 BOOL WINAPI WSACloseEvent(WSAEVENT);
600 int WINAPI WSAConnect(SOCKET,const struct WS(sockaddr)*,int,LPWSABUF,LPWSABUF,LPQOS,LPQOS);
601 WSAEVENT WINAPI WSACreateEvent(void);
602 INT WINAPI WSADuplicateSocketA(SOCKET,DWORD,LPWSAPROTOCOL_INFOA);
603 INT WINAPI WSADuplicateSocketW(SOCKET,DWORD,LPWSAPROTOCOL_INFOW);
604 #define WSADuplicateSocket WINELIB_NAME_AW(WSADuplicateSocket)
605 INT WINAPI WSAEnumNameSpaceProvidersA(LPDWORD,LPWSANAMESPACE_INFOA);
606 INT WINAPI WSAEnumNameSpaceProvidersW(LPDWORD,LPWSANAMESPACE_INFOW);
607 #define WSAEnumNameSpaceProviders WINELIB_NAME_AW(WSAEnumNameSpaceProviders)
608 int WINAPI WSAEnumNetworkEvents(SOCKET,WSAEVENT,LPWSANETWORKEVENTS);
609 int WINAPI WSAEnumProtocolsA(LPINT,LPWSAPROTOCOL_INFOA,LPDWORD);
610 int WINAPI WSAEnumProtocolsW(LPINT,LPWSAPROTOCOL_INFOW,LPDWORD);
611 #define WSAEnumProtocols WINELIB_NAME_AW(WSAEnumProtocols)
612 int WINAPI WSAEventSelect(SOCKET,WSAEVENT,long);
613 BOOL WINAPI WSAGetOverlappedResult(SOCKET,LPWSAOVERLAPPED,LPDWORD,BOOL,LPDWORD);
614 BOOL WINAPI WSAGetQOSByName(SOCKET,LPWSABUF,LPQOS);
615 INT WINAPI WSAGetServiceClassInfoA(LPGUID,LPGUID,LPDWORD,LPWSASERVICECLASSINFOA);
616 INT WINAPI WSAGetServiceClassInfoW(LPGUID,LPGUID,LPDWORD,LPWSASERVICECLASSINFOW);
617 #define WSAGetServiceClassInfo WINELIB_NAME_AW(WSAGetServiceClassInfo)
618 INT WINAPI WSAGetServiceClassNameByClassIdA(LPGUID,LPSTR,LPDWORD);
619 INT WINAPI WSAGetServiceClassNameByClassIdW(LPGUID,LPWSTR,LPDWORD);
620 #define WSAGetServiceClassNameByClassId WINELIB_NAME_AW(WSAGetServiceClassNameByClassId)
621 int WINAPI WSAHtonl(SOCKET,WS(u_long),WS(u_long)*);
622 int WINAPI WSAHtons(SOCKET,WS(u_short),WS(u_short)*);
623 int WINAPI WSAInstallServiceClassA(LPWSASERVICECLASSINFOA);
624 int WINAPI WSAInstallServiceClassW(LPWSASERVICECLASSINFOW);
625 #define WSAInstallServiceClass WINELIB_NAME_AW(WSAInstallServiceClass)
626 int WINAPI WSAIoctl(SOCKET,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
627 SOCKET WINAPI WSAJoinLeaf(SOCKET,const struct WS(sockaddr)*,int,LPWSABUF,LPWSABUF,LPQOS,LPQOS,DWORD);
628 INT WINAPI WSALookupServiceBeginA(LPWSAQUERYSETA,DWORD,LPHANDLE);
629 INT WINAPI WSALookupServiceBeginW(LPWSAQUERYSETW,DWORD,LPHANDLE);
630 #define WSALookupServiceBegin WINELIB_NAME_AW(WSALookupServiceBegin)
631 INT WINAPI WSALookupServiceEnd(HANDLE);
632 INT WINAPI WSALookupServiceNextA(HANDLE,DWORD,LPDWORD,LPWSAQUERYSETA);
633 INT WINAPI WSALookupServiceNextW(HANDLE,DWORD,LPDWORD,LPWSAQUERYSETW);
634 #define WSALookupServiceNext WINELIB_NAME_AW(WSALookupServiceNext)
635 int WINAPI WSANtohl(SOCKET,WS(u_long),WS(u_long)*);
636 int WINAPI WSANtohs(SOCKET,WS(u_short),WS(u_short)*);
637 INT WINAPI WSAProviderConfigChange(LPHANDLE,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
638 int WINAPI WSARecv(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
639 int WINAPI WSARecvDisconnect(SOCKET,LPWSABUF);
640 int WINAPI WSARecvFrom(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,struct WS(sockaddr)*,LPINT,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
641 INT WINAPI WSARemoveServiceClass(LPGUID);
642 BOOL WINAPI WSAResetEvent(WSAEVENT);
643 int WINAPI WSASend(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
644 int WINAPI WSASendDisconnect(SOCKET,LPWSABUF);
645 int WINAPI WSASendTo(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,const struct WS(sockaddr)*,int,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
646 BOOL WINAPI WSASetEvent(WSAEVENT);
647 INT WINAPI WSASetServiceA(LPWSAQUERYSETA,WSAESETSERVICEOP,DWORD);
648 INT WINAPI WSASetServiceW(LPWSAQUERYSETW,WSAESETSERVICEOP,DWORD);
649 #define WSASetService WINELIB_NAME_AW(WSASetService)
650 SOCKET WINAPI WSASocketA(int,int,int,LPWSAPROTOCOL_INFOA,GROUP,DWORD);
651 SOCKET WINAPI WSASocketW(int,int,int,LPWSAPROTOCOL_INFOW,GROUP,DWORD);
652 #define WSASocket WINELIB_NAME_AW(WSASocket)
653 INT WINAPI WSAStringToAddressA(LPSTR,INT,LPWSAPROTOCOL_INFOA,LPSOCKADDR,LPINT);
654 INT WINAPI WSAStringToAddressW(LPWSTR,INT,LPWSAPROTOCOL_INFOW,LPSOCKADDR,LPINT);
655 #define WSAStringToAddress WINELIB_NAME_AW(WSAStringToAddress)
656 DWORD WINAPI WSAWaitForMultipleEvents(DWORD,const WSAEVENT*,BOOL,DWORD,BOOL);
657 #endif /* WS_API_PROTOTYPES */
662 * Winsock2 Function Typedefs
664 * Remember to keep this section in sync with the
665 * "Winsock2 Prototypes" section above.
667 #if WS_API_TYPEDEFS
668 typedef SOCKET (WINAPI *LPFN_WSAACCEPT)(SOCKET,WS(sockaddr)*,LPINT,LPCONDITIONPROC,DWORD);
669 typedef INT (WINAPI *LPFN_WSAADRESSTOSTRINGA)(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOA,LPSTR,LPDWORD);
670 typedef INT (WINAPI *LPFN_WSAADRESSTOSTRINGW)(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOW,LPWSTR,LPDWORD);
671 #define LPFN_WSAADDRESSTOSTRING WINELIB_NAME_AW(LPFN_WSAADDRESSTOSTRING)
672 typedef BOOL (WINAPI *LPFN_WSACLOSEEVENT)(WSAEVENT);
673 typedef int (WINAPI *LPFN_WSACONNECT)(SOCKET,const struct WS(sockaddr)*,int,LPWSABUF,LPWSABUF,LPQOS,LPQOS);
674 typedef WSAEVENT (WINAPI *LPFN_WSACREATEEVENT)(void);
675 typedef INT (WINAPI *LPFN_WSADUPLICATESOCKETA)(SOCKET,DWORD,LPWSAPROTOCOL_INFOA);
676 typedef INT (WINAPI *LPFN_WSADUPLICATESOCKETW)(SOCKET,DWORD,LPWSAPROTOCOL_INFOW);
677 #define LPFN_WSADUPLICATESOCKET WINELIB_NAME_AW(LPFN_WSADUPLICATESOCKET)
678 typedef INT (WINAPI *LPFNWSAENUMNAMESPACEPROVIDERSA)(LPDWORD,LPWSANAMESPACE_INFOA);
679 typedef INT (WINAPI *LPFNWSAENUMNAMESPACEPROVIDERSW)(LPDWORD,LPWSANAMESPACE_INFOW);
680 #define LPFN_WSAENUMNAMESPACEPROVIDERS WINELIB_NAME_AW(LPFNWSAENUMNAMESPACEPROVIDERS)
681 typedef int (WINAPI *LPFN_WSAENUMNETWORKEVENT)(SOCKET,WSAEVENT,LPWSANETWORKEVENTS);
682 typedef int (WINAPI *LPFN_WSAENUMPROTOCOLSA)(LPINT,LPWSAPROTOCOL_INFOA,LPDWORD);
683 typedef int (WINAPI *LPFN_WSAENUMPROTOCOLSW)(LPINT,LPWSAPROTOCOL_INFOW,LPDWORD);
684 #define LPFN_WSAENUMPROTOCOLS WINELIB_NAME_AW(LPFN_WSAENUMPROTOCOLS)
685 typedef int (WINAPI *LPFN_WSAEVENTSELECT)(SOCKET,WSAEVENT,long);
686 typedef BOOL (WINAPI *LPFN_WSAGETOVERLAPPEDRESULT)(SOCKET,LPWSAOVERLAPPED,LPDWORD,BOOL,LPDWORD);
687 typedef BOOL (WINAPI *LPFNWSAGETQOSBYNAME)(SOCKET,LPWSABUF,LPQOS);
688 typedef INT (WINAPI *LPFNWSAGETSERVICECLASSINFOA)(LPGUID,LPGUID,LPDWORD,LPWSASERVICECLASSINFOA);
689 typedef INT (WINAPI *LPFNWSAGETSERVICECLASSINFOW)(LPGUID,LPGUID,LPDWORD,LPWSASERVICECLASSINFOW);
690 #define LPFN_LPFNWSAGETSERVICECLASSINFO WINELIB_NAME_AW(LPFN_LPFNWSAGETSERVICECLASSINFO)
691 typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA)(LPGUID,LPSTR,LPDWORD);
692 typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW)(LPGUID,LPWSTR,LPDWORD);
693 #define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID WINELIB_NAME_AW(LPFN_WSAGETSERVICECLASSNAMEBYCLASSID)
694 typedef int (WINAPI *LPFN_WSAHTONL)(SOCKET,WS(u_long),WS(u_long)*);
695 typedef int (WINAPI *LPFN_WSAHTONS)(SOCKET,WS(u_short),WS(u_short)*);
696 typedef int (WINAPI LPFN_WSAINSTALLSERVICECLASSA)(LPWSASERVICECLASSINFOA);
697 typedef int (WINAPI LPFN_WSAINSTALLSERVICECLASSW)(LPWSASERVICECLASSINFOW);
698 typedef int (WINAPI *LPFN_WSAIOCTL)(SOCKET,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
699 typedef int (WINAPI *LPFN_WSAJOINLEAF)(SOCKET,const struct WS(sockaddr)*,int,LPWSABUF,LPWSABUF,LPQOS,LPQOS,DWORD);
700 typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEBEGINA)(LPWSAQUERYSETA,DWORD,LPHANDLE);
701 typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEBEGINW)(LPWSAQUERYSETW,DWORD,LPHANDLE);
702 #define LPFN_WSALOOKUPSERVICEBEGIN WINELIB_NAME_AW(LPFN_WSALOOKUPSERVICEBEGIN);
703 typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEEND(HANDLE);
704 typedef INT (WINAPI *LPFN_WSALOOKUPSERVICENEXTA)(HANDLE,DWORD,LPDWORD,LPWSAQUERYSETA);
705 typedef INT (WINAPI *LPFN_WSALOOKUPSERVICENEXTW)(HANDLE,DWORD,LPDWORD,LPWSAQUERYSETW);
706 #define LPFN_WSALOOKUPSERVICENEXT WINELIB_NAME_AW(LPFN_WSALOOKUPSERVICENEXT)
707 typedef int (WINAPI *LPFN_WSANTOHL)(SOCKET,WS(u_long),WS(u_long)*);
708 typedef int (WINAPI *LPFN_WSANTOHS)(SOCKET,WS(u_short),WS(u_short)*);
709 typedef INT (WINAPI *LPFN_WSAPROVIDERCONFIGCHANGE)(LPHANDLE,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
710 typedef int (WINAPI *LPFN_WSARECV)(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
711 typedef int (WINAPI *LPFN_WSARECVDISCONNECT)(SOCKET,LPWSABUF);
712 typedef int (WINAPI *LPFN_WSARECVFROM)(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,struct WS(sockaddr)*,LPINT,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
713 typedef INT (WINAPI *LPFN_WSAREMOVESERVICECLASS)(LPGUID);
714 typedef BOOL (WINAPI *LPFN_WSARESETEVENT)(WSAEVENT);
715 typedef int (WINAPI *LPFN_WSASEND)(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
716 typedef int (WINAPI *LPFN_WSASENDDISCONNECT)(SOCKET,LPWSABUF);
717 typedef int (WINAPI *LPFN_WSASENDTO)(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,const struct WS(sockaddr)*,int,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
718 typedef BOOL (WINAPI *LPFN_WSASETEVENT)(WSAEVENT);
719 typedef INT (WINAPI *LPFN_WSASETSERVICEA)(LPWSAQUERYSETA,WSAESETSERVICEOP,DWORD);
720 typedef INT (WINAPI *LPFN_WSASETSERVICEW)(LPWSAQUERYSETW,WSAESETSERVICEOP,DWORD);
721 #define LPFN_WSASETSERVICE WINELIB_NAME_AW(LPFN_WSASETSERVICE)
722 typedef SOCKET (WINAPI *LPFN_WSASOCKETA)(int,int,int,LPWSAPROTOCOL_INFOA,GROUP,DWORD);
723 typedef SOCKET (WINAPI *LPFN_WSASOCKETW)(int,int,int,LPWSAPROTOCOL_INFOW,GROUP,DWORD);
724 typedef INT (WINAPI *LPFN_WSASTRINGTOADDRESSA)(LPSTR,INT,LPWSAPROTOCOL_INFOA,LPSOCKADDR,LPINT);
725 typedef INT (WINAPI *LPFN_WSASTRINGTOADDRESSW)(LPSTR,INT,LPWSAPROTOCOL_INFOA,LPSOCKADDR,LPINT);
726 #define LPFN_WSASOCKET WINELIB_NAME_AW(LPFN_WSASOCKET)
727 #define LPFN_WSASTRINGTOADDRESS WINELIB_NAME_AW(LPFN_WSASTRINGTOADDRESS)
728 typedef DWORD (WINAPI *LPFN_WSAWAITFORMULTIPLEEVENTS)(DWORD,const WSAEVENT*,BOOL,DWORD,BOOL);
729 #endif /* WS_API_TYPEDEFS */
732 /* Condition function return values */
733 #define CF_ACCEPT 0x0000
734 #define CF_REJECT 0x0001
735 #define CF_DEFER 0x0002
737 #ifdef __cplusplus
739 #endif
741 #undef WS
742 #undef WS_API_PROTOTYPES
743 #undef WS_API_TYPEDEFS
745 #endif /* __WINSOCK2API__ */