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
294 /* Constants for LPCONDITIONPROC */
295 #define CF_ACCEPT 0x0000
296 #define CF_REJECT 0x0001
297 #define CF_DEFER 0x0002
299 /* Constants for shutdown() */
300 #define SD_RECEIVE 0x00
304 /* Constants for WSAPoll() */
305 #ifndef USE_WS_PREFIX
306 #ifndef __WINE_WINE_PORT_H
307 #define POLLERR 0x0001
308 #define POLLHUP 0x0002
309 #define POLLNVAL 0x0004
310 #define POLLWRNORM 0x0010
311 #define POLLWRBAND 0x0020
312 #define POLLRDNORM 0x0100
313 #define POLLRDBAND 0x0200
314 #define POLLPRI 0x0400
315 #define POLLIN (POLLRDNORM|POLLRDBAND)
316 #define POLLOUT (POLLWRNORM)
319 #define WS_POLLERR 0x0001
320 #define WS_POLLHUP 0x0002
321 #define WS_POLLNVAL 0x0004
322 #define WS_POLLWRNORM 0x0010
323 #define WS_POLLWRBAND 0x0020
324 #define WS_POLLRDNORM 0x0100
325 #define WS_POLLRDBAND 0x0200
326 #define WS_POLLPRI 0x0400
327 #define WS_POLLIN (WS_POLLRDNORM|WS_POLLRDBAND)
328 #define WS_POLLOUT (WS_POLLWRNORM)
331 /* Constants for WSAIoctl() */
333 #define WS_IOC_UNIX 0x00000000
334 #define WS_IOC_WS2 0x08000000
335 #define WS_IOC_PROTOCOL 0x10000000
336 #define WS_IOC_VENDOR 0x18000000
337 #define WS_IOC_VOID 0x20000000
338 #define WS_IOC_OUT 0x40000000
339 #define WS_IOC_IN 0x80000000
340 #define WS_IOC_INOUT (WS_IOC_IN|WS_IOC_OUT)
341 #define WS_IOCPARM_MASK 0x7f
342 #define WS__IO(x,y) (WS_IOC_VOID | ((x) << 8) | (y))
343 #define WS__IOR(x,y,t) (WS_IOC_OUT | (((UINT)sizeof(t) & WS_IOCPARM_MASK) << 16) | ((x) << 8) | (y))
344 #define WS__IOW(x,y,t) (WS_IOC_IN | (((UINT)sizeof(t) & WS_IOCPARM_MASK) << 16) | ((x) << 8) | (y))
345 #define _WSAIO(x,y) (WS_IOC_VOID|(x)|(y))
346 #define _WSAIOR(x,y) (WS_IOC_OUT|(x)|(y))
347 #define _WSAIOW(x,y) (WS_IOC_IN|(x)|(y))
348 #define _WSAIORW(x,y) (WS_IOC_INOUT|(x)|(y))
349 #define WS_FIONREAD WS__IOR('f', 127, ULONG)
350 #define WS_FIONBIO WS__IOW('f', 126, ULONG)
351 #define WS_FIOASYNC WS__IOW('f', 125, ULONG)
352 #define WS_SIOCSHIWAT WS__IOW('s', 0, ULONG)
353 #define WS_SIOCGHIWAT WS__IOR('s', 1, ULONG)
354 #define WS_SIOCSLOWAT WS__IOW('s', 2, ULONG)
355 #define WS_SIOCGLOWAT WS__IOR('s', 3, ULONG)
356 #define WS_SIOCATMARK WS__IOR('s', 7, ULONG)
357 #define WS_SIO_ASSOCIATE_HANDLE _WSAIOW(WS_IOC_WS2,1)
358 #define WS_SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(WS_IOC_WS2,2)
359 #define WS_SIO_FIND_ROUTE _WSAIOR(WS_IOC_WS2,3)
360 #define WS_SIO_FLUSH _WSAIO(WS_IOC_WS2,4)
361 #define WS_SIO_GET_BROADCAST_ADDRESS _WSAIOR(WS_IOC_WS2,5)
362 #define WS_SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(WS_IOC_WS2,6)
363 #define WS_SIO_GET_QOS _WSAIORW(WS_IOC_WS2,7)
364 #define WS_SIO_GET_GROUP_QOS _WSAIORW(WS_IOC_WS2,8)
365 #define WS_SIO_MULTIPOINT_LOOPBACK _WSAIOW(WS_IOC_WS2,9)
366 #define WS_SIO_MULTICAST_SCOPE _WSAIOW(WS_IOC_WS2,10)
367 #define WS_SIO_SET_QOS _WSAIOW(WS_IOC_WS2,11)
368 #define WS_SIO_SET_GROUP_QOS _WSAIOW(WS_IOC_WS2,12)
369 #define WS_SIO_TRANSLATE_HANDLE _WSAIORW(WS_IOC_WS2,13)
370 #define WS_SIO_ROUTING_INTERFACE_QUERY _WSAIORW(WS_IOC_WS2,20)
371 #define WS_SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(WS_IOC_WS2,21)
372 #define WS_SIO_ADDRESS_LIST_QUERY _WSAIOR(WS_IOC_WS2,22)
373 #define WS_SIO_ADDRESS_LIST_CHANGE _WSAIO(WS_IOC_WS2,23)
374 #define WS_SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(WS_IOC_WS2,24)
375 #define WS_SIO_GET_INTERFACE_LIST WS__IOR('t', 127, ULONG)
376 #else /* USE_WS_PREFIX */
381 #define IOC_UNIX 0x00000000
382 #define IOC_WS2 0x08000000
383 #define IOC_PROTOCOL 0x10000000
384 #define IOC_VENDOR 0x18000000
385 #define IOC_VOID 0x20000000
386 #define IOC_OUT 0x40000000
387 #define IOC_IN 0x80000000
388 #define IOC_INOUT (IOC_IN|IOC_OUT)
389 #define IOCPARM_MASK 0x7f
390 #define _IO(x,y) (IOC_VOID | ((x) << 8) | (y))
391 #define _IOR(x,y,t) (IOC_OUT | (((UINT)sizeof(t) & IOCPARM_MASK) << 16) | ((x) << 8) | (y))
392 #define _IOW(x,y,t) (IOC_IN | (((UINT)sizeof(t) & IOCPARM_MASK) << 16) | ((x) << 8) | (y))
393 #define _WSAIO(x,y) (IOC_VOID|(x)|(y))
394 #define _WSAIOR(x,y) (IOC_OUT|(x)|(y))
395 #define _WSAIOW(x,y) (IOC_IN|(x)|(y))
396 #define _WSAIORW(x,y) (IOC_INOUT|(x)|(y))
397 #define FIONREAD _IOR('f', 127, ULONG)
398 #define FIONBIO _IOW('f', 126, ULONG)
399 #define FIOASYNC _IOW('f', 125, ULONG)
400 #define SIOCSHIWAT _IOW('s', 0, ULONG)
401 #define SIOCGHIWAT _IOR('s', 1, ULONG)
402 #define SIOCSLOWAT _IOW('s', 2, ULONG)
403 #define SIOCGLOWAT _IOR('s', 3, ULONG)
404 #define SIOCATMARK _IOR('s', 7, ULONG)
405 #define SIO_ASSOCIATE_HANDLE _WSAIOW(IOC_WS2,1)
406 #define SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(IOC_WS2,2)
407 #define SIO_FIND_ROUTE _WSAIOR(IOC_WS2,3)
408 #define SIO_FLUSH _WSAIO(IOC_WS2,4)
409 #define SIO_GET_BROADCAST_ADDRESS _WSAIOR(IOC_WS2,5)
410 #define SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(IOC_WS2,6)
411 #define SIO_GET_QOS _WSAIORW(IOC_WS2,7)
412 #define SIO_GET_GROUP_QOS _WSAIORW(IOC_WS2,8)
413 #define SIO_MULTIPOINT_LOOPBACK _WSAIOW(IOC_WS2,9)
414 #define SIO_MULTICAST_SCOPE _WSAIOW(IOC_WS2,10)
415 #define SIO_SET_QOS _WSAIOW(IOC_WS2,11)
416 #define SIO_SET_GROUP_QOS _WSAIOW(IOC_WS2,12)
417 #define SIO_TRANSLATE_HANDLE _WSAIORW(IOC_WS2,13)
418 #define SIO_ROUTING_INTERFACE_QUERY _WSAIORW(IOC_WS2,20)
419 #define SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(IOC_WS2,21)
420 #define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22)
421 #define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23)
422 #define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_WS2,24)
423 #define SIO_GET_INTERFACE_LIST _IOR ('t', 127, ULONG)
424 #endif /* USE_WS_PREFIX */
426 #ifndef USE_WS_PREFIX
427 #define SOMAXCONN 0x7fffffff
429 #define MSG_OOB 0x0001
430 #define MSG_PEEK 0x0002
431 #define MSG_DONTROUTE 0x0004
432 #define MSG_WAITALL 0x0008
433 #define MSG_INTERRUPT 0x0010
434 #define MSG_PARTIAL 0x8000
435 #define MSG_MAXIOVLEN 16
436 #else /* USE_WS_PREFIX */
437 #define WS_SOMAXCONN 0x7fffffff
439 #define WS_MSG_OOB 0x0001
440 #define WS_MSG_PEEK 0x0002
441 #define WS_MSG_DONTROUTE 0x0004
442 #define WS_MSG_WAITALL 0x0008
443 #define WS_MSG_INTERRUPT 0x0010
444 #define WS_MSG_PARTIAL 0x8000
445 #define WS_MSG_MAXIOVLEN 16
446 #endif /* USE_WS_PREFIX */
448 /* Constants for WSAIoctl() */
449 #define WSA_FLAG_OVERLAPPED 0x0001
450 #define WSA_FLAG_MULTIPOINT_C_ROOT 0x0002
451 #define WSA_FLAG_MULTIPOINT_C_LEAF 0x0004
452 #define WSA_FLAG_MULTIPOINT_D_ROOT 0x0008
453 #define WSA_FLAG_MULTIPOINT_D_LEAF 0x0010
454 #define WSA_FLAG_ACCESS_SYSTEM_SECURITY 0x0040
455 #define WSA_FLAG_NO_HANDLE_INHERIT 0x0080
456 #define WSA_FLAG_REGISTERED_IO 0x0100
458 /* Constants for WSAJoinLeaf() */
459 #define JL_SENDER_ONLY 0x01
460 #define JL_RECEIVER_ONLY 0x02
463 /* Constants for WSALookupServiceBegin() */
464 #define LUP_DEEP 0x0001
465 #define LUP_RETURN_NAME 0x0010
466 #define LUP_RETURN_TYPE 0x0020
467 #define LUP_RETURN_VERSION 0x0040
468 #define LUP_RETURN_COMMENT 0x0080
469 #define LUP_RETURN_ADDR 0x0100
470 #define LUP_RETURN_BLOB 0x0200
471 #define LUP_RETURN_ALIASES 0x0400
472 #define LUP_RETURN_QUERY_STRING 0x0800
473 #define LUP_RETURN_ALL (LUP_RETURN_ADDR|LUP_RETURN_BLOB|LUP_RETURN_ALIASES|LUP_RETURN_QUERY_STRING \
474 |LUP_RETURN_NAME|LUP_RETURN_TYPE|LUP_RETURN_VERSION|LUP_RETURN_COMMENT)
476 /* Constants for dwNameSpace from struct WSANAMESPACE_INFO */
480 #define NS_PEER_BROWSE 3
483 #define NS_TCPIP_LOCAL 10
484 #define NS_TCPIP_HOSTS 11
495 #define NS_PNRPNAME 38
496 #define NS_PNRPCLOUD 39
499 #define NS_NISPLUS 42
507 #define MAXGETHOSTSTRUCT 1024
509 #define MAX_PROTOCOL_CHAIN 7
510 #define BASE_PROTOCOL 1
511 #define LAYERED_PROTOCOL 0
513 typedef struct _WSAPROTOCOLCHAIN
515 int ChainLen
; /* the length of the chain, */
516 /* length = 0 means layered protocol, */
517 /* length = 1 means base protocol, */
518 /* length > 1 means protocol chain */
519 DWORD ChainEntries
[MAX_PROTOCOL_CHAIN
]; /* a list of dwCatalogEntryIds */
520 } WSAPROTOCOLCHAIN
, * LPWSAPROTOCOLCHAIN
;
522 /* constants used in dwProviderFlags from struct WSAPROTOCOL_INFO */
523 #define PFL_MULTIPLE_PROTO_ENTRIES 0x00000001
524 #define PFL_RECOMMENDED_PROTO_ENTRY 0x00000002
525 #define PFL_HIDDEN 0x00000004
526 #define PFL_MATCHES_PROTOCOL_ZERO 0x00000008
528 #define XP1_CONNECTIONLESS 0x00000001
529 #define XP1_GUARANTEED_DELIVERY 0x00000002
530 #define XP1_GUARANTEED_ORDER 0x00000004
531 #define XP1_MESSAGE_ORIENTED 0x00000008
532 #define XP1_PSEUDO_STREAM 0x00000010
533 #define XP1_GRACEFUL_CLOSE 0x00000020
534 #define XP1_EXPEDITED_DATA 0x00000040
535 #define XP1_CONNECT_DATA 0x00000080
536 #define XP1_DISCONNECT_DATA 0x00000100
537 #define XP1_SUPPORT_BROADCAST 0x00000200
538 #define XP1_SUPPORT_MULTIPOINT 0x00000400
539 #define XP1_MULTIPOINT_CONTROL_PLANE 0x00000800
540 #define XP1_MULTIPOINT_DATA_PLANE 0x00001000
541 #define XP1_QOS_SUPPORTED 0x00002000
542 #define XP1_INTERRUPT 0x00004000
543 #define XP1_UNI_SEND 0x00008000
544 #define XP1_UNI_RECV 0x00010000
545 #define XP1_IFS_HANDLES 0x00020000
546 #define XP1_PARTIAL_MESSAGE 0x00040000
548 #define BIGENDIAN 0x0000
549 #define LITTLEENDIAN 0x0001
551 #define SECURITY_PROTOCOL_NONE 0x0000
553 #ifndef _TIMEVAL_DEFINED
554 #define _TIMEVAL_DEFINED
555 typedef struct WS(timeval
)
559 } TIMEVAL
, *PTIMEVAL
, *LPTIMEVAL
;
562 #ifdef WS_DEFINE_SELECT
564 #define __WS_FD_CLR(fd, set, cast) do { \
566 for (__i = 0; __i < ((cast*)(set))->fd_count; __i++) \
568 if (((cast*)(set))->fd_array[__i] == fd) \
570 while (__i < ((cast*)(set))->fd_count-1) \
572 ((cast*)(set))->fd_array[__i] = \
573 ((cast*)(set))->fd_array[__i+1]; \
576 ((cast*)(set))->fd_count--; \
582 #define __WS_FD_SET(fd, set, cast) do { \
584 for (__i = 0; __i < ((cast*)(set))->fd_count; __i++) \
586 if (((cast*)(set))->fd_array[__i] == (fd)) \
589 if (__i == ((cast*)(set))->fd_count && ((cast*)(set))->fd_count < FD_SETSIZE) \
591 ((cast*)(set))->fd_count++; \
592 ((cast*)(set))->fd_array[__i]=(fd);\
596 #ifndef USE_WS_PREFIX
599 # define FD_SETSIZE 64
602 # define FD_CLR(fd, set) __WS_FD_CLR((fd), (set), fd_set)
603 # define FD_SET(fd, set) __WS_FD_SET((fd), (set), fd_set)
604 # define FD_ZERO(set) (((fd_set*)(set))->fd_count=0)
605 # define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (fd_set*)(set))
609 # ifndef WS_FD_SETSIZE
610 # define WS_FD_SETSIZE 64
613 # define WS_FD_CLR(fd, set) __WS_FD_CLR((fd), (set), WS_fd_set)
614 # define WS_FD_SET(fd, set) __WS_FD_SET((fd), (set), WS_fd_set)
615 # define WS_FD_ZERO(set) (((WS_fd_set*)(set))->fd_count=0)
616 # define WS_FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (WS_fd_set*)(set))
620 typedef struct WS(fd_set
)
623 SOCKET fd_array
[WS(FD_SETSIZE
)];
624 } WS(fd_set
), FD_SET
, *PFD_SET
, *LPFD_SET
;
628 typedef struct /*WS(pollfd)*/
635 typedef struct WS(hostent
)
642 #define h_addr h_addr_list[0]
643 } HOSTENT
, *PHOSTENT
, *LPHOSTENT
;
645 typedef struct WS(servent
)
656 } SERVENT
, *PSERVENT
, *LPSERVENT
;
658 typedef struct WS(protoent
)
663 } PROTOENT
, *PPROTOENT
, *LPPROTOENT
;
665 typedef struct WS(linger
)
668 WS(u_short
) l_linger
;
669 } LINGER
, *PLINGER
, *LPLINGER
;
671 #define WSAPROTOCOL_LEN 255
672 typedef struct _WSAPROTOCOL_INFOA
674 DWORD dwServiceFlags1
;
675 DWORD dwServiceFlags2
;
676 DWORD dwServiceFlags3
;
677 DWORD dwServiceFlags4
;
678 DWORD dwProviderFlags
;
680 DWORD dwCatalogEntryId
;
681 WSAPROTOCOLCHAIN ProtocolChain
;
688 int iProtocolMaxOffset
;
689 int iNetworkByteOrder
;
692 DWORD dwProviderReserved
;
693 CHAR szProtocol
[WSAPROTOCOL_LEN
+1];
694 } WSAPROTOCOL_INFOA
, * LPWSAPROTOCOL_INFOA
;
696 typedef struct _WSAPROTOCOL_INFOW
698 DWORD dwServiceFlags1
;
699 DWORD dwServiceFlags2
;
700 DWORD dwServiceFlags3
;
701 DWORD dwServiceFlags4
;
702 DWORD dwProviderFlags
;
704 DWORD dwCatalogEntryId
;
705 WSAPROTOCOLCHAIN ProtocolChain
;
712 int iProtocolMaxOffset
;
713 int iNetworkByteOrder
;
716 DWORD dwProviderReserved
;
717 WCHAR szProtocol
[WSAPROTOCOL_LEN
+1];
718 } WSAPROTOCOL_INFOW
, *LPWSAPROTOCOL_INFOW
;
720 DECL_WINELIB_TYPE_AW(WSAPROTOCOL_INFO
)
721 DECL_WINELIB_TYPE_AW(LPWSAPROTOCOL_INFO
)
723 typedef struct _WSANETWORKEVENTS
726 int iErrorCode
[FD_MAX_EVENTS
];
727 } WSANETWORKEVENTS
, *LPWSANETWORKEVENTS
;
729 typedef struct _WSANSClassInfoA
736 } WSANSCLASSINFOA
, *PWSANSCLASSINFOA
, *LPWSANSCLASSINFOA
;
738 typedef struct _WSANSClassInfoW
745 } WSANSCLASSINFOW
, *PWSANSCLASSINFOW
, *LPWSANSCLASSINFOW
;
747 DECL_WINELIB_TYPE_AW(WSANSCLASSINFO
)
748 DECL_WINELIB_TYPE_AW(PWSANSCLASSINFO
)
749 DECL_WINELIB_TYPE_AW(LPWSANSCLASSINFO
)
751 typedef struct _WSAServiceClassInfoA
753 LPGUID lpServiceClassId
;
754 LPSTR lpszServiceClassName
;
756 LPWSANSCLASSINFOA lpClassInfos
;
757 } WSASERVICECLASSINFOA
, *PWSASERVICECLASSINFOA
, *LPWSASERVICECLASSINFOA
;
759 typedef struct _WSAServiceClassInfoW
761 LPGUID lpServiceClassId
;
762 LPWSTR lpszServiceClassName
;
764 LPWSANSCLASSINFOW lpClassInfos
;
765 } WSASERVICECLASSINFOW
, *PWSASERVICECLASSINFOW
, *LPWSASERVICECLASSINFOW
;
768 DECL_WINELIB_TYPE_AW(WSASERVICECLASSINFO
)
769 DECL_WINELIB_TYPE_AW(PWSASERVICECLASSINFO
)
770 DECL_WINELIB_TYPE_AW(LPWSASERVICECLASSINFO
)
772 #define WSAEVENT HANDLE
773 #define LPWSAEVENT LPHANDLE
774 #define WSAOVERLAPPED OVERLAPPED
775 typedef struct _OVERLAPPED
* LPWSAOVERLAPPED
;
777 #ifndef USE_WS_PREFIX
778 #define h_errno WSAGetLastError()
780 #define WS_h_errno WSAGetLastError()
783 #define WSAHOST_NOT_FOUND (WSABASEERR + 1001)
784 #define WSATRY_AGAIN (WSABASEERR + 1002)
785 #define WSANO_RECOVERY (WSABASEERR + 1003)
786 #define WSANO_DATA (WSABASEERR + 1004)
788 #define WSA_IO_PENDING (ERROR_IO_PENDING)
789 #define WSA_IO_INCOMPLETE (ERROR_IO_INCOMPLETE)
790 #define WSA_INVALID_HANDLE (ERROR_INVALID_HANDLE)
791 #define WSA_INVALID_PARAMETER (ERROR_INVALID_PARAMETER)
792 #define WSA_NOT_ENOUGH_MEMORY (ERROR_NOT_ENOUGH_MEMORY)
793 #define WSA_OPERATION_ABORTED (ERROR_OPERATION_ABORTED)
795 #define WSA_INVALID_EVENT ((WSAEVENT)NULL)
796 #define WSA_MAXIMUM_WAIT_EVENTS (MAXIMUM_WAIT_OBJECTS)
797 #define WSA_WAIT_FAILED ((DWORD)-1)
798 #define WSA_WAIT_EVENT_0 (WAIT_OBJECT_0)
799 #define WSA_WAIT_IO_COMPLETION (WAIT_IO_COMPLETION)
800 #define WSA_WAIT_TIMEOUT (WAIT_TIMEOUT)
801 #define WSA_INFINITE (INFINITE)
803 typedef unsigned int GROUP
;
804 #define SG_UNCONSTRAINED_GROUP 0x01
805 #define SG_CONSTRAINED_GROUP 0x02
808 * FLOWSPEC and SERVICETYPE should eventually move to qos.h
811 typedef ULONG SERVICETYPE
;
813 typedef struct _FLOWSPEC
{
814 unsigned int TokenRate
;
815 unsigned int TokenBucketSize
;
816 unsigned int PeakBandwidth
;
817 unsigned int Latency
;
818 unsigned int DelayVariation
;
819 SERVICETYPE ServiceType
;
820 unsigned int MaxSduSize
;
821 unsigned int MinimumPolicedSize
;
822 } FLOWSPEC
, *PFLOWSPEC
, *LPFLOWSPEC
;
824 typedef struct _QUALITYOFSERVICE
{
825 FLOWSPEC SendingFlowspec
;
826 FLOWSPEC ReceivingFlowspec
;
827 WSABUF ProviderSpecific
;
830 typedef int (CALLBACK
*LPCONDITIONPROC
)
833 LPWSABUF lpCallerData
,
837 LPWSABUF lpCalleeData
,
839 DWORD_PTR dwCallbackData
842 typedef void (CALLBACK
*LPWSAOVERLAPPED_COMPLETION_ROUTINE
)
846 LPWSAOVERLAPPED lpOverlapped
,
850 #ifndef _tagBLOB_DEFINED
851 #define _tagBLOB_DEFINED
852 #define _BLOB_DEFINED
853 #define _LPBLOB_DEFINED
854 typedef struct _BLOB
{
860 /* addressfamily protocol pairs */
861 typedef struct _AFPROTOCOLS
{
864 } AFPROTOCOLS
, *PAFPROTOCOLS
, *LPAFPROTOCOLS
;
866 /* client query definitions */
867 typedef enum _WSAEcomparator
{
870 } WSAECOMPARATOR
, *PWSAECOMPARATOR
, *LPWSAECOMPARATOR
;
872 typedef struct _WSAVersion
{
874 WSAECOMPARATOR ecHow
;
875 } WSAVERSION
, *PWSAVERSION
, *LPWSAVERSION
;
878 typedef struct _WSAQuerySetA
{
880 LPSTR lpszServiceInstanceName
;
881 LPGUID lpServiceClassId
;
882 LPWSAVERSION lpVersion
;
885 LPGUID lpNSProviderId
;
887 DWORD dwNumberOfProtocols
;
888 LPAFPROTOCOLS lpafpProtocols
;
889 LPSTR lpszQueryString
;
890 DWORD dwNumberOfCsAddrs
;
891 LPCSADDR_INFO lpcsaBuffer
;
894 } WSAQUERYSETA
, *PWSAQUERYSETA
, *LPWSAQUERYSETA
;
896 typedef struct _WSAQuerySetW
{
898 LPWSTR lpszServiceInstanceName
;
899 LPGUID lpServiceClassId
;
900 LPWSAVERSION lpVersion
;
903 LPGUID lpNSProviderId
;
905 DWORD dwNumberOfProtocols
;
906 LPAFPROTOCOLS lpafpProtocols
;
907 LPWSTR lpszQueryString
;
908 DWORD dwNumberOfCsAddrs
;
909 LPCSADDR_INFO lpcsaBuffer
;
912 } WSAQUERYSETW
, *PWSAQUERYSETW
, *LPWSAQUERYSETW
;
914 DECL_WINELIB_TYPE_AW(WSAQUERYSET
)
915 DECL_WINELIB_TYPE_AW(PWSAQUERYSET
)
916 DECL_WINELIB_TYPE_AW(LPWSAQUERYSET
)
918 typedef enum _WSAESETSERVICEOP
{
919 RNRSERVICE_REGISTER
= 0,
920 RNRSERVICE_DEREGISTER
,
922 } WSAESETSERVICEOP
, *PWSAESETSERVICEOP
, *LPWSAESETSERVICEOP
;
924 typedef struct _WSANAMESPACE_INFOA
{
929 LPSTR lpszIdentifier
;
930 } WSANAMESPACE_INFOA
, *PWSANAMESPACE_INFOA
, *LPWSANAMESPACE_INFOA
;
932 typedef struct _WSANAMESPACE_INFOW
{
937 LPWSTR lpszIdentifier
;
938 } WSANAMESPACE_INFOW
, *PWSANAMESPACE_INFOW
, *LPWSANAMESPACE_INFOW
;
940 DECL_WINELIB_TYPE_AW(WSANAMESPACE_INFO
)
941 DECL_WINELIB_TYPE_AW(PWSANAMESPACE_INFO
)
942 DECL_WINELIB_TYPE_AW(LPWSANAMESPACE_INFO
)
944 typedef enum _WSACOMPLETIONTYPE
{
945 NSP_NOTIFY_IMMEDIATELY
= 0,
947 NSP_NOTIFY_EVENT
= 2,
950 } WSACOMPLETIONTYPE
, * PWSACOMPLETIONTYPE
, * LPWSACOMPLETIONTYPE
;
952 typedef struct _WSACOMPLETION
{
953 WSACOMPLETIONTYPE Type
;
961 LPWSAOVERLAPPED lpOverlapped
;
964 LPWSAOVERLAPPED lpOverlapped
;
965 LPWSAOVERLAPPED_COMPLETION_ROUTINE lpfnCompletionProc
;
968 LPWSAOVERLAPPED lpOverlapped
;
973 } WSACOMPLETION
, *PWSACOMPLETION
, *LPWSACOMPLETION
;
975 #define WSADESCRIPTION_LEN 256
976 #define WSASYS_STATUS_LEN 128
978 typedef struct WSAData
986 char szDescription
[WSADESCRIPTION_LEN
+1];
987 char szSystemStatus
[WSASYS_STATUS_LEN
+1];
989 char szDescription
[WSADESCRIPTION_LEN
+1];
990 char szSystemStatus
[WSASYS_STATUS_LEN
+1];
995 } WSADATA
, *LPWSADATA
;
997 #ifndef USE_WS_PREFIX
1004 #ifdef WORDS_BIGENDIAN
1006 static inline u_short
__wine_ushort_noop(u_short s
)
1010 static inline ULONG
__wine_ulong_noop(ULONG l
)
1014 #define htonl __wine_ulong_noop
1015 #define htons __wine_ushort_noop
1016 #define ntohl __wine_ulong_noop
1017 #define ntohs __wine_ushort_noop
1019 #else /* WORDS_BIGENDIAN */
1021 static inline u_short
__wine_ushort_swap(u_short s
)
1023 return (s
>> 8) | (s
<< 8);
1025 static inline ULONG
__wine_ulong_swap(ULONG l
)
1027 return ((ULONG
)__wine_ushort_swap((u_short
)l
) << 16) | __wine_ushort_swap((u_short
)(l
>> 16));
1029 #define htonl __wine_ulong_swap
1030 #define htons __wine_ushort_swap
1031 #define ntohl __wine_ulong_swap
1032 #define ntohs __wine_ushort_swap
1034 #endif /* WORDS_BIGENDIAN */
1035 #endif /* USE_WS_PREFIX */
1037 #define WSAMAKEASYNCREPLY(size, error) MAKELONG(size, error)
1038 #define WSAMAKESELECTREPLY(flags, error) MAKELONG(flags, error)
1039 #define WSAGETASYNCBUFLEN(x) LOWORD(x)
1040 #define WSAGETASYNCERROR(x) HIWORD(x)
1041 #define WSAGETSELECTEVENT(x) LOWORD(x)
1042 #define WSAGETSELECTERROR(x) HIWORD(x)
1045 * Winsock Function Typedefs
1047 * Remember to keep this section in sync with the
1048 * "Prototypes" section in winsock.h.
1051 typedef HANDLE (WINAPI
*LPFN_WSAASYNCGETHOSTBYADDR
)(HWND
,WS(u_int
),const char*,int,int,char*,int);
1052 typedef HANDLE (WINAPI
*LPFN_WSAASYNCGETHOSTBYNAME
)(HWND
,WS(u_int
),const char*,char*,int);
1053 typedef HANDLE (WINAPI
*LPFN_WSAASYNCGETPROTOBYNAME
)(HWND
,WS(u_int
),const char*,char*,int);
1054 typedef HANDLE (WINAPI
*LPFN_WSAASYNCGETPROTOBYNUMBER
)(HWND
,WS(u_int
),int,char*,int);
1055 typedef HANDLE (WINAPI
*LPFN_WSAASYNCGETSERVBYNAME
)(HWND
,WS(u_int
),const char*,const char*,char*,int);
1056 typedef HANDLE (WINAPI
*LPFN_WSAASYNCGETSERVBYPORT
)(HWND
,WS(u_int
),int,const char*,char*,int);
1057 typedef int (WINAPI
*LPFN_WSAASYNCSELECT
)(SOCKET
,HWND
,WS(u_int
),LONG
);
1058 typedef int (WINAPI
*LPFN_WSACANCELASYNCREQUEST
)(HANDLE
);
1059 typedef int (WINAPI
*LPFN_WSACANCELBLOCKINGCALL
)(void);
1060 typedef int (WINAPI
*LPFN_WSACLEANUP
)(void);
1061 typedef int (WINAPI
*LPFN_WSAGETLASTERROR
)(void);
1062 typedef BOOL (WINAPI
*LPFN_WSAISBLOCKING
)(void);
1063 typedef FARPROC (WINAPI
*LPFN_WSASETBLOCKINGHOOK
)(FARPROC
);
1064 typedef void (WINAPI
*LPFN_WSASETLASTERROR
)(int);
1065 typedef int (WINAPI
*LPFN_WSASTARTUP
)(WORD
,LPWSADATA
);
1066 typedef int (WINAPI
*LPFN_WSAUNHOOKBLOCKINGHOOK
)(void);
1068 typedef SOCKET (WINAPI
*LPFN_ACCEPT
)(SOCKET
,struct WS(sockaddr
)*,int*);
1069 typedef int (WINAPI
*LPFN_BIND
)(SOCKET
,const struct WS(sockaddr
)*,int);
1070 typedef int (WINAPI
*LPFN_CLOSESOCKET
)(SOCKET
);
1071 typedef int (WINAPI
*LPFN_CONNECT
)(SOCKET
,const struct WS(sockaddr
)*,int);
1072 typedef struct WS(hostent
)* (WINAPI
*LPFN_GETHOSTBYADDR
)(const char*,int,int);
1073 typedef struct WS(hostent
)* (WINAPI
*LPFN_GETHOSTBYNAME
)(const char*);
1074 typedef int (WINAPI
*LPFN_GETHOSTNAME
)(char*,int);
1075 typedef int (WINAPI
*LPFN_GETPEERNAME
)(SOCKET
,struct WS(sockaddr
)*,int*);
1076 typedef struct WS(protoent
)* (WINAPI
*LPFN_GETPROTOBYNAME
)(const char*);
1077 typedef struct WS(protoent
)* (WINAPI
*LPFN_GETPROTOBYNUMBER
)(int);
1078 #ifdef WS_DEFINE_SELECT
1079 typedef int (WINAPI
* LPFN_SELECT
)(int,WS(fd_set
)*,WS(fd_set
)*,WS(fd_set
)*,const struct WS(timeval
)*);
1081 typedef struct WS(servent
)* (WINAPI
*LPFN_GETSERVBYNAME
)(const char*,const char*);
1082 typedef struct WS(servent
)* (WINAPI
*LPFN_GETSERVBYPORT
)(int,const char*);
1083 typedef int (WINAPI
*LPFN_GETSOCKNAME
)(SOCKET
,struct WS(sockaddr
)*,int*);
1084 typedef int (WINAPI
*LPFN_GETSOCKOPT
)(SOCKET
,int,int,char*,int*);
1085 typedef ULONG (WINAPI
*LPFN_HTONL
)(ULONG
);
1086 typedef WS(u_short
) (WINAPI
*LPFN_HTONS
)(WS(u_short
));
1087 typedef ULONG (WINAPI
*LPFN_INET_ADDR
)(const char*);
1088 typedef char* (WINAPI
*LPFN_INET_NTOA
)(struct WS(in_addr
));
1089 typedef int (WINAPI
*LPFN_IOCTLSOCKET
)(SOCKET
,LONG
,ULONG
*);
1090 typedef int (WINAPI
*LPFN_LISTEN
)(SOCKET
,int);
1091 typedef ULONG (WINAPI
*LPFN_NTOHL
)(ULONG
);
1092 typedef WS(u_short
) (WINAPI
*LPFN_NTOHS
)(WS(u_short
));
1093 typedef int (WINAPI
*LPFN_RECV
)(SOCKET
,char*,int,int);
1094 typedef int (WINAPI
*LPFN_RECVFROM
)(SOCKET
,char*,int,int,struct WS(sockaddr
)*,int*);
1095 typedef int (WINAPI
*LPFN_SEND
)(SOCKET
,const char*,int,int);
1096 typedef int (WINAPI
*LPFN_SENDTO
)(SOCKET
,const char*,int,int,const struct WS(sockaddr
)*,int);
1097 typedef int (WINAPI
*LPFN_SETSOCKOPT
)(SOCKET
,int,int,const char*,int);
1098 typedef int (WINAPI
*LPFN_SHUTDOWN
)(SOCKET
,int);
1099 typedef SOCKET (WINAPI
*LPFN_SOCKET
)(int,int,int);
1100 #endif /* WS_API_TYPEDEFS */
1105 * Winsock2 Prototypes
1107 * Remember to keep this section in sync with the
1108 * "Winsock2 Function Typedefs" section below.
1110 #if WS_API_PROTOTYPES
1111 int WINAPI
__WSAFDIsSet(SOCKET
, WS(fd_set
) *);
1113 SOCKET WINAPI
WS(accept
)(SOCKET
, struct WS(sockaddr
) *, int *);
1114 int WINAPI
WS(bind
)(SOCKET
, const struct WS(sockaddr
) *, int);
1115 int WINAPI
WS(closesocket
)(SOCKET
);
1116 int WINAPI
WS(connect
)(SOCKET
, const struct WS(sockaddr
) *, int);
1117 struct WS(hostent
) * WINAPI
WS(gethostbyaddr
)(const char *, int, int);
1118 struct WS(hostent
) * WINAPI
WS(gethostbyname
)(const char *);
1119 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__WINE_USE_MSVCRT)
1120 /* gethostname is defined in unistd.h */
1121 int WINAPI
WS(gethostname
)(char *, int);
1123 int WINAPI
WS(getpeername
)(SOCKET
, struct WS(sockaddr
) *, int *);
1124 struct WS(protoent
) * WINAPI
WS(getprotobyname
)(const char *);
1125 struct WS(protoent
) * WINAPI
WS(getprotobynumber
)(int);
1126 struct WS(servent
) * WINAPI
WS(getservbyname
)(const char *, const char *);
1127 struct WS(servent
) * WINAPI
WS(getservbyport
)(int, const char *);
1128 int WINAPI
WS(getsockname
)(SOCKET
, struct WS(sockaddr
) *, int *);
1129 int WINAPI
WS(getsockopt
)(SOCKET
, int, int, char *, int *);
1130 ULONG WINAPI
WS(inet_addr
)(const char *);
1131 char * WINAPI
WS(inet_ntoa
)(struct WS(in_addr
));
1132 int WINAPI
WS(ioctlsocket
)(SOCKET
, LONG
, WS(u_long
) *);
1133 int WINAPI
WS(listen
)(SOCKET
, int);
1134 int WINAPI
WS(recv
)(SOCKET
, char *, int, int);
1135 int WINAPI
WS(recvfrom
)(SOCKET
, char *, int, int, struct WS(sockaddr
) *, int *);
1136 #ifdef WS_DEFINE_SELECT
1137 int WINAPI
WS(select
)(int, WS(fd_set
) *, WS(fd_set
) *, WS(fd_set
) *, const struct WS(timeval
) *);
1139 int WINAPI
WS(send
)(SOCKET
, const char *, int, int);
1140 int WINAPI
WS(sendto
)(SOCKET
, const char *, int, int, const struct WS(sockaddr
) *, int);
1141 int WINAPI
WS(setsockopt
)(SOCKET
, int, int, const char *, int);
1142 int WINAPI
WS(shutdown
)(SOCKET
, int);
1143 SOCKET WINAPI
WS(socket
)(int, int, int);
1145 int WINAPI
GetHostNameW(WCHAR
*, int);
1146 SOCKET WINAPI
WSAAccept(SOCKET
,struct WS(sockaddr
)*,LPINT
,LPCONDITIONPROC
,DWORD_PTR
);
1147 INT WINAPI
WSAAddressToStringA(LPSOCKADDR
,DWORD
,LPWSAPROTOCOL_INFOA
,LPSTR
,LPDWORD
);
1148 INT WINAPI
WSAAddressToStringW(LPSOCKADDR
,DWORD
,LPWSAPROTOCOL_INFOW
,LPWSTR
,LPDWORD
);
1149 #define WSAAddressToString WINELIB_NAME_AW(WSAAddressToString)
1150 HANDLE WINAPI
WSAAsyncGetHostByAddr(HWND
, WS(u_int
), const char *, int, int, char *, int);
1151 HANDLE WINAPI
WSAAsyncGetHostByName(HWND
, WS(u_int
), const char *, char *, int);
1152 HANDLE WINAPI
WSAAsyncGetProtoByName(HWND
, WS(u_int
), const char *, char *, int);
1153 HANDLE WINAPI
WSAAsyncGetProtoByNumber(HWND
, WS(u_int
), int, char *, int);
1154 HANDLE WINAPI
WSAAsyncGetServByName(HWND
, WS(u_int
), const char *, const char *, char *, int);
1155 HANDLE WINAPI
WSAAsyncGetServByPort(HWND
, WS(u_int
), int, const char *, char *, int);
1156 int WINAPI
WSAAsyncSelect(SOCKET
, HWND
, WS(u_int
), LONG
);
1157 int WINAPI
WSACancelAsyncRequest(HANDLE
);
1158 int WINAPI
WSACancelBlockingCall(void);
1159 int WINAPI
WSACleanup(void);
1160 BOOL WINAPI
WSACloseEvent(WSAEVENT
);
1161 int WINAPI
WSAConnect(SOCKET
,const struct WS(sockaddr
)*,int,LPWSABUF
,LPWSABUF
,LPQOS
,LPQOS
);
1162 WSAEVENT WINAPI
WSACreateEvent(void);
1163 INT WINAPI
WSADuplicateSocketA(SOCKET
,DWORD
,LPWSAPROTOCOL_INFOA
);
1164 INT WINAPI
WSADuplicateSocketW(SOCKET
,DWORD
,LPWSAPROTOCOL_INFOW
);
1165 #define WSADuplicateSocket WINELIB_NAME_AW(WSADuplicateSocket)
1166 INT WINAPI
WSAEnumNameSpaceProvidersA(LPDWORD
,LPWSANAMESPACE_INFOA
);
1167 INT WINAPI
WSAEnumNameSpaceProvidersW(LPDWORD
,LPWSANAMESPACE_INFOW
);
1168 #define WSAEnumNameSpaceProviders WINELIB_NAME_AW(WSAEnumNameSpaceProviders)
1169 int WINAPI
WSAEnumNetworkEvents(SOCKET
,WSAEVENT
,LPWSANETWORKEVENTS
);
1170 int WINAPI
WSAEnumProtocolsA(LPINT
,LPWSAPROTOCOL_INFOA
,LPDWORD
);
1171 int WINAPI
WSAEnumProtocolsW(LPINT
,LPWSAPROTOCOL_INFOW
,LPDWORD
);
1172 #define WSAEnumProtocols WINELIB_NAME_AW(WSAEnumProtocols)
1173 int WINAPI
WSAEventSelect(SOCKET
,WSAEVENT
,LONG
);
1174 int WINAPI
WSAGetLastError(void);
1175 BOOL WINAPI
WSAGetOverlappedResult(SOCKET
,LPWSAOVERLAPPED
,LPDWORD
,BOOL
,LPDWORD
);
1176 BOOL WINAPI
WSAGetQOSByName(SOCKET
,LPWSABUF
,LPQOS
);
1177 INT WINAPI
WSAGetServiceClassInfoA(LPGUID
,LPGUID
,LPDWORD
,LPWSASERVICECLASSINFOA
);
1178 INT WINAPI
WSAGetServiceClassInfoW(LPGUID
,LPGUID
,LPDWORD
,LPWSASERVICECLASSINFOW
);
1179 #define WSAGetServiceClassInfo WINELIB_NAME_AW(WSAGetServiceClassInfo)
1180 INT WINAPI
WSAGetServiceClassNameByClassIdA(LPGUID
,LPSTR
,LPDWORD
);
1181 INT WINAPI
WSAGetServiceClassNameByClassIdW(LPGUID
,LPWSTR
,LPDWORD
);
1182 #define WSAGetServiceClassNameByClassId WINELIB_NAME_AW(WSAGetServiceClassNameByClassId)
1183 int WINAPI
WSAHtonl(SOCKET
,ULONG
,ULONG
*);
1184 int WINAPI
WSAHtons(SOCKET
,WS(u_short
),WS(u_short
)*);
1185 int WINAPI
WSAInstallServiceClassA(LPWSASERVICECLASSINFOA
);
1186 int WINAPI
WSAInstallServiceClassW(LPWSASERVICECLASSINFOW
);
1187 #define WSAInstallServiceClass WINELIB_NAME_AW(WSAInstallServiceClass)
1188 int WINAPI
WSAIoctl(SOCKET
,DWORD
,LPVOID
,DWORD
,LPVOID
,DWORD
,LPDWORD
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1189 BOOL WINAPI
WSAIsBlocking(void);
1190 SOCKET WINAPI
WSAJoinLeaf(SOCKET
,const struct WS(sockaddr
)*,int,LPWSABUF
,LPWSABUF
,LPQOS
,LPQOS
,DWORD
);
1191 INT WINAPI
WSALookupServiceBeginA(LPWSAQUERYSETA
,DWORD
,LPHANDLE
);
1192 INT WINAPI
WSALookupServiceBeginW(LPWSAQUERYSETW
,DWORD
,LPHANDLE
);
1193 #define WSALookupServiceBegin WINELIB_NAME_AW(WSALookupServiceBegin)
1194 INT WINAPI
WSALookupServiceEnd(HANDLE
);
1195 INT WINAPI
WSALookupServiceNextA(HANDLE
,DWORD
,LPDWORD
,LPWSAQUERYSETA
);
1196 INT WINAPI
WSALookupServiceNextW(HANDLE
,DWORD
,LPDWORD
,LPWSAQUERYSETW
);
1197 #define WSALookupServiceNext WINELIB_NAME_AW(WSALookupServiceNext)
1198 int WINAPI
WSANSPIoctl(HANDLE
,DWORD
,LPVOID
,DWORD
,LPVOID
,DWORD
,LPDWORD
,LPWSACOMPLETION
);
1199 int WINAPI
WSANtohl(SOCKET
,ULONG
,ULONG
*);
1200 int WINAPI
WSANtohs(SOCKET
,WS(u_short
),WS(u_short
)*);
1201 int WINAPI
WSAPoll(WSAPOLLFD
*,ULONG
,int);
1202 INT WINAPI
WSAProviderConfigChange(LPHANDLE
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1203 int WINAPI
WSARecv(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,LPDWORD
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1204 int WINAPI
WSARecvDisconnect(SOCKET
,LPWSABUF
);
1205 int WINAPI
WSARecvFrom(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,LPDWORD
,struct WS(sockaddr
)*,LPINT
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1206 INT WINAPI
WSARemoveServiceClass(LPGUID
);
1207 BOOL WINAPI
WSAResetEvent(WSAEVENT
);
1208 int WINAPI
WSASend(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,DWORD
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1209 int WINAPI
WSASendDisconnect(SOCKET
,LPWSABUF
);
1210 int WINAPI
WSASendTo(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,DWORD
,const struct WS(sockaddr
)*,int,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1211 FARPROC WINAPI
WSASetBlockingHook(FARPROC
);
1212 BOOL WINAPI
WSASetEvent(WSAEVENT
);
1213 void WINAPI
WSASetLastError(int);
1214 INT WINAPI
WSASetServiceA(LPWSAQUERYSETA
,WSAESETSERVICEOP
,DWORD
);
1215 INT WINAPI
WSASetServiceW(LPWSAQUERYSETW
,WSAESETSERVICEOP
,DWORD
);
1216 #define WSASetService WINELIB_NAME_AW(WSASetService)
1217 SOCKET WINAPI
WSASocketA(int,int,int,LPWSAPROTOCOL_INFOA
,GROUP
,DWORD
);
1218 SOCKET WINAPI
WSASocketW(int,int,int,LPWSAPROTOCOL_INFOW
,GROUP
,DWORD
);
1219 #define WSASocket WINELIB_NAME_AW(WSASocket)
1220 int WINAPI
WSAStartup(WORD
,WSADATA
*);
1221 INT WINAPI
WSAStringToAddressA(LPSTR
,INT
,LPWSAPROTOCOL_INFOA
,LPSOCKADDR
,LPINT
);
1222 INT WINAPI
WSAStringToAddressW(LPWSTR
,INT
,LPWSAPROTOCOL_INFOW
,LPSOCKADDR
,LPINT
);
1223 #define WSAStringToAddress WINELIB_NAME_AW(WSAStringToAddress)
1224 int WINAPI
WSAUnhookBlockingHook(void);
1225 DWORD WINAPI
WSAWaitForMultipleEvents(DWORD
,const WSAEVENT
*,BOOL
,DWORD
,BOOL
);
1226 #endif /* WS_API_PROTOTYPES */
1231 * Winsock2 Function Typedefs
1233 * Remember to keep this section in sync with the
1234 * "Winsock2 Prototypes" section above.
1237 typedef SOCKET (WINAPI
*LPFN_WSAACCEPT
)(SOCKET
,struct WS(sockaddr
)*,LPINT
,LPCONDITIONPROC
,DWORD_PTR
);
1238 typedef INT (WINAPI
*LPFN_WSAADDRESSTOSTRINGA
)(LPSOCKADDR
,DWORD
,LPWSAPROTOCOL_INFOA
,LPSTR
,LPDWORD
);
1239 typedef INT (WINAPI
*LPFN_WSAADDRESSTOSTRINGW
)(LPSOCKADDR
,DWORD
,LPWSAPROTOCOL_INFOW
,LPWSTR
,LPDWORD
);
1240 #define LPFN_WSAADDRESSTOSTRING WINELIB_NAME_AW(LPFN_WSAADDRESSTOSTRING)
1241 typedef BOOL (WINAPI
*LPFN_WSACLOSEEVENT
)(WSAEVENT
);
1242 typedef int (WINAPI
*LPFN_WSACONNECT
)(SOCKET
,const struct WS(sockaddr
)*,int,LPWSABUF
,LPWSABUF
,LPQOS
,LPQOS
);
1243 typedef WSAEVENT (WINAPI
*LPFN_WSACREATEEVENT
)(void);
1244 typedef INT (WINAPI
*LPFN_WSADUPLICATESOCKETA
)(SOCKET
,DWORD
,LPWSAPROTOCOL_INFOA
);
1245 typedef INT (WINAPI
*LPFN_WSADUPLICATESOCKETW
)(SOCKET
,DWORD
,LPWSAPROTOCOL_INFOW
);
1246 #define LPFN_WSADUPLICATESOCKET WINELIB_NAME_AW(LPFN_WSADUPLICATESOCKET)
1247 typedef INT (WINAPI
*LPFN_WSAENUMNAMESPACEPROVIDERSA
)(LPDWORD
,LPWSANAMESPACE_INFOA
);
1248 typedef INT (WINAPI
*LPFN_WSAENUMNAMESPACEPROVIDERSW
)(LPDWORD
,LPWSANAMESPACE_INFOW
);
1249 #define LPFN_WSAENUMNAMESPACEPROVIDERS WINELIB_NAME_AW(LPFN_WSAENUMNAMESPACEPROVIDERS)
1250 typedef int (WINAPI
*LPFN_WSAENUMNETWORKEVENTS
)(SOCKET
,WSAEVENT
,LPWSANETWORKEVENTS
);
1251 typedef int (WINAPI
*LPFN_WSAENUMPROTOCOLSA
)(LPINT
,LPWSAPROTOCOL_INFOA
,LPDWORD
);
1252 typedef int (WINAPI
*LPFN_WSAENUMPROTOCOLSW
)(LPINT
,LPWSAPROTOCOL_INFOW
,LPDWORD
);
1253 #define LPFN_WSAENUMPROTOCOLS WINELIB_NAME_AW(LPFN_WSAENUMPROTOCOLS)
1254 typedef int (WINAPI
*LPFN_WSAEVENTSELECT
)(SOCKET
,WSAEVENT
,LONG
);
1255 typedef BOOL (WINAPI
*LPFN_WSAGETOVERLAPPEDRESULT
)(SOCKET
,LPWSAOVERLAPPED
,LPDWORD
,BOOL
,LPDWORD
);
1256 typedef BOOL (WINAPI
*LPFN_WSAGETQOSBYNAME
)(SOCKET
,LPWSABUF
,LPQOS
);
1257 typedef INT (WINAPI
*LPFN_WSAGETSERVICECLASSINFOA
)(LPGUID
,LPGUID
,LPDWORD
,LPWSASERVICECLASSINFOA
);
1258 typedef INT (WINAPI
*LPFN_WSAGETSERVICECLASSINFOW
)(LPGUID
,LPGUID
,LPDWORD
,LPWSASERVICECLASSINFOW
);
1259 #define LPFN_LPFNWSAGETSERVICECLASSINFO WINELIB_NAME_AW(LPFN_LPFNWSAGETSERVICECLASSINFO)
1260 typedef INT (WINAPI
*LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA
)(LPGUID
,LPSTR
,LPDWORD
);
1261 typedef INT (WINAPI
*LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW
)(LPGUID
,LPWSTR
,LPDWORD
);
1262 #define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID WINELIB_NAME_AW(LPFN_WSAGETSERVICECLASSNAMEBYCLASSID)
1263 typedef int (WINAPI
*LPFN_WSAHTONL
)(SOCKET
,ULONG
,ULONG
*);
1264 typedef int (WINAPI
*LPFN_WSAHTONS
)(SOCKET
,WS(u_short
),WS(u_short
)*);
1265 typedef int (WINAPI
*LPFN_WSAINSTALLSERVICECLASSA
)(LPWSASERVICECLASSINFOA
);
1266 typedef int (WINAPI
*LPFN_WSAINSTALLSERVICECLASSW
)(LPWSASERVICECLASSINFOW
);
1267 typedef int (WINAPI
*LPFN_WSAIOCTL
)(SOCKET
,DWORD
,LPVOID
,DWORD
,LPVOID
,DWORD
,LPDWORD
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1268 typedef int (WINAPI
*LPFN_WSAJOINLEAF
)(SOCKET
,const struct WS(sockaddr
)*,int,LPWSABUF
,LPWSABUF
,LPQOS
,LPQOS
,DWORD
);
1269 typedef INT (WINAPI
*LPFN_WSALOOKUPSERVICEBEGINA
)(LPWSAQUERYSETA
,DWORD
,LPHANDLE
);
1270 typedef INT (WINAPI
*LPFN_WSALOOKUPSERVICEBEGINW
)(LPWSAQUERYSETW
,DWORD
,LPHANDLE
);
1271 #define LPFN_WSALOOKUPSERVICEBEGIN WINELIB_NAME_AW(LPFN_WSALOOKUPSERVICEBEGIN)
1272 typedef INT (WINAPI
*LPFN_WSALOOKUPSERVICEEND
)(HANDLE
);
1273 typedef INT (WINAPI
*LPFN_WSALOOKUPSERVICENEXTA
)(HANDLE
,DWORD
,LPDWORD
,LPWSAQUERYSETA
);
1274 typedef INT (WINAPI
*LPFN_WSALOOKUPSERVICENEXTW
)(HANDLE
,DWORD
,LPDWORD
,LPWSAQUERYSETW
);
1275 #define LPFN_WSALOOKUPSERVICENEXT WINELIB_NAME_AW(LPFN_WSALOOKUPSERVICENEXT)
1276 typedef int (WINAPI
*LPFN_WSANSPIOCTL
)(HANDLE
,DWORD
,LPVOID
,DWORD
,LPVOID
,DWORD
,LPDWORD
,LPWSACOMPLETION
);
1277 typedef int (WINAPI
*LPFN_WSANTOHL
)(SOCKET
,ULONG
,ULONG
*);
1278 typedef int (WINAPI
*LPFN_WSANTOHS
)(SOCKET
,WS(u_short
),WS(u_short
)*);
1279 typedef INT (WINAPI
*LPFN_WSAPROVIDERCONFIGCHANGE
)(LPHANDLE
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1280 typedef int (WINAPI
*LPFN_WSAPOLL
)(WSAPOLLFD
*,ULONG
,int);
1281 typedef int (WINAPI
*LPFN_WSARECV
)(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,LPDWORD
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1282 typedef int (WINAPI
*LPFN_WSARECVDISCONNECT
)(SOCKET
,LPWSABUF
);
1283 typedef int (WINAPI
*LPFN_WSARECVFROM
)(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,LPDWORD
,struct WS(sockaddr
)*,LPINT
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1284 typedef INT (WINAPI
*LPFN_WSAREMOVESERVICECLASS
)(LPGUID
);
1285 typedef BOOL (WINAPI
*LPFN_WSARESETEVENT
)(WSAEVENT
);
1286 typedef int (WINAPI
*LPFN_WSASEND
)(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,DWORD
,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1287 typedef int (WINAPI
*LPFN_WSASENDDISCONNECT
)(SOCKET
,LPWSABUF
);
1288 typedef int (WINAPI
*LPFN_WSASENDTO
)(SOCKET
,LPWSABUF
,DWORD
,LPDWORD
,DWORD
,const struct WS(sockaddr
)*,int,LPWSAOVERLAPPED
,LPWSAOVERLAPPED_COMPLETION_ROUTINE
);
1289 typedef BOOL (WINAPI
*LPFN_WSASETEVENT
)(WSAEVENT
);
1290 typedef INT (WINAPI
*LPFN_WSASETSERVICEA
)(LPWSAQUERYSETA
,WSAESETSERVICEOP
,DWORD
);
1291 typedef INT (WINAPI
*LPFN_WSASETSERVICEW
)(LPWSAQUERYSETW
,WSAESETSERVICEOP
,DWORD
);
1292 #define LPFN_WSASETSERVICE WINELIB_NAME_AW(LPFN_WSASETSERVICE)
1293 typedef SOCKET (WINAPI
*LPFN_WSASOCKETA
)(int,int,int,LPWSAPROTOCOL_INFOA
,GROUP
,DWORD
);
1294 typedef SOCKET (WINAPI
*LPFN_WSASOCKETW
)(int,int,int,LPWSAPROTOCOL_INFOW
,GROUP
,DWORD
);
1295 typedef INT (WINAPI
*LPFN_WSASTRINGTOADDRESSA
)(LPSTR
,INT
,LPWSAPROTOCOL_INFOA
,LPSOCKADDR
,LPINT
);
1296 typedef INT (WINAPI
*LPFN_WSASTRINGTOADDRESSW
)(LPSTR
,INT
,LPWSAPROTOCOL_INFOA
,LPSOCKADDR
,LPINT
);
1297 #define LPFN_WSASOCKET WINELIB_NAME_AW(LPFN_WSASOCKET)
1298 #define LPFN_WSASTRINGTOADDRESS WINELIB_NAME_AW(LPFN_WSASTRINGTOADDRESS)
1299 typedef DWORD (WINAPI
*LPFN_WSAWAITFORMULTIPLEEVENTS
)(DWORD
,const WSAEVENT
*,BOOL
,DWORD
,BOOL
);
1300 #endif /* WS_API_TYPEDEFS */
1303 /* Condition function return values */
1304 #define CF_ACCEPT 0x0000
1305 #define CF_REJECT 0x0001
1306 #define CF_DEFER 0x0002
1313 #undef WS_API_PROTOTYPES
1314 #undef WS_API_TYPEDEFS
1316 #endif /* __WINSOCK2API__ */