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