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