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