blob: f2488d2e0a97f5d5aca5ac4e81e4e491b7cc7d46 [file] [log] [blame]
Ove Kaavena39ad1a1999-09-27 11:48:11 +00001/*
James Hatheway829405a2000-06-18 17:23:17 +00002 * Winsock 2 definitions - used for ws2_32.dll
Ove Kaavena39ad1a1999-09-27 11:48:11 +00003 *
Alexandre Julliard0799c1a2002-03-09 23:29:33 +00004 * 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 *
James Hatheway829405a2000-06-18 17:23:17 +000021 * FIXME: Still missing required Winsock 2 definitions.
Ove Kaavena39ad1a1999-09-27 11:48:11 +000022 */
Ove Kaavena39ad1a1999-09-27 11:48:11 +000023
Francois Gouget27202312001-11-14 21:26:23 +000024#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__
Dimitrie O. Paun53f9c212003-08-28 21:43:34 +000047#include <winsock.h>
Francois Gouget27202312001-11-14 21:26:23 +000048#undef __WINE_WINSOCK2__
49
50
51#ifdef __cplusplus
52extern "C" {
53#endif /* defined(__cplusplus) */
Ove Kaavena39ad1a1999-09-27 11:48:11 +000054
Andreas Mohrae509412000-08-03 22:19:09 +000055/* proper 4-byte packing */
Dimitrie O. Paun53f9c212003-08-28 21:43:34 +000056#include <pshpack4.h>
Andreas Mohrae509412000-08-03 22:19:09 +000057
Peter Hunnisett565b0082000-09-19 02:43:00 +000058
Francois Gouget27202312001-11-14 21:26:23 +000059#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
Peter Hunnisett565b0082000-09-19 02:43:00 +000078
79
80/* option flags per socket */
81
Francois Gouget27202312001-11-14 21:26:23 +000082#define FD_MAX_EVENTS 10
83#define FD_READ_BIT 0
84#define FD_WRITE_BIT 1
85#define FD_OOB_BIT 2
86#define FD_ACCEPT_BIT 3
87#define FD_CONNECT_BIT 4
88#define FD_CLOSE_BIT 5
Ove Kaavena39ad1a1999-09-27 11:48:11 +000089
Francois Gouget27202312001-11-14 21:26:23 +000090/* Constants for LPCONDITIONPROC */
91#define CF_ACCEPT 0x0000
92#define CF_REJECT 0x0001
93#define CF_DEFER 0x0002
94
95/* Constants for shutdown() */
96#define SD_RECEIVE 0x00
97#define SD_SEND 0x01
98#define SD_BOTH 0x02
99
100/* Constants for WSAIoctl() */
101#define IOC_UNIX 0x00000000
102#define IOC_WS2 0x08000000
103#define IOC_PROTOCOL 0x10000000
104#define IOC_VENDOR 0x18000000
105#define _WSAIO(x,y) (IOC_VOID|(x)|(y))
106#define _WSAIOR(x,y) (IOC_OUT|(x)|(y))
107#define _WSAIOW(x,y) (IOC_IN|(x)|(y))
108#define _WSAIORW(x,y) (IOC_INOUT|(x)|(y))
109#define SIO_ASSOCIATE_HANDLE _WSAIOW(IOC_WS2,1)
110#define SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(IOC_WS2,2)
111#define SIO_FIND_ROUTE _WSAIOR(IOC_WS2,3)
112#define SIO_FLUSH _WSAIO(IOC_WS2,4)
113#define SIO_GET_BROADCAST_ADDRESS _WSAIOR(IOC_WS2,5)
James Hatheway829405a2000-06-18 17:23:17 +0000114#define SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(IOC_WS2,6)
Francois Gouget27202312001-11-14 21:26:23 +0000115#define SIO_GET_QOS _WSAIORW(IOC_WS2,7)
116#define SIO_GET_GROUP_QOS _WSAIORW(IOC_WS2,8)
117#define SIO_MULTIPOINT_LOOPBACK _WSAIOW(IOC_WS2,9)
118#define SIO_MULTICAST_SCOPE _WSAIOW(IOC_WS2,10)
119#define SIO_SET_QOS _WSAIOW(IOC_WS2,11)
120#define SIO_SET_GROUP_QOS _WSAIOW(IOC_WS2,12)
121#define SIO_TRANSLATE_HANDLE _WSAIORW(IOC_WS2,13)
122#define SIO_ROUTING_INTERFACE_QUERY _WSAIORW(IOC_WS2,20)
123#define SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(IOC_WS2,21)
124#define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22)
125#define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23)
Alexandre Julliard28e80292002-01-12 21:17:51 +0000126#define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_WS2,24)
Francois Gouget27202312001-11-14 21:26:23 +0000127#ifndef USE_WS_PREFIX
128#define SIO_GET_INTERFACE_LIST _IOR ('t', 127, u_long)
129#else
130#define SIO_GET_INTERFACE_LIST WS__IOR ('t', 127, u_long)
James Hatheway829405a2000-06-18 17:23:17 +0000131#endif
Andreas Mohrae509412000-08-03 22:19:09 +0000132
Francois Gouget27202312001-11-14 21:26:23 +0000133/* Constants for WSAIoctl() */
134#define WSA_FLAG_OVERLAPPED 0x01
135#define WSA_FLAG_MULTIPOINT_C_ROOT 0x02
136#define WSA_FLAG_MULTIPOINT_C_LEAF 0x04
137#define WSA_FLAG_MULTIPOINT_D_ROOT 0x08
138#define WSA_FLAG_MULTIPOINT_D_LEAF 0x10
James Hatheway829405a2000-06-18 17:23:17 +0000139
James Hatheway829405a2000-06-18 17:23:17 +0000140
Alexandre Julliard83f52d12000-09-26 22:20:14 +0000141#ifndef GUID_DEFINED
Dimitrie O. Paun53f9c212003-08-28 21:43:34 +0000142#include <guiddef.h>
Alexandre Julliard83f52d12000-09-26 22:20:14 +0000143#endif
144
Francois Gouget27202312001-11-14 21:26:23 +0000145#define MAX_PROTOCOL_CHAIN 7
146#define BASE_PROTOCOL 1
147#define LAYERED_PROTOCOL 0
James Hatheway829405a2000-06-18 17:23:17 +0000148
Francois Gouget27202312001-11-14 21:26:23 +0000149typedef struct _WSAPROTOCOLCHAIN
James Hatheway829405a2000-06-18 17:23:17 +0000150{
Francois Gouget27202312001-11-14 21:26:23 +0000151 int ChainLen; /* the length of the chain, */
152 /* length = 0 means layered protocol, */
153 /* length = 1 means base protocol, */
154 /* length > 1 means protocol chain */
155 DWORD ChainEntries[MAX_PROTOCOL_CHAIN]; /* a list of dwCatalogEntryIds */
James Hatheway829405a2000-06-18 17:23:17 +0000156} WSAPROTOCOLCHAIN, * LPWSAPROTOCOLCHAIN;
James Hatheway829405a2000-06-18 17:23:17 +0000157
Francois Gouget27202312001-11-14 21:26:23 +0000158#define WSAPROTOCOL_LEN 255
159typedef struct _WSAPROTOCOL_INFOA
James Hatheway829405a2000-06-18 17:23:17 +0000160{
161 DWORD dwServiceFlags1;
162 DWORD dwServiceFlags2;
163 DWORD dwServiceFlags3;
164 DWORD dwServiceFlags4;
165 DWORD dwProviderFlags;
166 GUID ProviderId;
167 DWORD dwCatalogEntryId;
168 WSAPROTOCOLCHAIN ProtocolChain;
169 int iVersion;
170 int iAddressFamily;
171 int iMaxSockAddr;
172 int iMinSockAddr;
173 int iSocketType;
174 int iProtocol;
175 int iProtocolMaxOffset;
176 int iNetworkByteOrder;
177 int iSecurityScheme;
178 DWORD dwMessageSize;
179 DWORD dwProviderReserved;
Francois Gouget27202312001-11-14 21:26:23 +0000180 CHAR szProtocol[WSAPROTOCOL_LEN+1];
James Hatheway829405a2000-06-18 17:23:17 +0000181} WSAPROTOCOL_INFOA, * LPWSAPROTOCOL_INFOA;
182
Andreas Mohrab968452001-10-02 17:46:59 +0000183typedef struct _WSAPROTOCOL_INFOW
184{
185 DWORD dwServiceFlags1;
186 DWORD dwServiceFlags2;
187 DWORD dwServiceFlags3;
188 DWORD dwServiceFlags4;
189 DWORD dwProviderFlags;
190 GUID ProviderId;
191 DWORD dwCatalogEntryId;
192 WSAPROTOCOLCHAIN ProtocolChain;
193 int iVersion;
194 int iAddressFamily;
195 int iMaxSockAddr;
196 int iMinSockAddr;
197 int iSocketType;
198 int iProtocol;
199 int iProtocolMaxOffset;
200 int iNetworkByteOrder;
201 int iSecurityScheme;
202 DWORD dwMessageSize;
203 DWORD dwProviderReserved;
Francois Gouget27202312001-11-14 21:26:23 +0000204 WCHAR szProtocol[WSAPROTOCOL_LEN+1];
205} WSAPROTOCOL_INFOW, *LPWSAPROTOCOL_INFOW;
Andreas Mohrab968452001-10-02 17:46:59 +0000206
207DECL_WINELIB_TYPE_AW(WSAPROTOCOL_INFO)
208DECL_WINELIB_TYPE_AW(LPWSAPROTOCOL_INFO)
209
Francois Gouget27202312001-11-14 21:26:23 +0000210typedef struct _WSANETWORKEVENTS
James Hatheway829405a2000-06-18 17:23:17 +0000211{
Francois Gouget27202312001-11-14 21:26:23 +0000212 long lNetworkEvents;
213 int iErrorCode[FD_MAX_EVENTS];
Ove Kaavena39ad1a1999-09-27 11:48:11 +0000214} WSANETWORKEVENTS, *LPWSANETWORKEVENTS;
215
Mike McCormack947a74f2002-11-13 19:42:23 +0000216typedef struct _WSANSClassInfoA
217{
218 LPSTR lpszName;
219 DWORD dwNameSpace;
220 DWORD dwValueType;
221 DWORD dwValueSize;
222 LPVOID lpValue;
223} WSANSCLASSINFOA, *PWSANSCLASSINFOA, *LPWSANSCLASSINFOA;
224
225typedef struct _WSANSClassInfoW
226{
227 LPSTR lpszName;
228 DWORD dwNameSpace;
229 DWORD dwValueType;
230 DWORD dwValueSize;
231 LPVOID lpValue;
232} WSANSCLASSINFOW, *PWSANSCLASSINFOW, *LPWSANSCLASSINFOW;
233
234DECL_WINELIB_TYPE_AW(WSANSCLASSINFO)
235DECL_WINELIB_TYPE_AW(PWSANSCLASSINFO)
236DECL_WINELIB_TYPE_AW(LPWSANSCLASSINFO)
237
238typedef struct _WSAServiceClassInfoA
239{
240 LPGUID lpServiceClassId;
241 LPSTR lpszServiceClassName;
242 DWORD dwCount;
243 LPWSANSCLASSINFOA lpClassInfos;
244} WSASERVICECLASSINFOA, *PWSASERVICECLASSINFOA, *LPWSASERVICECLASSINFOA;
245
246typedef struct _WSAServiceClassInfoW
247{
248 LPGUID lpServiceClassId;
249 LPWSTR lpszServiceClassName;
250 DWORD dwCount;
251 LPWSANSCLASSINFOW lpClassInfos;
252} WSASERVICECLASSINFOW, *PWSASERVICECLASSINFOW, *LPWSASERVICECLASSINFOW;
253
254
255DECL_WINELIB_TYPE_AW(WSASERVICECLASSINFO)
256DECL_WINELIB_TYPE_AW(PWSASERVICECLASSINFO)
257DECL_WINELIB_TYPE_AW(LPWSASERVICECLASSINFO)
258
Francois Gouget27202312001-11-14 21:26:23 +0000259typedef struct _WSABUF
Peter Hunnisettde962af2001-04-10 21:22:34 +0000260{
261 ULONG len;
262 CHAR* buf;
263} WSABUF, *LPWSABUF;
264
Francois Gouget27202312001-11-14 21:26:23 +0000265#define WSAEVENT HANDLE
266#define LPWSAEVENT LPHANDLE
267#define WSAOVERLAPPED OVERLAPPED
268typedef struct _OVERLAPPED* LPWSAOVERLAPPED;
269
270#define WSA_IO_PENDING (ERROR_IO_PENDING)
271#define WSA_IO_INCOMPLETE (ERROR_IO_INCOMPLETE)
272#define WSA_INVALID_HANDLE (ERROR_INVALID_HANDLE)
273#define WSA_INVALID_PARAMETER (ERROR_INVALID_PARAMETER)
274#define WSA_NOT_ENOUGH_MEMORY (ERROR_NOT_ENOUGH_MEMORY)
275#define WSA_OPERATION_ABORTED (ERROR_OPERATION_ABORTED)
276
277#define WSA_INVALID_EVENT ((WSAEVENT)NULL)
278#define WSA_MAXIMUM_WAIT_EVENTS (MAXIMUM_WAIT_OBJECTS)
279#define WSA_WAIT_FAILED ((DWORD)-1L)
280#define WSA_WAIT_EVENT_0 (WAIT_OBJECT_0)
281#define WSA_WAIT_IO_COMPLETION (WAIT_IO_COMPLETION)
282#define WSA_WAIT_TIMEOUT (WAIT_TIMEOUT)
283#define WSA_INFINITE (INFINITE)
284
James Hatheway829405a2000-06-18 17:23:17 +0000285typedef unsigned int GROUP;
Francois Gouget27202312001-11-14 21:26:23 +0000286#define SG_UNCONSTRAINED_GROUP 0x01
287#define SG_CONSTRAINED_GROUP 0x02
288
Daniel Walker40491ec2002-01-14 18:33:44 +0000289/*
290 * FLOWSPEC and SERVICETYPE should eventually move to qos.h
291 */
292
293typedef ULONG SERVICETYPE;
294
295typedef struct _FLOWSPEC {
296 unsigned int TokenRate;
297 unsigned int TokenBucketSize;
298 unsigned int PeakBandwidth;
299 unsigned int Latency;
300 unsigned int DelayVariation;
301 SERVICETYPE ServiceType;
302 unsigned int MaxSduSize;
303 unsigned int MinimumPolicedSize;
304 } FLOWSPEC, *PFLOWSPEC, *LPFLOWSPEC;
305
306typedef struct _QUALITYOFSERVICE {
307 FLOWSPEC SendingFlowspec;
308 FLOWSPEC ReceivingFlowspec;
Vincent BĂ©ron9a624912002-05-31 23:06:46 +0000309 WSABUF ProviderSpecific;
Daniel Walker40491ec2002-01-14 18:33:44 +0000310 } QOS, *LPQOS;
Francois Gouget27202312001-11-14 21:26:23 +0000311
Patrik Stridvallf94462f2002-01-31 23:22:07 +0000312typedef int (CALLBACK *LPCONDITIONPROC)
Francois Gouget27202312001-11-14 21:26:23 +0000313(
314 LPWSABUF lpCallerId,
315 LPWSABUF lpCallerData,
316 LPQOS lpSQOS,
317 LPQOS lpGQOS,
318 LPWSABUF lpCalleeId,
319 LPWSABUF lpCalleeData,
320 GROUP *g,
321 DWORD dwCallbackData
322);
Ove Kaavena39ad1a1999-09-27 11:48:11 +0000323
Patrik Stridvallf94462f2002-01-31 23:22:07 +0000324typedef void (CALLBACK *LPWSAOVERLAPPED_COMPLETION_ROUTINE)
James Hatheway829405a2000-06-18 17:23:17 +0000325(
Francois Gouget27202312001-11-14 21:26:23 +0000326 DWORD dwError,
327 DWORD cbTransferred,
328 LPWSAOVERLAPPED lpOverlapped,
329 DWORD dwFlags
James Hatheway829405a2000-06-18 17:23:17 +0000330);
Ove Kaavena39ad1a1999-09-27 11:48:11 +0000331
James Hatheway829405a2000-06-18 17:23:17 +0000332
Francois Gouget27202312001-11-14 21:26:23 +0000333
334/*
335 * Winsock Function Typedefs
336 *
Vincent BĂ©ron9a624912002-05-31 23:06:46 +0000337 * Remember to keep this section in sync with the
Francois Gouget27202312001-11-14 21:26:23 +0000338 * "Prototypes" section in winsock.h.
339 */
340#if WS_API_TYPEDEFS
Patrik Stridvall1a4db3e2002-09-23 20:45:57 +0000341typedef HANDLE (WINAPI *LPFN_WSAASYNCGETHOSTBYADDR)(HWND,u_int,const char*,int,int,char*,int);
342typedef HANDLE (WINAPI *LPFN_WSAASYNCGETHOSTBYNAME)(HWND,u_int,const char*,char*,int);
343typedef HANDLE (WINAPI *LPFN_WSAASYNCGETPROTOBYNAME)(HWND,u_int,const char*,char*,int);
344typedef HANDLE (WINAPI *LPFN_WSAASYNCGETPROTOBYNUMBER)(HWND,u_int,int,char*,int);
345typedef HANDLE (WINAPI *LPFN_WSAASYNCGETSERVBYNAME)(HWND,u_int,const char*,const char*,char*,int);
346typedef HANDLE (WINAPI *LPFN_WSAASYNCGETSERVBYPORT)(HWND,u_int,int,const char*,char*,int);
347typedef int (WINAPI *LPFN_WSAASYNCSELECT)(SOCKET,HWND,u_int,long);
Dimitrie O. Paund93f0812003-05-13 00:37:36 +0000348typedef int (WINAPI *LPFN_WSACANCELASYNCREQUEST)(HANDLE);
Patrik Stridvall1a4db3e2002-09-23 20:45:57 +0000349typedef int (WINAPI *LPFN_WSACANCELBLOCKINGCALL)(void);
350typedef int (WINAPI *LPFN_WSACLEANUP)(void);
351typedef int (WINAPI *LPFN_WSAGETLASTERROR)(void);
352typedef BOOL (WINAPI *LPFN_WSAISBLOCKING)(void);
353typedef FARPROC (WINAPI *LPFN_WSASETBLOCKINGHOOK)(FARPROC);
354typedef void (WINAPI *LPFN_WSASETLASTERROR)(int);
355typedef int (WINAPI *LPFN_WSASTARTUP)(WORD,LPWSADATA);
356typedef int (WINAPI *LPFN_WSAUNHOOKBLOCKINGHOOK)(void);
Francois Gouget27202312001-11-14 21:26:23 +0000357
Patrik Stridvall1a4db3e2002-09-23 20:45:57 +0000358typedef SOCKET (WINAPI *LPFN_ACCEPT)(SOCKET,struct WS(sockaddr)*,int*);
359typedef int (WINAPI *LPFN_BIND)(SOCKET,const struct WS(sockaddr)*,int);
360typedef int (WINAPI *LPFN_CLOSESOCKET)(SOCKET);
361typedef int (WINAPI *LPFN_CONNECT)(SOCKET,const struct WS(sockaddr)*,int);
362typedef struct WS(hostent)* (WINAPI *LPFN_GETHOSTBYADDR)(const char*,int,int);
363typedef struct WS(hostent)* (WINAPI *LPFN_GETHOSTBYNAME)(const char*);
364typedef int (WINAPI *LPFN_GETHOSTNAME)(char*,int);
365typedef int (WINAPI *LPFN_GETPEERNAME)(SOCKET,struct WS(sockaddr)*,int*);
366typedef struct WS(protoent)* (WINAPI *LPFN_GETPROTOBYNAME)(const char*);
367typedef struct WS(protoent)* (WINAPI *LPFN_GETPROTOBYNUMBER)(int);
Francois Gouget27202312001-11-14 21:26:23 +0000368#ifdef WS_DEFINE_SELECT
369typedef int (WINAPI* LPFN_SELECT)(int,WS(fd_set)*,WS(fd_set)*,WS(fd_set)*,const struct WS(timeval)*);
370#endif
Patrik Stridvall1a4db3e2002-09-23 20:45:57 +0000371typedef struct WS(servent)* (WINAPI *LPFN_GETSERVBYNAME)(const char*,const char*);
372typedef struct WS(servent)* (WINAPI *LPFN_GETSERVBYPORT)(int,const char*);
373typedef int (WINAPI *LPFN_GETSOCKNAME)(SOCKET,struct WS(sockaddr)*,int*);
374typedef int (WINAPI *LPFN_GETSOCKOPT)(SOCKET,int,int,char*,int*);
375typedef u_long (WINAPI *LPFN_HTONL)(u_long);
376typedef u_short (WINAPI *LPFN_HTONS)(u_short);
Francois Gouget27202312001-11-14 21:26:23 +0000377typedef unsigned long (WINAPI *LPFN_INET_ADDR)(const char*);
Patrik Stridvall1a4db3e2002-09-23 20:45:57 +0000378typedef char* (WINAPI *LPFN_INET_NTOA)(struct WS(in_addr);
379typedef int (WINAPI *LPFN_IOCTLSOCKET)(SOCKET,long,u_long*);
380typedef int (WINAPI *LPFN_LISTEN)(SOCKET,int);
381typedef u_long (WINAPI *LPFN_NTOHL)(u_long);
382typedef u_short (WINAPI *LPFN_NTOHS)(u_short);
383typedef int (WINAPI *LPFN_RECV)(SOCKET,char*,int,int);
384typedef int (WINAPI *LPFN_RECVFROM)(SOCKET,char*,int,int,struct WS(sockaddr)*,int*);
385typedef int (WINAPI *LPFN_SEND)(SOCKET,const char*,int,int);
386typedef int (WINAPI *LPFN_SENDTO)(SOCKET,const char*,int,int,const struct WS(sockaddr)*,int);
387typedef int (WINAPI *LPFN_SETSOCKOPT)(SOCKET,int,int,const char*,int);
388typedef int (WINAPI *LPFN_SHUTDOWN)(SOCKET,int);
389typedef SOCKET (WINAPI *LPFN_SOCKET)(int,int,int);
Francois Gouget27202312001-11-14 21:26:23 +0000390#endif /* WS_API_TYPEDEFS */
391
392
393
394/*
395 * Winsock2 Prototypes
396 *
Vincent BĂ©ron9a624912002-05-31 23:06:46 +0000397 * Remember to keep this section in sync with the
Francois Gouget27202312001-11-14 21:26:23 +0000398 * "Winsock2 Function Typedefs" section below.
399 */
400#if WS_API_PROTOTYPES
401SOCKET WINAPI WSAAccept(SOCKET,struct WS(sockaddr)*,LPINT,LPCONDITIONPROC,DWORD);
402INT WINAPI WSAAddressToStringA(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOA,LPSTR,LPDWORD);
403INT WINAPI WSAAddressToStringW(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOW,LPWSTR,LPDWORD);
404#define WSAAddressToString WINELIB_NAME_AW(WSAAddressToString)
405BOOL WINAPI WSACloseEvent(WSAEVENT);
406int WINAPI WSAConnect(SOCKET,const struct WS(sockaddr)*,int,LPWSABUF,LPWSABUF,LPQOS,LPQOS);
James Hatheway829405a2000-06-18 17:23:17 +0000407WSAEVENT WINAPI WSACreateEvent(void);
Francois Gouget27202312001-11-14 21:26:23 +0000408/* WSADuplicateSocketA */
409/* WSADuplicateSocketW */
410/* WSAEnumNameSpaceProvidersA */
411/* WSAEnumNameSpaceProvidersW */
412int WINAPI WSAEnumNetworkEvents(SOCKET,WSAEVENT,LPWSANETWORKEVENTS);
413int WINAPI WSAEnumProtocolsA(LPINT,LPWSAPROTOCOL_INFOA,LPDWORD);
414int WINAPI WSAEnumProtocolsW(LPINT,LPWSAPROTOCOL_INFOW,LPDWORD);
415#define WSAEnumProtocols WINELIB_NAME_AW(WSAEnumProtocols)
416int WINAPI WSAEventSelect(SOCKET,WSAEVENT,long);
417BOOL WINAPI WSAGetOverlappedResult(SOCKET,LPWSAOVERLAPPED,LPDWORD,BOOL,LPDWORD);
418/* WSAGetQOSByName */
419/* WSAGetServiceClassInfoA */
420/* WSAGetServiceClassInfoW */
421/* WSAGetServiceClassNameByClassIdA */
422/* WSAGetServiceClassNameByClassIdW */
423int WINAPI WSAHtonl(SOCKET,u_long,u_long*);
424int WINAPI WSAHtons(SOCKET,u_short,u_short*);
Mike McCormack947a74f2002-11-13 19:42:23 +0000425int WINAPI WSAInstallServiceClassA(LPWSASERVICECLASSINFOA);
426int WINAPI WSAInstallServiceClassW(LPWSASERVICECLASSINFOW);
427#define WSAInstallServiceClass WINELIB_NAME_AW(WSAInstallServiceClass)
Francois Gouget27202312001-11-14 21:26:23 +0000428int WINAPI WSAIoctl(SOCKET,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
429/* WSAJoinLeaf */
430/* WSALookupServiceBeginA */
431/* WSALookupServiceBeginW */
432/* WSALookupServiceEnd */
433/* WSALookupServiceNextA */
434/* WSALookupServiceNextW */
435int WINAPI WSANtohl(SOCKET,u_long,u_long*);
436int WINAPI WSANtohs(SOCKET,u_short,u_short*);
437/* WSAProviderConfigChange */
438int WINAPI WSARecv(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
439int WINAPI WSARecvDisconnect(SOCKET,LPWSABUF);
440int WINAPI WSARecvFrom(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,struct WS(sockaddr)*,LPINT,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
441/* WSARemoveServiceClass */
442BOOL WINAPI WSAResetEvent(WSAEVENT);
443int WINAPI WSASend(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
444int WINAPI WSASendDisconnect(SOCKET,LPWSABUF);
445int WINAPI WSASendTo(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,const struct WS(sockaddr)*,int,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
446BOOL WINAPI WSASetEvent(WSAEVENT);
447/* WSASetServiceA */
448/* WSASetServiceW */
449SOCKET WINAPI WSASocketA(int,int,int,LPWSAPROTOCOL_INFOA,GROUP,DWORD);
450SOCKET WINAPI WSASocketW(int,int,int,LPWSAPROTOCOL_INFOW,GROUP,DWORD);
451INT WINAPI WSAStringToAddressA(LPSTR,INT,LPWSAPROTOCOL_INFOA,LPSOCKADDR,LPINT);
452INT WINAPI WSAStringToAddressW(LPSTR,INT,LPWSAPROTOCOL_INFOA,LPSOCKADDR,LPINT);
453#define WSASocket WINELIB_NAME_AW(WSASocket)
454#define WSAStringToAddress WINELIB_NAME_AW(WSAStringToAddress)
455DWORD WINAPI WSAWaitForMultipleEvents(DWORD,const WSAEVENT*,BOOL,DWORD,BOOL);
456#endif /* WS_API_PROTOTYPES */
457
458
459
460/*
461 * Winsock2 Function Typedefs
462 *
Vincent BĂ©ron9a624912002-05-31 23:06:46 +0000463 * Remember to keep this section in sync with the
Francois Gouget27202312001-11-14 21:26:23 +0000464 * "Winsock2 Prototypes" section above.
465 */
466#if WS_API_TYPEDEFS
467typedef SOCKET (WINAPI *LPFN_WSAACCEPT)(SOCKET,WS(sockaddr)*,LPINT,LPCONDITIONPROC,DWORD);
468typedef INT (WINAPI *LPFN_WSAADRESSTOSTRINGA)(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOA,LPSTR,LPDWORD);
469typedef INT (WINAPI *LPFN_WSAADRESSTOSTRINGW)(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOW,LPWSTR,LPDWORD);
470#define LPFN_WSAADDRESSTOSTRING WINELIB_NAME_AW(LPFN_WSAADDRESSTOSTRING)
471typedef BOOL (WINAPI *LPFN_WSACLOSEEVENT)(WSAEVENT);
472typedef int (WINAPI *LPFN_WSACONNECT)(SOCKET,const struct WS(sockaddr)*,int,LPWSABUF,LPWSABUF,LPQOS,LPQOS);
473typedef WSAEVENT (WINAPI *LPFN_WSACREATEEVENT)(void);
474/* WSADuplicateSocketA */
475/* WSADuplicateSocketW */
476/* WSAEnumNameSpaceProvidersA */
477/* WSAEnumNameSpaceProvidersW */
478typedef int (WINAPI *LPFN_WSAENUMNETWORKEVENT)(SOCKET,WSAEVENT,LPWSANETWORKEVENTS);
479typedef int (WINAPI *LPFN_WSAENUMPROTOCOLSA)(LPINT,LPWSAPROTOCOL_INFOA,LPDWORD);
480typedef int (WINAPI *LPFN_WSAENUMPROTOCOLSW)(LPINT,LPWSAPROTOCOL_INFOW,LPDWORD);
481#define LPFN_WSAENUMPROTOCOLS WINELIB_NAME_AW(LPFN_WSAENUMPROTOCOLS)
482typedef int (WINAPI *LPFN_WSAEVENTSELECT)(SOCKET,WSAEVENT,long);
483typedef BOOL (WINAPI *LPFN_WSAGETOVERLAPPEDRESULT)(SOCKET,LPWSAOVERLAPPED,LPDWORD,BOOL,LPDWORD);
484/* WSAGetQOSByName */
485/* WSAGetServiceClassInfoA */
486/* WSAGetServiceClassInfoW */
487/* WSAGetServiceClassNameByClassIdA */
488/* WSAGetServiceClassNameByClassIdW */
489typedef int (WINAPI *LPFN_WSAHTONL)(SOCKET,u_long,u_long*);
490typedef int (WINAPI *LPFN_WSAHTONS)(SOCKET,u_short,u_short*);
Mike McCormack947a74f2002-11-13 19:42:23 +0000491typedef int (WINAPI LPFN_WSAINSTALLSERVICECLASSA)(LPWSASERVICECLASSINFOA);
492typedef int (WINAPI LPFN_WSAINSTALLSERVICECLASSW)(LPWSASERVICECLASSINFOW);
Francois Gouget27202312001-11-14 21:26:23 +0000493typedef int (WINAPI *LPFN_WSAIOCTL)(SOCKET,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
494/* WSAJoinLeaf */
495/* WSALookupServiceBeginA */
496/* WSALookupServiceBeginW */
497/* WSALookupServiceEnd */
498/* WSALookupServiceNextA */
499/* WSALookupServiceNextW */
500typedef int (WINAPI *LPFN_WSANTOHL)(SOCKET,u_long,u_long*);
501typedef int (WINAPI *LPFN_WSANTOHS)(SOCKET,u_short,u_short*);
502/* WSAProviderConfigChange */
503typedef int (WINAPI *LPFN_WSARECV)(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
504typedef int (WINAPI *LPFN_WSARECVDISCONNECT)(SOCKET,LPWSABUF);
505typedef int (WINAPI *LPFN_WSARECVFROM)(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,struct WS(sockaddr)*,LPINT,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
506/* WSARemoveServiceClass */
507typedef BOOL (WINAPI *LPFN_WSARESETEVENT)(WSAEVENT);
508typedef int (WINAPI *LPFN_WSASEND)(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
509typedef int (WINAPI *LPFN_WSASENDDISCONNECT)(SOCKET,LPWSABUF);
510typedef int (WINAPI *LPFN_WSASENDTO)(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,const struct WS(sockaddr)*,int,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
511typedef BOOL (WINAPI *LPFN_WSASETEVENT)(WSAEVENT);
512/* WSASetServiceA */
513/* WSASetServiceW */
514typedef SOCKET (WINAPI *LPFN_WSASOCKETA)(int,int,int,LPWSAPROTOCOL_INFOA,GROUP,DWORD);
515typedef SOCKET (WINAPI *LPFN_WSASOCKETW)(int,int,int,LPWSAPROTOCOL_INFOW,GROUP,DWORD);
516typedef INT (WINAPI *LPFN_WSASTRINGTOADDRESSA)(LPSTR,INT,LPWSAPROTOCOL_INFOA,LPSOCKADDR,LPINT);
517typedef INT (WINAPI *LPFN_WSASTRINGTOADDRESSW)(LPSTR,INT,LPWSAPROTOCOL_INFOA,LPSOCKADDR,LPINT);
518#define LPFN_WSASOCKET WINELIB_NAME_AW(LPFN_WSASOCKET)
519#define LPFN_WSASTRINGTOADDRESS WINELIB_NAME_AW(LPFN_WSASTRINGTOADDRESS)
520typedef DWORD (WINAPI *LPFN_WSAWAITFORMULTIPLEEVENTS)(DWORD,const WSAEVENT*,BOOL,DWORD,BOOL);
521#endif /* WS_API_TYPEDEFS */
522
Ove Kaavena39ad1a1999-09-27 11:48:11 +0000523
Daniel Walker40491ec2002-01-14 18:33:44 +0000524/* Condition function return values */
525#define CF_ACCEPT 0x0000
526#define CF_REJECT 0x0001
527#define CF_DEFER 0x0002
528
Dimitrie O. Paun53f9c212003-08-28 21:43:34 +0000529#include <poppack.h>
Andreas Mohrae509412000-08-03 22:19:09 +0000530
Francois Gouget27202312001-11-14 21:26:23 +0000531#ifdef __cplusplus
532}
Ove Kaavena39ad1a1999-09-27 11:48:11 +0000533#endif
Francois Gouget27202312001-11-14 21:26:23 +0000534
535#undef WS
536#undef WS_API_PROTOTYPES
537#undef WS_API_TYPEDEFS
538
539#endif /* __WINSOCK2API__ */