1 /* 2 Definitions for winsock 1.1 3 4 Portions Copyright (c) 1980, 1983, 1988, 1993 5 The Regents of the University of California. All rights reserved. 6 7 Portions Copyright (c) 1993 by Digital Equipment Corporation. 8 */ 9 10 #pragma once 11 12 #define _WINSOCKAPI_ 13 14 #ifndef _INC_WINDOWS 15 #include <windows.h> 16 #endif 17 18 #if defined(__LP64__) || (!defined(_M_AMD64) && defined(__WINESRC__)) 19 #if !defined(__ROS_LONG64__) 20 #define __ROS_LONG64__ 21 #endif 22 #endif 23 24 #define _GNU_H_WINDOWS32_SOCKETS 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 #if !defined ( _BSDTYPES_DEFINED ) 31 32 /* also defined in gmon.h and in cygwin's sys/types */ 33 typedef unsigned char u_char; 34 typedef unsigned short u_short; 35 typedef unsigned int u_int; 36 37 #ifndef __ROS_LONG64__ 38 typedef unsigned long u_long; 39 #else 40 typedef unsigned int u_long; 41 #endif 42 43 #define _BSDTYPES_DEFINED 44 45 #endif /* !defined ( _BSDTYPES_DEFINED ) */ 46 47 typedef UINT_PTR SOCKET; 48 49 #ifndef FD_SETSIZE 50 #define FD_SETSIZE 64 51 #endif 52 53 /* shutdown() how types */ 54 #define SD_RECEIVE 0x00 55 #define SD_SEND 0x01 56 #define SD_BOTH 0x02 57 58 #ifndef _SYS_TYPES_FD_SET 59 60 /* fd_set may have be defined by the newlib <sys/types.h> 61 * if __USE_W32_SOCKETS not defined. 62 */ 63 #ifdef fd_set 64 #undef fd_set 65 #endif 66 typedef struct fd_set { 67 u_int fd_count; 68 SOCKET fd_array[FD_SETSIZE]; 69 } fd_set; 70 71 extern int PASCAL __WSAFDIsSet(SOCKET,fd_set FAR*); 72 73 #ifndef FD_CLR 74 #define FD_CLR(fd,set) do { u_int __i;\ 75 for (__i = 0; __i < ((fd_set FAR*)(set))->fd_count ; __i++) {\ 76 if (((fd_set FAR*)(set))->fd_array[__i] == (fd)) {\ 77 while (__i < ((fd_set FAR*)(set))->fd_count-1) {\ 78 ((fd_set FAR*)(set))->fd_array[__i] = ((fd_set FAR*)(set))->fd_array[__i+1];\ 79 __i++;\ 80 }\ 81 ((fd_set FAR*)(set))->fd_count--;\ 82 break;\ 83 }\ 84 }\ 85 } while (0) 86 #endif /* FD_CLR */ 87 88 #ifndef FD_SET 89 #define FD_SET(fd, set) do { \ 90 if (((fd_set FAR*)(set))->fd_count < FD_SETSIZE) \ 91 ((fd_set FAR*)(set))->fd_array[((fd_set FAR*)(set))->fd_count++]=(fd);\ 92 }while (0) 93 #endif 94 95 #ifndef FD_ZERO 96 #define FD_ZERO(set) (((fd_set FAR*)(set))->fd_count=0) 97 #endif 98 99 #ifndef FD_ISSET 100 #define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (fd_set FAR*)(set)) 101 #endif 102 103 104 105 #elif !defined(USE_SYS_TYPES_FD_SET) 106 #warning "fd_set and associated macros have been defined in sys/types. \ 107 This can cause runtime problems with W32 sockets" 108 #endif /* ndef _SYS_TYPES_FD_SET */ 109 110 #if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__)) 111 112 #ifndef _TIMEVAL_DEFINED /* also in sys/time.h */ 113 #define _TIMEVAL_DEFINED 114 115 struct timeval { 116 LONG tv_sec; 117 LONG tv_usec; 118 }; 119 120 #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) 121 122 #define timercmp(tvp, uvp, cmp) \ 123 (((tvp)->tv_sec != (uvp)->tv_sec) ? \ 124 ((tvp)->tv_sec cmp (uvp)->tv_sec) : \ 125 ((tvp)->tv_usec cmp (uvp)->tv_usec)) 126 127 #define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 128 129 #endif /* _TIMEVAL_DEFINED */ 130 131 #define h_addr h_addr_list[0] 132 133 struct hostent { 134 char *h_name; 135 char **h_aliases; 136 short h_addrtype; 137 short h_length; 138 char **h_addr_list; 139 }; 140 141 struct linger { 142 u_short l_onoff; 143 u_short l_linger; 144 }; 145 146 #define _IO(x,y) (IOC_VOID|((x)<<8)|(y)) 147 #define _IOR(x,y,t) (IOC_OUT|(((LONG)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y)) 148 #define _IOW(x,y,t) (IOC_IN|(((LONG)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y)) 149 #define FIONBIO _IOW('f', 126, u_long) 150 151 struct netent { 152 char * n_name; 153 char **n_aliases; 154 short n_addrtype; 155 u_long n_net; 156 }; 157 158 struct servent { 159 char *s_name; 160 char **s_aliases; 161 #ifdef _WIN64 162 char *s_proto; 163 short s_port; 164 #else 165 short s_port; 166 char *s_proto; 167 #endif 168 }; 169 170 struct protoent { 171 char *p_name; 172 char **p_aliases; 173 short p_proto; 174 }; 175 176 #define IP_OPTIONS 1 177 178 #define SO_DEBUG 1 179 #define SO_ACCEPTCONN 2 180 #define SO_REUSEADDR 4 181 #define SO_KEEPALIVE 8 182 #define SO_DONTROUTE 16 183 #define SO_BROADCAST 32 184 #define SO_USELOOPBACK 64 185 #define SO_LINGER 128 186 #define SO_OOBINLINE 256 187 #define SO_DONTLINGER (u_int)(~SO_LINGER) 188 #define SO_SNDBUF 0x1001 189 #define SO_RCVBUF 0x1002 190 #define SO_SNDLOWAT 0x1003 191 #define SO_RCVLOWAT 0x1004 192 #define SO_SNDTIMEO 0x1005 193 #define SO_RCVTIMEO 0x1006 194 #define SO_ERROR 0x1007 195 #define SO_TYPE 0x1008 196 197 #define SO_CONNDATA 0x7000 198 #define SO_CONNOPT 0x7001 199 #define SO_DISCDATA 0x7002 200 #define SO_DISCOPT 0x7003 201 #define SO_CONNDATALEN 0x7004 202 #define SO_CONNOPTLEN 0x7005 203 #define SO_DISCDATALEN 0x7006 204 #define SO_DISCOPTLEN 0x7007 205 #define SO_OPENTYPE 0x7008 206 #define SO_MAXDG 0x7009 207 #define SO_MAXPATHDG 0x700A 208 #define SO_UPDATE_ACCEPT_CONTEXT 0x700B 209 #define SO_CONNECT_TIME 0x700C 210 211 #define SO_SYNCHRONOUS_ALERT 0x10 212 #define SO_SYNCHRONOUS_NONALERT 0x20 213 214 #define AF_MAX 24 215 216 struct sockaddr { 217 u_short sa_family; 218 char sa_data[14]; 219 }; 220 221 #define MSG_OOB 1 222 #define MSG_PEEK 2 223 #define MSG_DONTROUTE 4 224 225 #define h_errno WSAGetLastError() 226 #define HOST_NOT_FOUND WSAHOST_NOT_FOUND 227 #define TRY_AGAIN WSATRY_AGAIN 228 #define NO_RECOVERY WSANO_RECOVERY 229 #define NO_DATA WSANO_DATA 230 #define NO_ADDRES WSANO_ADDRESS 231 232 u_long PASCAL htonl(u_long); 233 u_long PASCAL ntohl(u_long); 234 u_short PASCAL htons(u_short); 235 u_short PASCAL ntohs(u_short); 236 int PASCAL select(int nfds,fd_set*,fd_set*,fd_set*,const struct timeval*); 237 int PASCAL gethostname(char*,int); 238 239 #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */ 240 241 #define IOCPARM_MASK 0x7f 242 #define IOC_VOID 0x20000000 243 #define IOC_OUT 0x40000000 244 #define IOC_IN 0x80000000 245 #define IOC_INOUT (IOC_IN|IOC_OUT) 246 247 #define FIONREAD _IOR('f', 127, u_long) 248 #define FIOASYNC _IOW('f', 125, u_long) 249 #define SIOCSHIWAT _IOW('s', 0, u_long) 250 #define SIOCGHIWAT _IOR('s', 1, u_long) 251 #define SIOCSLOWAT _IOW('s', 2, u_long) 252 #define SIOCGLOWAT _IOR('s', 3, u_long) 253 #define SIOCATMARK _IOR('s', 7, u_long) 254 255 #define IPPROTO_IP 0 256 #define IPPROTO_ICMP 1 257 #define IPPROTO_IGMP 2 258 #define IPPROTO_GGP 3 259 #define IPPROTO_TCP 6 260 #define IPPROTO_PUP 12 261 #define IPPROTO_UDP 17 262 #define IPPROTO_IDP 22 263 #define IPPROTO_ND 77 264 #define IPPROTO_RAW 255 265 #define IPPROTO_MAX 256 266 #define IPPORT_ECHO 7 267 #define IPPORT_DISCARD 9 268 #define IPPORT_SYSTAT 11 269 #define IPPORT_DAYTIME 13 270 #define IPPORT_NETSTAT 15 271 #define IPPORT_FTP 21 272 #define IPPORT_TELNET 23 273 #define IPPORT_SMTP 25 274 #define IPPORT_TIMESERVER 37 275 #define IPPORT_NAMESERVER 42 276 #define IPPORT_WHOIS 43 277 #define IPPORT_MTP 57 278 #define IPPORT_TFTP 69 279 #define IPPORT_RJE 77 280 #define IPPORT_FINGER 79 281 #define IPPORT_TTYLINK 87 282 #define IPPORT_SUPDUP 95 283 #define IPPORT_EXECSERVER 512 284 #define IPPORT_LOGINSERVER 513 285 #define IPPORT_CMDSERVER 514 286 #define IPPORT_EFSSERVER 520 287 #define IPPORT_BIFFUDP 512 288 #define IPPORT_WHOSERVER 513 289 #define IPPORT_ROUTESERVER 520 290 #define IPPORT_RESERVED 1024 291 #define IMPLINK_IP 155 292 #define IMPLINK_LOWEXPER 156 293 #define IMPLINK_HIGHEXPER 158 294 295 #include <inaddr.h> 296 297 #define IN_CLASSA(i) ((LONG)(i)&0x80000000) 298 #define IN_CLASSA_NET 0xff000000 299 #define IN_CLASSA_NSHIFT 24 300 #define IN_CLASSA_HOST 0x00ffffff 301 #define IN_CLASSA_MAX 128 302 #define IN_CLASSB(i) (((LONG)(i)&0xc0000000)==0x80000000) 303 #define IN_CLASSB_NET 0xffff0000 304 #define IN_CLASSB_NSHIFT 16 305 #define IN_CLASSB_HOST 0x0000ffff 306 #define IN_CLASSB_MAX 65536 307 #define IN_CLASSC(i) (((LONG)(i)&0xe0000000)==0xc0000000) 308 #define IN_CLASSC_NET 0xffffff00 309 #define IN_CLASSC_NSHIFT 8 310 #define IN_CLASSC_HOST 0xff 311 #define INADDR_ANY (u_long)0 312 #define INADDR_LOOPBACK 0x7f000001 313 #define INADDR_BROADCAST (u_long)0xffffffff 314 #define INADDR_NONE 0xffffffff 315 316 #define WSADESCRIPTION_LEN 256 317 #define WSASYS_STATUS_LEN 128 318 319 #define IP_MULTICAST_IF 2 320 #define IP_MULTICAST_TTL 3 321 #define IP_MULTICAST_LOOP 4 322 #define IP_ADD_MEMBERSHIP 5 323 #define IP_DROP_MEMBERSHIP 6 324 #define IP_TTL 7 325 #define IP_TOS 8 326 #define IP_DONTFRAGMENT 9 327 328 #define IP_DEFAULT_MULTICAST_TTL 1 329 #define IP_DEFAULT_MULTICAST_LOOP 1 330 #define IP_MAX_MEMBERSHIPS 20 331 332 #define INVALID_SOCKET (SOCKET)(~0) 333 #define SOCKET_ERROR (-1) 334 335 #define SOCK_STREAM 1 336 #define SOCK_DGRAM 2 337 #define SOCK_RAW 3 338 #define SOCK_RDM 4 339 #define SOCK_SEQPACKET 5 340 341 #define TCP_NODELAY 0x0001 342 #define TCP_BSDURGENT 0x7000 343 344 #define AF_UNSPEC 0 345 #define AF_UNIX 1 346 #define AF_INET 2 347 #define AF_IMPLINK 3 348 #define AF_PUP 4 349 #define AF_CHAOS 5 350 #define AF_IPX 6 351 #define AF_NS 6 352 #define AF_ISO 7 353 #define AF_OSI AF_ISO 354 #define AF_ECMA 8 355 #define AF_DATAKIT 9 356 #define AF_CCITT 10 357 #define AF_SNA 11 358 #define AF_DECnet 12 359 #define AF_DLI 13 360 #define AF_LAT 14 361 #define AF_HYLINK 15 362 #define AF_APPLETALK 16 363 #define AF_NETBIOS 17 364 #define AF_VOICEVIEW 18 365 #define AF_FIREFOX 19 366 #define AF_UNKNOWN1 20 367 #define AF_BAN 21 368 #define AF_ATM 22 369 #define AF_INET6 23 370 371 #define PF_UNSPEC AF_UNSPEC 372 #define PF_UNIX AF_UNIX 373 #define PF_INET AF_INET 374 #define PF_IMPLINK AF_IMPLINK 375 #define PF_PUP AF_PUP 376 #define PF_CHAOS AF_CHAOS 377 #define PF_NS AF_NS 378 #define PF_IPX AF_IPX 379 #define PF_ISO AF_ISO 380 #define PF_OSI AF_OSI 381 #define PF_ECMA AF_ECMA 382 #define PF_DATAKIT AF_DATAKIT 383 #define PF_CCITT AF_CCITT 384 #define PF_SNA AF_SNA 385 #define PF_DECnet AF_DECnet 386 #define PF_DLI AF_DLI 387 #define PF_LAT AF_LAT 388 #define PF_HYLINK AF_HYLINK 389 #define PF_APPLETALK AF_APPLETALK 390 #define PF_VOICEVIEW AF_VOICEVIEW 391 #define PF_FIREFOX AF_FIREFOX 392 #define PF_UNKNOWN1 AF_UNKNOWN1 393 #define PF_BAN AF_BAN 394 #define PF_ATM AF_ATM 395 #define PF_INET6 AF_INET6 396 #define PF_MAX AF_MAX 397 398 #define SOL_SOCKET 0xffff 399 #define SOMAXCONN 5 400 401 #define MSG_MAXIOVLEN 16 402 #define MSG_PARTIAL 0x8000 403 #define MAXGETHOSTSTRUCT 1024 404 405 #define FD_READ 1 406 #define FD_WRITE 2 407 #define FD_OOB 4 408 #define FD_ACCEPT 8 409 #define FD_CONNECT 16 410 #define FD_CLOSE 32 411 412 #ifndef WSABASEERR 413 414 #define WSABASEERR 10000 415 #define WSAEINTR (WSABASEERR+4) 416 #define WSAEBADF (WSABASEERR+9) 417 #define WSAEACCES (WSABASEERR+13) 418 #define WSAEFAULT (WSABASEERR+14) 419 #define WSAEINVAL (WSABASEERR+22) 420 #define WSAEMFILE (WSABASEERR+24) 421 #define WSAEWOULDBLOCK (WSABASEERR+35) 422 #define WSAEINPROGRESS (WSABASEERR+36) 423 #define WSAEALREADY (WSABASEERR+37) 424 #define WSAENOTSOCK (WSABASEERR+38) 425 #define WSAEDESTADDRREQ (WSABASEERR+39) 426 #define WSAEMSGSIZE (WSABASEERR+40) 427 #define WSAEPROTOTYPE (WSABASEERR+41) 428 #define WSAENOPROTOOPT (WSABASEERR+42) 429 #define WSAEPROTONOSUPPORT (WSABASEERR+43) 430 #define WSAESOCKTNOSUPPORT (WSABASEERR+44) 431 #define WSAEOPNOTSUPP (WSABASEERR+45) 432 #define WSAEPFNOSUPPORT (WSABASEERR+46) 433 #define WSAEAFNOSUPPORT (WSABASEERR+47) 434 #define WSAEADDRINUSE (WSABASEERR+48) 435 #define WSAEADDRNOTAVAIL (WSABASEERR+49) 436 #define WSAENETDOWN (WSABASEERR+50) 437 #define WSAENETUNREACH (WSABASEERR+51) 438 #define WSAENETRESET (WSABASEERR+52) 439 #define WSAECONNABORTED (WSABASEERR+53) 440 #define WSAECONNRESET (WSABASEERR+54) 441 #define WSAENOBUFS (WSABASEERR+55) 442 #define WSAEISCONN (WSABASEERR+56) 443 #define WSAENOTCONN (WSABASEERR+57) 444 #define WSAESHUTDOWN (WSABASEERR+58) 445 #define WSAETOOMANYREFS (WSABASEERR+59) 446 #define WSAETIMEDOUT (WSABASEERR+60) 447 #define WSAECONNREFUSED (WSABASEERR+61) 448 #define WSAELOOP (WSABASEERR+62) 449 #define WSAENAMETOOLONG (WSABASEERR+63) 450 #define WSAEHOSTDOWN (WSABASEERR+64) 451 #define WSAEHOSTUNREACH (WSABASEERR+65) 452 #define WSAENOTEMPTY (WSABASEERR+66) 453 #define WSAEPROCLIM (WSABASEERR+67) 454 #define WSAEUSERS (WSABASEERR+68) 455 #define WSAEDQUOT (WSABASEERR+69) 456 #define WSAESTALE (WSABASEERR+70) 457 #define WSAEREMOTE (WSABASEERR+71) 458 #define WSASYSNOTREADY (WSABASEERR+91) 459 #define WSAVERNOTSUPPORTED (WSABASEERR+92) 460 #define WSANOTINITIALISED (WSABASEERR+93) 461 #define WSAEDISCON (WSABASEERR+101) 462 #define WSAHOST_NOT_FOUND (WSABASEERR+1001) 463 #define WSATRY_AGAIN (WSABASEERR+1002) 464 #define WSANO_RECOVERY (WSABASEERR+1003) 465 #define WSANO_DATA (WSABASEERR+1004) 466 #define WSA_SECURE_HOST_NOT_FOUND (WSABASEERR+1032) 467 #define WSA_IPSEC_NAME_POLICY_ERROR (WSABASEERR+1033) 468 469 #endif /* !WSABASEERR */ 470 471 #define WSANO_ADDRESS WSANO_DATA 472 473 #define TF_DISCONNECT 0x01 474 #define TF_REUSE_SOCKET 0x02 475 #define TF_WRITE_BEHIND 0x04 476 477 #define WSAMAKEASYNCREPLY(b,e) MAKELONG(b,e) 478 #define WSAMAKESELECTREPLY(e,error) MAKELONG(e,error) 479 #define WSAGETASYNCBUFLEN(l) LOWORD(l) 480 #define WSAGETASYNCERROR(l) HIWORD(l) 481 #define WSAGETSELECTEVENT(l) LOWORD(l) 482 #define WSAGETSELECTERROR(l) HIWORD(l) 483 484 typedef struct sockaddr SOCKADDR; 485 typedef struct sockaddr *PSOCKADDR; 486 typedef struct sockaddr *LPSOCKADDR; 487 typedef struct sockaddr_in SOCKADDR_IN; 488 typedef struct sockaddr_in *PSOCKADDR_IN; 489 typedef struct sockaddr_in *LPSOCKADDR_IN; 490 typedef struct linger LINGER; 491 typedef struct linger *PLINGER; 492 typedef struct linger *LPLINGER; 493 typedef struct fd_set FD_SET; 494 typedef struct fd_set *PFD_SET; 495 typedef struct fd_set *LPFD_SET; 496 typedef struct hostent HOSTENT; 497 typedef struct hostent *PHOSTENT; 498 typedef struct hostent *LPHOSTENT; 499 typedef struct servent SERVENT; 500 typedef struct servent *PSERVENT; 501 typedef struct servent *LPSERVENT; 502 typedef struct protoent PROTOENT; 503 typedef struct protoent *PPROTOENT; 504 typedef struct protoent *LPPROTOENT; 505 typedef struct timeval TIMEVAL; 506 typedef struct timeval *PTIMEVAL; 507 typedef struct timeval *LPTIMEVAL; 508 509 struct sockaddr_in { 510 short sin_family; 511 u_short sin_port; 512 struct in_addr sin_addr; 513 char sin_zero[8]; 514 }; 515 516 typedef struct WSAData { 517 WORD wVersion; 518 WORD wHighVersion; 519 #ifdef _WIN64 520 unsigned short iMaxSockets; 521 unsigned short iMaxUdpDg; 522 char *lpVendorInfo; 523 char szDescription[WSADESCRIPTION_LEN+1]; 524 char szSystemStatus[WSASYS_STATUS_LEN+1]; 525 #else 526 char szDescription[WSADESCRIPTION_LEN+1]; 527 char szSystemStatus[WSASYS_STATUS_LEN+1]; 528 unsigned short iMaxSockets; 529 unsigned short iMaxUdpDg; 530 char *lpVendorInfo; 531 #endif 532 } WSADATA, FAR *LPWSADATA; 533 534 struct ip_mreq { 535 struct in_addr imr_multiaddr; 536 struct in_addr imr_interface; 537 }; 538 539 struct sockproto { 540 u_short sp_family; 541 u_short sp_protocol; 542 }; 543 544 SOCKET 545 PASCAL FAR 546 accept( 547 _In_ SOCKET s, 548 _Out_writes_bytes_opt_(*addrlen) struct sockaddr FAR *addr, 549 _Inout_opt_ int FAR *addrlen); 550 551 int 552 PASCAL FAR 553 bind( 554 _In_ SOCKET s, 555 _In_reads_bytes_(namelen) const struct sockaddr FAR *addr, 556 _In_ int namelen); 557 558 int 559 PASCAL FAR 560 closesocket( 561 _In_ SOCKET s); 562 563 int 564 PASCAL FAR 565 connect( 566 _In_ SOCKET s, 567 _In_reads_bytes_(namelen) const struct sockaddr FAR *name, 568 _In_ int namelen); 569 570 int 571 PASCAL FAR 572 ioctlsocket( 573 _In_ SOCKET s, 574 _In_ long cmd, 575 _Inout_ u_long FAR *argp); 576 577 int 578 PASCAL FAR 579 getpeername( 580 _In_ SOCKET s, 581 _Out_writes_bytes_to_(*namelen, *namelen) struct sockaddr FAR *name, 582 _Inout_ int FAR *namelen); 583 584 int 585 PASCAL FAR 586 getsockname( 587 _In_ SOCKET s, 588 _Out_writes_bytes_to_(*namelen, *namelen) struct sockaddr FAR *name, 589 _Inout_ int FAR *namelen); 590 591 int 592 PASCAL FAR 593 getsockopt( 594 _In_ SOCKET s, 595 _In_ int level, 596 _In_ int optname, 597 _Out_writes_bytes_(*optlen) char FAR *optval, 598 _Inout_ int FAR *optlen); 599 600 u_long 601 PASCAL FAR 602 htonl( 603 _In_ u_long hostlong); 604 605 u_short 606 PASCAL FAR 607 htons( 608 _In_ u_short hostshort); 609 610 unsigned long 611 PASCAL FAR 612 inet_addr( 613 _In_z_ const char FAR *cp); 614 615 char FAR 616 *PASCAL FAR 617 inet_ntoa( 618 _In_ struct in_addr in); 619 620 int 621 PASCAL FAR 622 listen( 623 _In_ SOCKET s, 624 _In_ int backlog); 625 626 u_long 627 PASCAL FAR 628 ntohl( 629 _In_ u_long netlong); 630 631 u_short 632 PASCAL FAR 633 ntohs( 634 _In_ u_short netshort); 635 636 int 637 PASCAL FAR 638 recv( 639 _In_ SOCKET s, 640 _Out_writes_bytes_to_(len, return) __out_data_source(NETWORK) char FAR *buf, 641 _In_ int len, 642 _In_ int flags); 643 644 int 645 PASCAL FAR 646 recvfrom( 647 _In_ SOCKET s, 648 _Out_writes_bytes_to_(len, return) __out_data_source(NETWORK) char FAR *buf, 649 _In_ int len, 650 _In_ int flags, 651 _Out_writes_bytes_to_opt_(*fromlen, *fromlen) struct sockaddr FAR *from, 652 _Inout_opt_ int FAR * fromlen); 653 654 int 655 PASCAL FAR 656 select( 657 _In_ int nfds, 658 _Inout_opt_ fd_set FAR *readfds, 659 _Inout_opt_ fd_set FAR *writefds, 660 _Inout_opt_ fd_set FAR *exceptfds, 661 _In_opt_ const struct timeval FAR *timeout); 662 663 int 664 PASCAL FAR 665 send( 666 _In_ SOCKET s, 667 _In_reads_bytes_(len) const char FAR *buf, 668 _In_ int len, 669 _In_ int flags); 670 671 int 672 PASCAL FAR 673 sendto( 674 _In_ SOCKET s, 675 _In_reads_bytes_(len) const char FAR *buf, 676 _In_ int len, 677 _In_ int flags, 678 _In_reads_bytes_opt_(tolen) const struct sockaddr FAR *to, 679 _In_ int tolen); 680 681 int 682 PASCAL FAR 683 setsockopt( 684 _In_ SOCKET s, 685 _In_ int level, 686 _In_ int optname, 687 _In_reads_bytes_opt_(optlen) const char FAR *optval, 688 _In_ int optlen); 689 690 int 691 PASCAL FAR 692 shutdown( 693 _In_ SOCKET s, 694 _In_ int how); 695 696 SOCKET 697 PASCAL FAR 698 socket( 699 _In_ int af, 700 _In_ int type, 701 _In_ int protocol); 702 703 struct hostent FAR 704 *PASCAL FAR 705 gethostbyaddr( 706 _In_reads_bytes_(len) const char FAR *addr, 707 _In_ int len, 708 _In_ int type); 709 710 struct hostent FAR 711 *PASCAL FAR 712 gethostbyname( 713 _In_z_ const char FAR *name); 714 715 int 716 PASCAL FAR 717 gethostname( 718 _Out_writes_bytes_to_(namelen, return) char FAR *name, 719 _In_ int namelen); 720 721 struct servent FAR 722 *PASCAL FAR 723 getservbyport( 724 _In_ int port, 725 _In_z_ const char FAR *proto); 726 727 struct servent FAR 728 *PASCAL FAR 729 getservbyname( 730 _In_z_ const char FAR *name, 731 _In_z_ const char FAR *proto); 732 733 struct protoent FAR 734 *PASCAL FAR 735 getprotobynumber( 736 _In_ int number); 737 738 struct protoent FAR 739 *PASCAL FAR 740 getprotobyname( 741 _In_z_ const char FAR *name); 742 743 int 744 PASCAL FAR 745 WSAStartup( 746 _In_ WORD wVersionRequired, 747 _Out_ LPWSADATA lpWSAData); 748 749 int 750 PASCAL FAR 751 WSACleanup(void); 752 753 void 754 PASCAL FAR 755 WSASetLastError( 756 _In_ int iError); 757 758 int 759 PASCAL FAR 760 WSAGetLastError(void); 761 762 BOOL 763 PASCAL FAR 764 WSAIsBlocking(void); 765 766 int 767 PASCAL FAR 768 WSAUnhookBlockingHook(void); 769 770 FARPROC 771 PASCAL FAR 772 WSASetBlockingHook( 773 _In_ FARPROC lpBlockFunc); 774 775 int 776 PASCAL FAR 777 WSACancelBlockingCall(void); 778 779 HANDLE 780 PASCAL FAR 781 WSAAsyncGetServByName( 782 _In_ HWND hWnd, 783 _In_ u_int wMsg, 784 _In_z_ const char FAR *name, 785 _In_z_ const char FAR *proto, 786 _Out_writes_bytes_(buflen) char FAR *buf, 787 _In_ int buflen); 788 789 HANDLE 790 PASCAL FAR 791 WSAAsyncGetServByPort( 792 _In_ HWND hWnd, 793 _In_ u_int wMsg, 794 _In_ int port, 795 _In_ const char FAR *proto, 796 _Out_writes_bytes_(buflen) char FAR *buf, 797 _In_ int buflen); 798 799 HANDLE 800 PASCAL FAR 801 WSAAsyncGetProtoByName( 802 _In_ HWND hWnd, 803 _In_ u_int wMsg, 804 _In_z_ const char FAR *name, 805 _Out_writes_bytes_(buflen) char FAR *buf, 806 _In_ int buflen); 807 808 HANDLE 809 PASCAL FAR 810 WSAAsyncGetProtoByNumber( 811 _In_ HWND hWnd, 812 _In_ u_int wMsg, 813 _In_ int number, 814 _Out_writes_bytes_(buflen) char FAR *buf, 815 _In_ int buflen); 816 817 HANDLE 818 PASCAL FAR 819 WSAAsyncGetHostByName( 820 _In_ HWND hWnd, 821 _In_ u_int wMsg, 822 _In_z_ const char FAR *name, 823 _Out_writes_bytes_(buflen) char FAR *buf, 824 _In_ int buflen); 825 826 HANDLE 827 PASCAL FAR 828 WSAAsyncGetHostByAddr( 829 _In_ HWND hWnd, 830 _In_ u_int wMsg, 831 _In_ const char FAR *addr, 832 _In_ int len, 833 _In_ int type, 834 _Out_writes_bytes_(buflen) char FAR *buf, 835 _In_ int buflen); 836 837 int 838 PASCAL FAR 839 WSACancelAsyncRequest( 840 _In_ HANDLE hAsyncTaskHandle); 841 842 int 843 PASCAL FAR 844 WSAAsyncSelect( 845 _In_ SOCKET s, 846 _In_ HWND hWnd, 847 _In_ u_int wMsg, 848 _In_ long lEvent); 849 850 int 851 PASCAL FAR 852 WSARecvEx( 853 _In_ SOCKET s, 854 _Out_writes_bytes_to_(len, return) __out_data_source(NETWORK) char FAR *buf, 855 _In_ int len, 856 _Inout_ int FAR *flags); 857 858 typedef struct _TRANSMIT_FILE_BUFFERS { 859 PVOID Head; 860 DWORD HeadLength; 861 PVOID Tail; 862 DWORD TailLength; 863 } TRANSMIT_FILE_BUFFERS, *PTRANSMIT_FILE_BUFFERS, *LPTRANSMIT_FILE_BUFFERS; 864 865 BOOL 866 PASCAL FAR 867 TransmitFile( 868 _In_ SOCKET hSocket, 869 _In_ HANDLE hFile, 870 _In_ DWORD nNumberOfBytesToWrite, 871 _In_ DWORD nNumberOfBytesPerSend, 872 _Inout_opt_ LPOVERLAPPED lpOverlapped, 873 _In_opt_ LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers, 874 _In_ DWORD dwReserved); 875 876 BOOL 877 PASCAL FAR 878 AcceptEx( 879 _In_ SOCKET sListenSocket, 880 _In_ SOCKET sAcceptSocket, 881 _Out_writes_bytes_to_(dwReceiveDataLength + dwLocalAddressLength + dwRemoteAddressLength, *lpdwBytesReceived) PVOID lpOutputBuffer, 882 _In_ DWORD dwReceiveDataLength, 883 _In_ DWORD dwLocalAddressLength, 884 _In_ DWORD dwRemoteAddressLength, 885 _Out_ LPDWORD lpdwBytesReceived, 886 _Inout_ LPOVERLAPPED lpOverlapped); 887 888 VOID 889 PASCAL FAR 890 GetAcceptExSockaddrs( 891 _In_reads_bytes_(dwReceiveDataLength + dwLocalAddressLength + dwRemoteAddressLength) PVOID lpOutputBuffer, 892 _In_ DWORD dwReceiveDataLength, 893 _In_ DWORD dwLocalAddressLength, 894 _In_ DWORD dwRemoteAddressLength, 895 _Outptr_result_bytebuffer_(*LocalSockaddrLength) struct sockaddr **LocalSockaddr, 896 _Out_ LPINT LocalSockaddrLength, 897 _Outptr_result_bytebuffer_(*RemoteSockaddrLength) struct sockaddr **RemoteSockaddr, 898 _Out_ LPINT RemoteSockaddrLength); 899 900 #if(_WIN32_WINNT >= 0x0501) 901 902 #ifdef IPV6STRICT 903 #error WINSOCK2 required. 904 #endif 905 906 #endif /* (_WIN32_WINNT >= 0x0501) */ 907 908 #ifdef __cplusplus 909 } 910 #endif 911