Centralized calls for SymSetContext, we only do it when we change the
[wine/multimedia.git] / include / winsock2.h
blob29585929335c43566aa94943b84714e321d4d4d4
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) */
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 #define IOC_UNIX 0x00000000
114 #define IOC_WS2 0x08000000
115 #define IOC_PROTOCOL 0x10000000
116 #define IOC_VENDOR 0x18000000
117 #define IOC_VOID 0x20000000
118 #define _WSAIO(x,y) (IOC_VOID|(x)|(y))
119 #define _WSAIOR(x,y) (IOC_OUT|(x)|(y))
120 #define _WSAIOW(x,y) (IOC_IN|(x)|(y))
121 #define _WSAIORW(x,y) (IOC_INOUT|(x)|(y))
122 #define SIO_ASSOCIATE_HANDLE _WSAIOW(IOC_WS2,1)
123 #define SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(IOC_WS2,2)
124 #define SIO_FIND_ROUTE _WSAIOR(IOC_WS2,3)
125 #define SIO_FLUSH _WSAIO(IOC_WS2,4)
126 #define SIO_GET_BROADCAST_ADDRESS _WSAIOR(IOC_WS2,5)
127 #define SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(IOC_WS2,6)
128 #define SIO_GET_QOS _WSAIORW(IOC_WS2,7)
129 #define SIO_GET_GROUP_QOS _WSAIORW(IOC_WS2,8)
130 #define SIO_MULTIPOINT_LOOPBACK _WSAIOW(IOC_WS2,9)
131 #define SIO_MULTICAST_SCOPE _WSAIOW(IOC_WS2,10)
132 #define SIO_SET_QOS _WSAIOW(IOC_WS2,11)
133 #define SIO_SET_GROUP_QOS _WSAIOW(IOC_WS2,12)
134 #define SIO_TRANSLATE_HANDLE _WSAIORW(IOC_WS2,13)
135 #define SIO_ROUTING_INTERFACE_QUERY _WSAIORW(IOC_WS2,20)
136 #define SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(IOC_WS2,21)
137 #define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22)
138 #define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23)
139 #define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_WS2,24)
140 #ifndef USE_WS_PREFIX
141 #define SIO_GET_INTERFACE_LIST _IOR ('t', 127, u_long)
142 #else
143 #define SIO_GET_INTERFACE_LIST WS__IOR ('t', 127, u_long)
144 #endif
146 /* Constants for WSAIoctl() */
147 #define WSA_FLAG_OVERLAPPED 0x01
148 #define WSA_FLAG_MULTIPOINT_C_ROOT 0x02
149 #define WSA_FLAG_MULTIPOINT_C_LEAF 0x04
150 #define WSA_FLAG_MULTIPOINT_D_ROOT 0x08
151 #define WSA_FLAG_MULTIPOINT_D_LEAF 0x10
153 /* Constants for WSAJoinLeaf() */
154 #define JL_SENDER_ONLY 0x01
155 #define JL_RECEIVER_ONLY 0x02
156 #define JL_BOTH 0x04
159 #ifndef GUID_DEFINED
160 #include <guiddef.h>
161 #endif
163 #define MAX_PROTOCOL_CHAIN 7
164 #define BASE_PROTOCOL 1
165 #define LAYERED_PROTOCOL 0
167 typedef struct _WSAPROTOCOLCHAIN
169 int ChainLen; /* the length of the chain, */
170 /* length = 0 means layered protocol, */
171 /* length = 1 means base protocol, */
172 /* length > 1 means protocol chain */
173 DWORD ChainEntries[MAX_PROTOCOL_CHAIN]; /* a list of dwCatalogEntryIds */
174 } WSAPROTOCOLCHAIN, * LPWSAPROTOCOLCHAIN;
176 #define XP1_CONNECTIONLESS 0x00000001
177 #define XP1_GUARANTEED_DELIVERY 0x00000002
178 #define XP1_GUARANTEED_ORDER 0x00000004
179 #define XP1_MESSAGE_ORIENTED 0x00000008
180 #define XP1_PSEUDO_STREAM 0x00000010
181 #define XP1_GRACEFUL_CLOSE 0x00000020
182 #define XP1_EXPEDITED_DATA 0x00000040
183 #define XP1_CONNECT_DATA 0x00000080
184 #define XP1_DISCONNECT_DATA 0x00000100
185 #define XP1_SUPPORT_BROADCAST 0x00000200
186 #define XP1_SUPPORT_MULTIPOINT 0x00000400
187 #define XP1_MULTIPOINT_CONTROL_PLANE 0x00000800
188 #define XP1_MULTIPOINT_DATA_PLANE 0x00001000
189 #define XP1_QOS_SUPPORTED 0x00002000
190 #define XP1_INTERRUPT 0x00004000
191 #define XP1_UNI_SEND 0x00008000
192 #define XP1_UNI_RECV 0x00010000
193 #define XP1_IFS_HANDLES 0x00020000
194 #define XP1_PARTIAL_MESSAGE 0x00040000
196 #define BIGENDIAN 0x0000
197 #define LITTLEENDIAN 0x0001
199 #define SECURITY_PROTOCOL_NONE 0x0000
201 #define WSAPROTOCOL_LEN 255
202 typedef struct _WSAPROTOCOL_INFOA
204 DWORD dwServiceFlags1;
205 DWORD dwServiceFlags2;
206 DWORD dwServiceFlags3;
207 DWORD dwServiceFlags4;
208 DWORD dwProviderFlags;
209 GUID ProviderId;
210 DWORD dwCatalogEntryId;
211 WSAPROTOCOLCHAIN ProtocolChain;
212 int iVersion;
213 int iAddressFamily;
214 int iMaxSockAddr;
215 int iMinSockAddr;
216 int iSocketType;
217 int iProtocol;
218 int iProtocolMaxOffset;
219 int iNetworkByteOrder;
220 int iSecurityScheme;
221 DWORD dwMessageSize;
222 DWORD dwProviderReserved;
223 CHAR szProtocol[WSAPROTOCOL_LEN+1];
224 } WSAPROTOCOL_INFOA, * LPWSAPROTOCOL_INFOA;
226 typedef struct _WSAPROTOCOL_INFOW
228 DWORD dwServiceFlags1;
229 DWORD dwServiceFlags2;
230 DWORD dwServiceFlags3;
231 DWORD dwServiceFlags4;
232 DWORD dwProviderFlags;
233 GUID ProviderId;
234 DWORD dwCatalogEntryId;
235 WSAPROTOCOLCHAIN ProtocolChain;
236 int iVersion;
237 int iAddressFamily;
238 int iMaxSockAddr;
239 int iMinSockAddr;
240 int iSocketType;
241 int iProtocol;
242 int iProtocolMaxOffset;
243 int iNetworkByteOrder;
244 int iSecurityScheme;
245 DWORD dwMessageSize;
246 DWORD dwProviderReserved;
247 WCHAR szProtocol[WSAPROTOCOL_LEN+1];
248 } WSAPROTOCOL_INFOW, *LPWSAPROTOCOL_INFOW;
250 DECL_WINELIB_TYPE_AW(WSAPROTOCOL_INFO)
251 DECL_WINELIB_TYPE_AW(LPWSAPROTOCOL_INFO)
253 typedef struct _WSANETWORKEVENTS
255 long lNetworkEvents;
256 int iErrorCode[FD_MAX_EVENTS];
257 } WSANETWORKEVENTS, *LPWSANETWORKEVENTS;
259 typedef struct _WSANSClassInfoA
261 LPSTR lpszName;
262 DWORD dwNameSpace;
263 DWORD dwValueType;
264 DWORD dwValueSize;
265 LPVOID lpValue;
266 } WSANSCLASSINFOA, *PWSANSCLASSINFOA, *LPWSANSCLASSINFOA;
268 typedef struct _WSANSClassInfoW
270 LPSTR lpszName;
271 DWORD dwNameSpace;
272 DWORD dwValueType;
273 DWORD dwValueSize;
274 LPVOID lpValue;
275 } WSANSCLASSINFOW, *PWSANSCLASSINFOW, *LPWSANSCLASSINFOW;
277 DECL_WINELIB_TYPE_AW(WSANSCLASSINFO)
278 DECL_WINELIB_TYPE_AW(PWSANSCLASSINFO)
279 DECL_WINELIB_TYPE_AW(LPWSANSCLASSINFO)
281 typedef struct _WSAServiceClassInfoA
283 LPGUID lpServiceClassId;
284 LPSTR lpszServiceClassName;
285 DWORD dwCount;
286 LPWSANSCLASSINFOA lpClassInfos;
287 } WSASERVICECLASSINFOA, *PWSASERVICECLASSINFOA, *LPWSASERVICECLASSINFOA;
289 typedef struct _WSAServiceClassInfoW
291 LPGUID lpServiceClassId;
292 LPWSTR lpszServiceClassName;
293 DWORD dwCount;
294 LPWSANSCLASSINFOW lpClassInfos;
295 } WSASERVICECLASSINFOW, *PWSASERVICECLASSINFOW, *LPWSASERVICECLASSINFOW;
298 DECL_WINELIB_TYPE_AW(WSASERVICECLASSINFO)
299 DECL_WINELIB_TYPE_AW(PWSASERVICECLASSINFO)
300 DECL_WINELIB_TYPE_AW(LPWSASERVICECLASSINFO)
302 typedef struct _WSABUF
304 ULONG len;
305 CHAR* buf;
306 } WSABUF, *LPWSABUF;
308 #define WSAEVENT HANDLE
309 #define LPWSAEVENT LPHANDLE
310 #define WSAOVERLAPPED OVERLAPPED
311 typedef struct _OVERLAPPED* LPWSAOVERLAPPED;
313 #define WSA_IO_PENDING (ERROR_IO_PENDING)
314 #define WSA_IO_INCOMPLETE (ERROR_IO_INCOMPLETE)
315 #define WSA_INVALID_HANDLE (ERROR_INVALID_HANDLE)
316 #define WSA_INVALID_PARAMETER (ERROR_INVALID_PARAMETER)
317 #define WSA_NOT_ENOUGH_MEMORY (ERROR_NOT_ENOUGH_MEMORY)
318 #define WSA_OPERATION_ABORTED (ERROR_OPERATION_ABORTED)
320 #define WSA_INVALID_EVENT ((WSAEVENT)NULL)
321 #define WSA_MAXIMUM_WAIT_EVENTS (MAXIMUM_WAIT_OBJECTS)
322 #define WSA_WAIT_FAILED ((DWORD)-1L)
323 #define WSA_WAIT_EVENT_0 (WAIT_OBJECT_0)
324 #define WSA_WAIT_IO_COMPLETION (WAIT_IO_COMPLETION)
325 #define WSA_WAIT_TIMEOUT (WAIT_TIMEOUT)
326 #define WSA_INFINITE (INFINITE)
328 typedef unsigned int GROUP;
329 #define SG_UNCONSTRAINED_GROUP 0x01
330 #define SG_CONSTRAINED_GROUP 0x02
333 * FLOWSPEC and SERVICETYPE should eventually move to qos.h
336 typedef ULONG SERVICETYPE;
338 typedef struct _FLOWSPEC {
339 unsigned int TokenRate;
340 unsigned int TokenBucketSize;
341 unsigned int PeakBandwidth;
342 unsigned int Latency;
343 unsigned int DelayVariation;
344 SERVICETYPE ServiceType;
345 unsigned int MaxSduSize;
346 unsigned int MinimumPolicedSize;
347 } FLOWSPEC, *PFLOWSPEC, *LPFLOWSPEC;
349 typedef struct _QUALITYOFSERVICE {
350 FLOWSPEC SendingFlowspec;
351 FLOWSPEC ReceivingFlowspec;
352 WSABUF ProviderSpecific;
353 } QOS, *LPQOS;
355 typedef int (CALLBACK *LPCONDITIONPROC)
357 LPWSABUF lpCallerId,
358 LPWSABUF lpCallerData,
359 LPQOS lpSQOS,
360 LPQOS lpGQOS,
361 LPWSABUF lpCalleeId,
362 LPWSABUF lpCalleeData,
363 GROUP *g,
364 DWORD dwCallbackData
367 typedef void (CALLBACK *LPWSAOVERLAPPED_COMPLETION_ROUTINE)
369 DWORD dwError,
370 DWORD cbTransferred,
371 LPWSAOVERLAPPED lpOverlapped,
372 DWORD dwFlags
375 #ifndef _tagBLOB_DEFINED
376 #define _tagBLOB_DEFINED
377 #define _BLOB_DEFINED
378 #define _LPBLOB_DEFINED
379 typedef struct _BLOB {
380 ULONG cbSize;
381 BYTE *pBlobData;
382 } BLOB, *LPBLOB;
383 #endif
385 #ifndef __CSADDR_DEFINED__
386 #define __CSADDR_DEFINED__
388 typedef struct _SOCKET_ADDRESS {
389 LPSOCKADDR lpSockaddr;
390 INT iSockaddrLength;
391 } SOCKET_ADDRESS, *PSOCKET_ADDRESS, *LPSOCKET_ADDRESS;
393 typedef struct _CSADDR_INFO {
394 SOCKET_ADDRESS LocalAddr;
395 SOCKET_ADDRESS RemoteAddr;
396 INT iSocketType;
397 INT iProtocol;
398 } CSADDR_INFO, *PCSADDR_INFO, *LPCSADDR_INFO;
399 #endif
401 /*socket address list */
402 typedef struct _SOCKET_ADDRESS_LIST {
403 INT iAddressCount;
404 SOCKET_ADDRESS Address[1];
405 } SOCKET_ADDRESS_LIST, *LPSOCKET_ADDRESS_LIST;
407 /* addressfamily protocol pairs */
408 typedef struct _AFPROTOCOLS {
409 INT iAddressFamily;
410 INT iProtocol;
411 } AFPROTOCOLS, *PAFPROTOCOLS, *LPAFPROTOCOLS;
413 /* client query definitions */
414 typedef enum _WSAEcomparator {
415 COMP_EQUAL = 0,
416 COMP_NOTLESS
417 } WSAECOMPARATOR, *PWSAECOMPARATOR, *LPWSAECOMPARATOR;
419 typedef struct _WSAVersion {
420 DWORD dwVersion;
421 WSAECOMPARATOR ecHow;
422 } WSAVERSION, *PWSAVERSION, *LPWSAVERSION;
425 typedef struct _WSAQuerySetA {
426 DWORD dwSize;
427 LPSTR lpszServiceInstanceName;
428 LPGUID lpServiceClassId;
429 LPWSAVERSION lpVersion;
430 LPSTR lpszComment;
431 DWORD dwNameSpace;
432 LPGUID lpNSProviderId;
433 LPSTR lpszContext;
434 DWORD dwNumberOfProtocols;
435 LPAFPROTOCOLS lpafpProtocols;
436 LPSTR lpszQueryString;
437 DWORD dwNumberOfCsAddrs;
438 LPCSADDR_INFO lpcsaBuffer;
439 DWORD dwOutputFlags;
440 LPBLOB lpBlob;
441 } WSAQUERYSETA, *PWSAQUERYSETA, *LPWSAQUERYSETA;
443 typedef struct _WSAQuerySetW {
444 DWORD dwSize;
445 LPWSTR lpszServiceInstanceName;
446 LPGUID lpServiceClassId;
447 LPWSAVERSION lpVersion;
448 LPWSTR lpszComment;
449 DWORD dwNameSpace;
450 LPGUID lpNSProviderId;
451 LPWSTR lpszContext;
452 DWORD dwNumberOfProtocols;
453 LPAFPROTOCOLS lpafpProtocols;
454 LPWSTR lpszQueryString;
455 DWORD dwNumberOfCsAddrs;
456 LPCSADDR_INFO lpcsaBuffer;
457 DWORD dwOutputFlags;
458 LPBLOB lpBlob;
459 } WSAQUERYSETW, *PWSAQUERYSETW, *LPWSAQUERYSETW;
461 DECL_WINELIB_TYPE_AW(WSAQUERYSET)
462 DECL_WINELIB_TYPE_AW(PWSAQUERYSET)
463 DECL_WINELIB_TYPE_AW(LPWSAQUERYSET)
465 typedef enum _WSAESETSERVICEOP {
466 RNRSERVICE_REGISTER = 0,
467 RNRSERVICE_DEREGISTER,
468 RNRSERVICE_DELETE
469 } WSAESETSERVICEOP, *PWSAESETSERVICEOP, *LPWSAESETSERVICEOP;
471 typedef struct _WSANAMESPACE_INFOA {
472 GUID NSProviderId;
473 DWORD dwNameSpace;
474 BOOL fActive;
475 DWORD dwVersion;
476 LPSTR lpszIdentifier;
477 } WSANAMESPACE_INFOA, *PWSANAMESPACE_INFOA, *LPWSANAMESPACE_INFOA;
479 typedef struct _WSANAMESPACE_INFOW {
480 GUID NSProviderId;
481 DWORD dwNameSpace;
482 BOOL fActive;
483 DWORD dwVersion;
484 LPWSTR lpszIdentifier;
485 } WSANAMESPACE_INFOW, *PWSANAMESPACE_INFOW, *LPWSANAMESPACE_INFOW;
487 DECL_WINELIB_TYPE_AW(WSANAMESPACE_INFO)
488 DECL_WINELIB_TYPE_AW(PWSANAMESPACE_INFO)
489 DECL_WINELIB_TYPE_AW(LPWSANAMESPACE_INFO)
492 * Winsock Function Typedefs
494 * Remember to keep this section in sync with the
495 * "Prototypes" section in winsock.h.
497 #if WS_API_TYPEDEFS
498 typedef HANDLE (WINAPI *LPFN_WSAASYNCGETHOSTBYADDR)(HWND,u_int,const char*,int,int,char*,int);
499 typedef HANDLE (WINAPI *LPFN_WSAASYNCGETHOSTBYNAME)(HWND,u_int,const char*,char*,int);
500 typedef HANDLE (WINAPI *LPFN_WSAASYNCGETPROTOBYNAME)(HWND,u_int,const char*,char*,int);
501 typedef HANDLE (WINAPI *LPFN_WSAASYNCGETPROTOBYNUMBER)(HWND,u_int,int,char*,int);
502 typedef HANDLE (WINAPI *LPFN_WSAASYNCGETSERVBYNAME)(HWND,u_int,const char*,const char*,char*,int);
503 typedef HANDLE (WINAPI *LPFN_WSAASYNCGETSERVBYPORT)(HWND,u_int,int,const char*,char*,int);
504 typedef int (WINAPI *LPFN_WSAASYNCSELECT)(SOCKET,HWND,u_int,long);
505 typedef int (WINAPI *LPFN_WSACANCELASYNCREQUEST)(HANDLE);
506 typedef int (WINAPI *LPFN_WSACANCELBLOCKINGCALL)(void);
507 typedef int (WINAPI *LPFN_WSACLEANUP)(void);
508 typedef int (WINAPI *LPFN_WSAGETLASTERROR)(void);
509 typedef BOOL (WINAPI *LPFN_WSAISBLOCKING)(void);
510 typedef FARPROC (WINAPI *LPFN_WSASETBLOCKINGHOOK)(FARPROC);
511 typedef void (WINAPI *LPFN_WSASETLASTERROR)(int);
512 typedef int (WINAPI *LPFN_WSASTARTUP)(WORD,LPWSADATA);
513 typedef int (WINAPI *LPFN_WSAUNHOOKBLOCKINGHOOK)(void);
515 typedef SOCKET (WINAPI *LPFN_ACCEPT)(SOCKET,struct WS(sockaddr)*,int*);
516 typedef int (WINAPI *LPFN_BIND)(SOCKET,const struct WS(sockaddr)*,int);
517 typedef int (WINAPI *LPFN_CLOSESOCKET)(SOCKET);
518 typedef int (WINAPI *LPFN_CONNECT)(SOCKET,const struct WS(sockaddr)*,int);
519 typedef struct WS(hostent)* (WINAPI *LPFN_GETHOSTBYADDR)(const char*,int,int);
520 typedef struct WS(hostent)* (WINAPI *LPFN_GETHOSTBYNAME)(const char*);
521 typedef int (WINAPI *LPFN_GETHOSTNAME)(char*,int);
522 typedef int (WINAPI *LPFN_GETPEERNAME)(SOCKET,struct WS(sockaddr)*,int*);
523 typedef struct WS(protoent)* (WINAPI *LPFN_GETPROTOBYNAME)(const char*);
524 typedef struct WS(protoent)* (WINAPI *LPFN_GETPROTOBYNUMBER)(int);
525 #ifdef WS_DEFINE_SELECT
526 typedef int (WINAPI* LPFN_SELECT)(int,WS(fd_set)*,WS(fd_set)*,WS(fd_set)*,const struct WS(timeval)*);
527 #endif
528 typedef struct WS(servent)* (WINAPI *LPFN_GETSERVBYNAME)(const char*,const char*);
529 typedef struct WS(servent)* (WINAPI *LPFN_GETSERVBYPORT)(int,const char*);
530 typedef int (WINAPI *LPFN_GETSOCKNAME)(SOCKET,struct WS(sockaddr)*,int*);
531 typedef int (WINAPI *LPFN_GETSOCKOPT)(SOCKET,int,int,char*,int*);
532 typedef u_long (WINAPI *LPFN_HTONL)(u_long);
533 typedef u_short (WINAPI *LPFN_HTONS)(u_short);
534 typedef unsigned long (WINAPI *LPFN_INET_ADDR)(const char*);
535 typedef char* (WINAPI *LPFN_INET_NTOA)(struct WS(in_addr);
536 typedef int (WINAPI *LPFN_IOCTLSOCKET)(SOCKET,long,u_long*);
537 typedef int (WINAPI *LPFN_LISTEN)(SOCKET,int);
538 typedef u_long (WINAPI *LPFN_NTOHL)(u_long);
539 typedef u_short (WINAPI *LPFN_NTOHS)(u_short);
540 typedef int (WINAPI *LPFN_RECV)(SOCKET,char*,int,int);
541 typedef int (WINAPI *LPFN_RECVFROM)(SOCKET,char*,int,int,struct WS(sockaddr)*,int*);
542 typedef int (WINAPI *LPFN_SEND)(SOCKET,const char*,int,int);
543 typedef int (WINAPI *LPFN_SENDTO)(SOCKET,const char*,int,int,const struct WS(sockaddr)*,int);
544 typedef int (WINAPI *LPFN_SETSOCKOPT)(SOCKET,int,int,const char*,int);
545 typedef int (WINAPI *LPFN_SHUTDOWN)(SOCKET,int);
546 typedef SOCKET (WINAPI *LPFN_SOCKET)(int,int,int);
547 #endif /* WS_API_TYPEDEFS */
552 * Winsock2 Prototypes
554 * Remember to keep this section in sync with the
555 * "Winsock2 Function Typedefs" section below.
557 #if WS_API_PROTOTYPES
558 SOCKET WINAPI WSAAccept(SOCKET,struct WS(sockaddr)*,LPINT,LPCONDITIONPROC,DWORD);
559 INT WINAPI WSAAddressToStringA(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOA,LPSTR,LPDWORD);
560 INT WINAPI WSAAddressToStringW(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOW,LPWSTR,LPDWORD);
561 #define WSAAddressToString WINELIB_NAME_AW(WSAAddressToString)
562 BOOL WINAPI WSACloseEvent(WSAEVENT);
563 int WINAPI WSAConnect(SOCKET,const struct WS(sockaddr)*,int,LPWSABUF,LPWSABUF,LPQOS,LPQOS);
564 WSAEVENT WINAPI WSACreateEvent(void);
565 INT WINAPI WSADuplicateSocketA(SOCKET,DWORD,LPWSAPROTOCOL_INFOA);
566 INT WINAPI WSADuplicateSocketW(SOCKET,DWORD,LPWSAPROTOCOL_INFOW);
567 #define WSADuplicateSocket WINELIB_NAME_AW(WSADuplicateSocket)
568 INT WINAPI WSAEnumNameSpaceProvidersA(LPDWORD,LPWSANAMESPACE_INFOA);
569 INT WINAPI WSAEnumNameSpaceProvidersW(LPDWORD,LPWSANAMESPACE_INFOW);
570 #define WSAEnumNameSpaceProviders WINELIB_NAME_AW(WSAEnumNameSpaceProviders)
571 int WINAPI WSAEnumNetworkEvents(SOCKET,WSAEVENT,LPWSANETWORKEVENTS);
572 int WINAPI WSAEnumProtocolsA(LPINT,LPWSAPROTOCOL_INFOA,LPDWORD);
573 int WINAPI WSAEnumProtocolsW(LPINT,LPWSAPROTOCOL_INFOW,LPDWORD);
574 #define WSAEnumProtocols WINELIB_NAME_AW(WSAEnumProtocols)
575 int WINAPI WSAEventSelect(SOCKET,WSAEVENT,long);
576 BOOL WINAPI WSAGetOverlappedResult(SOCKET,LPWSAOVERLAPPED,LPDWORD,BOOL,LPDWORD);
577 BOOL WINAPI WSAGetQOSByName(SOCKET,LPWSABUF,LPQOS);
578 INT WINAPI WSAGetServiceClassInfoA(LPGUID,LPGUID,LPDWORD,LPWSASERVICECLASSINFOA);
579 INT WINAPI WSAGetServiceClassInfoW(LPGUID,LPGUID,LPDWORD,LPWSASERVICECLASSINFOW);
580 #define WSAGetServiceClassInfo WINELIB_NAME_AW(WSAGetServiceClassInfo)
581 INT WINAPI WSAGetServiceClassNameByClassIdA(LPGUID,LPSTR,LPDWORD);
582 INT WINAPI WSAGetServiceClassNameByClassIdW(LPGUID,LPWSTR,LPDWORD);
583 #define WSAGetServiceClassNameByClassId WINELIB_NAME_AW(WSAGetServiceClassNameByClassId)
584 int WINAPI WSAHtonl(SOCKET,u_long,u_long*);
585 int WINAPI WSAHtons(SOCKET,u_short,u_short*);
586 int WINAPI WSAInstallServiceClassA(LPWSASERVICECLASSINFOA);
587 int WINAPI WSAInstallServiceClassW(LPWSASERVICECLASSINFOW);
588 #define WSAInstallServiceClass WINELIB_NAME_AW(WSAInstallServiceClass)
589 int WINAPI WSAIoctl(SOCKET,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
590 SOCKET WINAPI WSAJoinLeaf(SOCKET,const struct WS(sockaddr)*,int,LPWSABUF,LPWSABUF,LPQOS,LPQOS,DWORD);
591 INT WINAPI WSALookupServiceBeginA(LPWSAQUERYSETA,DWORD,LPHANDLE);
592 INT WINAPI WSALookupServiceBeginW(LPWSAQUERYSETW,DWORD,LPHANDLE);
593 #define WSALookupServiceBegin WINELIB_NAME_AW(WSALookupServiceBegin)
594 INT WINAPI WSALookupServiceEnd(HANDLE);
595 INT WINAPI WSALookupServiceNextA(HANDLE,DWORD,LPDWORD,LPWSAQUERYSETA);
596 INT WINAPI WSALookupServiceNextW(HANDLE,DWORD,LPDWORD,LPWSAQUERYSETW);
597 #define WSALookupServiceNext WINELIB_NAME_AW(WSALookupServiceNext)
598 int WINAPI WSANtohl(SOCKET,u_long,u_long*);
599 int WINAPI WSANtohs(SOCKET,u_short,u_short*);
600 INT WINAPI WSAProviderConfigChange(LPHANDLE,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
601 int WINAPI WSARecv(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
602 int WINAPI WSARecvDisconnect(SOCKET,LPWSABUF);
603 int WINAPI WSARecvFrom(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,struct WS(sockaddr)*,LPINT,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
604 INT WINAPI WSARemoveServiceClass(LPGUID);
605 BOOL WINAPI WSAResetEvent(WSAEVENT);
606 int WINAPI WSASend(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
607 int WINAPI WSASendDisconnect(SOCKET,LPWSABUF);
608 int WINAPI WSASendTo(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,const struct WS(sockaddr)*,int,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
609 BOOL WINAPI WSASetEvent(WSAEVENT);
610 INT WINAPI WSASetServiceA(LPWSAQUERYSETA,WSAESETSERVICEOP,DWORD);
611 INT WINAPI WSASetServiceW(LPWSAQUERYSETW,WSAESETSERVICEOP,DWORD);
612 #define WSASetService WINELIB_NAME_AW(WSASetService)
613 SOCKET WINAPI WSASocketA(int,int,int,LPWSAPROTOCOL_INFOA,GROUP,DWORD);
614 SOCKET WINAPI WSASocketW(int,int,int,LPWSAPROTOCOL_INFOW,GROUP,DWORD);
615 #define WSASocket WINELIB_NAME_AW(WSASocket)
616 INT WINAPI WSAStringToAddressA(LPSTR,INT,LPWSAPROTOCOL_INFOA,LPSOCKADDR,LPINT);
617 INT WINAPI WSAStringToAddressW(LPWSTR,INT,LPWSAPROTOCOL_INFOW,LPSOCKADDR,LPINT);
618 #define WSAStringToAddress WINELIB_NAME_AW(WSAStringToAddress)
619 DWORD WINAPI WSAWaitForMultipleEvents(DWORD,const WSAEVENT*,BOOL,DWORD,BOOL);
620 #endif /* WS_API_PROTOTYPES */
625 * Winsock2 Function Typedefs
627 * Remember to keep this section in sync with the
628 * "Winsock2 Prototypes" section above.
630 #if WS_API_TYPEDEFS
631 typedef SOCKET (WINAPI *LPFN_WSAACCEPT)(SOCKET,WS(sockaddr)*,LPINT,LPCONDITIONPROC,DWORD);
632 typedef INT (WINAPI *LPFN_WSAADRESSTOSTRINGA)(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOA,LPSTR,LPDWORD);
633 typedef INT (WINAPI *LPFN_WSAADRESSTOSTRINGW)(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOW,LPWSTR,LPDWORD);
634 #define LPFN_WSAADDRESSTOSTRING WINELIB_NAME_AW(LPFN_WSAADDRESSTOSTRING)
635 typedef BOOL (WINAPI *LPFN_WSACLOSEEVENT)(WSAEVENT);
636 typedef int (WINAPI *LPFN_WSACONNECT)(SOCKET,const struct WS(sockaddr)*,int,LPWSABUF,LPWSABUF,LPQOS,LPQOS);
637 typedef WSAEVENT (WINAPI *LPFN_WSACREATEEVENT)(void);
638 typedef INT (WINAPI *LPFN_WSADUPLICATESOCKETA)(SOCKET,DWORD,LPWSAPROTOCOL_INFOA);
639 typedef INT (WINAPI *LPFN_WSADUPLICATESOCKETW)(SOCKET,DWORD,LPWSAPROTOCOL_INFOW);
640 #define LPFN_WSADUPLICATESOCKET WINELIB_NAME_AW(LPFN_WSADUPLICATESOCKET)
641 typedef INT (WINAPI *LPFNWSAENUMNAMESPACEPROVIDERSA)(LPDWORD,LPWSANAMESPACE_INFOA);
642 typedef INT (WINAPI *LPFNWSAENUMNAMESPACEPROVIDERSW)(LPDWORD,LPWSANAMESPACE_INFOW);
643 #define LPFN_WSAENUMNAMESPACEPROVIDERS WINELIB_NAME_AW(LPFNWSAENUMNAMESPACEPROVIDERS)
644 typedef int (WINAPI *LPFN_WSAENUMNETWORKEVENT)(SOCKET,WSAEVENT,LPWSANETWORKEVENTS);
645 typedef int (WINAPI *LPFN_WSAENUMPROTOCOLSA)(LPINT,LPWSAPROTOCOL_INFOA,LPDWORD);
646 typedef int (WINAPI *LPFN_WSAENUMPROTOCOLSW)(LPINT,LPWSAPROTOCOL_INFOW,LPDWORD);
647 #define LPFN_WSAENUMPROTOCOLS WINELIB_NAME_AW(LPFN_WSAENUMPROTOCOLS)
648 typedef int (WINAPI *LPFN_WSAEVENTSELECT)(SOCKET,WSAEVENT,long);
649 typedef BOOL (WINAPI *LPFN_WSAGETOVERLAPPEDRESULT)(SOCKET,LPWSAOVERLAPPED,LPDWORD,BOOL,LPDWORD);
650 typedef BOOL (WINAPI *LPFNWSAGETQOSBYNAME)(SOCKET,LPWSABUF,LPQOS);
651 typedef INT (WINAPI *LPFNWSAGETSERVICECLASSINFOA)(LPGUID,LPGUID,LPDWORD,LPWSASERVICECLASSINFOA);
652 typedef INT (WINAPI *LPFNWSAGETSERVICECLASSINFOW)(LPGUID,LPGUID,LPDWORD,LPWSASERVICECLASSINFOW);
653 #define LPFN_LPFNWSAGETSERVICECLASSINFO WINELIB_NAME_AW(LPFN_LPFNWSAGETSERVICECLASSINFO)
654 typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA)(LPGUID,LPSTR,LPDWORD);
655 typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW)(LPGUID,LPWSTR,LPDWORD);
656 #define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID WINELIB_NAME_AW(LPFN_WSAGETSERVICECLASSNAMEBYCLASSID)
657 typedef int (WINAPI *LPFN_WSAHTONL)(SOCKET,u_long,u_long*);
658 typedef int (WINAPI *LPFN_WSAHTONS)(SOCKET,u_short,u_short*);
659 typedef int (WINAPI LPFN_WSAINSTALLSERVICECLASSA)(LPWSASERVICECLASSINFOA);
660 typedef int (WINAPI LPFN_WSAINSTALLSERVICECLASSW)(LPWSASERVICECLASSINFOW);
661 typedef int (WINAPI *LPFN_WSAIOCTL)(SOCKET,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
662 typedef int (WINAPI *LPFN_WSAJOINLEAF)(SOCKET,const struct WS(sockaddr)*,int,LPWSABUF,LPWSABUF,LPQOS,LPQOS,DWORD);
663 typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEBEGINA)(LPWSAQUERYSETA,DWORD,LPHANDLE);
664 typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEBEGINW)(LPWSAQUERYSETW,DWORD,LPHANDLE);
665 #define LPFN_WSALOOKUPSERVICEBEGIN WINELIB_NAME_AW(LPFN_WSALOOKUPSERVICEBEGIN);
666 typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEEND(HANDLE);
667 typedef INT (WINAPI *LPFN_WSALOOKUPSERVICENEXTA)(HANDLE,DWORD,LPDWORD,LPWSAQUERYSETA);
668 typedef INT (WINAPI *LPFN_WSALOOKUPSERVICENEXTW)(HANDLE,DWORD,LPDWORD,LPWSAQUERYSETW);
669 #define LPFN_WSALOOKUPSERVICENEXT WINELIB_NAME_AW(LPFN_WSALOOKUPSERVICENEXT)
670 typedef int (WINAPI *LPFN_WSANTOHL)(SOCKET,u_long,u_long*);
671 typedef int (WINAPI *LPFN_WSANTOHS)(SOCKET,u_short,u_short*);
672 typedef INT (WINAPI *LPFN_WSAPROVIDERCONFIGCHANGE)(LPHANDLE,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
673 typedef int (WINAPI *LPFN_WSARECV)(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
674 typedef int (WINAPI *LPFN_WSARECVDISCONNECT)(SOCKET,LPWSABUF);
675 typedef int (WINAPI *LPFN_WSARECVFROM)(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,struct WS(sockaddr)*,LPINT,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
676 typedef INT (WINAPI *LPFN_WSAREMOVESERVICECLASS)(LPGUID);
677 typedef BOOL (WINAPI *LPFN_WSARESETEVENT)(WSAEVENT);
678 typedef int (WINAPI *LPFN_WSASEND)(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
679 typedef int (WINAPI *LPFN_WSASENDDISCONNECT)(SOCKET,LPWSABUF);
680 typedef int (WINAPI *LPFN_WSASENDTO)(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,const struct WS(sockaddr)*,int,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
681 typedef BOOL (WINAPI *LPFN_WSASETEVENT)(WSAEVENT);
682 typedef INT (WINAPI *LPFN_WSASETSERVICEA)(LPWSAQUERYSETA,WSAESETSERVICEOP,DWORD);
683 typedef INT (WINAPI *LPFN_WSASETSERVICEW)(LPWSAQUERYSETW,WSAESETSERVICEOP,DWORD);
684 #define LPFN_WSASETSERVICE WINELIB_NAME_AW(LPFN_WSASETSERVICE)
685 typedef SOCKET (WINAPI *LPFN_WSASOCKETA)(int,int,int,LPWSAPROTOCOL_INFOA,GROUP,DWORD);
686 typedef SOCKET (WINAPI *LPFN_WSASOCKETW)(int,int,int,LPWSAPROTOCOL_INFOW,GROUP,DWORD);
687 typedef INT (WINAPI *LPFN_WSASTRINGTOADDRESSA)(LPSTR,INT,LPWSAPROTOCOL_INFOA,LPSOCKADDR,LPINT);
688 typedef INT (WINAPI *LPFN_WSASTRINGTOADDRESSW)(LPSTR,INT,LPWSAPROTOCOL_INFOA,LPSOCKADDR,LPINT);
689 #define LPFN_WSASOCKET WINELIB_NAME_AW(LPFN_WSASOCKET)
690 #define LPFN_WSASTRINGTOADDRESS WINELIB_NAME_AW(LPFN_WSASTRINGTOADDRESS)
691 typedef DWORD (WINAPI *LPFN_WSAWAITFORMULTIPLEEVENTS)(DWORD,const WSAEVENT*,BOOL,DWORD,BOOL);
692 #endif /* WS_API_TYPEDEFS */
695 /* Condition function return values */
696 #define CF_ACCEPT 0x0000
697 #define CF_REJECT 0x0001
698 #define CF_DEFER 0x0002
700 #ifdef __cplusplus
702 #endif
704 #undef WS
705 #undef WS_API_PROTOTYPES
706 #undef WS_API_TYPEDEFS
708 #endif /* __WINSOCK2API__ */