winsock.h 34.2 KB
Newer Older
Alexandre Julliard's avatar
Alexandre Julliard committed
1 2 3 4
/* WINSOCK.H--definitions to be used with the WINSOCK.DLL
 *
 * This header file corresponds to version 1.1 of the Windows Sockets
 * specification.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
 *
 * Copyright (C) the Wine project
 *
 * 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
20
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Alexandre Julliard's avatar
Alexandre Julliard committed
21 22
 */

23
#ifdef __WINESRC__
24 25 26 27 28
# ifndef __WINE_WINSOCK2__
#  error Please use Winsock2 in Wine
# endif
#endif

29 30
#ifndef __WINE_WINSOCKAPI_STDLIB_H
#define __WINE_WINSOCKAPI_STDLIB_H
31

32 33 34
/*
 * This section defines the items that conflict with the Unix headers.
 */
35 36 37 38 39 40 41 42 43 44 45
#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
 * inadvertantly.
 */
46
#  include <sys/types.h>
47 48 49 50 51
#  undef FD_SETSIZE
#  undef FD_CLR
#  undef FD_SET
#  undef FD_ZERO
#  undef FD_ISSET
52

53 54 55 56 57 58 59
#  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
60 61 62 63 64 65 66 67 68 69 70 71 72 73
# 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
74 75 76 77
# 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.
78
 */
79 80 81 82
#  define fd_set unix_fd_set
#  define timeval unix_timeval
#  define select unix_select
#  include <sys/types.h>
83
#  include <time.h>
84 85 86 87 88 89 90 91 92
#  include <stdlib.h>
#  undef fd_set
#  undef timeval
#  undef select
#  undef FD_SETSIZE
#  undef FD_CLR
#  undef FD_SET
#  undef FD_ZERO
#  undef FD_ISSET
93

94 95 96 97 98 99 100 101 102
#  define WS_DEFINE_SELECT
# endif /* FD_CLR */

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

103 104
#endif /* __WINE_WINSOCKAPI_STDLIB_H */

105
#ifndef __WINESRC__
106
# include <windows.h>
107
#else
108
# include <windef.h>
109 110
#endif

111 112 113
#ifndef _WINSOCKAPI_
#define _WINSOCKAPI_

114 115 116 117
#ifdef USE_WS_PREFIX
typedef unsigned char  WS_u_char;
typedef unsigned short WS_u_short;
typedef unsigned int   WS_u_int;
118
#ifdef _MSC_VER
119
typedef unsigned long  WS_u_long;
120 121 122
#else
typedef unsigned int   WS_u_long;
#endif
123
#elif (defined(_MSC_VER) || defined(__MINGW_H) || defined(__WATCOMC__)) && !defined(_BSDTYPES_DEFINED)
124
/* MinGW doesn't define the u_xxx types */
125
typedef unsigned char  u_char;
126
typedef unsigned short u_short;
127 128 129 130 131 132
typedef unsigned int   u_int;
#ifdef _MSC_VER
typedef unsigned long  u_long;
#else
typedef unsigned int   u_long;
#endif
133
#define _BSDTYPES_DEFINED
134
#endif
135

136 137 138 139 140 141 142 143 144 145
#ifdef USE_WS_PREFIX
# define WS(x)    WS_##x
#else
# define WS(x)    x
#endif

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

146
/* proper 4-byte packing */
147
#include <pshpack4.h>
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285

/*
 * Address families
 */
#ifndef USE_WS_PREFIX
#define AF_UNSPEC                  0
#define AF_UNIX                    1
#define AF_INET                    2
#define AF_IMPLINK                 3
#define AF_PUP                     4
#define AF_CHAOS                   5
#define AF_NS                      6
#define AF_IPX                     AF_NS
#define AF_ISO                     7
#define AF_OSI                     AF_ISO
#define AF_ECMA                    8
#define AF_DATAKIT                 9
#define AF_CCITT                   10
#define AF_SNA                     11
#define AF_DECnet                  12
#define AF_DLI                     13
#define AF_LAT                     14
#define AF_HYLINK                  15
#define AF_APPLETALK               16
#define AF_NETBIOS                 17
#define AF_VOICEVIEW               18
#define AF_FIREFOX                 19
#define AF_UNKNOWN1                20
#define AF_BAN                     21
#define AF_ATM                     22
#define AF_INET6                   23
#define AF_CLUSTER                 24
#define AF_12844                   25
#define AF_IRDA                    26
#define AF_MAX                     27
#define PF_UNSPEC                  AF_UNSPEC
#define PF_UNIX                    AF_UNIX
#define PF_INET                    AF_INET
#define PF_IMPLINK                 AF_IMPLINK
#define PF_PUP                     AF_PUP
#define PF_CHAOS                   AF_CHAOS
#define PF_NS                      AF_NS
#define PF_IPX                     AF_IPX
#define PF_ISO                     AF_ISO
#define PF_OSI                     AF_OSI
#define PF_ECMA                    AF_ECMA
#define PF_DATAKIT                 AF_DATAKIT
#define PF_CCITT                   AF_CCITT
#define PF_SNA                     AF_SNA
#define PF_DECnet                  AF_DECnet
#define PF_DLI                     AF_DLI
#define PF_LAT                     AF_LAT
#define PF_HYLINK                  AF_HYLINK
#define PF_APPLETALK               AF_APPLETALK
#define PF_VOICEVIEW               AF_VOICEVIEW
#define PF_FIREFOX                 AF_FIREFOX
#define PF_UNKNOWN1                AF_UNKNOWN1
#define PF_BAN                     AF_BAN
#define PF_MAX                     AF_MAX
#else /* USE_WS_PREFIX */
#define WS_AF_UNSPEC               0
#define WS_AF_UNIX                 1
#define WS_AF_INET                 2
#define WS_AF_IMPLINK              3
#define WS_AF_PUP                  4
#define WS_AF_CHAOS                5
#define WS_AF_NS                   6
#define WS_AF_IPX                  WS_AF_NS
#define WS_AF_ISO                  7
#define WS_AF_OSI                  AF_ISO
#define WS_AF_ECMA                 8
#define WS_AF_DATAKIT              9
#define WS_AF_CCITT                10
#define WS_AF_SNA                  11
#define WS_AF_DECnet               12
#define WS_AF_DLI                  13
#define WS_AF_LAT                  14
#define WS_AF_HYLINK               15
#define WS_AF_APPLETALK            16
#define WS_AF_NETBIOS              17
#define WS_AF_VOICEVIEW            18
#define WS_AF_FIREFOX              19
#define WS_AF_UNKNOWN1             20
#define WS_AF_BAN                  21
#define WS_AF_ATM                  22
#define WS_AF_INET6                23
#define WS_AF_CLUSTER              24
#define WS_AF_12844                25
#define WS_AF_IRDA                 26
#define WS_AF_MAX                  27
#endif /* USE_WS_PREFIX */

/*
 * Types
 */
#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 */


/*
 * Protocols
 */
#ifndef USE_WS_PREFIX
#define IPPROTO_IP                 0
#define IPPROTO_ICMP               1
#define IPPROTO_IGMP               2
#define IPPROTO_GGP                3
#define IPPROTO_TCP                6
#define IPPROTO_UDP                17
#define IPPROTO_IDP                22
#define IPPROTO_ND                 77
#define IPPROTO_RAW                255
#define IPPROTO_MAX                256
#else /* USE_WS_PREFIX */
#define WS_IPPROTO_IP              0
#define WS_IPPROTO_ICMP            1
#define WS_IPPROTO_IGMP            2
#define WS_IPPROTO_GGP             3
#define WS_IPPROTO_TCP             6
#define WS_IPPROTO_UDP             17
#define WS_IPPROTO_IDP             22
#define WS_IPPROTO_ND              77
#define WS_IPPROTO_RAW             255
#define WS_IPPROTO_MAX             256
#endif /* USE_WS_PREFIX */

typedef struct WS(protoent)
Alexandre Julliard's avatar
Alexandre Julliard committed
286
{
287 288 289 290 291 292 293 294 295 296 297
    char* p_name;
    char** p_aliases;
    short p_proto;
} PROTOENT, *PPROTOENT, *LPPROTOENT;



/*
 * Networks
 */
struct WS(netent)
Alexandre Julliard's avatar
Alexandre Julliard committed
298
{
299 300 301
    char* n_name;                  /* official name of net */
    char** n_aliases;              /* alias list */
    short n_addrtype;              /* net address type */
302
    WS(u_long) n_net;              /* network # */
303 304
};

Alexandre Julliard's avatar
Alexandre Julliard committed
305

306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363
/*
 * Services
 */
#ifndef USE_WS_PREFIX
#define IPPORT_ECHO                7
#define IPPORT_DISCARD             9
#define IPPORT_SYSTAT              11
#define IPPORT_DAYTIME             13
#define IPPORT_NETSTAT             15
#define IPPORT_FTP                 21
#define IPPORT_TELNET              23
#define IPPORT_SMTP                25
#define IPPORT_TIMESERVER          37
#define IPPORT_NAMESERVER          42
#define IPPORT_WHOIS               43
#define IPPORT_MTP                 57
#define IPPORT_TFTP                69
#define IPPORT_RJE                 77
#define IPPORT_FINGER              79
#define IPPORT_TTYLINK             87
#define IPPORT_SUPDUP              95
#define IPPORT_EXECSERVER          512
#define IPPORT_LOGINSERVER         513
#define IPPORT_CMDSERVER           514
#define IPPORT_EFSSERVER           520
#define IPPORT_BIFFUDP             512
#define IPPORT_WHOSERVER           513
#define IPPORT_ROUTESERVER         520
#define IPPORT_RESERVED            1024
#else /* USE_WS_PREFIX */
#define WS_IPPORT_ECHO             7
#define WS_IPPORT_DISCARD          9
#define WS_IPPORT_SYSTAT           11
#define WS_IPPORT_DAYTIME          13
#define WS_IPPORT_NETSTAT          15
#define WS_IPPORT_FTP              21
#define WS_IPPORT_TELNET           23
#define WS_IPPORT_SMTP             25
#define WS_IPPORT_TIMESERVER       37
#define WS_IPPORT_NAMESERVER       42
#define WS_IPPORT_WHOIS            43
#define WS_IPPORT_MTP              57
#define WS_IPPORT_TFTP             69
#define WS_IPPORT_RJE              77
#define WS_IPPORT_FINGER           79
#define WS_IPPORT_TTYLINK          87
#define WS_IPPORT_SUPDUP           95
#define WS_IPPORT_EXECSERVER       512
#define WS_IPPORT_LOGINSERVER      513
#define WS_IPPORT_CMDSERVER        514
#define WS_IPPORT_EFSSERVER        520
#define WS_IPPORT_BIFFUDP          512
#define WS_IPPORT_WHOSERVER        513
#define WS_IPPORT_ROUTESERVER      520
#define WS_IPPORT_RESERVED         1024
#endif /* USE_WS_PREFIX */

typedef struct WS(servent)
Alexandre Julliard's avatar
Alexandre Julliard committed
364
{
365 366 367 368 369 370
    char* s_name;                  /* official service name */
    char** s_aliases;              /* alias list */
    short s_port;                  /* port # */
    char* s_proto;                 /* protocol to use */
} SERVENT, *PSERVENT, *LPSERVENT;

Alexandre Julliard's avatar
Alexandre Julliard committed
371

372 373 374 375 376 377

/*
 * Hosts
 */

typedef struct WS(hostent)
Alexandre Julliard's avatar
Alexandre Julliard committed
378
{
379 380 381 382 383 384 385
    char* h_name;                  /* official name of host */
    char** h_aliases;              /* alias list */
    short h_addrtype;              /* host address type */
    short h_length;                /* length of address */
    char** h_addr_list;            /* list of addresses from name server */
#define h_addr h_addr_list[0]      /* address, for backward compat */
} HOSTENT, *PHOSTENT, *LPHOSTENT;
Alexandre Julliard's avatar
Alexandre Julliard committed
386

387

388 389 390
/*
 * Sockets
 */
391

392
typedef UINT_PTR SOCKET;
Alexandre Julliard's avatar
Alexandre Julliard committed
393

394 395 396 397 398 399 400 401
/*
 * This is used instead of -1, since the
 * SOCKET type is unsigned.
 */
#define INVALID_SOCKET             (~0)
#define SOCKET_ERROR               (-1)

typedef struct WS(sockaddr)
Alexandre Julliard's avatar
Alexandre Julliard committed
402
{
403 404
        WS(u_short) sa_family;
        char        sa_data[14];
405
} SOCKADDR, *PSOCKADDR, *LPSOCKADDR;
Alexandre Julliard's avatar
Alexandre Julliard committed
406

407 408
typedef struct WS(linger)
{
409 410
    WS(u_short) l_onoff;           /* option on/off */
    WS(u_short) l_linger;          /* linger time */
411
} LINGER, *PLINGER, *LPLINGER;
412

413 414 415
/*
 * Select
 */
Alexandre Julliard's avatar
Alexandre Julliard committed
416

417 418 419 420 421 422 423 424 425 426 427 428 429 430 431
#ifdef WS_DEFINE_SELECT
/* Define our own version of select and the associated types and macros */

# ifndef USE_WS_PREFIX
#  ifndef FD_SETSIZE
#   define FD_SETSIZE              64
#  endif
# else
#  ifndef WS_FD_SETSIZE
#   define WS_FD_SETSIZE           64
#  endif
# endif

typedef struct WS(fd_set)
{
432
    WS(u_int) fd_count;            /* how many are SET? */
433 434 435 436 437 438 439
# ifndef USE_WS_PREFIX
    SOCKET fd_array[FD_SETSIZE];   /* an array of SOCKETs */
# else
    SOCKET fd_array[WS_FD_SETSIZE];/* an array of SOCKETs */
# endif
} WS(fd_set), FD_SET, *PFD_SET, *LPFD_SET;

440 441
#ifndef _TIMEVAL_DEFINED
#define _TIMEVAL_DEFINED
442 443
typedef struct WS(timeval)
{
444 445
    LONG    tv_sec;                /* seconds */
    LONG    tv_usec;               /* and microseconds */
446
} TIMEVAL, *PTIMEVAL, *LPTIMEVAL;
447
#endif
Alexandre Julliard's avatar
Alexandre Julliard committed
448

449
#define __WS_FD_CLR(fd, set, cast) do { \
450
    unsigned int __i; \
Alexandre Julliard's avatar
Alexandre Julliard committed
451
    for (__i = 0; __i < ((cast*)(set))->fd_count ; __i++) \
Alexandre Julliard's avatar
Alexandre Julliard committed
452
    { \
Alexandre Julliard's avatar
Alexandre Julliard committed
453
        if (((cast*)(set))->fd_array[__i] == fd) \
454
        { \
Alexandre Julliard's avatar
Alexandre Julliard committed
455
            while (__i < ((cast*)(set))->fd_count-1) \
456
            { \
Alexandre Julliard's avatar
Alexandre Julliard committed
457 458
                ((cast*)(set))->fd_array[__i] = \
                    ((cast*)(set))->fd_array[__i+1]; \
Alexandre Julliard's avatar
Alexandre Julliard committed
459 460
                __i++; \
            } \
Alexandre Julliard's avatar
Alexandre Julliard committed
461
            ((cast*)(set))->fd_count--; \
Alexandre Julliard's avatar
Alexandre Julliard committed
462 463 464 465
            break; \
        } \
    } \
} while(0)
466
#define __WS_FD_SET1(fd, set, cast) do { \
Alexandre Julliard's avatar
Alexandre Julliard committed
467
    if (((cast*)(set))->fd_count < FD_SETSIZE) \
468
        ((cast*)(set))->fd_array[((cast*)(set))->fd_count++]=(fd); \
Alexandre Julliard's avatar
Alexandre Julliard committed
469
} while(0)
470
/* This version checks if the filedesc is already in the list, and appends it
471 472 473
 * only if it's not the case
 */
#define __WS_FD_SET2(fd, set, cast) do { \
474
    unsigned int __i; \
475 476
    for (__i = 0; __i < ((cast*)(set))->fd_count ; __i++) \
    { \
477
        if (((cast*)(set))->fd_array[__i]==(fd)) \
478 479 480 481 482 483 484 485 486 487
            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 __WINE_WINSOCK2__
488
#define __WS_FD_SET(fd, set, cast) __WS_FD_SET1((fd),(set), cast)
489
#else
490
#define __WS_FD_SET(fd, set, cast) __WS_FD_SET2((fd),(set), cast)
491 492 493
#endif

#ifndef USE_WS_PREFIX
494 495 496 497
#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))
498
#else
499 500
#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)
501
#define WS_FD_ZERO(set)      (((WS_fd_set*)(set))->fd_count=0)
502
#define WS_FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (WS_fd_set*)(set))
503
#endif
504

505 506
int WINAPI __WSAFDIsSet(SOCKET,WS(fd_set)*);

507 508
#endif /* WS_DEFINE_SELECT */

509 510 511 512 513 514 515 516 517 518
/* we have to define hton/ntoh as macros to avoid conflicts with Unix headers */
#ifndef USE_WS_PREFIX

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

#ifdef WORDS_BIGENDIAN

519 520 521 522
#define htonl(l) ((u_long)(l))
#define htons(s) ((u_short)(s))
#define ntohl(l) ((u_long)(l))
#define ntohs(s) ((u_short)(s))
523 524 525

#else  /* WORDS_BIGENDIAN */

526
static inline u_short __wine_ushort_swap(u_short s)
527 528 529
{
    return (s >> 8) | (s << 8);
}
530
static inline u_long __wine_ulong_swap(u_long l)
531
{
532
    return ((u_long)__wine_ushort_swap((u_short)l) << 16) | __wine_ushort_swap((u_short)(l >> 16));
533 534 535 536 537 538 539 540 541
}
#define htonl(l) __wine_ulong_swap(l)
#define htons(s) __wine_ushort_swap(s)
#define ntohl(l) __wine_ulong_swap(l)
#define ntohs(s) __wine_ushort_swap(s)

#endif  /* WORDS_BIGENDIAN */

#endif  /* USE_WS_PREFIX */
Alexandre Julliard's avatar
Alexandre Julliard committed
542

543 544
/*
 * Internet address (old style... should be updated)
Alexandre Julliard's avatar
Alexandre Julliard committed
545
 */
Alexandre Julliard's avatar
Alexandre Julliard committed
546

547 548 549 550 551
#ifndef USE_WS_PREFIX
#define IN_CLASSA_NSHIFT           24
#define IN_CLASSA_MAX              128
#define IN_CLASSA_NET              0xff000000
#define IN_CLASSA_HOST             0x00ffffff
552
#define IN_CLASSA(i)               (((LONG)(i) & 0x80000000) == 0)
553 554 555 556
#define IN_CLASSB_NSHIFT           16
#define IN_CLASSB_MAX              65536
#define IN_CLASSB_NET              0xffff0000
#define IN_CLASSB_HOST             0x0000ffff
557
#define IN_CLASSB(i)               (((LONG)(i) & 0xc0000000) == 0x80000000)
558 559 560
#define IN_CLASSC_NSHIFT           8
#define IN_CLASSC_NET              0xffffff00
#define IN_CLASSC_HOST             0x000000ff
561
#define IN_CLASSC(i)               (((LONG)(i) & 0xe0000000) == 0xc0000000)
562 563 564 565 566
#else
#define WS_IN_CLASSA_NSHIFT        24
#define WS_IN_CLASSA_MAX           128
#define WS_IN_CLASSA_NET           0xff000000
#define WS_IN_CLASSA_HOST          0x00ffffff
567
#define WS_IN_CLASSA(i)            (((LONG)(i) & 0x80000000) == 0)
568 569 570 571
#define WS_IN_CLASSB_NSHIFT        16
#define WS_IN_CLASSB_MAX           65536
#define WS_IN_CLASSB_NET           0xffff0000
#define WS_IN_CLASSB_HOST          0x0000ffff
572
#define WS_IN_CLASSB(i)            (((LONG)(i) & 0xc0000000) == 0x80000000)
573 574 575
#define WS_IN_CLASSC_NSHIFT        8
#define WS_IN_CLASSC_NET           0xffffff00
#define WS_IN_CLASSC_HOST          0x000000ff
576
#define WS_IN_CLASSC(i)            (((LONG)(i) & 0xe0000000) == 0xc0000000)
577 578 579
#endif /* USE_WS_PREFIX */

#ifndef USE_WS_PREFIX
580
#define INADDR_ANY                 ((u_long)0x00000000)
581
#define INADDR_LOOPBACK            0x7f000001
582
#define INADDR_BROADCAST           ((u_long)0xffffffff)
583 584
#define INADDR_NONE                0xffffffff
#else
585
#define WS_INADDR_ANY              ((WS_u_long)0x00000000)
586
#define WS_INADDR_LOOPBACK         0x7f000001
587
#define WS_INADDR_BROADCAST        ((WS_u_long)0xffffffff)
588 589 590 591
#define WS_INADDR_NONE             0xffffffff
#endif /* USE_WS_PREFIX */

typedef struct WS(in_addr)
Alexandre Julliard's avatar
Alexandre Julliard committed
592
{
593 594
    union {
        struct {
595
            WS(u_char) s_b1,s_b2,s_b3,s_b4;
596 597
        } S_un_b;
        struct {
598
            WS(u_short) s_w1,s_w2;
599
        } S_un_w;
600
        WS(u_long) S_addr;
601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619
    } S_un;
#ifndef USE_WS_PREFIX
#define s_addr  S_un.S_addr
#define s_host  S_un.S_un_b.s_b2
#define s_net   S_un.S_un_b.s_b1
#define s_imp   S_un.S_un_w.s_w2
#define s_impno S_un.S_un_b.s_b4
#define s_lh    S_un.S_un_b.s_b3
#else
#define WS_s_addr  S_un.S_addr
#define WS_s_host  S_un.S_un_b.s_b2
#define WS_s_net   S_un.S_un_b.s_b1
#define WS_s_imp   S_un.S_un_w.s_w2
#define WS_s_impno S_un.S_un_b.s_b4
#define WS_s_lh    S_un.S_un_b.s_b3
#endif /* USE_WS_PREFIX */
} IN_ADDR, *PIN_ADDR, *LPIN_ADDR;

typedef struct WS(sockaddr_in)
Alexandre Julliard's avatar
Alexandre Julliard committed
620
{
621
    short              sin_family;
622
    WS(u_short)        sin_port;
623 624 625
    struct WS(in_addr) sin_addr;
    char               sin_zero[8];
} SOCKADDR_IN, *PSOCKADDR_IN, *LPSOCKADDR_IN;
Alexandre Julliard's avatar
Alexandre Julliard committed
626

Felix Nawothnig's avatar
Felix Nawothnig committed
627 628 629 630
/*
 * Multicast group information
 */

631
#if !defined(__WINE_WINSOCK2__)
Felix Nawothnig's avatar
Felix Nawothnig committed
632 633 634 635 636
struct WS(ip_mreq)
{
    struct WS(in_addr) imr_multiaddr;
    struct WS(in_addr) imr_interface;
};
637
#endif
Alexandre Julliard's avatar
Alexandre Julliard committed
638

Alexandre Julliard's avatar
Alexandre Julliard committed
639
/*
640
 * WSAStartup
Alexandre Julliard's avatar
Alexandre Julliard committed
641
 */
642 643
#define WSADESCRIPTION_LEN      256
#define WSASYS_STATUS_LEN       128
Alexandre Julliard's avatar
Alexandre Julliard committed
644

645 646 647 648 649 650 651 652 653 654
typedef struct WS(WSAData)
{
    WORD                    wVersion;
    WORD                    wHighVersion;
    char                    szDescription[WSADESCRIPTION_LEN+1];
    char                    szSystemStatus[WSASYS_STATUS_LEN+1];
    WORD                    iMaxSockets;
    WORD                    iMaxUdpDg;
    char                   *lpVendorInfo;
} WSADATA, *LPWSADATA;
Alexandre Julliard's avatar
Alexandre Julliard committed
655 656


Alexandre Julliard's avatar
Alexandre Julliard committed
657 658

/*
659
 * {get,set}sockopt
Alexandre Julliard's avatar
Alexandre Julliard committed
660
 */
661 662 663 664 665
#ifndef USE_WS_PREFIX
#define SOL_SOCKET                 0xffff
#define SO_DEBUG                   0x0001
#define SO_ACCEPTCONN              0x0002
#define SO_REUSEADDR               0x0004
666
#define SO_EXCLUSIVEADDRUSE        ((u_int)(~SO_REUSEADDR))
667 668 669 670 671 672
#define SO_KEEPALIVE               0x0008
#define SO_DONTROUTE               0x0010
#define SO_BROADCAST               0x0020
#define SO_USELOOPBACK             0x0040
#define SO_LINGER                  0x0080
#define SO_OOBINLINE               0x0100
673
#define SO_DONTLINGER              ((u_int)(~SO_LINGER))
674 675 676 677 678 679 680 681 682
#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

683

684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699
#define IOCPARM_MASK               0x7f
#define IOC_VOID                   0x20000000
#define IOC_OUT                    0x40000000
#define IOC_IN                     0x80000000
#define IOC_INOUT                  (IOC_IN|IOC_OUT)

#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))

#else

#define WS_SOL_SOCKET              0xffff
#define WS_SO_DEBUG                0x0001
#define WS_SO_ACCEPTCONN           0x0002
#define WS_SO_REUSEADDR            0x0004
700
#define WS_SO_EXCLUSIVEADDRUSE     ((WS_u_int)(~WS_SO_REUSEADDR))
701 702 703 704 705 706
#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
707
#define WS_SO_DONTLINGER           ((WS_u_int)(~WS_SO_LINGER))
708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723
#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

#define WS_IOCPARM_MASK            0x7f
#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)

#define WS__IO(x,y)    (WS_IOC_VOID|((x)<<8)|(y))
724 725
#define WS__IOR(x,y,t) (WS_IOC_OUT|(((LONG)sizeof(t)&WS_IOCPARM_MASK)<<16)|((x)<<8)|(y))
#define WS__IOW(x,y,t) (WS_IOC_IN|(((LONG)sizeof(t)&WS_IOCPARM_MASK)<<16)|((x)<<8)|(y))
Alexandre Julliard's avatar
Alexandre Julliard committed
726

727
#endif
Alexandre Julliard's avatar
Alexandre Julliard committed
728

729
/* IPPROTO_TCP options */
730 731 732 733 734
#ifndef USE_WS_PREFIX
#define TCP_NODELAY                1
#else
#define WS_TCP_NODELAY             1
#endif
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
/* IPPROTO_IP options */
#ifndef __WINE_WINSOCK2__    /* WinSock2 has different values for the IP_ constants */
# ifndef USE_WS_PREFIX
#  define IP_OPTIONS             1
#  define IP_MULTICAST_IF        2
#  define IP_MULTICAST_TTL       3
#  define IP_MULTICAST_LOOP      4
#  define IP_ADD_MEMBERSHIP      5
#  define IP_DROP_MEMBERSHIP     6
#  define IP_TTL                 7
#  define IP_TOS                 8
#  define IP_DONTFRAGMENT        9
# else
#  define WS_IP_OPTIONS          1
#  define WS_IP_MULTICAST_IF     2
#  define WS_IP_MULTICAST_TTL    3
#  define WS_IP_MULTICAST_LOOP   4
#  define WS_IP_ADD_MEMBERSHIP   5
#  define WS_IP_DROP_MEMBERSHIP  6
#  define WS_IP_TTL              7
#  define WS_IP_TOS              8
#  define WS_IP_DONTFRAGMENT     9
# endif
#endif


Alexandre Julliard's avatar
Alexandre Julliard committed
762 763 764
/*
 * Socket I/O flags (supported by spec 1.1)
 */
765 766 767
#ifndef USE_WS_PREFIX
#define FIONREAD                   _IOR('f', 127, u_long)
#define FIONBIO                    _IOW('f', 126, u_long)
768 769 770 771 772
#define FIOASYNC                   _IOW('f', 125, u_long)
#define SIOCSHIWAT                 _IOW('s',  0, u_long)
#define SIOCGHIWAT                 _IOR('s',  1, u_long)
#define SIOCSLOWAT                 _IOW('s',  2, u_long)
#define SIOCGLOWAT                 _IOR('s',  3, u_long)
773 774
#define SIOCATMARK                 _IOR('s',  7, u_long)
#else
775 776 777 778 779 780 781 782
#define WS_FIONREAD                WS__IOR('f', 127, WS_u_long)
#define WS_FIONBIO                 WS__IOW('f', 126, WS_u_long)
#define WS_FIOASYNC                WS__IOW('f', 125, WS_u_long)
#define WS_SIOCSHIWAT              WS__IOW('s',  0, WS_u_long)
#define WS_SIOCGHIWAT              WS__IOR('s',  1, WS_u_long)
#define WS_SIOCSLOWAT              WS__IOW('s',  2, WS_u_long)
#define WS_SIOCGLOWAT              WS__IOR('s',  3, WS_u_long)
#define WS_SIOCATMARK              WS__IOR('s',  7, WS_u_long)
783
#endif
Alexandre Julliard's avatar
Alexandre Julliard committed
784 785 786 787

/*
 * Maximum queue length specifiable by listen.
 */
788 789 790 791 792 793 794
#ifndef USE_WS_PREFIX
#define SOMAXCONN                  5

#define MSG_OOB                    0x0001
#define MSG_PEEK                   0x0002
#define MSG_DONTROUTE              0x0004
#define MSG_PARTIAL                0x8000
795
#define MSG_MAXIOVLEN              16
796 797 798 799 800 801 802
#else /* USE_WS_PREFIX */
#define WS_SOMAXCONN               5

#define WS_MSG_OOB                 0x0001
#define WS_MSG_PEEK                0x0002
#define WS_MSG_DONTROUTE           0x0004
#define WS_MSG_PARTIAL             0x8000
803
#define WS_MSG_MAXIOVLEN           16
804
#endif /* USE_WS_PREFIX */
805

Alexandre Julliard's avatar
Alexandre Julliard committed
806 807 808
/*
 * Define constant based on rfc883, used by gethostbyxxxx() calls.
 */
809 810 811 812 813 814
#ifndef USE_WS_PREFIX
#define MAXGETHOSTSTRUCT           1024
#else
#define MAXGETHOSTSTRUCT           1024
#endif

Alexandre Julliard's avatar
Alexandre Julliard committed
815 816 817 818

/*
 * Define flags to be used with the WSAAsyncSelect() call.
 */
819 820 821 822 823 824 825 826
#define FD_READ                    0x00000001
#define FD_WRITE                   0x00000002
#define FD_OOB                     0x00000004
#define FD_ACCEPT                  0x00000008
#define FD_CONNECT                 0x00000010
#define FD_CLOSE                   0x00000020

/* internal per-socket flags */
827
#ifdef __WINESRC__
828 829 830 831 832 833
#define FD_WINE_LISTENING          0x10000000
#define FD_WINE_NONBLOCKING        0x20000000
#define FD_WINE_CONNECTED          0x40000000
#define FD_WINE_RAW                0x80000000
#define FD_WINE_INTERNAL           0xFFFF0000
#endif
Alexandre Julliard's avatar
Alexandre Julliard committed
834 835 836 837 838

/*
 * All Windows Sockets error constants are biased by WSABASEERR from
 * the "normal"
 */
839
#define WSABASEERR                 10000
Alexandre Julliard's avatar
Alexandre Julliard committed
840 841 842
/*
 * Windows Sockets definitions of regular Microsoft C error constants
 */
843 844 845 846 847 848
#define WSAEINTR                   (WSABASEERR+4)
#define WSAEBADF                   (WSABASEERR+9)
#define WSAEACCES                  (WSABASEERR+13)
#define WSAEFAULT                  (WSABASEERR+14)
#define WSAEINVAL                  (WSABASEERR+22)
#define WSAEMFILE                  (WSABASEERR+24)
Alexandre Julliard's avatar
Alexandre Julliard committed
849 850 851 852

/*
 * Windows Sockets definitions of regular Berkeley error constants
 */
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
#define WSAEWOULDBLOCK             (WSABASEERR+35)
#define WSAEINPROGRESS             (WSABASEERR+36)
#define WSAEALREADY                (WSABASEERR+37)
#define WSAENOTSOCK                (WSABASEERR+38)
#define WSAEDESTADDRREQ            (WSABASEERR+39)
#define WSAEMSGSIZE                (WSABASEERR+40)
#define WSAEPROTOTYPE              (WSABASEERR+41)
#define WSAENOPROTOOPT             (WSABASEERR+42)
#define WSAEPROTONOSUPPORT         (WSABASEERR+43)
#define WSAESOCKTNOSUPPORT         (WSABASEERR+44)
#define WSAEOPNOTSUPP              (WSABASEERR+45)
#define WSAEPFNOSUPPORT            (WSABASEERR+46)
#define WSAEAFNOSUPPORT            (WSABASEERR+47)
#define WSAEADDRINUSE              (WSABASEERR+48)
#define WSAEADDRNOTAVAIL           (WSABASEERR+49)
#define WSAENETDOWN                (WSABASEERR+50)
#define WSAENETUNREACH             (WSABASEERR+51)
#define WSAENETRESET               (WSABASEERR+52)
#define WSAECONNABORTED            (WSABASEERR+53)
#define WSAECONNRESET              (WSABASEERR+54)
#define WSAENOBUFS                 (WSABASEERR+55)
#define WSAEISCONN                 (WSABASEERR+56)
#define WSAENOTCONN                (WSABASEERR+57)
#define WSAESHUTDOWN               (WSABASEERR+58)
#define WSAETOOMANYREFS            (WSABASEERR+59)
#define WSAETIMEDOUT               (WSABASEERR+60)
#define WSAECONNREFUSED            (WSABASEERR+61)
#define WSAELOOP                   (WSABASEERR+62)
#define WSAENAMETOOLONG            (WSABASEERR+63)
#define WSAEHOSTDOWN               (WSABASEERR+64)
#define WSAEHOSTUNREACH            (WSABASEERR+65)
#define WSAENOTEMPTY               (WSABASEERR+66)
#define WSAEPROCLIM                (WSABASEERR+67)
#define WSAEUSERS                  (WSABASEERR+68)
#define WSAEDQUOT                  (WSABASEERR+69)
#define WSAESTALE                  (WSABASEERR+70)
#define WSAEREMOTE                 (WSABASEERR+71)
Alexandre Julliard's avatar
Alexandre Julliard committed
890 891 892 893

/*
 * Extended Windows Sockets error constant definitions
 */
894 895 896
#define WSASYSNOTREADY             (WSABASEERR+91)
#define WSAVERNOTSUPPORTED         (WSABASEERR+92)
#define WSANOTINITIALISED          (WSABASEERR+93)
897 898 899 900 901 902 903 904 905 906 907 908
#define WSAEDISCON                 (WSABASEERR+101)
#define WSAENOMORE                 (WSABASEERR+102)
#define WSAECANCELLED              (WSABASEERR+103)
#define WSAEINVALIDPROCTABLE       (WSABASEERR+104)
#define WSAEINVALIDPROVIDER        (WSABASEERR+105)
#define WSAEPROVIDERFAILEDINIT     (WSABASEERR+106)
#define WSASYSCALLFAILURE          (WSABASEERR+107)
#define WSASERVICE_NOT_FOUND       (WSABASEERR+108)
#define WSATYPE_NOT_FOUND          (WSABASEERR+109)
#define WSA_E_NO_MORE              (WSABASEERR+110)
#define WSA_E_CANCELLED            (WSABASEERR+111)
#define WSAEREFUSED                (WSABASEERR+112)
Alexandre Julliard's avatar
Alexandre Julliard committed
909 910 911 912 913 914 915 916 917 918 919 920

/*
 * Error return codes from gethostbyname() and gethostbyaddr()
 * (when using the resolver). Note that these errors are
 * retrieved via WSAGetLastError() and must therefore follow
 * the rules for avoiding clashes with error numbers from
 * specific implementations or language run-time systems.
 * For this reason the codes are based at WSABASEERR+1001.
 * Note also that [WSA]NO_ADDRESS is defined only for
 * compatibility purposes.
 */

921 922 923 924 925
#ifndef USE_WS_PREFIX
#define h_errno                    WSAGetLastError()
#else
#define WS_h_errno                 WSAGetLastError()
#endif
Alexandre Julliard's avatar
Alexandre Julliard committed
926 927

/* Authoritative Answer: Host not found */
928
#define WSAHOST_NOT_FOUND          (WSABASEERR+1001)
Alexandre Julliard's avatar
Alexandre Julliard committed
929 930

/* Non-Authoritative: Host not found, or SERVERFAIL */
931
#define WSATRY_AGAIN               (WSABASEERR+1002)
Alexandre Julliard's avatar
Alexandre Julliard committed
932 933

/* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
934
#define WSANO_RECOVERY             (WSABASEERR+1003)
Alexandre Julliard's avatar
Alexandre Julliard committed
935 936

/* Valid name, no data record of requested type */
937
#define WSANO_DATA                 (WSABASEERR+1004)
Alexandre Julliard's avatar
Alexandre Julliard committed
938 939

/* no address, look for MX record */
940
#define WSANO_ADDRESS              WSANO_DATA
Alexandre Julliard's avatar
Alexandre Julliard committed
941

942 943 944 945 946 947 948
#ifndef USE_WS_PREFIX
#define HOST_NOT_FOUND             WSAHOST_NOT_FOUND
#define TRY_AGAIN                  WSATRY_AGAIN
#define NO_RECOVERY                WSANO_RECOVERY
#define NO_DATA                    WSANO_DATA
#define NO_ADDRESS                 WSANO_ADDRESS
#endif /* USE_WS_PREFIX */
Alexandre Julliard's avatar
Alexandre Julliard committed
949 950 951



952
/*
953 954
 * Windows message parameter composition and decomposition
 * macros.
955
 */
Alexandre Julliard's avatar
Alexandre Julliard committed
956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991

/*
 * WSAMAKEASYNCREPLY is intended for use by the Windows Sockets implementation
 * when constructing the response to a WSAAsyncGetXByY() routine.
 */
#define WSAMAKEASYNCREPLY(buflen,error)     MAKELONG(buflen,error)
/*
 * WSAMAKESELECTREPLY is intended for use by the Windows Sockets implementation
 * when constructing the response to WSAAsyncSelect().
 */
#define WSAMAKESELECTREPLY(event,error)     MAKELONG(event,error)
/*
 * WSAGETASYNCBUFLEN is intended for use by the Windows Sockets application
 * to extract the buffer length from the lParam in the response
 * to a WSAGetXByY().
 */
#define WSAGETASYNCBUFLEN(lParam)           LOWORD(lParam)
/*
 * WSAGETASYNCERROR is intended for use by the Windows Sockets application
 * to extract the error code from the lParam in the response
 * to a WSAGetXByY().
 */
#define WSAGETASYNCERROR(lParam)            HIWORD(lParam)
/*
 * WSAGETSELECTEVENT is intended for use by the Windows Sockets application
 * to extract the event code from the lParam in the response
 * to a WSAAsyncSelect().
 */
#define WSAGETSELECTEVENT(lParam)           LOWORD(lParam)
/*
 * WSAGETSELECTERROR is intended for use by the Windows Sockets application
 * to extract the error code from the lParam in the response
 * to a WSAAsyncSelect().
 */
#define WSAGETSELECTERROR(lParam)           HIWORD(lParam)

992 993 994 995 996


/*
 * Prototypes
 *
997
 * Remember to keep this section in sync with the
998 999 1000
 * "Winsock Function Typedefs" section in winsock2.h.
 */
#if !defined(__WINE_WINSOCK2__) || WS_API_PROTOTYPES
1001 1002 1003 1004 1005 1006
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);
1007
int WINAPI WSAAsyncSelect(SOCKET,HWND,WS(u_int),LONG);
1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023
int WINAPI WSACancelAsyncRequest(HANDLE);
int WINAPI WSACancelBlockingCall(void);
int WINAPI WSACleanup(void);
int WINAPI WSAGetLastError(void);
BOOL WINAPI WSAIsBlocking(void);
FARPROC WINAPI WSASetBlockingHook(FARPROC);
void WINAPI WSASetLastError(int);
int WINAPI WSAStartup(WORD,LPWSADATA);
int WINAPI WSAUnhookBlockingHook(void);

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*);
1024
/* gethostname not defined because of conflicts with unistd.h */
1025 1026 1027 1028
int WINAPI WS(getpeername)(SOCKET,struct WS(sockaddr)*,int*);
struct WS(protoent)* WINAPI WS(getprotobyname)(const char*);
struct WS(protoent)* WINAPI WS(getprotobynumber)(int);
#ifdef WS_DEFINE_SELECT
1029
int WINAPI WS(select)(int,WS(fd_set)*,WS(fd_set)*,WS(fd_set)*,const struct WS(timeval)*);
1030 1031 1032 1033 1034
#endif
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*);
1035
WS(u_long) WINAPI WS(inet_addr)(const char*);
1036
char* WINAPI WS(inet_ntoa)(struct WS(in_addr));
1037
int WINAPI WS(ioctlsocket)(SOCKET,LONG,WS(u_long)*);
1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049
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*);
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);

#endif /* !defined(__WINE_WINSOCK2__) || WS_API_PROTOTYPES */


1050
#include <poppack.h>
1051

1052
#ifdef __cplusplus
1053 1054
}
#endif
1055

1056 1057 1058 1059 1060
#ifndef __WINE_WINSOCK2__
#undef WS
#undef WS_API_PROTOTYPES
#undef WS_API_TYPEDEFS
#endif
Alexandre Julliard's avatar
Alexandre Julliard committed
1061

1062
#endif  /* _WINSOCKAPI_ */