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