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