2 * Winsock 2 definitions - used for ws2_32.dll
4 * Copyright (C) 1999 Ove Kaaven
5 * Copyright (C) 2001 Francois Gouget
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #ifndef __WINE_WINSOCKAPI_STDLIB_H
23 #define __WINE_WINSOCKAPI_STDLIB_H
26 * This section defines the items that conflict with the Unix headers.
29 /* We are not using the WS_ prefix we risk getting conflicts for
30 * everything related to select.
33 /* Too late, the Unix version of stdlib.h was included before winsock.h.
34 * This means select and all the related stuff is already defined and we
35 * cannot override types and function prototypes.
36 * All we can do is disable all these symbols so that they are not used
39 # include <sys/types.h>
46 # define FD_SETSIZE Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
47 # define FD_CLR Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
48 # define FD_SET Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
49 # define FD_ZERO Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
50 # define FD_ISSET Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
51 # define fd_set Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
52 # define select Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
53 # elif defined(RLIM_INFINITY)
54 /* On Darwin stdlib.h includes sys/resource.h which defines timeval but not the fd_set macros */
55 # define fd_set unix_fd_set
56 # include <sys/types.h>
65 # define select Include_winsock_h_before_sys_types_h_or_use_the_MSVCRT_library
66 # define timeval Include_winsock_h_before_sys_types_h_or_use_the_MSVCRT_library
68 /* stdlib.h has not been included yet so it's not too late. Include it now
69 * making sure that none of the select symbols is affected. Then we can
70 * define them with our own values.
72 # define fd_set unix_fd_set
73 # define timeval unix_timeval
74 # define select unix_select
75 # define socklen_t unix_socklen_t
76 # define u_long unix_u_long
77 # include <sys/types.h>
90 # undef _TIMEVAL_DEFINED
92 # define WS_DEFINE_SELECT
96 # define WS_DEFINE_SELECT
97 # include <sys/types.h>
99 #endif /* !USE_WS_PREFIX */
101 #endif /* __WINE_WINSOCKAPI_STDLIB_H */
103 #ifndef _WINSOCK2API_
104 #define _WINSOCK2API_
110 # define WS(x) WS_##x
116 typedef unsigned char WS_u_char
;
117 typedef unsigned short WS_u_short
;
118 typedef unsigned int WS_u_int
;
119 typedef ULONG WS_u_long
;
120 #elif (defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__)) && !defined(_BSDTYPES_DEFINED)
121 /* MinGW doesn't define the u_xxx types */
122 typedef unsigned char u_char
;
123 typedef unsigned short u_short
;
124 typedef unsigned int u_int
;
125 typedef ULONG u_long
;
126 #define _BSDTYPES_DEFINED
128 #define u_long ULONG /* make sure we don't use the system u_long */
131 typedef UINT_PTR SOCKET
;
137 /* Everything common between winsock.h and winsock2.h */
138 #ifndef INCL_WINSOCK_API_PROTOTYPES
139 #define INCL_WINSOCK_API_PROTOTYPES 1
140 #define WS_API_PROTOTYPES 1
142 #define WS_API_PROTOTYPES INCL_WINSOCK_API_PROTOTYPES
145 #ifndef INCL_WINSOCK_API_TYPEDEFS
146 #define INCL_WINSOCK_API_TYPEDEFS 0
147 #define WS_API_TYPEDEFS 0
149 #define WS_API_TYPEDEFS INCL_WINSOCK_API_TYPEDEFS
156 #endif /* defined(__cplusplus) */
158 #define INVALID_SOCKET (SOCKET)(~0)
159 #define SOCKET_ERROR (-1)
161 #ifndef USE_WS_PREFIX
162 #define SOL_SOCKET 0xffff
163 #define SO_DEBUG 0x0001
164 #define SO_ACCEPTCONN 0x0002
165 #define SO_REUSEADDR 0x0004
166 #define SO_EXCLUSIVEADDRUSE ((u_int)(~SO_REUSEADDR))
167 #define SO_KEEPALIVE 0x0008
168 #define SO_DONTROUTE 0x0010
169 #define SO_BROADCAST 0x0020
170 #define SO_USELOOPBACK 0x0040
171 #define SO_LINGER 0x0080
172 #define SO_OOBINLINE 0x0100
173 #define SO_DONTLINGER ((u_int)(~SO_LINGER))
174 #define SO_SNDBUF 0x1001
175 #define SO_RCVBUF 0x1002
176 #define SO_SNDLOWAT 0x1003
177 #define SO_RCVLOWAT 0x1004
178 #define SO_SNDTIMEO 0x1005
179 #define SO_RCVTIMEO 0x1006
180 #define SO_ERROR 0x1007
181 #define SO_TYPE 0x1008
182 #define SO_GROUP_ID 0x2001
183 #define SO_GROUP_PRIORITY 0x2002
184 #define SO_MAX_MSG_SIZE 0x2003
185 #define SO_PROTOCOL_INFOA 0x2004
186 #define SO_PROTOCOL_INFOW 0x2005
187 #define SO_PROTOCOL_INFO WINELIB_NAME_AW(WS_SO_PROTOCOL_INFO)
188 #define PVD_CONFIG 0x3001
189 #define SO_CONDITIONAL_ACCEPT 0x3002
191 #define WS_SOL_SOCKET 0xffff
192 #define WS_SO_DEBUG 0x0001
193 #define WS_SO_ACCEPTCONN 0x0002
194 #define WS_SO_REUSEADDR 0x0004
195 #define WS_SO_EXCLUSIVEADDRUSE ((WS_u_int)(~WS_SO_REUSEADDR))
196 #define WS_SO_KEEPALIVE 0x0008
197 #define WS_SO_DONTROUTE 0x0010
198 #define WS_SO_BROADCAST 0x0020
199 #define WS_SO_USELOOPBACK 0x0040
200 #define WS_SO_LINGER 0x0080
201 #define WS_SO_OOBINLINE 0x0100
202 #define WS_SO_DONTLINGER ((WS_u_int)(~WS_SO_LINGER))
203 #define WS_SO_SNDBUF 0x1001
204 #define WS_SO_RCVBUF 0x1002
205 #define WS_SO_SNDLOWAT 0x1003
206 #define WS_SO_RCVLOWAT 0x1004
207 #define WS_SO_SNDTIMEO 0x1005
208 #define WS_SO_RCVTIMEO 0x1006
209 #define WS_SO_ERROR 0x1007
210 #define WS_SO_TYPE 0x1008
211 #define WS_SO_GROUP_ID 0x2001
212 #define WS_SO_GROUP_PRIORITY 0x2002
213 #define WS_SO_MAX_MSG_SIZE 0x2003
214 #define WS_SO_PROTOCOL_INFOA 0x2004
215 #define WS_SO_PROTOCOL_INFOW 0x2005
216 #define WS_SO_PROTOCOL_INFO WINELIB_NAME_AW(WS_SO_PROTOCOL_INFO)
217 #define WS_PVD_CONFIG 0x3001
218 #define WS_SO_CONDITIONAL_ACCEPT 0x3002
223 #define FROM_PROTOCOL_INFO (-1)
225 #ifndef USE_WS_PREFIX
226 #define SOCK_STREAM 1
230 #define SOCK_SEQPACKET 5
231 #else /* USE_WS_PREFIX */
232 #define WS_SOCK_STREAM 1
233 #define WS_SOCK_DGRAM 2
234 #define WS_SOCK_RAW 3
235 #define WS_SOCK_RDM 4
236 #define WS_SOCK_SEQPACKET 5
237 #endif /* USE_WS_PREFIX */
239 /* protocol families */
241 #ifndef USE_WS_PREFIX
242 #define PF_APPLETALK AF_APPLETALK
243 #define PF_BAN AF_BAN
244 #define PF_CCITT AF_CCITT
245 #define PF_CHAOS AF_CHAOS
246 #define PF_DATAKIT AF_DATAKIT
247 #define PF_DECnet AF_DECnet
248 #define PF_DLI AF_DLI
249 #define PF_ECMA AF_ECMA
250 #define PF_FIREFOX AF_FIREFOX
251 #define PF_HYLINK AF_HYLINK
252 #define PF_IMPLINK AF_IMPLINK
253 #define PF_INET AF_INET
254 #define PF_INET6 AF_INET6
255 #define PF_IPX AF_IPX
256 #define PF_ISO AF_ISO
257 #define PF_LAT AF_LAT
258 #define PF_MAX AF_MAX
260 #define PF_OSI AF_OSI
261 #define PF_PUP AF_PUP
262 #define PF_SNA AF_SNA
263 #define PF_UNIX AF_UNIX
264 #define PF_UNKNOWN1 AF_UNKNOWN1
265 #define PF_UNSPEC AF_UNSPEC
266 #define PF_VOICEVIEW AF_VOICEVIEW
269 /* option flags per socket */
271 #define FD_MAX_EVENTS 10
272 #define FD_READ_BIT 0
273 #define FD_WRITE_BIT 1
275 #define FD_ACCEPT_BIT 3
276 #define FD_CONNECT_BIT 4
277 #define FD_CLOSE_BIT 5
279 #define FD_GROUP_QOS_BIT 7
280 #define FD_ROUTING_INTERFACE_CHANGE_BIT 8
281 #define FD_ADDRESS_LIST_CHANGE_BIT 9
283 #define FD_READ 0x00000001
284 #define FD_WRITE 0x00000002
285 #define FD_OOB 0x00000004
286 #define FD_ACCEPT 0x00000008
287 #define FD_CONNECT 0x00000010
288 #define FD_CLOSE 0x00000020
289 #define FD_QOS 0x00000040
290 #define FD_GROUP_QOS 0x00000080
291 #define FD_ROUTING_INTERFACE_CHANGE 0x00000100
292 #define FD_ADDRESS_LIST_CHANGE 0x00000200
295 #define FD_WINE_LISTENING 0x10000000
296 #define FD_WINE_NONBLOCKING 0x20000000
297 #define FD_WINE_CONNECTED 0x40000000
300 /* Constants for LPCONDITIONPROC */
301 #define CF_ACCEPT 0x0000
302 #define CF_REJECT 0x0001
303 #define CF_DEFER 0x0002
305 /* Constants for shutdown() */
306 #define SD_RECEIVE 0x00
310 /* Constants for WSAPoll() */
311 #ifndef USE_WS_PREFIX
312 #ifndef __WINE_WINE_PORT_H
313 #define POLLERR 0x0001
314 #define POLLHUP 0x0002
315 #define POLLNVAL 0x0004
316 #define POLLWRNORM 0x0010
317 #define POLLWRBAND 0x0020
318 #define POLLRDNORM 0x0100
319 #define POLLRDBAND 0x0200
320 #define POLLPRI 0x0400
321 #define POLLIN (POLLRDNORM|POLLRDBAND)
322 #define POLLOUT (POLLWRNORM)
325 #define WS_POLLERR 0x0001
326 #define WS_POLLHUP 0x0002
327 #define WS_POLLNVAL 0x0004
328 #define WS_POLLWRNORM 0x0010
329 #define WS_POLLWRBAND 0x0020
330 #define WS_POLLRDNORM 0x0100
331 #define WS_POLLRDBAND 0x0200
332 #define WS_POLLPRI 0x0400
333 #define WS_POLLIN (WS_POLLRDNORM|WS_POLLRDBAND)
334 #define WS_POLLOUT (WS_POLLWRNORM)
337 /* Constants for WSAIoctl() */
339 #define WS_IOC_UNIX 0x00000000
340 #define WS_IOC_WS2 0x08000000
341 #define WS_IOC_PROTOCOL 0x10000000
342 #define WS_IOC_VENDOR 0x18000000
343 #define WS_IOC_VOID 0x20000000
344 #define WS_IOC_OUT 0x40000000
345 #define WS_IOC_IN 0x80000000
346 #define WS_IOC_INOUT (WS_IOC_IN|WS_IOC_OUT)
347 #define WS_IOCPARM_MASK 0x7f
348 #define WS__IO(x,y) (WS_IOC_VOID | ((x) << 8) | (y))
349 #define WS__IOR(x,y,t) (WS_IOC_OUT | (((UINT)sizeof(t) & WS_IOCPARM_MASK) << 16) | ((x) << 8) | (y))
350 #define WS__IOW(x,y,t) (WS_IOC_IN | (((UINT)sizeof(t) & WS_IOCPARM_MASK) << 16) | ((x) << 8) | (y))
351 #define _WSAIO(x,y) (WS_IOC_VOID|(x)|(y))
352 #define _WSAIOR(x,y) (WS_IOC_OUT|(x)|(y))
353 #define _WSAIOW(x,y) (WS_IOC_IN|(x)|(y))
354 #define _WSAIORW(x,y) (WS_IOC_INOUT|(x)|(y))
355 #define WS_FIONREAD WS__IOR('f', 127, ULONG)
356 #define WS_FIONBIO WS__IOW('f', 126, ULONG)
357 #define WS_FIOASYNC WS__IOW('f', 125, ULONG)
358 #define WS_SIOCSHIWAT WS__IOW('s', 0, ULONG)
359 #define WS_SIOCGHIWAT WS__IOR('s', 1, ULONG)
360 #define WS_SIOCSLOWAT WS__IOW('s', 2, ULONG)
361 #define WS_SIOCGLOWAT WS__IOR('s', 3, ULONG)
362 #define WS_SIOCATMARK WS__IOR('s', 7, ULONG)
363 #define WS_SIO_ASSOCIATE_HANDLE _WSAIOW(WS_IOC_WS2,1)
364 #define WS_SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(WS_IOC_WS2,2)
365 #define WS_SIO_FIND_ROUTE _WSAIOR(WS_IOC_WS2,3)
366 #define WS_SIO_FLUSH _WSAIO(WS_IOC_WS2,4)
367 #define WS_SIO_GET_BROADCAST_ADDRESS _WSAIOR(WS_IOC_WS2,5)
368 #define WS_SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(WS_IOC_WS2,6)
369 #define WS_SIO_GET_QOS _WSAIORW(WS_IOC_WS2,7)
370 #define WS_SIO_GET_GROUP_QOS _WSAIORW(WS_IOC_WS2,8)
371 #define WS_SIO_MULTIPOINT_LOOPBACK _WSAIOW(WS_IOC_WS2,9)
372 #define WS_SIO_MULTICAST_SCOPE _WSAIOW(WS_IOC_WS2,10)
373 #define WS_SIO_SET_QOS _WSAIOW(WS_IOC_WS2,11)
374 #define WS_SIO_SET_GROUP_QOS _WSAIOW(WS_IOC_WS2,12)
375 #define WS_SIO_TRANSLATE_HANDLE _WSAIORW(WS_IOC_WS2,13)
376 #define WS_SIO_ROUTING_INTERFACE_QUERY _WSAIORW(WS_IOC_WS2,20)
377 #define WS_SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(WS_IOC_WS2,21)
378 #define WS_SIO_ADDRESS_LIST_QUERY _WSAIOR(WS_IOC_WS2,22)
379 #define WS_SIO_ADDRESS_LIST_CHANGE _WSAIO(WS_IOC_WS2,23)
380 #define WS_SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(WS_IOC_WS2,24)
381 #define WS_SIO_GET_INTERFACE_LIST WS__IOR('t', 127, ULONG)
382 #else /* USE_WS_PREFIX */
387 #define IOC_UNIX 0x00000000
388 #define IOC_WS2 0x08000000
389 #define IOC_PROTOCOL 0x10000000
390 #define IOC_VENDOR 0x18000000
391 #define IOC_VOID 0x20000000
392 #define IOC_OUT 0x40000000
393 #define IOC_IN 0x80000000
394 #define IOC_INOUT (IOC_IN|IOC_OUT)
395 #define IOCPARM_MASK 0x7f
396 #define _IO(x,y) (IOC_VOID | ((x) << 8) | (y))
397 #define _IOR(x,y,t) (IOC_OUT | (((UINT)sizeof(t) & IOCPARM_MASK) << 16) | ((x) << 8) | (y))
398 #define _IOW(x,y,t) (IOC_IN | (((UINT)sizeof(t) & IOCPARM_MASK) << 16) | ((x) << 8) | (y))
399 #define _WSAIO(x,y) (IOC_VOID|(x)|(y))
400 #define _WSAIOR(x,y) (IOC_OUT|(x)|(y))
401 #define _WSAIOW(x,y) (IOC_IN|(x)|(y))
402 #define _WSAIORW(x,y) (IOC_INOUT|(x)|(y))
403 #define FIONREAD _IOR('f', 127, ULONG)
404 #define FIONBIO _IOW('f', 126, ULONG)
405 #define FIOASYNC _IOW('f', 125, ULONG)
406 #define SIOCSHIWAT _IOW('s', 0, ULONG)
407 #define SIOCGHIWAT _IOR('s', 1, ULONG)
408 #define SIOCSLOWAT _IOW('s', 2, ULONG)
409 #define SIOCGLOWAT _IOR('s', 3, ULONG)
410 #define SIOCATMARK _IOR('s', 7, ULONG)
411 #define SIO_ASSOCIATE_HANDLE _WSAIOW(IOC_WS2,1)
412 #define SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(IOC_WS2,2)
413 #define SIO_FIND_ROUTE _WSAIOR(IOC_WS2,3)
414 #define SIO_FLUSH _WSAIO(IOC_WS2,4)
415 #define SIO_GET_BROADCAST_ADDRESS _WSAIOR(IOC_WS2,5)
416 #define SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(IOC_WS2,6)
417 #define SIO_GET_QOS _WSAIORW(IOC_WS2,7)
418 #define SIO_GET_GROUP_QOS _WSAIORW(IOC_WS2,8)
419 #define SIO_MULTIPOINT_LOOPBACK _WSAIOW(IOC_WS2,9)
420 #define SIO_MULTICAST_SCOPE _WSAIOW(IOC_WS2,10)
421 #define SIO_SET_QOS _WSAIOW(IOC_WS2,11)
422 #define SIO_SET_GROUP_QOS _WSAIOW(IOC_WS2,12)
423 #define SIO_TRANSLATE_HANDLE _WSAIORW(IOC_WS2,13)
424 #define SIO_ROUTING_INTERFACE_QUERY _WSAIORW(IOC_WS2,20)
425 #define SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(IOC_WS2,21)
426 #define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22)
427 #define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23)
428 #define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_WS2,24)
429 #define SIO_GET_INTERFACE_LIST _IOR ('t', 127, ULONG)
430 #endif /* USE_WS_PREFIX */
432 #ifndef USE_WS_PREFIX
433 #define SOMAXCONN 0x7fffffff
435 #define MSG_OOB 0x0001
436 #define MSG_PEEK 0x0002
437 #define MSG_DONTROUTE 0x0004
438 #define MSG_WAITALL 0x0008
439 #define MSG_INTERRUPT 0x0010
440 #define MSG_PARTIAL 0x8000
441 #define MSG_MAXIOVLEN 16
442 #else /* USE_WS_PREFIX */
443 #define WS_SOMAXCONN 0x7fffffff
445 #define WS_MSG_OOB 0x0001
446 #define WS_MSG_PEEK 0x0002
447 #define WS_MSG_DONTROUTE 0x0004
448 #define WS_MSG_WAITALL 0x0008
449 #define WS_MSG_INTERRUPT 0x0010
450 #define WS_MSG_PARTIAL 0x8000
451 #define WS_MSG_MAXIOVLEN 16
452 #endif /* USE_WS_PREFIX */
454 /* Constants for WSAIoctl() */
455 #define WSA_FLAG_OVERLAPPED 0x0001
456 #define WSA_FLAG_MULTIPOINT_C_ROOT 0x0002
457 #define WSA_FLAG_MULTIPOINT_C_LEAF 0x0004
458 #define WSA_FLAG_MULTIPOINT_D_ROOT 0x0008
459 #define WSA_FLAG_MULTIPOINT_D_LEAF 0x0010
460 #define WSA_FLAG_ACCESS_SYSTEM_SECURITY 0x0040
461 #define WSA_FLAG_NO_HANDLE_INHERIT 0x0080
462 #define WSA_FLAG_REGISTERED_IO 0x0100
464 /* Constants for WSAJoinLeaf() */
465 #define JL_SENDER_ONLY 0x01
466 #define JL_RECEIVER_ONLY 0x02
469 /* Constants for WSALookupServiceBegin() */
470 #define LUP_DEEP 0x0001
471 #define LUP_RETURN_NAME 0x0010
472 #define LUP_RETURN_TYPE 0x0020
473 #define LUP_RETURN_VERSION 0x0040
474 #define LUP_RETURN_COMMENT 0x0080
475 #define LUP_RETURN_ADDR 0x0100
476 #define LUP_RETURN_BLOB 0x0200
477 #define LUP_RETURN_ALIASES 0x0400
478 #define LUP_RETURN_QUERY_STRING 0x0800
479 #define LUP_RETURN_ALL (LUP_RETURN_ADDR|LUP_RETURN_BLOB|LUP_RETURN_ALIASES|LUP_RETURN_QUERY_STRING \
480 |LUP_RETURN_NAME|LUP_RETURN_TYPE|LUP_RETURN_VERSION|LUP_RETURN_COMMENT)
482 /* Constants for dwNameSpace from struct WSANAMESPACE_INFO */
486 #define NS_PEER_BROWSE 3
489 #define NS_TCPIP_LOCAL 10
490 #define NS_TCPIP_HOSTS 11
501 #define NS_PNRPNAME 38
502 #define NS_PNRPCLOUD 39
505 #define NS_NISPLUS 42
513 #define MAXGETHOSTSTRUCT 1024
515 #define MAX_PROTOCOL_CHAIN 7
516 #define BASE_PROTOCOL 1
517 #define LAYERED_PROTOCOL 0
519 typedef struct _WSAPROTOCOLCHAIN
521 int ChainLen
; /* the length of the chain, */
522 /* length = 0 means layered protocol, */
523 /* length = 1 means base protocol, */
524 /* length > 1 means protocol chain */
525 DWORD ChainEntries
[MAX_PROTOCOL_CHAIN
]; /* a list of dwCatalogEntryIds */
526 } WSAPROTOCOLCHAIN
, * LPWSAPROTOCOLCHAIN
;
528 /* constants used in dwProviderFlags from struct WSAPROTOCOL_INFO */
529 #define PFL_MULTIPLE_PROTO_ENTRIES 0x00000001
530 #define PFL_RECOMMENDED_PROTO_ENTRY 0x00000002
531 #define PFL_HIDDEN 0x00000004
532 #define PFL_MATCHES_PROTOCOL_ZERO 0x00000008
534 #define XP1_CONNECTIONLESS 0x00000001
535 #define XP1_GUARANTEED_DELIVERY 0x00000002
536 #define XP1_GUARANTEED_ORDER 0x00000004
537 #define XP1_MESSAGE_ORIENTED 0x00000008
538 #define XP1_PSEUDO_STREAM 0x00000010
539 #define XP1_GRACEFUL_CLOSE 0x00000020
540 #define XP1_EXPEDITED_DATA 0x00000040
541 #define XP1_CONNECT_DATA 0x00000080
542 #define XP1_DISCONNECT_DATA 0x00000100
543 #define XP1_SUPPORT_BROADCAST 0x00000200
544 #define XP1_SUPPORT_MULTIPOINT 0x00000400
545 #define XP1_MULTIPOINT_CONTROL_PLANE 0x00000800
546 #define XP1_MULTIPOINT_DATA_PLANE 0x00001000
547 #define XP1_QOS_SUPPORTED 0x00002000
548 #define XP1_INTERRUPT 0x00004000
549 #define XP1_UNI_SEND 0x00008000
550 #define XP1_UNI_RECV 0x00010000
551 #define XP1_IFS_HANDLES 0x00020000
552 #define XP1_PARTIAL_MESSAGE 0x00040000
554 #define BIGENDIAN 0x0000
555 #define LITTLEENDIAN 0x0001
557 #define SECURITY_PROTOCOL_NONE 0x0000
559 #ifndef _TIMEVAL_DEFINED
560 #define _TIMEVAL_DEFINED
561 typedef struct WS(timeval
)
565 } TIMEVAL
, *PTIMEVAL
, *LPTIMEVAL
;
568 #ifdef WS_DEFINE_SELECT
570 #define __WS_FD_CLR(fd, set, cast) do { \
572 for (__i = 0; __i < ((cast*)(set))->fd_count; __i++) \
574 if (((cast*)(set))->fd_array[__i] == fd) \
576 while (__i < ((cast*)(set))->fd_count-1) \
578 ((cast*)(set))->fd_array[__i] = \
579 ((cast*)(set))->fd_array[__i+1]; \
582 ((cast*)(set))->fd_count--; \
588 #define __WS_FD_SET(fd, set, cast) do { \
590 for (__i = 0; __i < ((cast*)(set))->fd_count; __i++) \
592 if (((cast*)(set))->fd_array[__i] == (fd)) \
595 if (__i == ((cast*)(set))->fd_count && ((cast*)(set))->fd_count < FD_SETSIZE) \
597 ((cast*)(set))->fd_count++; \
598 ((cast*)(set))->fd_array[__i]=(fd);\
602 #ifndef USE_WS_PREFIX
605 # define FD_SETSIZE 64
608 # define FD_CLR(fd, set) __WS_FD_CLR((fd), (set), fd_set)
609 # define FD_SET(fd, set) __WS_FD_SET((fd), (set), fd_set)
610 # define FD_ZERO(set) (((fd_set*)(set))->fd_count=0)
611 # define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (fd_set*)(set))
615 # ifndef WS_FD_SETSIZE
616 # define WS_FD_SETSIZE 64
619 # define WS_FD_CLR(fd, set) __WS_FD_CLR((fd), (set), WS_fd_set)
620 # define WS_FD_SET(fd, set) __WS_FD_SET((fd), (set), WS_fd_set)
621 # define WS_FD_ZERO(set) (((WS_fd_set*)(set))->fd_count=0)
622 # define WS_FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (WS_fd_set*)(set))
626 typedef struct WS(fd_set
)
629 SOCKET fd_array
[WS(FD_SETSIZE
)];
630 } WS(fd_set
), FD_SET
, *PFD_SET
, *LPFD_SET
;
634 typedef struct /*WS(pollfd)*/
641 typedef struct WS(hostent
)
648 #define h_addr h_addr_list[0]
649 } HOSTENT
, *PHOSTENT
, *LPHOSTENT
;
651 typedef struct WS(servent
)
662 } SERVENT
, *PSERVENT
, *LPSERVENT
;
664 typedef struct WS(protoent
)
669 } PROTOENT
, *PPROTOENT
, *LPPROTOENT
;
671 typedef struct WS(linger
)
674 WS(u_short
) l_linger
;
675 } LINGER
, *PLINGER
, *LPLINGER
;
677 #define WSAPROTOCOL_LEN 255
678 typedef struct _WSAPROTOCOL_INFOA
680 DWORD dwServiceFlags1
;
681 DWORD dwServiceFlags2
;
682 DWORD dwServiceFlags3
;
683 DWORD dwServiceFlags4
;
684 DWORD dwProviderFlags
;
686 DWORD dwCatalogEntryId
;
687 WSAPROTOCOLCHAIN ProtocolChain
;
694 int iProtocolMaxOffset
;
695 int iNetworkByteOrder
;
698 DWORD dwProviderReserved
;
699 CHAR szProtocol
[WSAPROTOCOL_LEN
+1];
700 } WSAPROTOCOL_INFOA
, * LPWSAPROTOCOL_INFOA
;
702 typedef struct _WSAPROTOCOL_INFOW
704 DWORD dwServiceFlags1
;
705 DWORD dwServiceFlags2
;
706 DWORD dwServiceFlags3
;
707 DWORD dwServiceFlags4
;
708 DWORD dwProviderFlags
;
710 DWORD dwCatalogEntryId
;
711 WSAPROTOCOLCHAIN ProtocolChain
;
718 int iProtocolMaxOffset
;
719 int iNetworkByteOrder
;
722 DWORD dwProviderReserved
;
723 WCHAR szProtocol
[WSAPROTOCOL_LEN
+1];
724 } WSAPROTOCOL_INFOW
, *LPWSAPROTOCOL_INFOW
;
726 DECL_WINELIB_TYPE_AW(WSAPROTOCOL_INFO
)
727 DECL_WINELIB_TYPE_AW(LPWSAPROTOCOL_INFO
)
729 typedef struct _WSANETWORKEVENTS
732 int iErrorCode
[FD_MAX_EVENTS
];
733 } WSANETWORKEVENTS
, *LPWSANETWORKEVENTS
;
735 typedef struct _WSANSClassInfoA
742 } WSANSCLASSINFOA
, *PWSANSCLASSINFOA
, *LPWSANSCLASSINFOA
;
744 typedef struct _WSANSClassInfoW
751 } WSANSCLASSINFOW
, *PWSANSCLASSINFOW
, *LPWSANSCLASSINFOW
;
753 DECL_WINELIB_TYPE_AW(WSANSCLASSINFO
)
754 DECL_WINELIB_TYPE_AW(PWSANSCLASSINFO
)
755 DECL_WINELIB_TYPE_AW(LPWSANSCLASSINFO
)
757 typedef struct _WSAServiceClassInfoA
759 LPGUID lpServiceClassId
;
760 LPSTR lpszServiceClassName
;
762 LPWSANSCLASSINFOA lpClassInfos
;
763 } WSASERVICECLASSINFOA
, *PWSASERVICECLASSINFOA
, *LPWSASERVICECLASSINFOA
;
765 typedef struct _WSAServiceClassInfoW
767 LPGUID lpServiceClassId
;
768 LPWSTR lpszServiceClassName
;
770 LPWSANSCLASSINFOW lpClassInfos
;
771 } WSASERVICECLASSINFOW
, *PWSASERVICECLASSINFOW
, *LPWSASERVICECLASSINFOW
;
774 DECL_WINELIB_TYPE_AW(WSASERVICECLASSINFO
)
775 DECL_WINELIB_TYPE_AW(PWSASERVICECLASSINFO
)
776 DECL_WINELIB_TYPE_AW(LPWSASERVICECLASSINFO
)
778 #define WSAEVENT HANDLE
779 #define LPWSAEVENT LPHANDLE
780 #define WSAOVERLAPPED OVERLAPPED
781 typedef struct _OVERLAPPED
* LPWSAOVERLAPPED
;
783 #ifndef USE_WS_PREFIX
784 #define h_errno WSAGetLastError()
786 #define WS_h_errno WSAGetLastError()
789 #define WSAHOST_NOT_FOUND (WSABASEERR + 1001)
790 #define WSATRY_AGAIN (WSABASEERR + 1002)
791 #define WSANO_RECOVERY (WSABASEERR + 1003)
792 #define WSANO_DATA (WSABASEERR + 1004)
794 #define WSA_IO_PENDING (ERROR_IO_PENDING)
795 #define WSA_IO_INCOMPLETE (ERROR_IO_INCOMPLETE)
796 #define WSA_INVALID_HANDLE (ERROR_INVALID_HANDLE)
797 #define WSA_INVALID_PARAMETER (ERROR_INVALID_PARAMETER)
798 #define WSA_NOT_ENOUGH_MEMORY (ERROR_NOT_ENOUGH_MEMORY)
799 #define WSA_OPERATION_ABORTED (ERROR_OPERATION_ABORTED)
801 #define WSA_INVALID_EVENT ((WSAEVENT)NULL)
802 #define WSA_MAXIMUM_WAIT_EVENTS (MAXIMUM_WAIT_OBJECTS)
803 #define WSA_WAIT_FAILED ((DWORD)-1)
804 #define WSA_WAIT_EVENT_0 (WAIT_OBJECT_0)
805 #define WSA_WAIT_IO_COMPLETION (WAIT_IO_COMPLETION)
806 #define WSA_WAIT_TIMEOUT (WAIT_TIMEOUT)
807 #define WSA_INFINITE (INFINITE)
809 typedef unsigned int GROUP
;
810 #define SG_UNCONSTRAINED_GROUP 0x01
811 #define SG_CONSTRAINED_GROUP 0x02
814 * FLOWSPEC and SERVICETYPE should eventually move to qos.h
817 typedef ULONG SERVICETYPE
;
819 typedef struct _FLOWSPEC
{
820 unsigned int TokenRate
;
821 unsigned int TokenBucketSize
;
822 unsigned int PeakBandwidth
;
823 unsigned int Latency
;
824 unsigned int DelayVariation
;
825 SERVICETYPE ServiceType
;
826 unsigned int MaxSduSize
;
827 unsigned int MinimumPolicedSize
;
828 } FLOWSPEC
, *PFLOWSPEC
, *LPFLOWSPEC
;
830 typedef struct _QUALITYOFSERVICE
{
831 FLOWSPEC SendingFlowspec
;
832 FLOWSPEC ReceivingFlowspec
;
833 WSABUF ProviderSpecific
;
836 typedef int (CALLBACK
*LPCONDITIONPROC
)
839 LPWSABUF lpCallerData
,
843 LPWSABUF lpCalleeData
,
845 DWORD_PTR dwCallbackData
848 typedef void (CALLBACK
*LPWSAOVERLAPPED_COMPLETION_ROUTINE
)
852 LPWSAOVERLAPPED lpOverlapped
,
856 #ifndef _tagBLOB_DEFINED
857 #define _tagBLOB_DEFINED
858 #define _BLOB_DEFINED
859 #define _LPBLOB_DEFINED
860 typedef struct _BLOB
{
866 /* addressfamily protocol pairs */
867 typedef struct _AFPROTOCOLS
{
870 } AFPROTOCOLS
, *PAFPROTOCOLS
, *LPAFPROTOCOLS
;
872 /* client query definitions */
873 typedef enum _WSAEcomparator
{
876 } WSAECOMPARATOR
, *PWSAECOMPARATOR
, *LPWSAECOMPARATOR
;
878 typedef struct _WSAVersion
{
880 WSAECOMPARATOR ecHow
;
881 } WSAVERSION
, *PWSAVERSION
, *LPWSAVERSION
;
884 typedef struct _WSAQuerySetA
{
886 LPSTR lpszServiceInstanceName
;
887 LPGUID lpServiceClassId
;
888 LPWSAVERSION lpVersion
;
891 LPGUID lpNSProviderId
;
893 DWORD dwNumberOfProtocols
;
894 LPAFPROTOCOLS lpafpProtocols
;
895 LPSTR lpszQueryString
;
896 DWORD dwNumberOfCsAddrs
;
897 LPCSADDR_INFO lpcsaBuffer
;
900 } WSAQUERYSETA
, *PWSAQUERYSETA
, *LPWSAQUERYSETA
;
902 typedef struct _WSAQuerySetW
{
904 LPWSTR lpszServiceInstanceName
;
905 LPGUID lpServiceClassId
;
906 LPWSAVERSION lpVersion
;
909 LPGUID lpNSProviderId
;
911 DWORD dwNumberOfProtocols
;
912 LPAFPROTOCOLS lpafpProtocols
;
913 LPWSTR lpszQueryString
;
914 DWORD dwNumberOfCsAddrs
;
915 LPCSADDR_INFO lpcsaBuffer
;
918 } WSAQUERYSETW
, *PWSAQUERYSETW
, *LPWSAQUERYSETW
;
920 DECL_WINELIB_TYPE_AW(WSAQUERYSET
)
921 DECL_WINELIB_TYPE_AW(PWSAQUERYSET
)
922 DECL_WINELIB_TYPE_AW(LPWSAQUERYSET
)
924 typedef enum _WSAESETSERVICEOP
{
925 RNRSERVICE_REGISTER
= 0,
926 RNRSERVICE_DEREGISTER
,
928 } WSAESETSERVICEOP
, *PWSAESETSERVICEOP
, *LPWSAESETSERVICEOP
;
930 typedef struct _WSANAMESPACE_INFOA
{
935 LPSTR lpszIdentifier
;
936 } WSANAMESPACE_INFOA
, *PWSANAMESPACE_INFOA
, *LPWSANAMESPACE_INFOA
;
938 typedef struct _WSANAMESPACE_INFOW
{
943 LPWSTR lpszIdentifier
;
944 } WSANAMESPACE_INFOW
, *PWSANAMESPACE_INFOW
, *LPWSANAMESPACE_INFOW
;
946 DECL_WINELIB_TYPE_AW(WSANAMESPACE_INFO
)
947 DECL_WINELIB_TYPE_AW(PWSANAMESPACE_INFO
)
948 DECL_WINELIB_TYPE_AW(LPWSANAMESPACE_INFO
)
950 typedef enum _WSACOMPLETIONTYPE
{
951 NSP_NOTIFY_IMMEDIATELY
= 0,
953 NSP_NOTIFY_EVENT
= 2,
956 } WSACOMPLETIONTYPE
, * PWSACOMPLETIONTYPE
, * LPWSACOMPLETIONTYPE
;
958 typedef struct _WSACOMPLETION
{
959 WSACOMPLETIONTYPE Type
;
967 LPWSAOVERLAPPED lpOverlapped
;
970 LPWSAOVERLAPPED lpOverlapped
;
971 LPWSAOVERLAPPED_COMPLETION_ROUTINE lpfnCompletionProc
;
974 LPWSAOVERLAPPED lpOverlapped
;
979 } WSACOMPLETION
, *PWSACOMPLETION
, *LPWSACOMPLETION
;
981 #define WSADESCRIPTION_LEN 256
982 #define WSASYS_STATUS_LEN 128
984 typedef struct WSAData
992 char szDescription
[WSADESCRIPTION_LEN
+1];
993 char szSystemStatus
[WSASYS_STATUS_LEN
+1];
995 char szDescription
[WSADESCRIPTION_LEN
+1];
996 char szSystemStatus
[WSASYS_STATUS_LEN
+1];
1001 } WSADATA
, *LPWSADATA
;
1003 #ifndef USE_WS_PREFIX
1010 #ifdef WORDS_BIGENDIAN
1012 static inline u_short
__wine_ushort_noop(u_short s
)
1016 static inline ULONG
__wine_ulong_noop(ULONG l
)
1020 #define htonl __wine_ulong_noop
1021 #define htons __wine_ushort_noop
1022 #define ntohl __wine_ulong_noop
1023 #define ntohs __wine_ushort_noop
1025 #else /* WORDS_BIGENDIAN */
1027 static inline u_short
__wine_ushort_swap(u_short s
)
1029 return (s
>> 8) | (s
<< 8);
1031 static inline ULONG
__wine_ulong_swap(ULONG l
)
1033 return ((ULONG
)__wine_ushort_swap((u_short
)l
) << 16) | __wine_ushort_swap((u_short
)(l
>> 16));
1035 #define htonl __wine_ulong_swap
1036 #define htons __wine_ushort_swap
1037 #define ntohl __wine_ulong_swap
1038 #define ntohs __wine_ushort_swap
1040 #endif /* WORDS_BIGENDIAN */
1041 #endif /* USE_WS_PREFIX */
1043 #define WSAMAKEASYNCREPLY(size, error) MAKELONG(size, error)
1044 #define WSAMAKESELECTREPLY(flags, error) MAKELONG(flags, error)
1045 #define WSAGETASYNCBUFLEN(x) LOWORD(x)
1046 #define WSAGETASYNCERROR(x) HIWORD(x)
1047 #define WSAGETSELECTEVENT(x) LOWORD(x)
1048 #define WSAGETSELECTERROR(x) HIWORD(x)
1051 * Winsock Function Typedefs
1053 * Remember to keep this section in sync with the
1054 * "Prototypes" section in winsock.h.
1057 typedef HANDLE (WINAPI
*LPFN_WSAASYNCGETHOSTBYADDR
)(HWND
,WS(u_int
),const char*,int,int,char*,int);
1058 typedef HANDLE (WINAPI
*LPFN_WSAASYNCGETHOSTBYNAME
)(HWND
,WS(u_int
),const char*,char*,int);
1059 typedef HANDLE (WINAPI
*LPFN_WSAASYNCGETPROTOBYNAME
)(HWND
,WS(u_int
),const char*,char*,int);
1060 typedef HANDLE (WINAPI
*LPFN_WSAASYNCGETPROTOBYNUMBER
)(HWND
,WS(u_int
),int,char*,int);
1061 typedef HANDLE (WINAPI
*LPFN_WSAASYNCGETSERVBYNAME
)(HWND
,WS(u_int
),const char*,const char*,char*,int);
1062 typedef HANDLE (WINAPI
*LPFN_WSAASYNCGETSERVBYPORT
)(HWND
,WS(u_int
),int,const char*,char*,int);
1063 typedef int (WINAPI
*LPFN_WSAASYNCSELECT
)(SOCKET
,HWND
,WS(u_int
),LONG
);
1064 typedef int (WINAPI
*LPFN_WSACANCELASYNCREQUEST
)(HANDLE
);
1065 typedef int (WINAPI
*LPFN_WSACANCELBLOCKINGCALL
)(void);
1066 typedef int (WINAPI
*LPFN_WSACLEANUP
)(void);
1067 typedef int (WINAPI
*LPFN_WSAGETLASTERROR
)(void);
1068 typedef BOOL (WINAPI
*LPFN_WSAISBLOCKING
)(void);
1069 typedef FARPROC (WINAPI
*LPFN_WSASETBLOCKINGHOOK
)(FARPROC
);
1070 typedef void (WINAPI
*LPFN_WSASETLASTERROR
)(int);
1071 typedef int (WINAPI
*LPFN_WSASTARTUP
)(WORD
,LPWSADATA
);
1072 typedef int (WINAPI
*LPFN_WSAUNHOOKBLOCKINGHOOK
)(void);
1074 typedef SOCKET (WINAPI
*LPFN_ACCEPT
)(SOCKET
,struct WS(sockaddr
)*,int*);
1075 typedef int (WINAPI
*LPFN_BIND
)(SOCKET
,const struct WS(sockaddr
)*,int);
1076 typedef int (WINAPI
*LPFN_CLOSESOCKET
)(SOCKET
);
1077 typedef int (WINAPI
*LPFN_CONNECT
)(SOCKET
,const struct WS(sockaddr
)*,int);
1078 typedef struct WS(hostent
)* (WINAPI
*LPFN_GETHOSTBYADDR
)(const char*,int,int);
1079 typedef struct WS(hostent
)* (WINAPI
*LPFN_GETHOSTBYNAME
)(const char*);
1080 typedef int (WINAPI
*LPFN_GETHOSTNAME
)(char*,int);
1081 typedef int (WINAPI
*LPFN_GETPEERNAME
)(SOCKET
,struct WS(sockaddr
)*,int*);
1082 typedef struct WS(protoent
)* (WINAPI
*LPFN_GETPROTOBYNAME
)(const char*);
1083 typedef struct WS(protoent
)* (WINAPI
*LPFN_GETPROTOBYNUMBER
)(int);
1084 #ifdef WS_DEFINE_SELECT
1085 typedef int (WINAPI
* LPFN_SELECT
)(int,WS(fd_set
)*,WS(fd_set
)*,WS(fd_set
)*,const struct WS(timeval
)*);
1087 typedef struct WS(servent
)* (WINAPI
*LPFN_GETSERVBYNAME
)(const char*,const char*);
1088 typedef struct WS(servent
)* (WINAPI
*LPFN_GETSERVBYPORT
)(int,const char*);
1089 typedef int (WINAPI
*LPFN_GETSOCKNAME
)(SOCKET
,struct WS(sockaddr
)*,int*);
1090 typedef int (WINAPI
*LPFN_GETSOCKOPT
)(SOCKET
,int,int,char*,int*);
1091 typedef ULONG (WINAPI
*LPFN_HTONL
)(ULONG
);
1092 typedef WS(u_short
) (WINAPI
*LPFN_HTONS
)(WS(u_short
));
1093 typedef ULONG (WINAPI
*LPFN_INET_ADDR
)(const char*);
1094 typedef char* (WINAPI
*LPFN_INET_NTOA
)(struct WS(in_addr
));
1095 typedef int (WINAPI
*LPFN_IOCTLSOCKET
)(SOCKET
,LONG
,ULONG
*);
1096 typedef int (WINAPI
*LPFN_LISTEN
)(SOCKET
,int);
1097 typedef ULONG (WINAPI
*LPFN_NTOHL
)(ULONG
);
1098 typedef WS(u_short
) (WINAPI
*LPFN_NTOHS
)(WS(u_short
));
1099 typedef int (WINAPI
*LPFN_RECV
)(SOCKET
,char*,int,int);
1100 typedef int (WINAPI
*LPFN_RECVFROM
)(SOCKET
,char*,int,int,struct WS(sockaddr
)*,int*);
1101 typedef int (WINAPI
*LPFN_SEND
)(SOCKET
,const char*,int,int);
1102 typedef int (WINAPI
*LPFN_SENDTO
)(SOCKET
,const char*,int,int,const struct WS(sockaddr
)*,int);
1103 typedef int (WINAPI
*LPFN_SETSOCKOPT
)(SOCKET
,int,int,const char*,int);
1104 typedef int (WINAPI
*LPFN_SHUTDOWN
)(SOCKET
,int);
1105 typedef SOCKET (WINAPI
*LPFN_SOCKET
)(int,int,int);
1106 #endif /* WS_API_TYPEDEFS */
1111 * Winsock2 Prototypes
1113 * Remember to keep this section in sync with the
1114 * "Winsock2 Function Typedefs" section below.
1116 #if WS_API_PROTOTYPES
1117 int WINAPI
__WSAFDIsSet(SOCKET
, WS(fd_set
) *);
1119 SOCKET WINAPI
WS(accept
)(SOCKET
, struct WS(sockaddr
) *, int *);
1120 int WINAPI
WS(bind
)(SOCKET
, const struct WS(sockaddr
) *, int);
1121 int WINAPI
WS(closesocket
)(SOCKET
);
1122 int WINAPI
WS(connect
)(SOCKET
, const struct WS(sockaddr
) *, int);
1123 struct WS(hostent
) * WINAPI
WS(gethostbyaddr
)(const char *, int, int);
1124 struct WS(hostent
) * WINAPI
WS(gethostbyname
)(const char *);
1125 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__WINE_USE_MSVCRT)
1126 /* gethostname is defined in unistd.h */
1127 int WINAPI
WS(gethostname
)(char *, int);
1129 int WINAPI
WS(getpeername
)(SOCKET
, struct WS(sockaddr
) *, int *);
1130 struct WS(protoent
) * WINAPI
WS(getprotobyname
)(const char *);
1131 struct WS(protoent
) * WINAPI
WS(getprotobynumber
)(int);
1132 struct WS(servent
) * WINAPI
WS(getservbyname
)(const char *, const char *);
1133 struct WS(servent
) * WINAPI
WS(getservbyport
)(int, const char *);
1134 int WINAPI
WS(getsockname
)(SOCKET
, struct WS(sockaddr
) *, int *);
1135 int WINAPI
WS(getsockopt
)(SOCKET
, int, int, char *, int *);
1136 ULONG WINAPI
WS(inet_addr
)(const char *);
1137 char * WINAPI
WS(inet_ntoa
)(struct WS(in_addr
));
1138 int WINAPI
WS(ioctlsocket
)(SOCKET
, LONG
, WS(u_long
) *);
1139 int WINAPI
WS(listen
)(SOCKET
, int);
1140 int WINAPI
WS(recv
)(SOCKET
, char *, int, int);
1141 int WINAPI
WS(recvfrom
)(SOCKET
, char *, int, int, struct WS(sockaddr
) *, int *);
1142 #ifdef WS_DEFINE_SELECT
1143 int WINAPI
WS(select
)(int, WS(fd_set
) *, WS(fd_set
) *, WS(fd_set
) *, const struct WS(timeval
) *);
1145 int WINAPI
WS(send
)(SOCKET
, const char *, int, int);
1146 int WINAPI
WS(sendto
)(SOCKET
, const char *, int, int, const struct WS(sockaddr
) *, int);
1147 int WINAPI
WS(setsockopt
)(SOCKET
, int, int, const char *, int);
1148 int WINAPI
WS(shutdown
)(SOCKET
, int);
1149 SOCKET WINAPI
WS(socket
)(int, int, int);
1151 int WINAPI
GetHostNameW(WCHAR
*, int);
1152 SOCKET WINAPI
WSAAccept(SOCKET
,struct WS(sockaddr
)*,LPINT
,LPCONDITIONPROC
,DWORD_PTR
);
1153 INT WINAPI
WSAAddressToStringA(LPSOCKADDR
,DWORD
,LPWSAPROTOCOL_INFOA
,LPSTR
,LPDWORD
);
1154 INT WINAPI
WSAAddressToStringW(LPSOCKADDR
,DWORD
,LPWSAPROTOCOL_INFOW
,LPWSTR
,LPDWORD
);
1155 #define WSAAddressToString WINELIB_NAME_AW(WSAAddressToString)
1156 HANDLE WINAPI
WSAAsyncGetHostByAddr(HWND
, WS(u_int
), const char *, int, int, char *, int);
1157 HANDLE WINAPI
WSAAsyncGetHostByName(HWND
, WS(u_int
), const char *, char *, int);
1158 HANDLE WINAPI
WSAAsyncGetProtoByName(HWND
, WS(u_int
), const char *, char *, int);
1159 HANDLE WINAPI
WSAAsyncGetProtoByNumber(HWND
, WS(u_int
), int, char *, int);
1160 HANDLE WINAPI
WSAAsyncGetServByName(HWND
, WS(u_int
), const char *, const char *, char *, int);
1161 HANDLE WINAPI
WSAAsyncGetServByPort(HWND
, WS(u_int
), int, const char *, char *, int);
1162 int WINAPI
WSAAsyncSelect(SOCKET
, HWND
, WS(u_int
), LONG
);
1163 int WINAPI
WSACancelAsyncRequest(HANDLE
);
1164 int WINAPI
WSACancelBlockingCall(void);
1165 int WINAPI
WSACleanup(void);
1166 BOOL WINAPI
WSACloseEvent(WSAEVENT
);
1167 int WINAPI
WSAConnect(SOCKET
,const struct WS(sockaddr
)*,int,LPWSABUF
,LPWSABUF
,LPQOS
,LPQOS
);
1168 WSAEVENT WINAPI
WSACreateEvent(void);
1169 INT WINAPI
WSADuplicateSocketA(SOCKET
,DWORD
,LPWSAPROTOCOL_INFOA
);
1170 INT WINAPI
WSADuplicateSocketW(SOCKET
,DWORD
,LPWSAPROTOCOL_INFOW
);
1171 #define WSADuplicateSocket WINELIB_NAME_AW(WSADuplicateSocket)
1172 INT WINAPI
WSAEnumNameSpaceProvidersA(LPDWORD
,LPWSANAMESPACE_INFOA
);
1173 INT WINAPI
WSAEnumNameSpaceProvidersW(LPDWORD
,LPWSANAMESPACE_INFOW
);
1174 #define WSAEnumNameSpaceProviders WINELIB_NAME_AW(WSAEnumNameSpaceProviders)
1175 int WINAPI
WSAEnumNetworkEvents(SOCKET
,WSAEVENT
,LPWSANETWORKEVENTS
);
1176 int WINAPI
WSAEnumProtocolsA(LPINT
,LPWSAPROTOCOL_INFOA
,LPDWORD
);
1177 int WINAPI
WSAEnumProtocolsW(LPINT
,LPWSAPROTOCOL_INFOW
,LPDWORD
);
1178 #define WSAEnumProtocols WINELIB_NAME_AW(WSAEnumProtocols)
1179 int WINAPI
WSAEventSelect(SOCKET
,WSAEVENT
,LONG
);
1180 int WINAPI
WSAGetLastError(void);
1181 BOOL WINAPI
WSAGetOverlappedResult(SOCKET
,LPWSAOVERLAPPED
,LPDWORD
,BOOL
,LPDWORD
);
1182 BOOL WINAPI
WSAGetQOSByName(SOCKET
,LPWSABUF
,LPQOS
);
1183 INT WINAPI
WSAGetServiceClassInfoA(LPGUID
,LPGUID
,LPDWORD
,LPWSASERVICECLASSINFOA
);
1184 INT WINAPI
WSAGetServiceClassInfoW(LPGUID
,LPGUID
,LPDWORD
,LPWSASERVICECLASSINFOW
);
1185 #define WSAGetServiceClassInfo WINELIB_NAME_AW(WSAGetServiceClassInfo)
1186 INT WINAPI
WSAGetServiceClassNameByClassIdA(LPGUID
,LPSTR
,LPDWORD
);
1187 INT WINAPI
WSAGetServiceClassNameByClassIdW(LPGUID
,LPWSTR
,LPDWORD
);
1188 #define WSAGetServiceClassNameByClassId WINELIB_NAME_AW(WSAGetServiceClassNameByClassId)
1189 int WINAPI
WSAHtonl(SOCKET
,ULONG
,ULONG
*);
1190 int WINAPI
WSAHtons(SOCKET
,WS(u_short
),WS(u_short
)*);
1191 int WINAPI
WSAInstallServiceClassA(LPWSASERVICECLASSINFOA
);
1192 int WINAPI
WSAInstallServiceClassW(LPWSASERVICECLASSINFOW
);
1193 #define WSAInstallServiceClass WINELIB_NAME_AW(WSAInstallServiceClass)
1194 int WINAPI
WSAIoctl(SOCKET
,DWORD
,LPVOID
,DWORD
,LPVOID
,DWORD
,LPDWORD
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1195 BOOL WINAPI
WSAIsBlocking(void);
1196 SOCKET WINAPI
WSAJoinLeaf(SOCKET
,const struct WS(sockaddr
)*,int,LPWSABUF
,LPWSABUF
,LPQOS
,LPQOS
,DWORD
);
1197 INT WINAPI
WSALookupServiceBeginA(LPWSAQUERYSETA
,DWORD
,LPHANDLE
);
1198 INT WINAPI
WSALookupServiceBeginW(LPWSAQUERYSETW
,DWORD
,LPHANDLE
);
1199 #define WSALookupServiceBegin WINELIB_NAME_AW(WSALookupServiceBegin)
1200 INT WINAPI
WSALookupServiceEnd(HANDLE
);
1201 INT WINAPI
WSALookupServiceNextA(HANDLE
,DWORD
,LPDWORD
,LPWSAQUERYSETA
);
1202 INT WINAPI
WSALookupServiceNextW(HANDLE
,DWORD
,LPDWORD
,LPWSAQUERYSETW
);
1203 #define WSALookupServiceNext WINELIB_NAME_AW(WSALookupServiceNext)
1204 int WINAPI
WSANSPIoctl(HANDLE
,DWORD
,LPVOID
,DWORD
,LPVOID
,DWORD
,LPDWORD
,LPWSACOMPLETION
);
1205 int WINAPI
WSANtohl(SOCKET
,ULONG
,ULONG
*);
1206 int WINAPI
WSANtohs(SOCKET
,WS(u_short
),WS(u_short
)*);
1207 int WINAPI
WSAPoll(WSAPOLLFD
*,ULONG
,int);
1208 INT WINAPI
WSAProviderConfigChange(LPHANDLE
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1209 int WINAPI
WSARecv(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,LPDWORD
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1210 int WINAPI
WSARecvDisconnect(SOCKET
,LPWSABUF
);
1211 int WINAPI
WSARecvFrom(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,LPDWORD
,struct WS(sockaddr
)*,LPINT
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1212 INT WINAPI
WSARemoveServiceClass(LPGUID
);
1213 BOOL WINAPI
WSAResetEvent(WSAEVENT
);
1214 int WINAPI
WSASend(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,DWORD
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1215 int WINAPI
WSASendDisconnect(SOCKET
,LPWSABUF
);
1216 int WINAPI
WSASendTo(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,DWORD
,const struct WS(sockaddr
)*,int,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1217 FARPROC WINAPI
WSASetBlockingHook(FARPROC
);
1218 BOOL WINAPI
WSASetEvent(WSAEVENT
);
1219 void WINAPI
WSASetLastError(int);
1220 INT WINAPI
WSASetServiceA(LPWSAQUERYSETA
,WSAESETSERVICEOP
,DWORD
);
1221 INT WINAPI
WSASetServiceW(LPWSAQUERYSETW
,WSAESETSERVICEOP
,DWORD
);
1222 #define WSASetService WINELIB_NAME_AW(WSASetService)
1223 SOCKET WINAPI
WSASocketA(int,int,int,LPWSAPROTOCOL_INFOA
,GROUP
,DWORD
);
1224 SOCKET WINAPI
WSASocketW(int,int,int,LPWSAPROTOCOL_INFOW
,GROUP
,DWORD
);
1225 #define WSASocket WINELIB_NAME_AW(WSASocket)
1226 int WINAPI
WSAStartup(WORD
,WSADATA
*);
1227 INT WINAPI
WSAStringToAddressA(LPSTR
,INT
,LPWSAPROTOCOL_INFOA
,LPSOCKADDR
,LPINT
);
1228 INT WINAPI
WSAStringToAddressW(LPWSTR
,INT
,LPWSAPROTOCOL_INFOW
,LPSOCKADDR
,LPINT
);
1229 #define WSAStringToAddress WINELIB_NAME_AW(WSAStringToAddress)
1230 int WINAPI
WSAUnhookBlockingHook(void);
1231 DWORD WINAPI
WSAWaitForMultipleEvents(DWORD
,const WSAEVENT
*,BOOL
,DWORD
,BOOL
);
1232 #endif /* WS_API_PROTOTYPES */
1237 * Winsock2 Function Typedefs
1239 * Remember to keep this section in sync with the
1240 * "Winsock2 Prototypes" section above.
1243 typedef SOCKET (WINAPI
*LPFN_WSAACCEPT
)(SOCKET
,struct WS(sockaddr
)*,LPINT
,LPCONDITIONPROC
,DWORD_PTR
);
1244 typedef INT (WINAPI
*LPFN_WSAADDRESSTOSTRINGA
)(LPSOCKADDR
,DWORD
,LPWSAPROTOCOL_INFOA
,LPSTR
,LPDWORD
);
1245 typedef INT (WINAPI
*LPFN_WSAADDRESSTOSTRINGW
)(LPSOCKADDR
,DWORD
,LPWSAPROTOCOL_INFOW
,LPWSTR
,LPDWORD
);
1246 #define LPFN_WSAADDRESSTOSTRING WINELIB_NAME_AW(LPFN_WSAADDRESSTOSTRING)
1247 typedef BOOL (WINAPI
*LPFN_WSACLOSEEVENT
)(WSAEVENT
);
1248 typedef int (WINAPI
*LPFN_WSACONNECT
)(SOCKET
,const struct WS(sockaddr
)*,int,LPWSABUF
,LPWSABUF
,LPQOS
,LPQOS
);
1249 typedef WSAEVENT (WINAPI
*LPFN_WSACREATEEVENT
)(void);
1250 typedef INT (WINAPI
*LPFN_WSADUPLICATESOCKETA
)(SOCKET
,DWORD
,LPWSAPROTOCOL_INFOA
);
1251 typedef INT (WINAPI
*LPFN_WSADUPLICATESOCKETW
)(SOCKET
,DWORD
,LPWSAPROTOCOL_INFOW
);
1252 #define LPFN_WSADUPLICATESOCKET WINELIB_NAME_AW(LPFN_WSADUPLICATESOCKET)
1253 typedef INT (WINAPI
*LPFN_WSAENUMNAMESPACEPROVIDERSA
)(LPDWORD
,LPWSANAMESPACE_INFOA
);
1254 typedef INT (WINAPI
*LPFN_WSAENUMNAMESPACEPROVIDERSW
)(LPDWORD
,LPWSANAMESPACE_INFOW
);
1255 #define LPFN_WSAENUMNAMESPACEPROVIDERS WINELIB_NAME_AW(LPFN_WSAENUMNAMESPACEPROVIDERS)
1256 typedef int (WINAPI
*LPFN_WSAENUMNETWORKEVENTS
)(SOCKET
,WSAEVENT
,LPWSANETWORKEVENTS
);
1257 typedef int (WINAPI
*LPFN_WSAENUMPROTOCOLSA
)(LPINT
,LPWSAPROTOCOL_INFOA
,LPDWORD
);
1258 typedef int (WINAPI
*LPFN_WSAENUMPROTOCOLSW
)(LPINT
,LPWSAPROTOCOL_INFOW
,LPDWORD
);
1259 #define LPFN_WSAENUMPROTOCOLS WINELIB_NAME_AW(LPFN_WSAENUMPROTOCOLS)
1260 typedef int (WINAPI
*LPFN_WSAEVENTSELECT
)(SOCKET
,WSAEVENT
,LONG
);
1261 typedef BOOL (WINAPI
*LPFN_WSAGETOVERLAPPEDRESULT
)(SOCKET
,LPWSAOVERLAPPED
,LPDWORD
,BOOL
,LPDWORD
);
1262 typedef BOOL (WINAPI
*LPFN_WSAGETQOSBYNAME
)(SOCKET
,LPWSABUF
,LPQOS
);
1263 typedef INT (WINAPI
*LPFN_WSAGETSERVICECLASSINFOA
)(LPGUID
,LPGUID
,LPDWORD
,LPWSASERVICECLASSINFOA
);
1264 typedef INT (WINAPI
*LPFN_WSAGETSERVICECLASSINFOW
)(LPGUID
,LPGUID
,LPDWORD
,LPWSASERVICECLASSINFOW
);
1265 #define LPFN_LPFNWSAGETSERVICECLASSINFO WINELIB_NAME_AW(LPFN_LPFNWSAGETSERVICECLASSINFO)
1266 typedef INT (WINAPI
*LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA
)(LPGUID
,LPSTR
,LPDWORD
);
1267 typedef INT (WINAPI
*LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW
)(LPGUID
,LPWSTR
,LPDWORD
);
1268 #define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID WINELIB_NAME_AW(LPFN_WSAGETSERVICECLASSNAMEBYCLASSID)
1269 typedef int (WINAPI
*LPFN_WSAHTONL
)(SOCKET
,ULONG
,ULONG
*);
1270 typedef int (WINAPI
*LPFN_WSAHTONS
)(SOCKET
,WS(u_short
),WS(u_short
)*);
1271 typedef int (WINAPI
*LPFN_WSAINSTALLSERVICECLASSA
)(LPWSASERVICECLASSINFOA
);
1272 typedef int (WINAPI
*LPFN_WSAINSTALLSERVICECLASSW
)(LPWSASERVICECLASSINFOW
);
1273 typedef int (WINAPI
*LPFN_WSAIOCTL
)(SOCKET
,DWORD
,LPVOID
,DWORD
,LPVOID
,DWORD
,LPDWORD
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1274 typedef int (WINAPI
*LPFN_WSAJOINLEAF
)(SOCKET
,const struct WS(sockaddr
)*,int,LPWSABUF
,LPWSABUF
,LPQOS
,LPQOS
,DWORD
);
1275 typedef INT (WINAPI
*LPFN_WSALOOKUPSERVICEBEGINA
)(LPWSAQUERYSETA
,DWORD
,LPHANDLE
);
1276 typedef INT (WINAPI
*LPFN_WSALOOKUPSERVICEBEGINW
)(LPWSAQUERYSETW
,DWORD
,LPHANDLE
);
1277 #define LPFN_WSALOOKUPSERVICEBEGIN WINELIB_NAME_AW(LPFN_WSALOOKUPSERVICEBEGIN)
1278 typedef INT (WINAPI
*LPFN_WSALOOKUPSERVICEEND
)(HANDLE
);
1279 typedef INT (WINAPI
*LPFN_WSALOOKUPSERVICENEXTA
)(HANDLE
,DWORD
,LPDWORD
,LPWSAQUERYSETA
);
1280 typedef INT (WINAPI
*LPFN_WSALOOKUPSERVICENEXTW
)(HANDLE
,DWORD
,LPDWORD
,LPWSAQUERYSETW
);
1281 #define LPFN_WSALOOKUPSERVICENEXT WINELIB_NAME_AW(LPFN_WSALOOKUPSERVICENEXT)
1282 typedef int (WINAPI
*LPFN_WSANSPIOCTL
)(HANDLE
,DWORD
,LPVOID
,DWORD
,LPVOID
,DWORD
,LPDWORD
,LPWSACOMPLETION
);
1283 typedef int (WINAPI
*LPFN_WSANTOHL
)(SOCKET
,ULONG
,ULONG
*);
1284 typedef int (WINAPI
*LPFN_WSANTOHS
)(SOCKET
,WS(u_short
),WS(u_short
)*);
1285 typedef INT (WINAPI
*LPFN_WSAPROVIDERCONFIGCHANGE
)(LPHANDLE
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1286 typedef int (WINAPI
*LPFN_WSAPOLL
)(WSAPOLLFD
*,ULONG
,int);
1287 typedef int (WINAPI
*LPFN_WSARECV
)(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,LPDWORD
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1288 typedef int (WINAPI
*LPFN_WSARECVDISCONNECT
)(SOCKET
,LPWSABUF
);
1289 typedef int (WINAPI
*LPFN_WSARECVFROM
)(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,LPDWORD
,struct WS(sockaddr
)*,LPINT
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1290 typedef INT (WINAPI
*LPFN_WSAREMOVESERVICECLASS
)(LPGUID
);
1291 typedef BOOL (WINAPI
*LPFN_WSARESETEVENT
)(WSAEVENT
);
1292 typedef int (WINAPI
*LPFN_WSASEND
)(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,DWORD
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1293 typedef int (WINAPI
*LPFN_WSASENDDISCONNECT
)(SOCKET
,LPWSABUF
);
1294 typedef int (WINAPI
*LPFN_WSASENDTO
)(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,DWORD
,const struct WS(sockaddr
)*,int,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1295 typedef BOOL (WINAPI
*LPFN_WSASETEVENT
)(WSAEVENT
);
1296 typedef INT (WINAPI
*LPFN_WSASETSERVICEA
)(LPWSAQUERYSETA
,WSAESETSERVICEOP
,DWORD
);
1297 typedef INT (WINAPI
*LPFN_WSASETSERVICEW
)(LPWSAQUERYSETW
,WSAESETSERVICEOP
,DWORD
);
1298 #define LPFN_WSASETSERVICE WINELIB_NAME_AW(LPFN_WSASETSERVICE)
1299 typedef SOCKET (WINAPI
*LPFN_WSASOCKETA
)(int,int,int,LPWSAPROTOCOL_INFOA
,GROUP
,DWORD
);
1300 typedef SOCKET (WINAPI
*LPFN_WSASOCKETW
)(int,int,int,LPWSAPROTOCOL_INFOW
,GROUP
,DWORD
);
1301 typedef INT (WINAPI
*LPFN_WSASTRINGTOADDRESSA
)(LPSTR
,INT
,LPWSAPROTOCOL_INFOA
,LPSOCKADDR
,LPINT
);
1302 typedef INT (WINAPI
*LPFN_WSASTRINGTOADDRESSW
)(LPSTR
,INT
,LPWSAPROTOCOL_INFOA
,LPSOCKADDR
,LPINT
);
1303 #define LPFN_WSASOCKET WINELIB_NAME_AW(LPFN_WSASOCKET)
1304 #define LPFN_WSASTRINGTOADDRESS WINELIB_NAME_AW(LPFN_WSASTRINGTOADDRESS)
1305 typedef DWORD (WINAPI
*LPFN_WSAWAITFORMULTIPLEEVENTS
)(DWORD
,const WSAEVENT
*,BOOL
,DWORD
,BOOL
);
1306 #endif /* WS_API_TYPEDEFS */
1309 /* Condition function return values */
1310 #define CF_ACCEPT 0x0000
1311 #define CF_REJECT 0x0001
1312 #define CF_DEFER 0x0002
1319 #undef WS_API_PROTOTYPES
1320 #undef WS_API_TYPEDEFS
1322 #endif /* __WINSOCK2API__ */