winsock2.h 50 KB
Newer Older
1
/*
2
 * Winsock 2 definitions - used for ws2_32.dll
3
 *
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
 * Copyright (C) 1999 Ove Kaaven
 * Copyright (C) 2001 Francois Gouget
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * 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
20 21
 */

22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
#ifndef __WINE_WINSOCKAPI_STDLIB_H
#define __WINE_WINSOCKAPI_STDLIB_H

/*
 * This section defines the items that conflict with the Unix headers.
 */
#ifndef USE_WS_PREFIX
/* We are not using the WS_ prefix we risk getting conflicts for
 * everything related to select.
 */
# ifdef FD_CLR
/* Too late, the Unix version of stdlib.h was included before winsock.h.
 * This means select and all the related stuff is already defined and we
 * cannot override types and function prototypes.
 * All we can do is disable all these symbols so that they are not used
 * inadvertently.
 */
#  include <sys/types.h>
#  undef FD_SETSIZE
#  undef FD_CLR
#  undef FD_SET
#  undef FD_ZERO
#  undef FD_ISSET

#  define FD_SETSIZE Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
#  define FD_CLR     Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
#  define FD_SET     Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
#  define FD_ZERO    Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
#  define FD_ISSET   Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
#  define fd_set     Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
#  define select     Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
# elif defined(RLIM_INFINITY)
/* On Darwin stdlib.h includes sys/resource.h which defines timeval but not the fd_set macros */
#  define fd_set unix_fd_set
#  include <sys/types.h>
#  include <time.h>
#  include <stdlib.h>
#  undef fd_set
#  undef FD_SETSIZE
#  undef FD_CLR
#  undef FD_SET
#  undef FD_ZERO
#  undef FD_ISSET
#  define select     Include_winsock_h_before_sys_types_h_or_use_the_MSVCRT_library
#  define timeval    Include_winsock_h_before_sys_types_h_or_use_the_MSVCRT_library
# else  /* FD_CLR */
/* stdlib.h has not been included yet so it's not too late. Include it now
 * making sure that none of the select symbols is affected. Then we can
 * define them with our own values.
 */
#  define fd_set unix_fd_set
#  define timeval unix_timeval
#  define select unix_select
#  define socklen_t unix_socklen_t
#  define u_long unix_u_long
#  include <sys/types.h>
#  include <time.h>
#  include <stdlib.h>
#  undef fd_set
#  undef timeval
#  undef select
#  undef socklen_t
#  undef u_long
#  undef FD_SETSIZE
#  undef FD_CLR
#  undef FD_SET
#  undef FD_ZERO
#  undef FD_ISSET
#  undef _TIMEVAL_DEFINED

#  define WS_DEFINE_SELECT
# endif /* FD_CLR */

#else
# define WS_DEFINE_SELECT
# include <sys/types.h>
# include <stdlib.h>
#endif /* !USE_WS_PREFIX */

#endif /* __WINE_WINSOCKAPI_STDLIB_H */

103 104
#ifndef _WINSOCK2API_
#define _WINSOCK2API_
105
#define _WINSOCKAPI_
106

107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
#include <windows.h>

#ifdef USE_WS_PREFIX
# define WS(x)    WS_##x
#else
# define WS(x)    x
#endif

#ifdef USE_WS_PREFIX
typedef unsigned char  WS_u_char;
typedef unsigned short WS_u_short;
typedef unsigned int   WS_u_int;
typedef ULONG          WS_u_long;
#elif (defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__)) && !defined(_BSDTYPES_DEFINED)
/* MinGW doesn't define the u_xxx types */
typedef unsigned char  u_char;
typedef unsigned short u_short;
typedef unsigned int   u_int;
typedef ULONG          u_long;
#define _BSDTYPES_DEFINED
#else
#define u_long ULONG  /* make sure we don't use the system u_long */
#endif

typedef UINT_PTR SOCKET;

133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
/*
 * Setup phase
 */

/* Everything common between winsock.h and winsock2.h */
#ifndef INCL_WINSOCK_API_PROTOTYPES
#define INCL_WINSOCK_API_PROTOTYPES 1
#define WS_API_PROTOTYPES          1
#else
#define WS_API_PROTOTYPES          INCL_WINSOCK_API_PROTOTYPES
#endif

#ifndef INCL_WINSOCK_API_TYPEDEFS
#define INCL_WINSOCK_API_TYPEDEFS  0
#define WS_API_TYPEDEFS            0
#else
#define WS_API_TYPEDEFS            INCL_WINSOCK_API_TYPEDEFS
#endif

152
#include <ws2def.h>
153 154 155 156

#ifdef __cplusplus
extern "C" {
#endif /* defined(__cplusplus) */
157

158 159
#define INVALID_SOCKET             (SOCKET)(~0)
#define SOCKET_ERROR               (-1)
160

161
#ifndef USE_WS_PREFIX
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
#define SOL_SOCKET                 0xffff
#define SO_DEBUG                   0x0001
#define SO_ACCEPTCONN              0x0002
#define SO_REUSEADDR               0x0004
#define SO_EXCLUSIVEADDRUSE        ((u_int)(~SO_REUSEADDR))
#define SO_KEEPALIVE               0x0008
#define SO_DONTROUTE               0x0010
#define SO_BROADCAST               0x0020
#define SO_USELOOPBACK             0x0040
#define SO_LINGER                  0x0080
#define SO_OOBINLINE               0x0100
#define SO_DONTLINGER              ((u_int)(~SO_LINGER))
#define SO_SNDBUF                  0x1001
#define SO_RCVBUF                  0x1002
#define SO_SNDLOWAT                0x1003
#define SO_RCVLOWAT                0x1004
#define SO_SNDTIMEO                0x1005
#define SO_RCVTIMEO                0x1006
#define SO_ERROR                   0x1007
#define SO_TYPE                    0x1008
182 183 184 185 186 187 188 189 190
#define SO_GROUP_ID                0x2001
#define SO_GROUP_PRIORITY          0x2002
#define SO_MAX_MSG_SIZE            0x2003
#define SO_PROTOCOL_INFOA          0x2004
#define SO_PROTOCOL_INFOW          0x2005
#define SO_PROTOCOL_INFO           WINELIB_NAME_AW(WS_SO_PROTOCOL_INFO)
#define PVD_CONFIG                 0x3001
#define SO_CONDITIONAL_ACCEPT      0x3002
#else
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
#define WS_SOL_SOCKET              0xffff
#define WS_SO_DEBUG                0x0001
#define WS_SO_ACCEPTCONN           0x0002
#define WS_SO_REUSEADDR            0x0004
#define WS_SO_EXCLUSIVEADDRUSE     ((WS_u_int)(~WS_SO_REUSEADDR))
#define WS_SO_KEEPALIVE            0x0008
#define WS_SO_DONTROUTE            0x0010
#define WS_SO_BROADCAST            0x0020
#define WS_SO_USELOOPBACK          0x0040
#define WS_SO_LINGER               0x0080
#define WS_SO_OOBINLINE            0x0100
#define WS_SO_DONTLINGER           ((WS_u_int)(~WS_SO_LINGER))
#define WS_SO_SNDBUF               0x1001
#define WS_SO_RCVBUF               0x1002
#define WS_SO_SNDLOWAT             0x1003
#define WS_SO_RCVLOWAT             0x1004
#define WS_SO_SNDTIMEO             0x1005
#define WS_SO_RCVTIMEO             0x1006
#define WS_SO_ERROR                0x1007
#define WS_SO_TYPE                 0x1008
211 212 213 214 215 216 217 218 219
#define WS_SO_GROUP_ID             0x2001
#define WS_SO_GROUP_PRIORITY       0x2002
#define WS_SO_MAX_MSG_SIZE         0x2003
#define WS_SO_PROTOCOL_INFOA       0x2004
#define WS_SO_PROTOCOL_INFOW       0x2005
#define WS_SO_PROTOCOL_INFO        WINELIB_NAME_AW(WS_SO_PROTOCOL_INFO)
#define WS_PVD_CONFIG              0x3001
#define WS_SO_CONDITIONAL_ACCEPT   0x3002
#endif
220

221 222
/* protocol types */

223 224
#define FROM_PROTOCOL_INFO       (-1)

225 226 227 228 229 230 231 232 233 234 235 236 237
#ifndef USE_WS_PREFIX
#define SOCK_STREAM                1
#define SOCK_DGRAM                 2
#define SOCK_RAW                   3
#define SOCK_RDM                   4
#define SOCK_SEQPACKET             5
#else /* USE_WS_PREFIX */
#define WS_SOCK_STREAM             1
#define WS_SOCK_DGRAM              2
#define WS_SOCK_RAW                3
#define WS_SOCK_RDM                4
#define WS_SOCK_SEQPACKET          5
#endif /* USE_WS_PREFIX */
238

239 240 241
/* protocol families */

#ifndef USE_WS_PREFIX
242 243 244 245 246 247 248 249 250 251 252 253
#define PF_APPLETALK               AF_APPLETALK
#define PF_BAN                     AF_BAN
#define PF_CCITT                   AF_CCITT
#define PF_CHAOS                   AF_CHAOS
#define PF_DATAKIT                 AF_DATAKIT
#define PF_DECnet                  AF_DECnet
#define PF_DLI                     AF_DLI
#define PF_ECMA                    AF_ECMA
#define PF_FIREFOX                 AF_FIREFOX
#define PF_HYLINK                  AF_HYLINK
#define PF_IMPLINK                 AF_IMPLINK
#define PF_INET                    AF_INET
254
#define PF_INET6                   AF_INET6
255 256 257 258 259 260 261 262 263 264 265 266
#define PF_IPX                     AF_IPX
#define PF_ISO                     AF_ISO
#define PF_LAT                     AF_LAT
#define PF_MAX                     AF_MAX
#define PF_NS                      AF_NS
#define PF_OSI                     AF_OSI
#define PF_PUP                     AF_PUP
#define PF_SNA                     AF_SNA
#define PF_UNIX                    AF_UNIX
#define PF_UNKNOWN1                AF_UNKNOWN1
#define PF_UNSPEC                  AF_UNSPEC
#define PF_VOICEVIEW               AF_VOICEVIEW
267 268
#endif

269 270
/* option flags per socket */

271 272 273 274 275 276 277
#define FD_MAX_EVENTS              10
#define FD_READ_BIT                0
#define FD_WRITE_BIT               1
#define FD_OOB_BIT                 2
#define FD_ACCEPT_BIT              3
#define FD_CONNECT_BIT             4
#define FD_CLOSE_BIT               5
278 279 280 281 282
#define FD_QOS_BIT                 6
#define FD_GROUP_QOS_BIT           7
#define FD_ROUTING_INTERFACE_CHANGE_BIT 8
#define FD_ADDRESS_LIST_CHANGE_BIT 9

283 284 285 286 287 288
#define FD_READ                     0x00000001
#define FD_WRITE                    0x00000002
#define FD_OOB                      0x00000004
#define FD_ACCEPT                   0x00000008
#define FD_CONNECT                  0x00000010
#define FD_CLOSE                    0x00000020
289 290 291 292
#define FD_QOS                      0x00000040
#define FD_GROUP_QOS                0x00000080
#define FD_ROUTING_INTERFACE_CHANGE 0x00000100
#define FD_ADDRESS_LIST_CHANGE      0x00000200
293 294 295 296 297 298 299 300 301 302 303

/* Constants for LPCONDITIONPROC */
#define CF_ACCEPT                  0x0000
#define CF_REJECT                  0x0001
#define CF_DEFER                   0x0002

/* Constants for shutdown() */
#define SD_RECEIVE                 0x00
#define SD_SEND                    0x01
#define SD_BOTH                    0x02

304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328
/* Constants for WSAPoll() */
#ifndef USE_WS_PREFIX
#define POLLERR                    0x0001
#define POLLHUP                    0x0002
#define POLLNVAL                   0x0004
#define POLLWRNORM                 0x0010
#define POLLWRBAND                 0x0020
#define POLLRDNORM                 0x0100
#define POLLRDBAND                 0x0200
#define POLLPRI                    0x0400
#define POLLIN                     (POLLRDNORM|POLLRDBAND)
#define POLLOUT                    (POLLWRNORM)
#else
#define WS_POLLERR                 0x0001
#define WS_POLLHUP                 0x0002
#define WS_POLLNVAL                0x0004
#define WS_POLLWRNORM              0x0010
#define WS_POLLWRBAND              0x0020
#define WS_POLLRDNORM              0x0100
#define WS_POLLRDBAND              0x0200
#define WS_POLLPRI                 0x0400
#define WS_POLLIN                  (WS_POLLRDNORM|WS_POLLRDBAND)
#define WS_POLLOUT                 (WS_POLLWRNORM)
#endif

329
/* Constants for WSAIoctl() */
330 331 332 333 334 335 336 337 338
#ifdef USE_WS_PREFIX
#define WS_IOC_UNIX                0x00000000
#define WS_IOC_WS2                 0x08000000
#define WS_IOC_PROTOCOL            0x10000000
#define WS_IOC_VENDOR              0x18000000
#define WS_IOC_VOID                0x20000000
#define WS_IOC_OUT                 0x40000000
#define WS_IOC_IN                  0x80000000
#define WS_IOC_INOUT               (WS_IOC_IN|WS_IOC_OUT)
339 340 341 342
#define WS_IOCPARM_MASK            0x7f
#define WS__IO(x,y)                (WS_IOC_VOID | ((x) << 8) | (y))
#define WS__IOR(x,y,t)             (WS_IOC_OUT | (((UINT)sizeof(t) & WS_IOCPARM_MASK) << 16) | ((x) << 8) | (y))
#define WS__IOW(x,y,t)             (WS_IOC_IN | (((UINT)sizeof(t) & WS_IOCPARM_MASK) << 16) | ((x) << 8) | (y))
343 344 345 346
#define _WSAIO(x,y)                (WS_IOC_VOID|(x)|(y))
#define _WSAIOR(x,y)               (WS_IOC_OUT|(x)|(y))
#define _WSAIOW(x,y)               (WS_IOC_IN|(x)|(y))
#define _WSAIORW(x,y)              (WS_IOC_INOUT|(x)|(y))
347 348 349 350 351 352 353 354
#define WS_FIONREAD                           WS__IOR('f', 127, ULONG)
#define WS_FIONBIO                            WS__IOW('f', 126, ULONG)
#define WS_FIOASYNC                           WS__IOW('f', 125, ULONG)
#define WS_SIOCSHIWAT                         WS__IOW('s',  0, ULONG)
#define WS_SIOCGHIWAT                         WS__IOR('s',  1, ULONG)
#define WS_SIOCSLOWAT                         WS__IOW('s',  2, ULONG)
#define WS_SIOCGLOWAT                         WS__IOR('s',  3, ULONG)
#define WS_SIOCATMARK                         WS__IOR('s',  7, ULONG)
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372
#define WS_SIO_ASSOCIATE_HANDLE               _WSAIOW(WS_IOC_WS2,1)
#define WS_SIO_ENABLE_CIRCULAR_QUEUEING       _WSAIO(WS_IOC_WS2,2)
#define WS_SIO_FIND_ROUTE                     _WSAIOR(WS_IOC_WS2,3)
#define WS_SIO_FLUSH                          _WSAIO(WS_IOC_WS2,4)
#define WS_SIO_GET_BROADCAST_ADDRESS          _WSAIOR(WS_IOC_WS2,5)
#define WS_SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(WS_IOC_WS2,6)
#define WS_SIO_GET_QOS                        _WSAIORW(WS_IOC_WS2,7)
#define WS_SIO_GET_GROUP_QOS                  _WSAIORW(WS_IOC_WS2,8)
#define WS_SIO_MULTIPOINT_LOOPBACK            _WSAIOW(WS_IOC_WS2,9)
#define WS_SIO_MULTICAST_SCOPE                _WSAIOW(WS_IOC_WS2,10)
#define WS_SIO_SET_QOS                        _WSAIOW(WS_IOC_WS2,11)
#define WS_SIO_SET_GROUP_QOS                  _WSAIOW(WS_IOC_WS2,12)
#define WS_SIO_TRANSLATE_HANDLE               _WSAIORW(WS_IOC_WS2,13)
#define WS_SIO_ROUTING_INTERFACE_QUERY        _WSAIORW(WS_IOC_WS2,20)
#define WS_SIO_ROUTING_INTERFACE_CHANGE       _WSAIOW(WS_IOC_WS2,21)
#define WS_SIO_ADDRESS_LIST_QUERY             _WSAIOR(WS_IOC_WS2,22)
#define WS_SIO_ADDRESS_LIST_CHANGE            _WSAIO(WS_IOC_WS2,23)
#define WS_SIO_QUERY_TARGET_PNP_HANDLE        _WSAIOR(WS_IOC_WS2,24)
373
#define WS_SIO_GET_INTERFACE_LIST             WS__IOR('t', 127, ULONG)
374 375 376 377 378
#else /* USE_WS_PREFIX */
#undef IOC_VOID
#undef IOC_IN
#undef IOC_OUT
#undef IOC_INOUT
379 380 381 382
#define IOC_UNIX                   0x00000000
#define IOC_WS2                    0x08000000
#define IOC_PROTOCOL               0x10000000
#define IOC_VENDOR                 0x18000000
383
#define IOC_VOID                   0x20000000
384 385 386
#define IOC_OUT                    0x40000000
#define IOC_IN                     0x80000000
#define IOC_INOUT                  (IOC_IN|IOC_OUT)
387 388 389 390
#define IOCPARM_MASK               0x7f
#define _IO(x,y)                   (IOC_VOID | ((x) << 8) | (y))
#define _IOR(x,y,t)                (IOC_OUT | (((UINT)sizeof(t) & IOCPARM_MASK) << 16) | ((x) << 8) | (y))
#define _IOW(x,y,t)                (IOC_IN | (((UINT)sizeof(t) & IOCPARM_MASK) << 16) | ((x) << 8) | (y))
391 392 393 394
#define _WSAIO(x,y)                (IOC_VOID|(x)|(y))
#define _WSAIOR(x,y)               (IOC_OUT|(x)|(y))
#define _WSAIOW(x,y)               (IOC_IN|(x)|(y))
#define _WSAIORW(x,y)              (IOC_INOUT|(x)|(y))
395 396 397 398 399 400 401 402
#define FIONREAD                   _IOR('f', 127, ULONG)
#define FIONBIO                    _IOW('f', 126, ULONG)
#define FIOASYNC                   _IOW('f', 125, ULONG)
#define SIOCSHIWAT                 _IOW('s',  0, ULONG)
#define SIOCGHIWAT                 _IOR('s',  1, ULONG)
#define SIOCSLOWAT                 _IOW('s',  2, ULONG)
#define SIOCGLOWAT                 _IOR('s',  3, ULONG)
#define SIOCATMARK                 _IOR('s',  7, ULONG)
403 404 405 406 407
#define SIO_ASSOCIATE_HANDLE       _WSAIOW(IOC_WS2,1)
#define SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(IOC_WS2,2)
#define SIO_FIND_ROUTE             _WSAIOR(IOC_WS2,3)
#define SIO_FLUSH                  _WSAIO(IOC_WS2,4)
#define SIO_GET_BROADCAST_ADDRESS  _WSAIOR(IOC_WS2,5)
408
#define SIO_GET_EXTENSION_FUNCTION_POINTER  _WSAIORW(IOC_WS2,6)
409 410 411 412 413 414 415 416 417 418 419
#define SIO_GET_QOS                _WSAIORW(IOC_WS2,7)
#define SIO_GET_GROUP_QOS          _WSAIORW(IOC_WS2,8)
#define SIO_MULTIPOINT_LOOPBACK    _WSAIOW(IOC_WS2,9)
#define SIO_MULTICAST_SCOPE        _WSAIOW(IOC_WS2,10)
#define SIO_SET_QOS                _WSAIOW(IOC_WS2,11)
#define SIO_SET_GROUP_QOS          _WSAIOW(IOC_WS2,12)
#define SIO_TRANSLATE_HANDLE       _WSAIORW(IOC_WS2,13)
#define SIO_ROUTING_INTERFACE_QUERY _WSAIORW(IOC_WS2,20)
#define SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(IOC_WS2,21)
#define SIO_ADDRESS_LIST_QUERY     _WSAIOR(IOC_WS2,22)
#define SIO_ADDRESS_LIST_CHANGE    _WSAIO(IOC_WS2,23)
Alexandre Julliard's avatar
Alexandre Julliard committed
420
#define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_WS2,24)
421
#define SIO_GET_INTERFACE_LIST     _IOR ('t', 127, ULONG)
422
#endif /* USE_WS_PREFIX */
423

424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445
#ifndef USE_WS_PREFIX
#define SOMAXCONN                  0x7fffffff

#define MSG_OOB                    0x0001
#define MSG_PEEK                   0x0002
#define MSG_DONTROUTE              0x0004
#define MSG_WAITALL                0x0008
#define MSG_INTERRUPT              0x0010
#define MSG_PARTIAL                0x8000
#define MSG_MAXIOVLEN              16
#else /* USE_WS_PREFIX */
#define WS_SOMAXCONN               0x7fffffff

#define WS_MSG_OOB                 0x0001
#define WS_MSG_PEEK                0x0002
#define WS_MSG_DONTROUTE           0x0004
#define WS_MSG_WAITALL             0x0008
#define WS_MSG_INTERRUPT           0x0010
#define WS_MSG_PARTIAL             0x8000
#define WS_MSG_MAXIOVLEN           16
#endif /* USE_WS_PREFIX */

446
/* Constants for WSAIoctl() */
447 448 449 450 451 452 453 454
#define WSA_FLAG_OVERLAPPED             0x0001
#define WSA_FLAG_MULTIPOINT_C_ROOT      0x0002
#define WSA_FLAG_MULTIPOINT_C_LEAF      0x0004
#define WSA_FLAG_MULTIPOINT_D_ROOT      0x0008
#define WSA_FLAG_MULTIPOINT_D_LEAF      0x0010
#define WSA_FLAG_ACCESS_SYSTEM_SECURITY 0x0040
#define WSA_FLAG_NO_HANDLE_INHERIT      0x0080
#define WSA_FLAG_REGISTERED_IO          0x0100
455

456 457 458 459 460
/* Constants for WSAJoinLeaf() */
#define JL_SENDER_ONLY    0x01
#define JL_RECEIVER_ONLY  0x02
#define JL_BOTH           0x04

461 462 463 464 465 466 467 468 469 470 471 472
/* Constants for WSALookupServiceBegin() */
#define LUP_DEEP                0x0001
#define LUP_RETURN_NAME         0x0010
#define LUP_RETURN_TYPE         0x0020
#define LUP_RETURN_VERSION      0x0040
#define LUP_RETURN_COMMENT      0x0080
#define LUP_RETURN_ADDR         0x0100
#define LUP_RETURN_BLOB         0x0200
#define LUP_RETURN_ALIASES      0x0400
#define LUP_RETURN_QUERY_STRING 0x0800
#define LUP_RETURN_ALL          (LUP_RETURN_ADDR|LUP_RETURN_BLOB|LUP_RETURN_ALIASES|LUP_RETURN_QUERY_STRING \
                                |LUP_RETURN_NAME|LUP_RETURN_TYPE|LUP_RETURN_VERSION|LUP_RETURN_COMMENT)
473

474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500
/* Constants for dwNameSpace from struct WSANAMESPACE_INFO */
#define NS_ALL         0
#define NS_SAP         1
#define NS_NDS         2
#define NS_PEER_BROWSE 3
#define NS_SLP         5
#define NS_DHCP        6
#define NS_TCPIP_LOCAL 10
#define NS_TCPIP_HOSTS 11
#define NS_DNS         12
#define NS_NETBT       13
#define NS_WINS        14
#define NS_NLA         15
#define NS_BTH         16
#define NS_NBP         20
#define NS_MS          30
#define NS_STDA        31
#define NS_NTDS        32
#define NS_EMAIL       37
#define NS_PNRPNAME    38
#define NS_PNRPCLOUD   39
#define NS_X500        40
#define NS_NIS         41
#define NS_NISPLUS     42
#define NS_WRQ         50
#define NS_NETDES      60

501
#ifndef GUID_DEFINED
502
#include <guiddef.h>
503 504
#endif

505 506
#define MAXGETHOSTSTRUCT 1024

507 508 509
#define MAX_PROTOCOL_CHAIN         7
#define BASE_PROTOCOL              1
#define LAYERED_PROTOCOL           0
510

511
typedef struct _WSAPROTOCOLCHAIN
512
{
513 514 515 516 517
    int ChainLen;                  /* the length of the chain,     */
                                   /* length = 0 means layered protocol, */
                                   /* length = 1 means base protocol, */
                                   /* length > 1 means protocol chain */
    DWORD ChainEntries[MAX_PROTOCOL_CHAIN]; /* a list of dwCatalogEntryIds */
518 519
} WSAPROTOCOLCHAIN, * LPWSAPROTOCOLCHAIN;

520 521 522 523 524 525
/* constants used in dwProviderFlags from struct WSAPROTOCOL_INFO */
#define PFL_MULTIPLE_PROTO_ENTRIES          0x00000001
#define PFL_RECOMMENDED_PROTO_ENTRY         0x00000002
#define PFL_HIDDEN                          0x00000004
#define PFL_MATCHES_PROTOCOL_ZERO           0x00000008

526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550
#define XP1_CONNECTIONLESS                  0x00000001
#define XP1_GUARANTEED_DELIVERY             0x00000002
#define XP1_GUARANTEED_ORDER                0x00000004
#define XP1_MESSAGE_ORIENTED                0x00000008
#define XP1_PSEUDO_STREAM                   0x00000010
#define XP1_GRACEFUL_CLOSE                  0x00000020
#define XP1_EXPEDITED_DATA                  0x00000040
#define XP1_CONNECT_DATA                    0x00000080
#define XP1_DISCONNECT_DATA                 0x00000100
#define XP1_SUPPORT_BROADCAST               0x00000200
#define XP1_SUPPORT_MULTIPOINT              0x00000400
#define XP1_MULTIPOINT_CONTROL_PLANE        0x00000800
#define XP1_MULTIPOINT_DATA_PLANE           0x00001000
#define XP1_QOS_SUPPORTED                   0x00002000
#define XP1_INTERRUPT                       0x00004000
#define XP1_UNI_SEND                        0x00008000
#define XP1_UNI_RECV                        0x00010000
#define XP1_IFS_HANDLES                     0x00020000
#define XP1_PARTIAL_MESSAGE                 0x00040000

#define BIGENDIAN                           0x0000
#define LITTLEENDIAN                        0x0001

#define SECURITY_PROTOCOL_NONE              0x0000

551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625
#ifndef _TIMEVAL_DEFINED
#define _TIMEVAL_DEFINED
typedef struct WS(timeval)
{
    LONG tv_sec;
    LONG tv_usec;
} TIMEVAL, *PTIMEVAL, *LPTIMEVAL;
#endif

#ifdef WS_DEFINE_SELECT

#define __WS_FD_CLR(fd, set, cast) do { \
    unsigned int __i; \
    for (__i = 0; __i < ((cast*)(set))->fd_count; __i++) \
    { \
        if (((cast*)(set))->fd_array[__i] == fd) \
        { \
            while (__i < ((cast*)(set))->fd_count-1) \
            { \
                ((cast*)(set))->fd_array[__i] = \
                    ((cast*)(set))->fd_array[__i+1]; \
                __i++; \
            } \
            ((cast*)(set))->fd_count--; \
            break; \
        } \
    } \
} while (0)

#define __WS_FD_SET(fd, set, cast) do { \
    unsigned int __i; \
    for (__i = 0; __i < ((cast*)(set))->fd_count; __i++) \
    { \
        if (((cast*)(set))->fd_array[__i] == (fd)) \
            break; \
    } \
    if (__i == ((cast*)(set))->fd_count && ((cast*)(set))->fd_count < FD_SETSIZE) \
    { \
        ((cast*)(set))->fd_count++; \
        ((cast*)(set))->fd_array[__i]=(fd);\
    } \
} while (0)

#ifndef USE_WS_PREFIX

# ifndef FD_SETSIZE
#  define FD_SETSIZE    64
# endif

# define FD_CLR(fd, set)      __WS_FD_CLR((fd), (set), fd_set)
# define FD_SET(fd, set)      __WS_FD_SET((fd), (set), fd_set)
# define FD_ZERO(set)         (((fd_set*)(set))->fd_count=0)
# define FD_ISSET(fd, set)    __WSAFDIsSet((SOCKET)(fd), (fd_set*)(set))

#else

# ifndef WS_FD_SETSIZE
#  define WS_FD_SETSIZE 64
# endif

# define WS_FD_CLR(fd, set)   __WS_FD_CLR((fd), (set), WS_fd_set)
# define WS_FD_SET(fd, set)   __WS_FD_SET((fd), (set), WS_fd_set)
# define WS_FD_ZERO(set)      (((WS_fd_set*)(set))->fd_count=0)
# define WS_FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (WS_fd_set*)(set))

#endif

typedef struct WS(fd_set)
{
    WS(u_int) fd_count;
    SOCKET fd_array[WS(FD_SETSIZE)];
} WS(fd_set), FD_SET, *PFD_SET, *LPFD_SET;

#endif

626 627 628 629 630 631 632
typedef struct /*WS(pollfd)*/
{
    SOCKET fd;
    SHORT events;
    SHORT revents;
} WSAPOLLFD;

633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668
typedef struct WS(hostent)
{
    char *h_name;
    char **h_aliases;
    short h_addrtype;
    short h_length;
    char **h_addr_list;
#define h_addr h_addr_list[0]
} HOSTENT, *PHOSTENT, *LPHOSTENT;

typedef struct WS(servent)
{
    char *s_name;
    char **s_aliases;
#ifdef _WIN64
    char *s_proto;
    short s_port;
#else
    short s_port;
    char *s_proto;
#endif
} SERVENT, *PSERVENT, *LPSERVENT;

typedef struct WS(protoent)
{
    char *p_name;
    char **p_aliases;
    short p_proto;
} PROTOENT, *PPROTOENT, *LPPROTOENT;

typedef struct WS(linger)
{
    WS(u_short) l_onoff;
    WS(u_short) l_linger;
} LINGER, *PLINGER, *LPLINGER;

669 670
#define WSAPROTOCOL_LEN  255
typedef struct _WSAPROTOCOL_INFOA
671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690
{
    DWORD dwServiceFlags1;
    DWORD dwServiceFlags2;
    DWORD dwServiceFlags3;
    DWORD dwServiceFlags4;
    DWORD dwProviderFlags;
    GUID ProviderId;
    DWORD dwCatalogEntryId;
    WSAPROTOCOLCHAIN ProtocolChain;
    int iVersion;
    int iAddressFamily;
    int iMaxSockAddr;
    int iMinSockAddr;
    int iSocketType;
    int iProtocol;
    int iProtocolMaxOffset;
    int iNetworkByteOrder;
    int iSecurityScheme;
    DWORD dwMessageSize;
    DWORD dwProviderReserved;
691
    CHAR szProtocol[WSAPROTOCOL_LEN+1];
692 693
} WSAPROTOCOL_INFOA, * LPWSAPROTOCOL_INFOA;

694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714
typedef struct _WSAPROTOCOL_INFOW
{
    DWORD dwServiceFlags1;
    DWORD dwServiceFlags2;
    DWORD dwServiceFlags3;
    DWORD dwServiceFlags4;
    DWORD dwProviderFlags;
    GUID ProviderId;
    DWORD dwCatalogEntryId;
    WSAPROTOCOLCHAIN ProtocolChain;
    int iVersion;
    int iAddressFamily;
    int iMaxSockAddr;
    int iMinSockAddr;
    int iSocketType;
    int iProtocol;
    int iProtocolMaxOffset;
    int iNetworkByteOrder;
    int iSecurityScheme;
    DWORD dwMessageSize;
    DWORD dwProviderReserved;
715 716
    WCHAR szProtocol[WSAPROTOCOL_LEN+1];
} WSAPROTOCOL_INFOW, *LPWSAPROTOCOL_INFOW;
717 718 719 720

DECL_WINELIB_TYPE_AW(WSAPROTOCOL_INFO)
DECL_WINELIB_TYPE_AW(LPWSAPROTOCOL_INFO)

721
typedef struct _WSANETWORKEVENTS
722
{
723
    LONG lNetworkEvents;
724
    int iErrorCode[FD_MAX_EVENTS];
725 726
} WSANETWORKEVENTS, *LPWSANETWORKEVENTS;

727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769
typedef struct _WSANSClassInfoA
{
    LPSTR lpszName;
    DWORD dwNameSpace;
    DWORD dwValueType;
    DWORD dwValueSize;
    LPVOID lpValue;
} WSANSCLASSINFOA, *PWSANSCLASSINFOA, *LPWSANSCLASSINFOA;

typedef struct _WSANSClassInfoW
{
    LPSTR lpszName;
    DWORD dwNameSpace;
    DWORD dwValueType;
    DWORD dwValueSize;
    LPVOID lpValue;
} WSANSCLASSINFOW, *PWSANSCLASSINFOW, *LPWSANSCLASSINFOW;

DECL_WINELIB_TYPE_AW(WSANSCLASSINFO)
DECL_WINELIB_TYPE_AW(PWSANSCLASSINFO)
DECL_WINELIB_TYPE_AW(LPWSANSCLASSINFO)

typedef struct _WSAServiceClassInfoA
{
    LPGUID lpServiceClassId;
    LPSTR lpszServiceClassName;
    DWORD dwCount;
    LPWSANSCLASSINFOA lpClassInfos;
} WSASERVICECLASSINFOA, *PWSASERVICECLASSINFOA, *LPWSASERVICECLASSINFOA;

typedef struct _WSAServiceClassInfoW
{
    LPGUID lpServiceClassId;
    LPWSTR lpszServiceClassName;
    DWORD dwCount;
    LPWSANSCLASSINFOW lpClassInfos;
} WSASERVICECLASSINFOW, *PWSASERVICECLASSINFOW, *LPWSASERVICECLASSINFOW;


DECL_WINELIB_TYPE_AW(WSASERVICECLASSINFO)
DECL_WINELIB_TYPE_AW(PWSASERVICECLASSINFO)
DECL_WINELIB_TYPE_AW(LPWSASERVICECLASSINFO)

770 771 772 773 774
#define WSAEVENT      HANDLE
#define LPWSAEVENT    LPHANDLE
#define WSAOVERLAPPED OVERLAPPED
typedef struct _OVERLAPPED* LPWSAOVERLAPPED;

775 776 777 778 779 780 781 782 783 784
#ifndef USE_WS_PREFIX
#define h_errno                    WSAGetLastError()
#else
#define WS_h_errno                 WSAGetLastError()
#endif

#define WSAHOST_NOT_FOUND          (WSABASEERR + 1001)
#define WSATRY_AGAIN               (WSABASEERR + 1002)
#define WSANO_RECOVERY             (WSABASEERR + 1003)
#define WSANO_DATA                 (WSABASEERR + 1004)
785
#define WSANO_ADDRESS              WSANO_DATA
786

787 788 789 790 791 792 793 794 795
#define WSA_IO_PENDING             (ERROR_IO_PENDING)
#define WSA_IO_INCOMPLETE          (ERROR_IO_INCOMPLETE)
#define WSA_INVALID_HANDLE         (ERROR_INVALID_HANDLE)
#define WSA_INVALID_PARAMETER      (ERROR_INVALID_PARAMETER)
#define WSA_NOT_ENOUGH_MEMORY      (ERROR_NOT_ENOUGH_MEMORY)
#define WSA_OPERATION_ABORTED      (ERROR_OPERATION_ABORTED)

#define WSA_INVALID_EVENT          ((WSAEVENT)NULL)
#define WSA_MAXIMUM_WAIT_EVENTS    (MAXIMUM_WAIT_OBJECTS)
796
#define WSA_WAIT_FAILED            ((DWORD)-1)
797 798 799 800 801
#define WSA_WAIT_EVENT_0           (WAIT_OBJECT_0)
#define WSA_WAIT_IO_COMPLETION     (WAIT_IO_COMPLETION)
#define WSA_WAIT_TIMEOUT           (WAIT_TIMEOUT)
#define WSA_INFINITE               (INFINITE)

802
typedef unsigned int   GROUP;
803 804 805
#define SG_UNCONSTRAINED_GROUP   0x01
#define SG_CONSTRAINED_GROUP     0x02

Daniel Walker's avatar
Daniel Walker committed
806 807 808 809 810 811 812 813 814 815 816
/*
 * FLOWSPEC and SERVICETYPE should eventually move to qos.h
 */

typedef ULONG   SERVICETYPE;

typedef struct _FLOWSPEC {
       unsigned int      TokenRate;
       unsigned int      TokenBucketSize;
       unsigned int      PeakBandwidth;
       unsigned int      Latency;
817
       unsigned int      DelayVariation;
Daniel Walker's avatar
Daniel Walker committed
818 819 820 821 822 823 824 825
       SERVICETYPE       ServiceType;
       unsigned int      MaxSduSize;
       unsigned int      MinimumPolicedSize;
   } FLOWSPEC, *PFLOWSPEC, *LPFLOWSPEC;

typedef struct _QUALITYOFSERVICE {
        FLOWSPEC           SendingFlowspec;
        FLOWSPEC           ReceivingFlowspec;
826
        WSABUF             ProviderSpecific;
Daniel Walker's avatar
Daniel Walker committed
827
   } QOS, *LPQOS;
828

829
typedef int (CALLBACK *LPCONDITIONPROC)
830 831 832 833 834 835 836 837
(
    LPWSABUF lpCallerId,
    LPWSABUF lpCallerData,
    LPQOS lpSQOS,
    LPQOS lpGQOS,
    LPWSABUF lpCalleeId,
    LPWSABUF lpCalleeData,
    GROUP *g,
838
    DWORD_PTR dwCallbackData
839
);
840

841
typedef void (CALLBACK *LPWSAOVERLAPPED_COMPLETION_ROUTINE)
842
(
843 844 845 846
    DWORD dwError,
    DWORD cbTransferred,
    LPWSAOVERLAPPED lpOverlapped,
    DWORD dwFlags
847
);
848

849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915
#ifndef _tagBLOB_DEFINED
#define _tagBLOB_DEFINED
#define _BLOB_DEFINED
#define _LPBLOB_DEFINED
typedef struct _BLOB {
        ULONG   cbSize;
        BYTE   *pBlobData;
} BLOB, *LPBLOB;
#endif

/*   addressfamily protocol pairs */
typedef struct _AFPROTOCOLS {
        INT     iAddressFamily;
        INT     iProtocol;
} AFPROTOCOLS, *PAFPROTOCOLS, *LPAFPROTOCOLS;

/* client query definitions */
typedef enum _WSAEcomparator {
        COMP_EQUAL = 0,
        COMP_NOTLESS
} WSAECOMPARATOR, *PWSAECOMPARATOR, *LPWSAECOMPARATOR;

typedef struct _WSAVersion {
        DWORD           dwVersion;
        WSAECOMPARATOR  ecHow;
} WSAVERSION, *PWSAVERSION, *LPWSAVERSION;


typedef struct _WSAQuerySetA {
        DWORD           dwSize;
        LPSTR           lpszServiceInstanceName;
        LPGUID          lpServiceClassId;
        LPWSAVERSION    lpVersion;
        LPSTR           lpszComment;
        DWORD           dwNameSpace;
        LPGUID          lpNSProviderId;
        LPSTR           lpszContext;
        DWORD           dwNumberOfProtocols;
        LPAFPROTOCOLS   lpafpProtocols;
        LPSTR           lpszQueryString;
        DWORD           dwNumberOfCsAddrs;
        LPCSADDR_INFO   lpcsaBuffer;
        DWORD           dwOutputFlags;
        LPBLOB          lpBlob;
} WSAQUERYSETA, *PWSAQUERYSETA, *LPWSAQUERYSETA;

typedef struct _WSAQuerySetW {
        DWORD           dwSize;
        LPWSTR          lpszServiceInstanceName;
        LPGUID          lpServiceClassId;
        LPWSAVERSION    lpVersion;
        LPWSTR          lpszComment;
        DWORD           dwNameSpace;
        LPGUID          lpNSProviderId;
        LPWSTR          lpszContext;
        DWORD           dwNumberOfProtocols;
        LPAFPROTOCOLS   lpafpProtocols;
        LPWSTR          lpszQueryString;
        DWORD           dwNumberOfCsAddrs;
        LPCSADDR_INFO   lpcsaBuffer;
        DWORD           dwOutputFlags;
        LPBLOB          lpBlob;
} WSAQUERYSETW, *PWSAQUERYSETW, *LPWSAQUERYSETW;

DECL_WINELIB_TYPE_AW(WSAQUERYSET)
DECL_WINELIB_TYPE_AW(PWSAQUERYSET)
DECL_WINELIB_TYPE_AW(LPWSAQUERYSET)
916

917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941
typedef enum _WSAESETSERVICEOP {
        RNRSERVICE_REGISTER = 0,
        RNRSERVICE_DEREGISTER,
        RNRSERVICE_DELETE
} WSAESETSERVICEOP, *PWSAESETSERVICEOP, *LPWSAESETSERVICEOP;

typedef struct _WSANAMESPACE_INFOA {
        GUID    NSProviderId;
        DWORD   dwNameSpace;
        BOOL    fActive;
        DWORD   dwVersion;
        LPSTR   lpszIdentifier;
} WSANAMESPACE_INFOA, *PWSANAMESPACE_INFOA, *LPWSANAMESPACE_INFOA;

typedef struct _WSANAMESPACE_INFOW {
        GUID    NSProviderId;
        DWORD   dwNameSpace;
        BOOL    fActive;
        DWORD   dwVersion;
        LPWSTR  lpszIdentifier;
} WSANAMESPACE_INFOW, *PWSANAMESPACE_INFOW, *LPWSANAMESPACE_INFOW;

DECL_WINELIB_TYPE_AW(WSANAMESPACE_INFO)
DECL_WINELIB_TYPE_AW(PWSANAMESPACE_INFO)
DECL_WINELIB_TYPE_AW(LPWSANAMESPACE_INFO)
942

943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973
typedef enum _WSACOMPLETIONTYPE {
    NSP_NOTIFY_IMMEDIATELY = 0,
    NSP_NOTIFY_HWND = 1,
    NSP_NOTIFY_EVENT = 2,
    NSP_NOTIFY_PORT = 3,
    NSP_NOTIFY_APC = 4
} WSACOMPLETIONTYPE, * PWSACOMPLETIONTYPE, * LPWSACOMPLETIONTYPE;

typedef struct _WSACOMPLETION {
    WSACOMPLETIONTYPE Type;
    union {
        struct {
            HWND hWnd;
            UINT uMsg;
            WPARAM context;
        } WindowMessage;
        struct {
            LPWSAOVERLAPPED lpOverlapped;
        } Event;
        struct {
            LPWSAOVERLAPPED lpOverlapped;
            LPWSAOVERLAPPED_COMPLETION_ROUTINE lpfnCompletionProc;
        } Apc;
        struct {
            LPWSAOVERLAPPED lpOverlapped;
            HANDLE hPort;
            ULONG_PTR Key;
        } Port;
    } Parameters;
} WSACOMPLETION, *PWSACOMPLETION, *LPWSACOMPLETION;

974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042
#define WSADESCRIPTION_LEN      256
#define WSASYS_STATUS_LEN       128

typedef struct WSAData
{
    WORD wVersion;
    WORD wHighVersion;
#ifdef _WIN64
    WORD iMaxSockets;
    WORD iMaxUdpDg;
    char *lpVendorInfo;
    char szDescription[WSADESCRIPTION_LEN+1];
    char szSystemStatus[WSASYS_STATUS_LEN+1];
#else
    char szDescription[WSADESCRIPTION_LEN+1];
    char szSystemStatus[WSASYS_STATUS_LEN+1];
    WORD iMaxSockets;
    WORD iMaxUdpDg;
    char *lpVendorInfo;
#endif
} WSADATA, *LPWSADATA;

#ifndef USE_WS_PREFIX

#undef htonl
#undef htons
#undef ntohl
#undef ntohs

#ifdef WORDS_BIGENDIAN

static inline u_short __wine_ushort_noop(u_short s)
{
    return s;
}
static inline ULONG __wine_ulong_noop(ULONG l)
{
    return l;
}
#define htonl __wine_ulong_noop
#define htons __wine_ushort_noop
#define ntohl __wine_ulong_noop
#define ntohs __wine_ushort_noop

#else /* WORDS_BIGENDIAN */

static inline u_short __wine_ushort_swap(u_short s)
{
    return (s >> 8) | (s << 8);
}
static inline ULONG __wine_ulong_swap(ULONG l)
{
    return ((ULONG)__wine_ushort_swap((u_short)l) << 16) | __wine_ushort_swap((u_short)(l >> 16));
}
#define htonl __wine_ulong_swap
#define htons __wine_ushort_swap
#define ntohl __wine_ulong_swap
#define ntohs __wine_ushort_swap

#endif /* WORDS_BIGENDIAN */
#endif /* USE_WS_PREFIX */

#define WSAMAKEASYNCREPLY(size, error) MAKELONG(size, error)
#define WSAMAKESELECTREPLY(flags, error) MAKELONG(flags, error)
#define WSAGETASYNCBUFLEN(x) LOWORD(x)
#define WSAGETASYNCERROR(x) HIWORD(x)
#define WSAGETSELECTEVENT(x) LOWORD(x)
#define WSAGETSELECTERROR(x) HIWORD(x)

1043 1044 1045
/*
 * Winsock Function Typedefs
 *
1046
 * Remember to keep this section in sync with the
1047 1048 1049
 * "Prototypes" section in winsock.h.
 */
#if WS_API_TYPEDEFS
1050 1051 1052 1053 1054 1055
typedef HANDLE (WINAPI *LPFN_WSAASYNCGETHOSTBYADDR)(HWND,WS(u_int),const char*,int,int,char*,int);
typedef HANDLE (WINAPI *LPFN_WSAASYNCGETHOSTBYNAME)(HWND,WS(u_int),const char*,char*,int);
typedef HANDLE (WINAPI *LPFN_WSAASYNCGETPROTOBYNAME)(HWND,WS(u_int),const char*,char*,int);
typedef HANDLE (WINAPI *LPFN_WSAASYNCGETPROTOBYNUMBER)(HWND,WS(u_int),int,char*,int);
typedef HANDLE (WINAPI *LPFN_WSAASYNCGETSERVBYNAME)(HWND,WS(u_int),const char*,const char*,char*,int);
typedef HANDLE (WINAPI *LPFN_WSAASYNCGETSERVBYPORT)(HWND,WS(u_int),int,const char*,char*,int);
1056
typedef int (WINAPI *LPFN_WSAASYNCSELECT)(SOCKET,HWND,WS(u_int),LONG);
1057
typedef int (WINAPI *LPFN_WSACANCELASYNCREQUEST)(HANDLE);
1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076
typedef int (WINAPI *LPFN_WSACANCELBLOCKINGCALL)(void);
typedef int (WINAPI *LPFN_WSACLEANUP)(void);
typedef int (WINAPI *LPFN_WSAGETLASTERROR)(void);
typedef BOOL (WINAPI *LPFN_WSAISBLOCKING)(void);
typedef FARPROC (WINAPI *LPFN_WSASETBLOCKINGHOOK)(FARPROC);
typedef void (WINAPI *LPFN_WSASETLASTERROR)(int);
typedef int (WINAPI *LPFN_WSASTARTUP)(WORD,LPWSADATA);
typedef int (WINAPI *LPFN_WSAUNHOOKBLOCKINGHOOK)(void);

typedef SOCKET (WINAPI *LPFN_ACCEPT)(SOCKET,struct WS(sockaddr)*,int*);
typedef int (WINAPI *LPFN_BIND)(SOCKET,const struct WS(sockaddr)*,int);
typedef int (WINAPI *LPFN_CLOSESOCKET)(SOCKET);
typedef int (WINAPI *LPFN_CONNECT)(SOCKET,const struct WS(sockaddr)*,int);
typedef struct WS(hostent)* (WINAPI *LPFN_GETHOSTBYADDR)(const char*,int,int);
typedef struct WS(hostent)* (WINAPI *LPFN_GETHOSTBYNAME)(const char*);
typedef int (WINAPI *LPFN_GETHOSTNAME)(char*,int);
typedef int (WINAPI *LPFN_GETPEERNAME)(SOCKET,struct WS(sockaddr)*,int*);
typedef struct WS(protoent)* (WINAPI *LPFN_GETPROTOBYNAME)(const char*);
typedef struct WS(protoent)* (WINAPI *LPFN_GETPROTOBYNUMBER)(int);
1077 1078 1079
#ifdef WS_DEFINE_SELECT
typedef int (WINAPI* LPFN_SELECT)(int,WS(fd_set)*,WS(fd_set)*,WS(fd_set)*,const struct WS(timeval)*);
#endif
1080 1081 1082 1083
typedef struct WS(servent)* (WINAPI *LPFN_GETSERVBYNAME)(const char*,const char*);
typedef struct WS(servent)* (WINAPI *LPFN_GETSERVBYPORT)(int,const char*);
typedef int (WINAPI *LPFN_GETSOCKNAME)(SOCKET,struct WS(sockaddr)*,int*);
typedef int (WINAPI *LPFN_GETSOCKOPT)(SOCKET,int,int,char*,int*);
1084
typedef ULONG (WINAPI *LPFN_HTONL)(ULONG);
1085
typedef WS(u_short) (WINAPI *LPFN_HTONS)(WS(u_short));
1086
typedef ULONG (WINAPI *LPFN_INET_ADDR)(const char*);
1087
typedef char* (WINAPI *LPFN_INET_NTOA)(struct WS(in_addr));
1088
typedef int (WINAPI *LPFN_IOCTLSOCKET)(SOCKET,LONG,ULONG*);
1089
typedef int (WINAPI *LPFN_LISTEN)(SOCKET,int);
1090
typedef ULONG (WINAPI *LPFN_NTOHL)(ULONG);
1091
typedef WS(u_short) (WINAPI *LPFN_NTOHS)(WS(u_short));
1092 1093 1094 1095 1096 1097 1098
typedef int (WINAPI *LPFN_RECV)(SOCKET,char*,int,int);
typedef int (WINAPI *LPFN_RECVFROM)(SOCKET,char*,int,int,struct WS(sockaddr)*,int*);
typedef int (WINAPI *LPFN_SEND)(SOCKET,const char*,int,int);
typedef int (WINAPI *LPFN_SENDTO)(SOCKET,const char*,int,int,const struct WS(sockaddr)*,int);
typedef int (WINAPI *LPFN_SETSOCKOPT)(SOCKET,int,int,const char*,int);
typedef int (WINAPI *LPFN_SHUTDOWN)(SOCKET,int);
typedef SOCKET (WINAPI *LPFN_SOCKET)(int,int,int);
1099 1100 1101 1102 1103 1104 1105
#endif /* WS_API_TYPEDEFS */



/*
 * Winsock2 Prototypes
 *
1106
 * Remember to keep this section in sync with the
1107 1108 1109
 * "Winsock2 Function Typedefs" section below.
 */
#if WS_API_PROTOTYPES
1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143
int WINAPI __WSAFDIsSet(SOCKET, WS(fd_set) *);

SOCKET WINAPI WS(accept)(SOCKET, struct WS(sockaddr) *, int *);
int WINAPI WS(bind)(SOCKET, const struct WS(sockaddr) *, int);
int WINAPI WS(closesocket)(SOCKET);
int WINAPI WS(connect)(SOCKET, const struct WS(sockaddr) *, int);
struct WS(hostent) * WINAPI WS(gethostbyaddr)(const char *, int, int);
struct WS(hostent) * WINAPI WS(gethostbyname)(const char *);
#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__WINE_USE_MSVCRT)
/* gethostname is defined in unistd.h */
int WINAPI WS(gethostname)(char *, int);
#endif
int WINAPI WS(getpeername)(SOCKET, struct WS(sockaddr) *, int *);
struct WS(protoent) * WINAPI WS(getprotobyname)(const char *);
struct WS(protoent) * WINAPI WS(getprotobynumber)(int);
struct WS(servent) * WINAPI WS(getservbyname)(const char *, const char *);
struct WS(servent) * WINAPI WS(getservbyport)(int, const char *);
int WINAPI WS(getsockname)(SOCKET, struct WS(sockaddr) *, int *);
int WINAPI WS(getsockopt)(SOCKET, int, int, char *, int *);
ULONG WINAPI WS(inet_addr)(const char *);
char * WINAPI WS(inet_ntoa)(struct WS(in_addr));
int WINAPI WS(ioctlsocket)(SOCKET, LONG, WS(u_long) *);
int WINAPI WS(listen)(SOCKET, int);
int WINAPI WS(recv)(SOCKET, char *, int, int);
int WINAPI WS(recvfrom)(SOCKET, char *, int, int, struct WS(sockaddr) *, int *);
#ifdef WS_DEFINE_SELECT
int WINAPI WS(select)(int, WS(fd_set) *, WS(fd_set) *, WS(fd_set) *, const struct WS(timeval) *);
#endif
int WINAPI WS(send)(SOCKET, const char *, int, int);
int WINAPI WS(sendto)(SOCKET, const char *, int, int, const struct WS(sockaddr) *, int);
int WINAPI WS(setsockopt)(SOCKET, int, int, const char *, int);
int WINAPI WS(shutdown)(SOCKET, int);
SOCKET WINAPI WS(socket)(int, int, int);

1144
int WINAPI GetHostNameW(WCHAR *, int);
1145
SOCKET WINAPI WSAAccept(SOCKET,struct WS(sockaddr)*,LPINT,LPCONDITIONPROC,DWORD_PTR);
1146 1147 1148
INT WINAPI WSAAddressToStringA(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOA,LPSTR,LPDWORD);
INT WINAPI WSAAddressToStringW(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOW,LPWSTR,LPDWORD);
#define WSAAddressToString         WINELIB_NAME_AW(WSAAddressToString)
1149 1150 1151 1152 1153 1154 1155 1156 1157 1158
HANDLE WINAPI WSAAsyncGetHostByAddr(HWND, WS(u_int), const char *, int, int, char *, int);
HANDLE WINAPI WSAAsyncGetHostByName(HWND, WS(u_int), const char *, char *, int);
HANDLE WINAPI WSAAsyncGetProtoByName(HWND, WS(u_int), const char *, char *, int);
HANDLE WINAPI WSAAsyncGetProtoByNumber(HWND, WS(u_int), int, char *, int);
HANDLE WINAPI WSAAsyncGetServByName(HWND, WS(u_int), const char *, const char *, char *, int);
HANDLE WINAPI WSAAsyncGetServByPort(HWND, WS(u_int), int, const char *, char *, int);
int WINAPI WSAAsyncSelect(SOCKET, HWND, WS(u_int), LONG);
int WINAPI WSACancelAsyncRequest(HANDLE);
int WINAPI WSACancelBlockingCall(void);
int WINAPI WSACleanup(void);
1159 1160
BOOL WINAPI WSACloseEvent(WSAEVENT);
int WINAPI WSAConnect(SOCKET,const struct WS(sockaddr)*,int,LPWSABUF,LPWSABUF,LPQOS,LPQOS);
1161 1162 1163
BOOL WINAPI WSAConnectByNameA(SOCKET,const char *,const char *,DWORD *,struct WS(sockaddr) *,DWORD *,struct WS(sockaddr) *,const struct WS(timeval) *,WSAOVERLAPPED *);
BOOL WINAPI WSAConnectByNameW(SOCKET,const WCHAR *,const WCHAR *,DWORD *,struct WS(sockaddr) *,DWORD *,struct WS(sockaddr) *,const struct WS(timeval) *,WSAOVERLAPPED *);
#define WSAConnectByName           WINELIB_NAME_AW(WSAConnectByName)
1164
WSAEVENT WINAPI WSACreateEvent(void);
1165 1166 1167 1168 1169 1170
INT WINAPI WSADuplicateSocketA(SOCKET,DWORD,LPWSAPROTOCOL_INFOA);
INT WINAPI WSADuplicateSocketW(SOCKET,DWORD,LPWSAPROTOCOL_INFOW);
#define WSADuplicateSocket         WINELIB_NAME_AW(WSADuplicateSocket)
INT WINAPI WSAEnumNameSpaceProvidersA(LPDWORD,LPWSANAMESPACE_INFOA);
INT WINAPI WSAEnumNameSpaceProvidersW(LPDWORD,LPWSANAMESPACE_INFOW);
#define WSAEnumNameSpaceProviders  WINELIB_NAME_AW(WSAEnumNameSpaceProviders)
1171 1172 1173 1174
int WINAPI WSAEnumNetworkEvents(SOCKET,WSAEVENT,LPWSANETWORKEVENTS);
int WINAPI WSAEnumProtocolsA(LPINT,LPWSAPROTOCOL_INFOA,LPDWORD);
int WINAPI WSAEnumProtocolsW(LPINT,LPWSAPROTOCOL_INFOW,LPDWORD);
#define WSAEnumProtocols           WINELIB_NAME_AW(WSAEnumProtocols)
1175
int WINAPI WSAEventSelect(SOCKET,WSAEVENT,LONG);
1176
int WINAPI WSAGetLastError(void);
1177
BOOL WINAPI WSAGetOverlappedResult(SOCKET,LPWSAOVERLAPPED,LPDWORD,BOOL,LPDWORD);
1178 1179 1180 1181 1182 1183 1184
BOOL WINAPI WSAGetQOSByName(SOCKET,LPWSABUF,LPQOS);
INT WINAPI WSAGetServiceClassInfoA(LPGUID,LPGUID,LPDWORD,LPWSASERVICECLASSINFOA);
INT WINAPI WSAGetServiceClassInfoW(LPGUID,LPGUID,LPDWORD,LPWSASERVICECLASSINFOW);
#define WSAGetServiceClassInfo     WINELIB_NAME_AW(WSAGetServiceClassInfo)
INT WINAPI WSAGetServiceClassNameByClassIdA(LPGUID,LPSTR,LPDWORD);
INT WINAPI WSAGetServiceClassNameByClassIdW(LPGUID,LPWSTR,LPDWORD);
#define WSAGetServiceClassNameByClassId WINELIB_NAME_AW(WSAGetServiceClassNameByClassId)
1185
int WINAPI WSAHtonl(SOCKET,ULONG,ULONG*);
1186
int WINAPI WSAHtons(SOCKET,WS(u_short),WS(u_short)*);
1187 1188 1189
int WINAPI WSAInstallServiceClassA(LPWSASERVICECLASSINFOA);
int WINAPI WSAInstallServiceClassW(LPWSASERVICECLASSINFOW);
#define WSAInstallServiceClass     WINELIB_NAME_AW(WSAInstallServiceClass)
1190
int WINAPI WSAIoctl(SOCKET,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1191
BOOL WINAPI WSAIsBlocking(void);
1192
SOCKET WINAPI WSAJoinLeaf(SOCKET,const struct WS(sockaddr)*,int,LPWSABUF,LPWSABUF,LPQOS,LPQOS,DWORD);
1193 1194 1195 1196 1197 1198 1199
INT WINAPI WSALookupServiceBeginA(LPWSAQUERYSETA,DWORD,LPHANDLE);
INT WINAPI WSALookupServiceBeginW(LPWSAQUERYSETW,DWORD,LPHANDLE);
#define WSALookupServiceBegin      WINELIB_NAME_AW(WSALookupServiceBegin)
INT WINAPI WSALookupServiceEnd(HANDLE);
INT WINAPI WSALookupServiceNextA(HANDLE,DWORD,LPDWORD,LPWSAQUERYSETA);
INT WINAPI WSALookupServiceNextW(HANDLE,DWORD,LPDWORD,LPWSAQUERYSETW);
#define WSALookupServiceNext       WINELIB_NAME_AW(WSALookupServiceNext) 
1200
int WINAPI WSANSPIoctl(HANDLE,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPWSACOMPLETION);
1201
int WINAPI WSANtohl(SOCKET,ULONG,ULONG*);
1202
int WINAPI WSANtohs(SOCKET,WS(u_short),WS(u_short)*);
1203
int WINAPI WSAPoll(WSAPOLLFD*,ULONG,int);
1204
INT WINAPI WSAProviderConfigChange(LPHANDLE,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1205 1206 1207
int WINAPI WSARecv(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
int WINAPI WSARecvDisconnect(SOCKET,LPWSABUF);
int WINAPI WSARecvFrom(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,struct WS(sockaddr)*,LPINT,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1208
INT WINAPI WSARemoveServiceClass(LPGUID);
1209 1210 1211 1212
BOOL WINAPI WSAResetEvent(WSAEVENT);
int WINAPI WSASend(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
int WINAPI WSASendDisconnect(SOCKET,LPWSABUF);
int WINAPI WSASendTo(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,const struct WS(sockaddr)*,int,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1213
FARPROC WINAPI WSASetBlockingHook(FARPROC);
1214
BOOL WINAPI WSASetEvent(WSAEVENT);
1215
void WINAPI WSASetLastError(int);
1216 1217 1218
INT WINAPI WSASetServiceA(LPWSAQUERYSETA,WSAESETSERVICEOP,DWORD);
INT WINAPI WSASetServiceW(LPWSAQUERYSETW,WSAESETSERVICEOP,DWORD);
#define WSASetService   WINELIB_NAME_AW(WSASetService)
1219 1220
SOCKET WINAPI WSASocketA(int,int,int,LPWSAPROTOCOL_INFOA,GROUP,DWORD);
SOCKET WINAPI WSASocketW(int,int,int,LPWSAPROTOCOL_INFOW,GROUP,DWORD);
1221
#define WSASocket WINELIB_NAME_AW(WSASocket)
1222
int WINAPI WSAStartup(WORD,WSADATA*);
1223
INT WINAPI WSAStringToAddressA(LPSTR,INT,LPWSAPROTOCOL_INFOA,LPSOCKADDR,LPINT);
1224 1225
INT WINAPI WSAStringToAddressW(LPWSTR,INT,LPWSAPROTOCOL_INFOW,LPSOCKADDR,LPINT);
#define WSAStringToAddress WINELIB_NAME_AW(WSAStringToAddress)
1226
int WINAPI WSAUnhookBlockingHook(void);
1227 1228 1229 1230 1231 1232 1233 1234
DWORD WINAPI WSAWaitForMultipleEvents(DWORD,const WSAEVENT*,BOOL,DWORD,BOOL);
#endif /* WS_API_PROTOTYPES */



/*
 * Winsock2 Function Typedefs
 *
1235
 * Remember to keep this section in sync with the
1236 1237 1238
 * "Winsock2 Prototypes" section above.
 */
#if WS_API_TYPEDEFS
1239 1240 1241
typedef SOCKET (WINAPI *LPFN_WSAACCEPT)(SOCKET,struct WS(sockaddr)*,LPINT,LPCONDITIONPROC,DWORD_PTR);
typedef INT (WINAPI *LPFN_WSAADDRESSTOSTRINGA)(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOA,LPSTR,LPDWORD);
typedef INT (WINAPI *LPFN_WSAADDRESSTOSTRINGW)(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOW,LPWSTR,LPDWORD);
1242 1243 1244 1245
#define LPFN_WSAADDRESSTOSTRING    WINELIB_NAME_AW(LPFN_WSAADDRESSTOSTRING)
typedef BOOL (WINAPI *LPFN_WSACLOSEEVENT)(WSAEVENT);
typedef int (WINAPI *LPFN_WSACONNECT)(SOCKET,const struct WS(sockaddr)*,int,LPWSABUF,LPWSABUF,LPQOS,LPQOS);
typedef WSAEVENT (WINAPI *LPFN_WSACREATEEVENT)(void);
1246 1247 1248
typedef INT (WINAPI *LPFN_WSADUPLICATESOCKETA)(SOCKET,DWORD,LPWSAPROTOCOL_INFOA);
typedef INT (WINAPI *LPFN_WSADUPLICATESOCKETW)(SOCKET,DWORD,LPWSAPROTOCOL_INFOW);
#define LPFN_WSADUPLICATESOCKET    WINELIB_NAME_AW(LPFN_WSADUPLICATESOCKET)
1249 1250 1251 1252
typedef INT (WINAPI *LPFN_WSAENUMNAMESPACEPROVIDERSA)(LPDWORD,LPWSANAMESPACE_INFOA);
typedef INT (WINAPI *LPFN_WSAENUMNAMESPACEPROVIDERSW)(LPDWORD,LPWSANAMESPACE_INFOW);
#define LPFN_WSAENUMNAMESPACEPROVIDERS WINELIB_NAME_AW(LPFN_WSAENUMNAMESPACEPROVIDERS)
typedef int (WINAPI *LPFN_WSAENUMNETWORKEVENTS)(SOCKET,WSAEVENT,LPWSANETWORKEVENTS);
1253 1254 1255
typedef int (WINAPI *LPFN_WSAENUMPROTOCOLSA)(LPINT,LPWSAPROTOCOL_INFOA,LPDWORD);
typedef int (WINAPI *LPFN_WSAENUMPROTOCOLSW)(LPINT,LPWSAPROTOCOL_INFOW,LPDWORD);
#define LPFN_WSAENUMPROTOCOLS      WINELIB_NAME_AW(LPFN_WSAENUMPROTOCOLS)
1256
typedef int (WINAPI *LPFN_WSAEVENTSELECT)(SOCKET,WSAEVENT,LONG);
1257
typedef BOOL (WINAPI *LPFN_WSAGETOVERLAPPEDRESULT)(SOCKET,LPWSAOVERLAPPED,LPDWORD,BOOL,LPDWORD);
1258 1259 1260
typedef BOOL (WINAPI *LPFN_WSAGETQOSBYNAME)(SOCKET,LPWSABUF,LPQOS);
typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSINFOA)(LPGUID,LPGUID,LPDWORD,LPWSASERVICECLASSINFOA);
typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSINFOW)(LPGUID,LPGUID,LPDWORD,LPWSASERVICECLASSINFOW);
1261 1262 1263 1264
#define LPFN_LPFNWSAGETSERVICECLASSINFO WINELIB_NAME_AW(LPFN_LPFNWSAGETSERVICECLASSINFO)
typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA)(LPGUID,LPSTR,LPDWORD);
typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW)(LPGUID,LPWSTR,LPDWORD);
#define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID WINELIB_NAME_AW(LPFN_WSAGETSERVICECLASSNAMEBYCLASSID)
1265
typedef int (WINAPI *LPFN_WSAHTONL)(SOCKET,ULONG,ULONG*);
1266
typedef int (WINAPI *LPFN_WSAHTONS)(SOCKET,WS(u_short),WS(u_short)*);
1267 1268
typedef int (WINAPI *LPFN_WSAINSTALLSERVICECLASSA)(LPWSASERVICECLASSINFOA);
typedef int (WINAPI *LPFN_WSAINSTALLSERVICECLASSW)(LPWSASERVICECLASSINFOW);
1269
typedef int (WINAPI *LPFN_WSAIOCTL)(SOCKET,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1270
typedef int (WINAPI *LPFN_WSAJOINLEAF)(SOCKET,const struct WS(sockaddr)*,int,LPWSABUF,LPWSABUF,LPQOS,LPQOS,DWORD);
1271 1272
typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEBEGINA)(LPWSAQUERYSETA,DWORD,LPHANDLE);
typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEBEGINW)(LPWSAQUERYSETW,DWORD,LPHANDLE);
1273
#define LPFN_WSALOOKUPSERVICEBEGIN WINELIB_NAME_AW(LPFN_WSALOOKUPSERVICEBEGIN)
1274
typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEEND)(HANDLE);
1275 1276 1277
typedef INT (WINAPI *LPFN_WSALOOKUPSERVICENEXTA)(HANDLE,DWORD,LPDWORD,LPWSAQUERYSETA);
typedef INT (WINAPI *LPFN_WSALOOKUPSERVICENEXTW)(HANDLE,DWORD,LPDWORD,LPWSAQUERYSETW);
#define LPFN_WSALOOKUPSERVICENEXT WINELIB_NAME_AW(LPFN_WSALOOKUPSERVICENEXT)
1278
typedef int (WINAPI *LPFN_WSANSPIOCTL)(HANDLE,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPWSACOMPLETION);
1279
typedef int (WINAPI *LPFN_WSANTOHL)(SOCKET,ULONG,ULONG*);
1280
typedef int (WINAPI *LPFN_WSANTOHS)(SOCKET,WS(u_short),WS(u_short)*);
1281
typedef INT (WINAPI *LPFN_WSAPROVIDERCONFIGCHANGE)(LPHANDLE,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1282
typedef int (WINAPI *LPFN_WSAPOLL)(WSAPOLLFD*,ULONG,int);
1283 1284 1285
typedef int (WINAPI *LPFN_WSARECV)(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
typedef int (WINAPI *LPFN_WSARECVDISCONNECT)(SOCKET,LPWSABUF);
typedef int (WINAPI *LPFN_WSARECVFROM)(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,struct WS(sockaddr)*,LPINT,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
1286
typedef INT (WINAPI *LPFN_WSAREMOVESERVICECLASS)(LPGUID);
1287 1288 1289 1290 1291
typedef BOOL (WINAPI *LPFN_WSARESETEVENT)(WSAEVENT);
typedef int (WINAPI *LPFN_WSASEND)(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
typedef int (WINAPI *LPFN_WSASENDDISCONNECT)(SOCKET,LPWSABUF);
typedef int (WINAPI *LPFN_WSASENDTO)(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,const struct WS(sockaddr)*,int,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
typedef BOOL (WINAPI *LPFN_WSASETEVENT)(WSAEVENT);
1292 1293 1294
typedef INT (WINAPI *LPFN_WSASETSERVICEA)(LPWSAQUERYSETA,WSAESETSERVICEOP,DWORD);
typedef INT (WINAPI *LPFN_WSASETSERVICEW)(LPWSAQUERYSETW,WSAESETSERVICEOP,DWORD);
#define LPFN_WSASETSERVICE WINELIB_NAME_AW(LPFN_WSASETSERVICE)
1295 1296 1297 1298 1299 1300 1301 1302 1303
typedef SOCKET (WINAPI *LPFN_WSASOCKETA)(int,int,int,LPWSAPROTOCOL_INFOA,GROUP,DWORD);
typedef SOCKET (WINAPI *LPFN_WSASOCKETW)(int,int,int,LPWSAPROTOCOL_INFOW,GROUP,DWORD);
typedef INT (WINAPI *LPFN_WSASTRINGTOADDRESSA)(LPSTR,INT,LPWSAPROTOCOL_INFOA,LPSOCKADDR,LPINT);
typedef INT (WINAPI *LPFN_WSASTRINGTOADDRESSW)(LPSTR,INT,LPWSAPROTOCOL_INFOA,LPSOCKADDR,LPINT);
#define LPFN_WSASOCKET             WINELIB_NAME_AW(LPFN_WSASOCKET)
#define LPFN_WSASTRINGTOADDRESS    WINELIB_NAME_AW(LPFN_WSASTRINGTOADDRESS)
typedef DWORD (WINAPI *LPFN_WSAWAITFORMULTIPLEEVENTS)(DWORD,const WSAEVENT*,BOOL,DWORD,BOOL);
#endif /* WS_API_TYPEDEFS */

1304

Daniel Walker's avatar
Daniel Walker committed
1305 1306 1307 1308 1309
/* Condition function return values */
#define CF_ACCEPT       0x0000
#define CF_REJECT       0x0001
#define CF_DEFER        0x0002

1310 1311
#ifdef __cplusplus
}
1312
#endif
1313 1314 1315 1316 1317 1318

#undef WS
#undef WS_API_PROTOTYPES
#undef WS_API_TYPEDEFS

#endif /* __WINSOCK2API__ */