Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3857 lines
104 KiB

  1. /* Winsock2.h -- definitions to be used with the WinSock 2 DLL and
  2. * WinSock 2 applications.
  3. *
  4. * This header file corresponds to version 2.2.x of the WinSock API
  5. * specification.
  6. *
  7. * This file includes parts which are Copyright (c) 1982-1986 Regents
  8. * of the University of California. All rights reserved. The
  9. * Berkeley Software License Agreement specifies the terms and
  10. * conditions for redistribution.
  11. */
  12. #ifndef _WINSOCK2API_
  13. #define _WINSOCK2API_
  14. #define _WINSOCKAPI_ /* Prevent inclusion of winsock.h in windows.h */
  15. /*
  16. * Ensure structures are packed consistently.
  17. * Not necessary for WIN32, it is already packed >=4 and there are
  18. * no structures in this header that have alignment requirement
  19. * higher than 4.
  20. * For WIN64 we do not have compatibility requirement because it is
  21. * not possible to mix 32/16 bit code with 64 bit code in the same
  22. * process.
  23. */
  24. #if !defined(WIN32) && !defined(_WIN64)
  25. #include <pshpack4.h>
  26. #endif
  27. /*
  28. * Default: include function prototypes, don't include function typedefs.
  29. */
  30. #ifndef INCL_WINSOCK_API_PROTOTYPES
  31. #define INCL_WINSOCK_API_PROTOTYPES 1
  32. #endif
  33. #ifndef INCL_WINSOCK_API_TYPEDEFS
  34. #define INCL_WINSOCK_API_TYPEDEFS 0
  35. #endif
  36. /*
  37. * Pull in WINDOWS.H if necessary
  38. */
  39. #ifndef _INC_WINDOWS
  40. #include <windows.h>
  41. #endif /* _INC_WINDOWS */
  42. /*
  43. * Define the current Winsock version. To build an earlier Winsock version
  44. * application redefine this value prior to including Winsock2.h.
  45. */
  46. #if !defined(MAKEWORD)
  47. #define MAKEWORD(low,high) \
  48. ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
  49. #endif
  50. #ifndef WINSOCK_VERSION
  51. #define WINSOCK_VERSION MAKEWORD(2,2)
  52. #endif
  53. /*
  54. * Establish DLL function linkage if supported by the current build
  55. * environment and not previously defined.
  56. */
  57. #ifndef WINSOCK_API_LINKAGE
  58. #ifdef DECLSPEC_IMPORT
  59. #define WINSOCK_API_LINKAGE DECLSPEC_IMPORT
  60. #else
  61. #define WINSOCK_API_LINKAGE
  62. #endif
  63. #endif
  64. #ifdef __cplusplus
  65. extern "C" {
  66. #endif
  67. /*
  68. * Basic system type definitions, taken from the BSD file sys/types.h.
  69. */
  70. typedef unsigned char u_char;
  71. typedef unsigned short u_short;
  72. typedef unsigned int u_int;
  73. typedef unsigned long u_long;
  74. typedef unsigned __int64 u_int64;
  75. /*
  76. * The new type to be used in all
  77. * instances which refer to sockets.
  78. */
  79. typedef UINT_PTR SOCKET;
  80. /*
  81. * Select uses arrays of SOCKETs. These macros manipulate such
  82. * arrays. FD_SETSIZE may be defined by the user before including
  83. * this file, but the default here should be >= 64.
  84. *
  85. * CAVEAT IMPLEMENTOR and USER: THESE MACROS AND TYPES MUST BE
  86. * INCLUDED IN WINSOCK2.H EXACTLY AS SHOWN HERE.
  87. */
  88. #ifndef FD_SETSIZE
  89. #define FD_SETSIZE 64
  90. #endif /* FD_SETSIZE */
  91. typedef struct fd_set {
  92. u_int fd_count; /* how many are SET? */
  93. SOCKET fd_array[FD_SETSIZE]; /* an array of SOCKETs */
  94. } fd_set;
  95. extern int PASCAL FAR __WSAFDIsSet(SOCKET, fd_set FAR *);
  96. #define FD_CLR(fd, set) do { \
  97. u_int __i; \
  98. for (__i = 0; __i < ((fd_set FAR *)(set))->fd_count ; __i++) { \
  99. if (((fd_set FAR *)(set))->fd_array[__i] == fd) { \
  100. while (__i < ((fd_set FAR *)(set))->fd_count-1) { \
  101. ((fd_set FAR *)(set))->fd_array[__i] = \
  102. ((fd_set FAR *)(set))->fd_array[__i+1]; \
  103. __i++; \
  104. } \
  105. ((fd_set FAR *)(set))->fd_count--; \
  106. break; \
  107. } \
  108. } \
  109. } while(0)
  110. #define FD_SET(fd, set) do { \
  111. u_int __i; \
  112. for (__i = 0; __i < ((fd_set FAR *)(set))->fd_count; __i++) { \
  113. if (((fd_set FAR *)(set))->fd_array[__i] == (fd)) { \
  114. break; \
  115. } \
  116. } \
  117. if (__i == ((fd_set FAR *)(set))->fd_count) { \
  118. if (((fd_set FAR *)(set))->fd_count < FD_SETSIZE) { \
  119. ((fd_set FAR *)(set))->fd_array[__i] = (fd); \
  120. ((fd_set FAR *)(set))->fd_count++; \
  121. } \
  122. } \
  123. } while(0)
  124. #define FD_ZERO(set) (((fd_set FAR *)(set))->fd_count=0)
  125. #define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (fd_set FAR *)(set))
  126. /*
  127. * Structure used in select() call, taken from the BSD file sys/time.h.
  128. */
  129. struct timeval {
  130. long tv_sec; /* seconds */
  131. long tv_usec; /* and microseconds */
  132. };
  133. /*
  134. * Operations on timevals.
  135. *
  136. * NB: timercmp does not work for >= or <=.
  137. */
  138. #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
  139. #define timercmp(tvp, uvp, cmp) \
  140. ((tvp)->tv_sec cmp (uvp)->tv_sec || \
  141. (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
  142. #define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
  143. /*
  144. * Commands for ioctlsocket(), taken from the BSD file fcntl.h.
  145. *
  146. *
  147. * Ioctl's have the command encoded in the lower word,
  148. * and the size of any in or out parameters in the upper
  149. * word. The high 2 bits of the upper word are used
  150. * to encode the in/out status of the parameter; for now
  151. * we restrict parameters to at most 128 bytes.
  152. */
  153. #define IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */
  154. #define IOC_VOID 0x20000000 /* no parameters */
  155. #define IOC_OUT 0x40000000 /* copy out parameters */
  156. #define IOC_IN 0x80000000 /* copy in parameters */
  157. #define IOC_INOUT (IOC_IN|IOC_OUT)
  158. /* 0x20000000 distinguishes new &
  159. old ioctl's */
  160. #define _IO(x,y) (IOC_VOID|((x)<<8)|(y))
  161. #define _IOR(x,y,t) (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
  162. #define _IOW(x,y,t) (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
  163. #define FIONREAD _IOR('f', 127, u_long) /* get # bytes to read */
  164. #define FIONBIO _IOW('f', 126, u_long) /* set/clear non-blocking i/o */
  165. #define FIOASYNC _IOW('f', 125, u_long) /* set/clear async i/o */
  166. /* Socket I/O Controls */
  167. #define SIOCSHIWAT _IOW('s', 0, u_long) /* set high watermark */
  168. #define SIOCGHIWAT _IOR('s', 1, u_long) /* get high watermark */
  169. #define SIOCSLOWAT _IOW('s', 2, u_long) /* set low watermark */
  170. #define SIOCGLOWAT _IOR('s', 3, u_long) /* get low watermark */
  171. #define SIOCATMARK _IOR('s', 7, u_long) /* at oob mark? */
  172. /*
  173. * Structures returned by network data base library, taken from the
  174. * BSD file netdb.h. All addresses are supplied in host order, and
  175. * returned in network order (suitable for use in system calls).
  176. */
  177. struct hostent {
  178. char FAR * h_name; /* official name of host */
  179. char FAR * FAR * h_aliases; /* alias list */
  180. short h_addrtype; /* host address type */
  181. short h_length; /* length of address */
  182. char FAR * FAR * h_addr_list; /* list of addresses */
  183. #define h_addr h_addr_list[0] /* address, for backward compat */
  184. };
  185. /*
  186. * It is assumed here that a network number
  187. * fits in 32 bits.
  188. */
  189. struct netent {
  190. char FAR * n_name; /* official name of net */
  191. char FAR * FAR * n_aliases; /* alias list */
  192. short n_addrtype; /* net address type */
  193. u_long n_net; /* network # */
  194. };
  195. struct servent {
  196. char FAR * s_name; /* official service name */
  197. char FAR * FAR * s_aliases; /* alias list */
  198. #ifdef _WIN64
  199. char FAR * s_proto; /* protocol to use */
  200. short s_port; /* port # */
  201. #else
  202. short s_port; /* port # */
  203. char FAR * s_proto; /* protocol to use */
  204. #endif
  205. };
  206. struct protoent {
  207. char FAR * p_name; /* official protocol name */
  208. char FAR * FAR * p_aliases; /* alias list */
  209. short p_proto; /* protocol # */
  210. };
  211. /*
  212. * Constants and structures defined by the internet system,
  213. * Per RFC 790, September 1981, taken from the BSD file netinet/in.h.
  214. * IPv6 additions per RFC 2292.
  215. */
  216. /*
  217. * Protocols
  218. */
  219. #define IPPROTO_IP 0 /* dummy for IP */
  220. #define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */
  221. #define IPPROTO_ICMP 1 /* control message protocol */
  222. #define IPPROTO_IGMP 2 /* internet group management protocol */
  223. #define IPPROTO_GGP 3 /* gateway^2 (deprecated) */
  224. #define IPPROTO_IPV4 4 /* IPv4 */
  225. #define IPPROTO_TCP 6 /* tcp */
  226. #define IPPROTO_PUP 12 /* pup */
  227. #define IPPROTO_UDP 17 /* user datagram protocol */
  228. #define IPPROTO_IDP 22 /* xns idp */
  229. #define IPPROTO_IPV6 41 /* IPv6 */
  230. #define IPPROTO_ROUTING 43 /* IPv6 routing header */
  231. #define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */
  232. #define IPPROTO_ESP 50 /* IPsec ESP header */
  233. #define IPPROTO_AH 51 /* IPsec AH */
  234. #define IPPROTO_ICMPV6 58 /* ICMPv6 */
  235. #define IPPROTO_NONE 59 /* IPv6 no next header */
  236. #define IPPROTO_DSTOPTS 60 /* IPv6 destination options */
  237. #define IPPROTO_ND 77 /* UNOFFICIAL net disk proto */
  238. #define IPPROTO_ICLFXBM 78
  239. #define IPPROTO_RAW 255 /* raw IP packet */
  240. #define IPPROTO_MAX 256
  241. /*
  242. * Port/socket numbers: network standard functions
  243. */
  244. #define IPPORT_ECHO 7
  245. #define IPPORT_DISCARD 9
  246. #define IPPORT_SYSTAT 11
  247. #define IPPORT_DAYTIME 13
  248. #define IPPORT_NETSTAT 15
  249. #define IPPORT_FTP 21
  250. #define IPPORT_TELNET 23
  251. #define IPPORT_SMTP 25
  252. #define IPPORT_TIMESERVER 37
  253. #define IPPORT_NAMESERVER 42
  254. #define IPPORT_WHOIS 43
  255. #define IPPORT_MTP 57
  256. /*
  257. * Port/socket numbers: host specific functions
  258. */
  259. #define IPPORT_TFTP 69
  260. #define IPPORT_RJE 77
  261. #define IPPORT_FINGER 79
  262. #define IPPORT_TTYLINK 87
  263. #define IPPORT_SUPDUP 95
  264. /*
  265. * UNIX TCP sockets
  266. */
  267. #define IPPORT_EXECSERVER 512
  268. #define IPPORT_LOGINSERVER 513
  269. #define IPPORT_CMDSERVER 514
  270. #define IPPORT_EFSSERVER 520
  271. /*
  272. * UNIX UDP sockets
  273. */
  274. #define IPPORT_BIFFUDP 512
  275. #define IPPORT_WHOSERVER 513
  276. #define IPPORT_ROUTESERVER 520
  277. /* 520+1 also used */
  278. /*
  279. * Ports < IPPORT_RESERVED are reserved for
  280. * privileged processes (e.g. root).
  281. */
  282. #define IPPORT_RESERVED 1024
  283. /*
  284. * Link numbers
  285. */
  286. #define IMPLINK_IP 155
  287. #define IMPLINK_LOWEXPER 156
  288. #define IMPLINK_HIGHEXPER 158
  289. #ifndef s_addr
  290. /*
  291. * Internet address (old style... should be updated)
  292. */
  293. struct in_addr {
  294. union {
  295. struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
  296. struct { u_short s_w1,s_w2; } S_un_w;
  297. u_long S_addr;
  298. } S_un;
  299. #define s_addr S_un.S_addr
  300. /* can be used for most tcp & ip code */
  301. #define s_host S_un.S_un_b.s_b2
  302. /* host on imp */
  303. #define s_net S_un.S_un_b.s_b1
  304. /* network */
  305. #define s_imp S_un.S_un_w.s_w2
  306. /* imp */
  307. #define s_impno S_un.S_un_b.s_b4
  308. /* imp # */
  309. #define s_lh S_un.S_un_b.s_b3
  310. /* logical host */
  311. };
  312. #endif
  313. /*
  314. * Definitions of bits in internet address integers.
  315. * On subnets, the decomposition of addresses to host and net parts
  316. * is done according to subnet mask, not the masks here.
  317. */
  318. #define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0)
  319. #define IN_CLASSA_NET 0xff000000
  320. #define IN_CLASSA_NSHIFT 24
  321. #define IN_CLASSA_HOST 0x00ffffff
  322. #define IN_CLASSA_MAX 128
  323. #define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000)
  324. #define IN_CLASSB_NET 0xffff0000
  325. #define IN_CLASSB_NSHIFT 16
  326. #define IN_CLASSB_HOST 0x0000ffff
  327. #define IN_CLASSB_MAX 65536
  328. #define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000)
  329. #define IN_CLASSC_NET 0xffffff00
  330. #define IN_CLASSC_NSHIFT 8
  331. #define IN_CLASSC_HOST 0x000000ff
  332. #define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000)
  333. #define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */
  334. #define IN_CLASSD_NSHIFT 28 /* net and host fields, but */
  335. #define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */
  336. #define IN_MULTICAST(i) IN_CLASSD(i)
  337. #define INADDR_ANY (u_long)0x00000000
  338. #define INADDR_LOOPBACK 0x7f000001
  339. #define INADDR_BROADCAST (u_long)0xffffffff
  340. #define INADDR_NONE 0xffffffff
  341. #define ADDR_ANY INADDR_ANY
  342. /*
  343. * Socket address, internet style.
  344. */
  345. struct sockaddr_in {
  346. short sin_family;
  347. u_short sin_port;
  348. struct in_addr sin_addr;
  349. char sin_zero[8];
  350. };
  351. #define WSADESCRIPTION_LEN 256
  352. #define WSASYS_STATUS_LEN 128
  353. typedef struct WSAData {
  354. WORD wVersion;
  355. WORD wHighVersion;
  356. #ifdef _WIN64
  357. unsigned short iMaxSockets;
  358. unsigned short iMaxUdpDg;
  359. char FAR * lpVendorInfo;
  360. char szDescription[WSADESCRIPTION_LEN+1];
  361. char szSystemStatus[WSASYS_STATUS_LEN+1];
  362. #else
  363. char szDescription[WSADESCRIPTION_LEN+1];
  364. char szSystemStatus[WSASYS_STATUS_LEN+1];
  365. unsigned short iMaxSockets;
  366. unsigned short iMaxUdpDg;
  367. char FAR * lpVendorInfo;
  368. #endif
  369. } WSADATA, FAR * LPWSADATA;
  370. /*
  371. * Definitions related to sockets: types, address families, options,
  372. * taken from the BSD file sys/socket.h.
  373. */
  374. /*
  375. * This is used instead of -1, since the
  376. * SOCKET type is unsigned.
  377. */
  378. #define INVALID_SOCKET (SOCKET)(~0)
  379. #define SOCKET_ERROR (-1)
  380. /*
  381. * The following may be used in place of the address family, socket type, or
  382. * protocol in a call to WSASocket to indicate that the corresponding value
  383. * should be taken from the supplied WSAPROTOCOL_INFO structure instead of the
  384. * parameter itself.
  385. */
  386. #define FROM_PROTOCOL_INFO (-1)
  387. /*
  388. * Types
  389. */
  390. #define SOCK_STREAM 1 /* stream socket */
  391. #define SOCK_DGRAM 2 /* datagram socket */
  392. #define SOCK_RAW 3 /* raw-protocol interface */
  393. #define SOCK_RDM 4 /* reliably-delivered message */
  394. #define SOCK_SEQPACKET 5 /* sequenced packet stream */
  395. /*
  396. * Option flags per-socket.
  397. */
  398. #define SO_DEBUG 0x0001 /* turn on debugging info recording */
  399. #define SO_ACCEPTCONN 0x0002 /* socket has had listen() */
  400. #define SO_REUSEADDR 0x0004 /* allow local address reuse */
  401. #define SO_KEEPALIVE 0x0008 /* keep connections alive */
  402. #define SO_DONTROUTE 0x0010 /* just use interface addresses */
  403. #define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */
  404. #define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */
  405. #define SO_LINGER 0x0080 /* linger on close if data present */
  406. #define SO_OOBINLINE 0x0100 /* leave received OOB data in line */
  407. #define SO_DONTLINGER (int)(~SO_LINGER)
  408. #define SO_EXCLUSIVEADDRUSE ((int)(~SO_REUSEADDR)) /* disallow local address reuse */
  409. /*
  410. * Additional options.
  411. */
  412. #define SO_SNDBUF 0x1001 /* send buffer size */
  413. #define SO_RCVBUF 0x1002 /* receive buffer size */
  414. #define SO_SNDLOWAT 0x1003 /* send low-water mark */
  415. #define SO_RCVLOWAT 0x1004 /* receive low-water mark */
  416. #define SO_SNDTIMEO 0x1005 /* send timeout */
  417. #define SO_RCVTIMEO 0x1006 /* receive timeout */
  418. #define SO_ERROR 0x1007 /* get error status and clear */
  419. #define SO_TYPE 0x1008 /* get socket type */
  420. /*
  421. * WinSock 2 extension -- new options
  422. */
  423. #define SO_GROUP_ID 0x2001 /* ID of a socket group */
  424. #define SO_GROUP_PRIORITY 0x2002 /* the relative priority within a group*/
  425. #define SO_MAX_MSG_SIZE 0x2003 /* maximum message size */
  426. #define SO_PROTOCOL_INFOA 0x2004 /* WSAPROTOCOL_INFOA structure */
  427. #define SO_PROTOCOL_INFOW 0x2005 /* WSAPROTOCOL_INFOW structure */
  428. #ifdef UNICODE
  429. #define SO_PROTOCOL_INFO SO_PROTOCOL_INFOW
  430. #else
  431. #define SO_PROTOCOL_INFO SO_PROTOCOL_INFOA
  432. #endif /* UNICODE */
  433. #define PVD_CONFIG 0x3001 /* configuration info for service provider */
  434. #define SO_CONDITIONAL_ACCEPT 0x3002 /* enable true conditional accept: */
  435. /* connection is not ack-ed to the */
  436. /* other side until conditional */
  437. /* function returns CF_ACCEPT */
  438. /*
  439. * TCP options.
  440. */
  441. #define TCP_NODELAY 0x0001
  442. /*
  443. * Address families.
  444. */
  445. #define AF_UNSPEC 0 /* unspecified */
  446. /*
  447. * Although AF_UNSPEC is defined for backwards compatibility, using
  448. * AF_UNSPEC for the "af" parameter when creating a socket is STRONGLY
  449. * DISCOURAGED. The interpretation of the "protocol" parameter
  450. * depends on the actual address family chosen. As environments grow
  451. * to include more and more address families that use overlapping
  452. * protocol values there is more and more chance of choosing an
  453. * undesired address family when AF_UNSPEC is used.
  454. */
  455. #define AF_UNIX 1 /* local to host (pipes, portals) */
  456. #define AF_INET 2 /* internetwork: UDP, TCP, etc. */
  457. #define AF_IMPLINK 3 /* arpanet imp addresses */
  458. #define AF_PUP 4 /* pup protocols: e.g. BSP */
  459. #define AF_CHAOS 5 /* mit CHAOS protocols */
  460. #define AF_NS 6 /* XEROX NS protocols */
  461. #define AF_IPX AF_NS /* IPX protocols: IPX, SPX, etc. */
  462. #define AF_ISO 7 /* ISO protocols */
  463. #define AF_OSI AF_ISO /* OSI is ISO */
  464. #define AF_ECMA 8 /* european computer manufacturers */
  465. #define AF_DATAKIT 9 /* datakit protocols */
  466. #define AF_CCITT 10 /* CCITT protocols, X.25 etc */
  467. #define AF_SNA 11 /* IBM SNA */
  468. #define AF_DECnet 12 /* DECnet */
  469. #define AF_DLI 13 /* Direct data link interface */
  470. #define AF_LAT 14 /* LAT */
  471. #define AF_HYLINK 15 /* NSC Hyperchannel */
  472. #define AF_APPLETALK 16 /* AppleTalk */
  473. #define AF_NETBIOS 17 /* NetBios-style addresses */
  474. #define AF_VOICEVIEW 18 /* VoiceView */
  475. #define AF_FIREFOX 19 /* Protocols from Firefox */
  476. #define AF_UNKNOWN1 20 /* Somebody is using this! */
  477. #define AF_BAN 21 /* Banyan */
  478. #define AF_ATM 22 /* Native ATM Services */
  479. #define AF_INET6 23 /* Internetwork Version 6 */
  480. #define AF_CLUSTER 24 /* Microsoft Wolfpack */
  481. #define AF_12844 25 /* IEEE 1284.4 WG AF */
  482. #define AF_IRDA 26 /* IrDA */
  483. #define AF_NETDES 28 /* Network Designers OSI & gateway
  484. enabled protocols */
  485. #define AF_TCNPROCESS 29
  486. #define AF_TCNMESSAGE 30
  487. #define AF_ICLFXBM 31
  488. #define AF_MAX 32
  489. /*
  490. * Structure used by kernel to store most
  491. * addresses.
  492. */
  493. struct sockaddr {
  494. u_short sa_family; /* address family */
  495. char sa_data[14]; /* up to 14 bytes of direct address */
  496. };
  497. /*
  498. * Portable socket structure (RFC 2553).
  499. */
  500. /*
  501. * Desired design of maximum size and alignment.
  502. * These are implementation specific.
  503. */
  504. #define _SS_MAXSIZE 128 // Maximum size.
  505. #define _SS_ALIGNSIZE (sizeof(__int64)) // Desired alignment.
  506. /*
  507. * Definitions used for sockaddr_storage structure paddings design.
  508. */
  509. #define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof (short))
  510. #define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (short) + _SS_PAD1SIZE \
  511. + _SS_ALIGNSIZE))
  512. struct sockaddr_storage {
  513. short ss_family; // Address family.
  514. char __ss_pad1[_SS_PAD1SIZE]; // 6 byte pad, this is to make
  515. // implementation specific pad up to
  516. // alignment field that follows explicit
  517. // in the data structure.
  518. __int64 __ss_align; // Field to force desired structure.
  519. char __ss_pad2[_SS_PAD2SIZE]; // 112 byte pad to achieve desired size;
  520. // _SS_MAXSIZE value minus size of
  521. // ss_family, __ss_pad1, and
  522. // __ss_align fields is 112.
  523. };
  524. /*
  525. * Structure used by kernel to pass protocol
  526. * information in raw sockets.
  527. */
  528. struct sockproto {
  529. u_short sp_family; /* address family */
  530. u_short sp_protocol; /* protocol */
  531. };
  532. /*
  533. * Protocol families, same as address families for now.
  534. */
  535. #define PF_UNSPEC AF_UNSPEC
  536. #define PF_UNIX AF_UNIX
  537. #define PF_INET AF_INET
  538. #define PF_IMPLINK AF_IMPLINK
  539. #define PF_PUP AF_PUP
  540. #define PF_CHAOS AF_CHAOS
  541. #define PF_NS AF_NS
  542. #define PF_IPX AF_IPX
  543. #define PF_ISO AF_ISO
  544. #define PF_OSI AF_OSI
  545. #define PF_ECMA AF_ECMA
  546. #define PF_DATAKIT AF_DATAKIT
  547. #define PF_CCITT AF_CCITT
  548. #define PF_SNA AF_SNA
  549. #define PF_DECnet AF_DECnet
  550. #define PF_DLI AF_DLI
  551. #define PF_LAT AF_LAT
  552. #define PF_HYLINK AF_HYLINK
  553. #define PF_APPLETALK AF_APPLETALK
  554. #define PF_VOICEVIEW AF_VOICEVIEW
  555. #define PF_FIREFOX AF_FIREFOX
  556. #define PF_UNKNOWN1 AF_UNKNOWN1
  557. #define PF_BAN AF_BAN
  558. #define PF_ATM AF_ATM
  559. #define PF_INET6 AF_INET6
  560. #define PF_MAX AF_MAX
  561. /*
  562. * Structure used for manipulating linger option.
  563. */
  564. struct linger {
  565. u_short l_onoff; /* option on/off */
  566. u_short l_linger; /* linger time */
  567. };
  568. /*
  569. * Level number for (get/set)sockopt() to apply to socket itself.
  570. */
  571. #define SOL_SOCKET 0xffff /* options for socket level */
  572. /*
  573. * Maximum queue length specifiable by listen.
  574. */
  575. #define SOMAXCONN 0x7fffffff
  576. #define MSG_OOB 0x1 /* process out-of-band data */
  577. #define MSG_PEEK 0x2 /* peek at incoming message */
  578. #define MSG_DONTROUTE 0x4 /* send without using routing tables */
  579. #define MSG_PARTIAL 0x8000 /* partial send or recv for message xport */
  580. /*
  581. * WinSock 2 extension -- new flags for WSASend(), WSASendTo(), WSARecv() and
  582. * WSARecvFrom()
  583. */
  584. #define MSG_INTERRUPT 0x10 /* send/recv in the interrupt context */
  585. #define MSG_MAXIOVLEN 16
  586. /*
  587. * Define constant based on rfc883, used by gethostbyxxxx() calls.
  588. */
  589. #define MAXGETHOSTSTRUCT 1024
  590. /*
  591. * WinSock 2 extension -- bit values and indices for FD_XXX network events
  592. */
  593. #define FD_READ_BIT 0
  594. #define FD_READ (1 << FD_READ_BIT)
  595. #define FD_WRITE_BIT 1
  596. #define FD_WRITE (1 << FD_WRITE_BIT)
  597. #define FD_OOB_BIT 2
  598. #define FD_OOB (1 << FD_OOB_BIT)
  599. #define FD_ACCEPT_BIT 3
  600. #define FD_ACCEPT (1 << FD_ACCEPT_BIT)
  601. #define FD_CONNECT_BIT 4
  602. #define FD_CONNECT (1 << FD_CONNECT_BIT)
  603. #define FD_CLOSE_BIT 5
  604. #define FD_CLOSE (1 << FD_CLOSE_BIT)
  605. #define FD_QOS_BIT 6
  606. #define FD_QOS (1 << FD_QOS_BIT)
  607. #define FD_GROUP_QOS_BIT 7
  608. #define FD_GROUP_QOS (1 << FD_GROUP_QOS_BIT)
  609. #define FD_ROUTING_INTERFACE_CHANGE_BIT 8
  610. #define FD_ROUTING_INTERFACE_CHANGE (1 << FD_ROUTING_INTERFACE_CHANGE_BIT)
  611. #define FD_ADDRESS_LIST_CHANGE_BIT 9
  612. #define FD_ADDRESS_LIST_CHANGE (1 << FD_ADDRESS_LIST_CHANGE_BIT)
  613. #define FD_MAX_EVENTS 10
  614. #define FD_ALL_EVENTS ((1 << FD_MAX_EVENTS) - 1)
  615. /*
  616. * WinSock error codes are also defined in winerror.h
  617. * Hence the IFDEF.
  618. */
  619. #ifndef WSABASEERR
  620. /*
  621. * All Windows Sockets error constants are biased by WSABASEERR from
  622. * the "normal"
  623. */
  624. #define WSABASEERR 10000
  625. /*
  626. * Windows Sockets definitions of regular Microsoft C error constants
  627. */
  628. #define WSAEINTR (WSABASEERR+4)
  629. #define WSAEBADF (WSABASEERR+9)
  630. #define WSAEACCES (WSABASEERR+13)
  631. #define WSAEFAULT (WSABASEERR+14)
  632. #define WSAEINVAL (WSABASEERR+22)
  633. #define WSAEMFILE (WSABASEERR+24)
  634. /*
  635. * Windows Sockets definitions of regular Berkeley error constants
  636. */
  637. #define WSAEWOULDBLOCK (WSABASEERR+35)
  638. #define WSAEINPROGRESS (WSABASEERR+36)
  639. #define WSAEALREADY (WSABASEERR+37)
  640. #define WSAENOTSOCK (WSABASEERR+38)
  641. #define WSAEDESTADDRREQ (WSABASEERR+39)
  642. #define WSAEMSGSIZE (WSABASEERR+40)
  643. #define WSAEPROTOTYPE (WSABASEERR+41)
  644. #define WSAENOPROTOOPT (WSABASEERR+42)
  645. #define WSAEPROTONOSUPPORT (WSABASEERR+43)
  646. #define WSAESOCKTNOSUPPORT (WSABASEERR+44)
  647. #define WSAEOPNOTSUPP (WSABASEERR+45)
  648. #define WSAEPFNOSUPPORT (WSABASEERR+46)
  649. #define WSAEAFNOSUPPORT (WSABASEERR+47)
  650. #define WSAEADDRINUSE (WSABASEERR+48)
  651. #define WSAEADDRNOTAVAIL (WSABASEERR+49)
  652. #define WSAENETDOWN (WSABASEERR+50)
  653. #define WSAENETUNREACH (WSABASEERR+51)
  654. #define WSAENETRESET (WSABASEERR+52)
  655. #define WSAECONNABORTED (WSABASEERR+53)
  656. #define WSAECONNRESET (WSABASEERR+54)
  657. #define WSAENOBUFS (WSABASEERR+55)
  658. #define WSAEISCONN (WSABASEERR+56)
  659. #define WSAENOTCONN (WSABASEERR+57)
  660. #define WSAESHUTDOWN (WSABASEERR+58)
  661. #define WSAETOOMANYREFS (WSABASEERR+59)
  662. #define WSAETIMEDOUT (WSABASEERR+60)
  663. #define WSAECONNREFUSED (WSABASEERR+61)
  664. #define WSAELOOP (WSABASEERR+62)
  665. #define WSAENAMETOOLONG (WSABASEERR+63)
  666. #define WSAEHOSTDOWN (WSABASEERR+64)
  667. #define WSAEHOSTUNREACH (WSABASEERR+65)
  668. #define WSAENOTEMPTY (WSABASEERR+66)
  669. #define WSAEPROCLIM (WSABASEERR+67)
  670. #define WSAEUSERS (WSABASEERR+68)
  671. #define WSAEDQUOT (WSABASEERR+69)
  672. #define WSAESTALE (WSABASEERR+70)
  673. #define WSAEREMOTE (WSABASEERR+71)
  674. /*
  675. * Extended Windows Sockets error constant definitions
  676. */
  677. #define WSASYSNOTREADY (WSABASEERR+91)
  678. #define WSAVERNOTSUPPORTED (WSABASEERR+92)
  679. #define WSANOTINITIALISED (WSABASEERR+93)
  680. #define WSAEDISCON (WSABASEERR+101)
  681. #define WSAENOMORE (WSABASEERR+102)
  682. #define WSAECANCELLED (WSABASEERR+103)
  683. #define WSAEINVALIDPROCTABLE (WSABASEERR+104)
  684. #define WSAEINVALIDPROVIDER (WSABASEERR+105)
  685. #define WSAEPROVIDERFAILEDINIT (WSABASEERR+106)
  686. #define WSASYSCALLFAILURE (WSABASEERR+107)
  687. #define WSASERVICE_NOT_FOUND (WSABASEERR+108)
  688. #define WSATYPE_NOT_FOUND (WSABASEERR+109)
  689. #define WSA_E_NO_MORE (WSABASEERR+110)
  690. #define WSA_E_CANCELLED (WSABASEERR+111)
  691. #define WSAEREFUSED (WSABASEERR+112)
  692. /*
  693. * Error return codes from gethostbyname() and gethostbyaddr()
  694. * (when using the resolver). Note that these errors are
  695. * retrieved via WSAGetLastError() and must therefore follow
  696. * the rules for avoiding clashes with error numbers from
  697. * specific implementations or language run-time systems.
  698. * For this reason the codes are based at WSABASEERR+1001.
  699. * Note also that [WSA]NO_ADDRESS is defined only for
  700. * compatibility purposes.
  701. */
  702. /* Authoritative Answer: Host not found */
  703. #define WSAHOST_NOT_FOUND (WSABASEERR+1001)
  704. /* Non-Authoritative: Host not found, or SERVERFAIL */
  705. #define WSATRY_AGAIN (WSABASEERR+1002)
  706. /* Non-recoverable errors, FORMERR, REFUSED, NOTIMP */
  707. #define WSANO_RECOVERY (WSABASEERR+1003)
  708. /* Valid name, no data record of requested type */
  709. #define WSANO_DATA (WSABASEERR+1004)
  710. /*
  711. * Define QOS related error return codes
  712. *
  713. */
  714. #define WSA_QOS_RECEIVERS (WSABASEERR + 1005)
  715. /* at least one Reserve has arrived */
  716. #define WSA_QOS_SENDERS (WSABASEERR + 1006)
  717. /* at least one Path has arrived */
  718. #define WSA_QOS_NO_SENDERS (WSABASEERR + 1007)
  719. /* there are no senders */
  720. #define WSA_QOS_NO_RECEIVERS (WSABASEERR + 1008)
  721. /* there are no receivers */
  722. #define WSA_QOS_REQUEST_CONFIRMED (WSABASEERR + 1009)
  723. /* Reserve has been confirmed */
  724. #define WSA_QOS_ADMISSION_FAILURE (WSABASEERR + 1010)
  725. /* error due to lack of resources */
  726. #define WSA_QOS_POLICY_FAILURE (WSABASEERR + 1011)
  727. /* rejected for administrative reasons - bad credentials */
  728. #define WSA_QOS_BAD_STYLE (WSABASEERR + 1012)
  729. /* unknown or conflicting style */
  730. #define WSA_QOS_BAD_OBJECT (WSABASEERR + 1013)
  731. /* problem with some part of the filterspec or providerspecific
  732. * buffer in general */
  733. #define WSA_QOS_TRAFFIC_CTRL_ERROR (WSABASEERR + 1014)
  734. /* problem with some part of the flowspec */
  735. #define WSA_QOS_GENERIC_ERROR (WSABASEERR + 1015)
  736. /* general error */
  737. #define WSA_QOS_ESERVICETYPE (WSABASEERR + 1016)
  738. /* invalid service type in flowspec */
  739. #define WSA_QOS_EFLOWSPEC (WSABASEERR + 1017)
  740. /* invalid flowspec */
  741. #define WSA_QOS_EPROVSPECBUF (WSABASEERR + 1018)
  742. /* invalid provider specific buffer */
  743. #define WSA_QOS_EFILTERSTYLE (WSABASEERR + 1019)
  744. /* invalid filter style */
  745. #define WSA_QOS_EFILTERTYPE (WSABASEERR + 1020)
  746. /* invalid filter type */
  747. #define WSA_QOS_EFILTERCOUNT (WSABASEERR + 1021)
  748. /* incorrect number of filters */
  749. #define WSA_QOS_EOBJLENGTH (WSABASEERR + 1022)
  750. /* invalid object length */
  751. #define WSA_QOS_EFLOWCOUNT (WSABASEERR + 1023)
  752. /* incorrect number of flows */
  753. #define WSA_QOS_EUNKOWNPSOBJ (WSABASEERR + 1024)
  754. /* unknown object in provider specific buffer */
  755. #define WSA_QOS_EPOLICYOBJ (WSABASEERR + 1025)
  756. /* invalid policy object in provider specific buffer */
  757. #define WSA_QOS_EFLOWDESC (WSABASEERR + 1026)
  758. /* invalid flow descriptor in the list */
  759. #define WSA_QOS_EPSFLOWSPEC (WSABASEERR + 1027)
  760. /* inconsistent flow spec in provider specific buffer */
  761. #define WSA_QOS_EPSFILTERSPEC (WSABASEERR + 1028)
  762. /* invalid filter spec in provider specific buffer */
  763. #define WSA_QOS_ESDMODEOBJ (WSABASEERR + 1029)
  764. /* invalid shape discard mode object in provider specific buffer */
  765. #define WSA_QOS_ESHAPERATEOBJ (WSABASEERR + 1030)
  766. /* invalid shaping rate object in provider specific buffer */
  767. #define WSA_QOS_RESERVED_PETYPE (WSABASEERR + 1031)
  768. /* reserved policy element in provider specific buffer */
  769. /*
  770. * WinSock error codes are also defined in winerror.h
  771. * Hence the IFDEF.
  772. */
  773. #endif /* ifdef WSABASEERR */
  774. /*
  775. * Compatibility macros.
  776. */
  777. #define h_errno WSAGetLastError()
  778. #define HOST_NOT_FOUND WSAHOST_NOT_FOUND
  779. #define TRY_AGAIN WSATRY_AGAIN
  780. #define NO_RECOVERY WSANO_RECOVERY
  781. #define NO_DATA WSANO_DATA
  782. /* no address, look for MX record */
  783. #define WSANO_ADDRESS WSANO_DATA
  784. #define NO_ADDRESS WSANO_ADDRESS
  785. /*
  786. * Windows Sockets errors redefined as regular Berkeley error constants.
  787. * These are commented out in Windows NT to avoid conflicts with errno.h.
  788. * Use the WSA constants instead.
  789. */
  790. #if 0
  791. #define EWOULDBLOCK WSAEWOULDBLOCK
  792. #define EINPROGRESS WSAEINPROGRESS
  793. #define EALREADY WSAEALREADY
  794. #define ENOTSOCK WSAENOTSOCK
  795. #define EDESTADDRREQ WSAEDESTADDRREQ
  796. #define EMSGSIZE WSAEMSGSIZE
  797. #define EPROTOTYPE WSAEPROTOTYPE
  798. #define ENOPROTOOPT WSAENOPROTOOPT
  799. #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
  800. #define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
  801. #define EOPNOTSUPP WSAEOPNOTSUPP
  802. #define EPFNOSUPPORT WSAEPFNOSUPPORT
  803. #define EAFNOSUPPORT WSAEAFNOSUPPORT
  804. #define EADDRINUSE WSAEADDRINUSE
  805. #define EADDRNOTAVAIL WSAEADDRNOTAVAIL
  806. #define ENETDOWN WSAENETDOWN
  807. #define ENETUNREACH WSAENETUNREACH
  808. #define ENETRESET WSAENETRESET
  809. #define ECONNABORTED WSAECONNABORTED
  810. #define ECONNRESET WSAECONNRESET
  811. #define ENOBUFS WSAENOBUFS
  812. #define EISCONN WSAEISCONN
  813. #define ENOTCONN WSAENOTCONN
  814. #define ESHUTDOWN WSAESHUTDOWN
  815. #define ETOOMANYREFS WSAETOOMANYREFS
  816. #define ETIMEDOUT WSAETIMEDOUT
  817. #define ECONNREFUSED WSAECONNREFUSED
  818. #define ELOOP WSAELOOP
  819. #define ENAMETOOLONG WSAENAMETOOLONG
  820. #define EHOSTDOWN WSAEHOSTDOWN
  821. #define EHOSTUNREACH WSAEHOSTUNREACH
  822. #define ENOTEMPTY WSAENOTEMPTY
  823. #define EPROCLIM WSAEPROCLIM
  824. #define EUSERS WSAEUSERS
  825. #define EDQUOT WSAEDQUOT
  826. #define ESTALE WSAESTALE
  827. #define EREMOTE WSAEREMOTE
  828. #endif
  829. /*
  830. * WinSock 2 extension -- new error codes and type definition
  831. */
  832. #ifdef WIN32
  833. #define WSAAPI FAR PASCAL
  834. #define WSAEVENT HANDLE
  835. #define LPWSAEVENT LPHANDLE
  836. #define WSAOVERLAPPED OVERLAPPED
  837. typedef struct _OVERLAPPED * LPWSAOVERLAPPED;
  838. #define WSA_IO_PENDING (ERROR_IO_PENDING)
  839. #define WSA_IO_INCOMPLETE (ERROR_IO_INCOMPLETE)
  840. #define WSA_INVALID_HANDLE (ERROR_INVALID_HANDLE)
  841. #define WSA_INVALID_PARAMETER (ERROR_INVALID_PARAMETER)
  842. #define WSA_NOT_ENOUGH_MEMORY (ERROR_NOT_ENOUGH_MEMORY)
  843. #define WSA_OPERATION_ABORTED (ERROR_OPERATION_ABORTED)
  844. #define WSA_INVALID_EVENT ((WSAEVENT)NULL)
  845. #define WSA_MAXIMUM_WAIT_EVENTS (MAXIMUM_WAIT_OBJECTS)
  846. #define WSA_WAIT_FAILED (WAIT_FAILED)
  847. #define WSA_WAIT_EVENT_0 (WAIT_OBJECT_0)
  848. #define WSA_WAIT_IO_COMPLETION (WAIT_IO_COMPLETION)
  849. #define WSA_WAIT_TIMEOUT (WAIT_TIMEOUT)
  850. #define WSA_INFINITE (INFINITE)
  851. #else /* WIN16 */
  852. #define WSAAPI FAR PASCAL
  853. typedef DWORD WSAEVENT, FAR * LPWSAEVENT;
  854. typedef struct _WSAOVERLAPPED {
  855. DWORD Internal;
  856. DWORD InternalHigh;
  857. DWORD Offset;
  858. DWORD OffsetHigh;
  859. WSAEVENT hEvent;
  860. } WSAOVERLAPPED, FAR * LPWSAOVERLAPPED;
  861. #define WSA_IO_PENDING (WSAEWOULDBLOCK)
  862. #define WSA_IO_INCOMPLETE (WSAEWOULDBLOCK)
  863. #define WSA_INVALID_HANDLE (WSAENOTSOCK)
  864. #define WSA_INVALID_PARAMETER (WSAEINVAL)
  865. #define WSA_NOT_ENOUGH_MEMORY (WSAENOBUFS)
  866. #define WSA_OPERATION_ABORTED (WSAEINTR)
  867. #define WSA_INVALID_EVENT ((WSAEVENT)NULL)
  868. #define WSA_MAXIMUM_WAIT_EVENTS (MAXIMUM_WAIT_OBJECTS)
  869. #define WSA_WAIT_FAILED ((DWORD)-1L)
  870. #define WSA_WAIT_EVENT_0 ((DWORD)0)
  871. #define WSA_WAIT_TIMEOUT ((DWORD)0x102L)
  872. #define WSA_INFINITE ((DWORD)-1L)
  873. #endif /* WIN32 */
  874. /*
  875. * WinSock 2 extension -- WSABUF and QOS struct, include qos.h
  876. * to pull in FLOWSPEC and related definitions
  877. */
  878. typedef struct _WSABUF {
  879. u_long len; /* the length of the buffer */
  880. char FAR * buf; /* the pointer to the buffer */
  881. } WSABUF, FAR * LPWSABUF;
  882. #include <qos.h>
  883. typedef struct _QualityOfService
  884. {
  885. FLOWSPEC SendingFlowspec; /* the flow spec for data sending */
  886. FLOWSPEC ReceivingFlowspec; /* the flow spec for data receiving */
  887. WSABUF ProviderSpecific; /* additional provider specific stuff */
  888. } QOS, FAR * LPQOS;
  889. /*
  890. * WinSock 2 extension -- manifest constants for return values of the condition function
  891. */
  892. #define CF_ACCEPT 0x0000
  893. #define CF_REJECT 0x0001
  894. #define CF_DEFER 0x0002
  895. /*
  896. * WinSock 2 extension -- manifest constants for shutdown()
  897. */
  898. #define SD_RECEIVE 0x00
  899. #define SD_SEND 0x01
  900. #define SD_BOTH 0x02
  901. /*
  902. * WinSock 2 extension -- data type and manifest constants for socket groups
  903. */
  904. typedef unsigned int GROUP;
  905. #define SG_UNCONSTRAINED_GROUP 0x01
  906. #define SG_CONSTRAINED_GROUP 0x02
  907. /*
  908. * WinSock 2 extension -- data type for WSAEnumNetworkEvents()
  909. */
  910. typedef struct _WSANETWORKEVENTS {
  911. long lNetworkEvents;
  912. int iErrorCode[FD_MAX_EVENTS];
  913. } WSANETWORKEVENTS, FAR * LPWSANETWORKEVENTS;
  914. /*
  915. * WinSock 2 extension -- WSAPROTOCOL_INFO structure and associated
  916. * manifest constants
  917. */
  918. #ifndef GUID_DEFINED
  919. #include <guiddef.h>
  920. #endif /* GUID_DEFINED */
  921. #define MAX_PROTOCOL_CHAIN 7
  922. #define BASE_PROTOCOL 1
  923. #define LAYERED_PROTOCOL 0
  924. typedef struct _WSAPROTOCOLCHAIN {
  925. int ChainLen; /* the length of the chain, */
  926. /* length = 0 means layered protocol, */
  927. /* length = 1 means base protocol, */
  928. /* length > 1 means protocol chain */
  929. DWORD ChainEntries[MAX_PROTOCOL_CHAIN]; /* a list of dwCatalogEntryIds */
  930. } WSAPROTOCOLCHAIN, FAR * LPWSAPROTOCOLCHAIN;
  931. #define WSAPROTOCOL_LEN 255
  932. typedef struct _WSAPROTOCOL_INFOA {
  933. DWORD dwServiceFlags1;
  934. DWORD dwServiceFlags2;
  935. DWORD dwServiceFlags3;
  936. DWORD dwServiceFlags4;
  937. DWORD dwProviderFlags;
  938. GUID ProviderId;
  939. DWORD dwCatalogEntryId;
  940. WSAPROTOCOLCHAIN ProtocolChain;
  941. int iVersion;
  942. int iAddressFamily;
  943. int iMaxSockAddr;
  944. int iMinSockAddr;
  945. int iSocketType;
  946. int iProtocol;
  947. int iProtocolMaxOffset;
  948. int iNetworkByteOrder;
  949. int iSecurityScheme;
  950. DWORD dwMessageSize;
  951. DWORD dwProviderReserved;
  952. CHAR szProtocol[WSAPROTOCOL_LEN+1];
  953. } WSAPROTOCOL_INFOA, FAR * LPWSAPROTOCOL_INFOA;
  954. typedef struct _WSAPROTOCOL_INFOW {
  955. DWORD dwServiceFlags1;
  956. DWORD dwServiceFlags2;
  957. DWORD dwServiceFlags3;
  958. DWORD dwServiceFlags4;
  959. DWORD dwProviderFlags;
  960. GUID ProviderId;
  961. DWORD dwCatalogEntryId;
  962. WSAPROTOCOLCHAIN ProtocolChain;
  963. int iVersion;
  964. int iAddressFamily;
  965. int iMaxSockAddr;
  966. int iMinSockAddr;
  967. int iSocketType;
  968. int iProtocol;
  969. int iProtocolMaxOffset;
  970. int iNetworkByteOrder;
  971. int iSecurityScheme;
  972. DWORD dwMessageSize;
  973. DWORD dwProviderReserved;
  974. WCHAR szProtocol[WSAPROTOCOL_LEN+1];
  975. } WSAPROTOCOL_INFOW, FAR * LPWSAPROTOCOL_INFOW;
  976. #ifdef UNICODE
  977. typedef WSAPROTOCOL_INFOW WSAPROTOCOL_INFO;
  978. typedef LPWSAPROTOCOL_INFOW LPWSAPROTOCOL_INFO;
  979. #else
  980. typedef WSAPROTOCOL_INFOA WSAPROTOCOL_INFO;
  981. typedef LPWSAPROTOCOL_INFOA LPWSAPROTOCOL_INFO;
  982. #endif /* UNICODE */
  983. /* Flag bit definitions for dwProviderFlags */
  984. #define PFL_MULTIPLE_PROTO_ENTRIES 0x00000001
  985. #define PFL_RECOMMENDED_PROTO_ENTRY 0x00000002
  986. #define PFL_HIDDEN 0x00000004
  987. #define PFL_MATCHES_PROTOCOL_ZERO 0x00000008
  988. /* Flag bit definitions for dwServiceFlags1 */
  989. #define XP1_CONNECTIONLESS 0x00000001
  990. #define XP1_GUARANTEED_DELIVERY 0x00000002
  991. #define XP1_GUARANTEED_ORDER 0x00000004
  992. #define XP1_MESSAGE_ORIENTED 0x00000008
  993. #define XP1_PSEUDO_STREAM 0x00000010
  994. #define XP1_GRACEFUL_CLOSE 0x00000020
  995. #define XP1_EXPEDITED_DATA 0x00000040
  996. #define XP1_CONNECT_DATA 0x00000080
  997. #define XP1_DISCONNECT_DATA 0x00000100
  998. #define XP1_SUPPORT_BROADCAST 0x00000200
  999. #define XP1_SUPPORT_MULTIPOINT 0x00000400
  1000. #define XP1_MULTIPOINT_CONTROL_PLANE 0x00000800
  1001. #define XP1_MULTIPOINT_DATA_PLANE 0x00001000
  1002. #define XP1_QOS_SUPPORTED 0x00002000
  1003. #define XP1_INTERRUPT 0x00004000
  1004. #define XP1_UNI_SEND 0x00008000
  1005. #define XP1_UNI_RECV 0x00010000
  1006. #define XP1_IFS_HANDLES 0x00020000
  1007. #define XP1_PARTIAL_MESSAGE 0x00040000
  1008. #define BIGENDIAN 0x0000
  1009. #define LITTLEENDIAN 0x0001
  1010. #define SECURITY_PROTOCOL_NONE 0x0000
  1011. /*
  1012. * WinSock 2 extension -- manifest constants for WSAJoinLeaf()
  1013. */
  1014. #define JL_SENDER_ONLY 0x01
  1015. #define JL_RECEIVER_ONLY 0x02
  1016. #define JL_BOTH 0x04
  1017. /*
  1018. * WinSock 2 extension -- manifest constants for WSASocket()
  1019. */
  1020. #define WSA_FLAG_OVERLAPPED 0x01
  1021. #define WSA_FLAG_MULTIPOINT_C_ROOT 0x02
  1022. #define WSA_FLAG_MULTIPOINT_C_LEAF 0x04
  1023. #define WSA_FLAG_MULTIPOINT_D_ROOT 0x08
  1024. #define WSA_FLAG_MULTIPOINT_D_LEAF 0x10
  1025. /*
  1026. * WinSock 2 extension -- manifest constants for WSAIoctl()
  1027. */
  1028. #define IOC_UNIX 0x00000000
  1029. #define IOC_WS2 0x08000000
  1030. #define IOC_PROTOCOL 0x10000000
  1031. #define IOC_VENDOR 0x18000000
  1032. #define _WSAIO(x,y) (IOC_VOID|(x)|(y))
  1033. #define _WSAIOR(x,y) (IOC_OUT|(x)|(y))
  1034. #define _WSAIOW(x,y) (IOC_IN|(x)|(y))
  1035. #define _WSAIORW(x,y) (IOC_INOUT|(x)|(y))
  1036. #define SIO_ASSOCIATE_HANDLE _WSAIOW(IOC_WS2,1)
  1037. #define SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(IOC_WS2,2)
  1038. #define SIO_FIND_ROUTE _WSAIOR(IOC_WS2,3)
  1039. #define SIO_FLUSH _WSAIO(IOC_WS2,4)
  1040. #define SIO_GET_BROADCAST_ADDRESS _WSAIOR(IOC_WS2,5)
  1041. #define SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(IOC_WS2,6)
  1042. #define SIO_GET_QOS _WSAIORW(IOC_WS2,7)
  1043. #define SIO_GET_GROUP_QOS _WSAIORW(IOC_WS2,8)
  1044. #define SIO_MULTIPOINT_LOOPBACK _WSAIOW(IOC_WS2,9)
  1045. #define SIO_MULTICAST_SCOPE _WSAIOW(IOC_WS2,10)
  1046. #define SIO_SET_QOS _WSAIOW(IOC_WS2,11)
  1047. #define SIO_SET_GROUP_QOS _WSAIOW(IOC_WS2,12)
  1048. #define SIO_TRANSLATE_HANDLE _WSAIORW(IOC_WS2,13)
  1049. #define SIO_ROUTING_INTERFACE_QUERY _WSAIORW(IOC_WS2,20)
  1050. #define SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(IOC_WS2,21)
  1051. #define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22)
  1052. #define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23)
  1053. #define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_WS2,24)
  1054. #define SIO_ADDRESS_LIST_SORT _WSAIORW(IOC_WS2,25)
  1055. /*
  1056. * WinSock 2 extensions -- data types for the condition function in
  1057. * WSAAccept() and overlapped I/O completion routine.
  1058. */
  1059. typedef
  1060. int
  1061. (CALLBACK * LPCONDITIONPROC)(
  1062. IN LPWSABUF lpCallerId,
  1063. IN LPWSABUF lpCallerData,
  1064. IN OUT LPQOS lpSQOS,
  1065. IN OUT LPQOS lpGQOS,
  1066. IN LPWSABUF lpCalleeId,
  1067. IN LPWSABUF lpCalleeData,
  1068. OUT GROUP FAR * g,
  1069. IN DWORD_PTR dwCallbackData
  1070. );
  1071. typedef
  1072. void
  1073. (CALLBACK * LPWSAOVERLAPPED_COMPLETION_ROUTINE)(
  1074. IN DWORD dwError,
  1075. IN DWORD cbTransferred,
  1076. IN LPWSAOVERLAPPED lpOverlapped,
  1077. IN DWORD dwFlags
  1078. );
  1079. /*
  1080. * WinSock 2 extension -- manifest constants and associated structures
  1081. * for WSANSPIoctl()
  1082. */
  1083. #define SIO_NSP_NOTIFY_CHANGE _WSAIOW(IOC_WS2,25)
  1084. typedef enum _WSACOMPLETIONTYPE {
  1085. NSP_NOTIFY_IMMEDIATELY = 0,
  1086. NSP_NOTIFY_HWND,
  1087. NSP_NOTIFY_EVENT,
  1088. NSP_NOTIFY_PORT,
  1089. NSP_NOTIFY_APC,
  1090. } WSACOMPLETIONTYPE, *PWSACOMPLETIONTYPE, FAR * LPWSACOMPLETIONTYPE;
  1091. typedef struct _WSACOMPLETION {
  1092. WSACOMPLETIONTYPE Type;
  1093. union {
  1094. struct {
  1095. HWND hWnd;
  1096. UINT uMsg;
  1097. WPARAM context;
  1098. } WindowMessage;
  1099. struct {
  1100. LPWSAOVERLAPPED lpOverlapped;
  1101. } Event;
  1102. struct {
  1103. LPWSAOVERLAPPED lpOverlapped;
  1104. LPWSAOVERLAPPED_COMPLETION_ROUTINE lpfnCompletionProc;
  1105. } Apc;
  1106. struct {
  1107. LPWSAOVERLAPPED lpOverlapped;
  1108. HANDLE hPort;
  1109. ULONG_PTR Key;
  1110. } Port;
  1111. } Parameters;
  1112. } WSACOMPLETION, *PWSACOMPLETION, FAR *LPWSACOMPLETION;
  1113. /*
  1114. * WinSock 2 extension -- manifest constants for SIO_TRANSLATE_HANDLE ioctl
  1115. */
  1116. #define TH_NETDEV 0x00000001
  1117. #define TH_TAPI 0x00000002
  1118. /*
  1119. * Microsoft Windows Extended data types required for the functions to
  1120. * convert back and forth between binary and string forms of
  1121. * addresses.
  1122. */
  1123. typedef struct sockaddr SOCKADDR;
  1124. typedef struct sockaddr *PSOCKADDR;
  1125. typedef struct sockaddr FAR *LPSOCKADDR;
  1126. typedef struct sockaddr_storage SOCKADDR_STORAGE;
  1127. typedef struct sockaddr_storage *PSOCKADDR_STORAGE;
  1128. typedef struct sockaddr_storage FAR *LPSOCKADDR_STORAGE;
  1129. /*
  1130. * Manifest constants and type definitions related to name resolution and
  1131. * registration (RNR) API
  1132. */
  1133. #ifndef _tagBLOB_DEFINED
  1134. #define _tagBLOB_DEFINED
  1135. #define _BLOB_DEFINED
  1136. #define _LPBLOB_DEFINED
  1137. typedef struct _BLOB {
  1138. ULONG cbSize ;
  1139. #ifdef MIDL_PASS
  1140. [size_is(cbSize)] BYTE *pBlobData;
  1141. #else /* MIDL_PASS */
  1142. BYTE *pBlobData ;
  1143. #endif /* MIDL_PASS */
  1144. } BLOB, *LPBLOB ;
  1145. #endif
  1146. /*
  1147. * Service Install Flags
  1148. */
  1149. #define SERVICE_MULTIPLE (0x00000001)
  1150. /*
  1151. *& Name Spaces
  1152. */
  1153. #define NS_ALL (0)
  1154. #define NS_SAP (1)
  1155. #define NS_NDS (2)
  1156. #define NS_PEER_BROWSE (3)
  1157. #define NS_SLP (5)
  1158. #define NS_DHCP (6)
  1159. #define NS_TCPIP_LOCAL (10)
  1160. #define NS_TCPIP_HOSTS (11)
  1161. #define NS_DNS (12)
  1162. #define NS_NETBT (13)
  1163. #define NS_WINS (14)
  1164. #define NS_NLA (15) /* Network Location Awareness */
  1165. #define NS_NBP (20)
  1166. #define NS_MS (30)
  1167. #define NS_STDA (31)
  1168. #define NS_NTDS (32)
  1169. #define NS_X500 (40)
  1170. #define NS_NIS (41)
  1171. #define NS_NISPLUS (42)
  1172. #define NS_WRQ (50)
  1173. #define NS_NETDES (60) /* Network Designers Limited */
  1174. /*
  1175. * Resolution flags for WSAGetAddressByName().
  1176. * Note these are also used by the 1.1 API GetAddressByName, so
  1177. * leave them around.
  1178. */
  1179. #define RES_UNUSED_1 (0x00000001)
  1180. #define RES_FLUSH_CACHE (0x00000002)
  1181. #ifndef RES_SERVICE
  1182. #define RES_SERVICE (0x00000004)
  1183. #endif /* RES_SERVICE */
  1184. /*
  1185. * Well known value names for Service Types
  1186. */
  1187. #define SERVICE_TYPE_VALUE_IPXPORTA "IpxSocket"
  1188. #define SERVICE_TYPE_VALUE_IPXPORTW L"IpxSocket"
  1189. #define SERVICE_TYPE_VALUE_SAPIDA "SapId"
  1190. #define SERVICE_TYPE_VALUE_SAPIDW L"SapId"
  1191. #define SERVICE_TYPE_VALUE_TCPPORTA "TcpPort"
  1192. #define SERVICE_TYPE_VALUE_TCPPORTW L"TcpPort"
  1193. #define SERVICE_TYPE_VALUE_UDPPORTA "UdpPort"
  1194. #define SERVICE_TYPE_VALUE_UDPPORTW L"UdpPort"
  1195. #define SERVICE_TYPE_VALUE_OBJECTIDA "ObjectId"
  1196. #define SERVICE_TYPE_VALUE_OBJECTIDW L"ObjectId"
  1197. #ifdef UNICODE
  1198. #define SERVICE_TYPE_VALUE_SAPID SERVICE_TYPE_VALUE_SAPIDW
  1199. #define SERVICE_TYPE_VALUE_TCPPORT SERVICE_TYPE_VALUE_TCPPORTW
  1200. #define SERVICE_TYPE_VALUE_UDPPORT SERVICE_TYPE_VALUE_UDPPORTW
  1201. #define SERVICE_TYPE_VALUE_OBJECTID SERVICE_TYPE_VALUE_OBJECTIDW
  1202. #else /* not UNICODE */
  1203. #define SERVICE_TYPE_VALUE_SAPID SERVICE_TYPE_VALUE_SAPIDA
  1204. #define SERVICE_TYPE_VALUE_TCPPORT SERVICE_TYPE_VALUE_TCPPORTA
  1205. #define SERVICE_TYPE_VALUE_UDPPORT SERVICE_TYPE_VALUE_UDPPORTA
  1206. #define SERVICE_TYPE_VALUE_OBJECTID SERVICE_TYPE_VALUE_OBJECTIDA
  1207. #endif
  1208. #ifndef __CSADDR_DEFINED__
  1209. #define __CSADDR_DEFINED__
  1210. /*
  1211. * SockAddr Information
  1212. */
  1213. typedef struct _SOCKET_ADDRESS {
  1214. LPSOCKADDR lpSockaddr ;
  1215. INT iSockaddrLength ;
  1216. } SOCKET_ADDRESS, *PSOCKET_ADDRESS, FAR * LPSOCKET_ADDRESS ;
  1217. /*
  1218. * CSAddr Information
  1219. */
  1220. typedef struct _CSADDR_INFO {
  1221. SOCKET_ADDRESS LocalAddr ;
  1222. SOCKET_ADDRESS RemoteAddr ;
  1223. INT iSocketType ;
  1224. INT iProtocol ;
  1225. } CSADDR_INFO, *PCSADDR_INFO, FAR * LPCSADDR_INFO ;
  1226. #endif /* __CSADDR_DEFINED__ */
  1227. /*
  1228. * Address list returned via SIO_ADDRESS_LIST_QUERY
  1229. */
  1230. typedef struct _SOCKET_ADDRESS_LIST {
  1231. INT iAddressCount;
  1232. SOCKET_ADDRESS Address[1];
  1233. } SOCKET_ADDRESS_LIST, FAR * LPSOCKET_ADDRESS_LIST;
  1234. /*
  1235. * Address Family/Protocol Tuples
  1236. */
  1237. typedef struct _AFPROTOCOLS {
  1238. INT iAddressFamily;
  1239. INT iProtocol;
  1240. } AFPROTOCOLS, *PAFPROTOCOLS, *LPAFPROTOCOLS;
  1241. /*
  1242. * Client Query API Typedefs
  1243. */
  1244. /*
  1245. * The comparators
  1246. */
  1247. typedef enum _WSAEcomparator
  1248. {
  1249. COMP_EQUAL = 0,
  1250. COMP_NOTLESS
  1251. } WSAECOMPARATOR, *PWSAECOMPARATOR, *LPWSAECOMPARATOR;
  1252. typedef struct _WSAVersion
  1253. {
  1254. DWORD dwVersion;
  1255. WSAECOMPARATOR ecHow;
  1256. }WSAVERSION, *PWSAVERSION, *LPWSAVERSION;
  1257. typedef struct _WSAQuerySetA
  1258. {
  1259. DWORD dwSize;
  1260. LPSTR lpszServiceInstanceName;
  1261. LPGUID lpServiceClassId;
  1262. LPWSAVERSION lpVersion;
  1263. LPSTR lpszComment;
  1264. DWORD dwNameSpace;
  1265. LPGUID lpNSProviderId;
  1266. LPSTR lpszContext;
  1267. DWORD dwNumberOfProtocols;
  1268. LPAFPROTOCOLS lpafpProtocols;
  1269. LPSTR lpszQueryString;
  1270. DWORD dwNumberOfCsAddrs;
  1271. LPCSADDR_INFO lpcsaBuffer;
  1272. DWORD dwOutputFlags;
  1273. LPBLOB lpBlob;
  1274. } WSAQUERYSETA, *PWSAQUERYSETA, *LPWSAQUERYSETA;
  1275. typedef struct _WSAQuerySetW
  1276. {
  1277. DWORD dwSize;
  1278. LPWSTR lpszServiceInstanceName;
  1279. LPGUID lpServiceClassId;
  1280. LPWSAVERSION lpVersion;
  1281. LPWSTR lpszComment;
  1282. DWORD dwNameSpace;
  1283. LPGUID lpNSProviderId;
  1284. LPWSTR lpszContext;
  1285. DWORD dwNumberOfProtocols;
  1286. LPAFPROTOCOLS lpafpProtocols;
  1287. LPWSTR lpszQueryString;
  1288. DWORD dwNumberOfCsAddrs;
  1289. LPCSADDR_INFO lpcsaBuffer;
  1290. DWORD dwOutputFlags;
  1291. LPBLOB lpBlob;
  1292. } WSAQUERYSETW, *PWSAQUERYSETW, *LPWSAQUERYSETW;
  1293. #ifdef UNICODE
  1294. typedef WSAQUERYSETW WSAQUERYSET;
  1295. typedef PWSAQUERYSETW PWSAQUERYSET;
  1296. typedef LPWSAQUERYSETW LPWSAQUERYSET;
  1297. #else
  1298. typedef WSAQUERYSETA WSAQUERYSET;
  1299. typedef PWSAQUERYSETA PWSAQUERYSET;
  1300. typedef LPWSAQUERYSETA LPWSAQUERYSET;
  1301. #endif /* UNICODE */
  1302. #define LUP_DEEP 0x0001
  1303. #define LUP_CONTAINERS 0x0002
  1304. #define LUP_NOCONTAINERS 0x0004
  1305. #define LUP_NEAREST 0x0008
  1306. #define LUP_RETURN_NAME 0x0010
  1307. #define LUP_RETURN_TYPE 0x0020
  1308. #define LUP_RETURN_VERSION 0x0040
  1309. #define LUP_RETURN_COMMENT 0x0080
  1310. #define LUP_RETURN_ADDR 0x0100
  1311. #define LUP_RETURN_BLOB 0x0200
  1312. #define LUP_RETURN_ALIASES 0x0400
  1313. #define LUP_RETURN_QUERY_STRING 0x0800
  1314. #define LUP_RETURN_ALL 0x0FF0
  1315. #define LUP_RES_SERVICE 0x8000
  1316. #define LUP_FLUSHCACHE 0x1000
  1317. #define LUP_FLUSHPREVIOUS 0x2000
  1318. /*
  1319. * Return flags
  1320. */
  1321. #define RESULT_IS_ALIAS 0x0001
  1322. #define RESULT_IS_ADDED 0x0010
  1323. #define RESULT_IS_CHANGED 0x0020
  1324. #define RESULT_IS_DELETED 0x0040
  1325. /*
  1326. * Service Address Registration and Deregistration Data Types.
  1327. */
  1328. typedef enum _WSAESETSERVICEOP
  1329. {
  1330. RNRSERVICE_REGISTER=0,
  1331. RNRSERVICE_DEREGISTER,
  1332. RNRSERVICE_DELETE
  1333. } WSAESETSERVICEOP, *PWSAESETSERVICEOP, *LPWSAESETSERVICEOP;
  1334. /*
  1335. * Service Installation/Removal Data Types.
  1336. */
  1337. typedef struct _WSANSClassInfoA
  1338. {
  1339. LPSTR lpszName;
  1340. DWORD dwNameSpace;
  1341. DWORD dwValueType;
  1342. DWORD dwValueSize;
  1343. LPVOID lpValue;
  1344. }WSANSCLASSINFOA, *PWSANSCLASSINFOA, *LPWSANSCLASSINFOA;
  1345. typedef struct _WSANSClassInfoW
  1346. {
  1347. LPWSTR lpszName;
  1348. DWORD dwNameSpace;
  1349. DWORD dwValueType;
  1350. DWORD dwValueSize;
  1351. LPVOID lpValue;
  1352. }WSANSCLASSINFOW, *PWSANSCLASSINFOW, *LPWSANSCLASSINFOW;
  1353. #ifdef UNICODE
  1354. typedef WSANSCLASSINFOW WSANSCLASSINFO;
  1355. typedef PWSANSCLASSINFOW PWSANSCLASSINFO;
  1356. typedef LPWSANSCLASSINFOW LPWSANSCLASSINFO;
  1357. #else
  1358. typedef WSANSCLASSINFOA WSANSCLASSINFO;
  1359. typedef PWSANSCLASSINFOA PWSANSCLASSINFO;
  1360. typedef LPWSANSCLASSINFOA LPWSANSCLASSINFO;
  1361. #endif /* UNICODE */
  1362. typedef struct _WSAServiceClassInfoA
  1363. {
  1364. LPGUID lpServiceClassId;
  1365. LPSTR lpszServiceClassName;
  1366. DWORD dwCount;
  1367. LPWSANSCLASSINFOA lpClassInfos;
  1368. }WSASERVICECLASSINFOA, *PWSASERVICECLASSINFOA, *LPWSASERVICECLASSINFOA;
  1369. typedef struct _WSAServiceClassInfoW
  1370. {
  1371. LPGUID lpServiceClassId;
  1372. LPWSTR lpszServiceClassName;
  1373. DWORD dwCount;
  1374. LPWSANSCLASSINFOW lpClassInfos;
  1375. }WSASERVICECLASSINFOW, *PWSASERVICECLASSINFOW, *LPWSASERVICECLASSINFOW;
  1376. #ifdef UNICODE
  1377. typedef WSASERVICECLASSINFOW WSASERVICECLASSINFO;
  1378. typedef PWSASERVICECLASSINFOW PWSASERVICECLASSINFO;
  1379. typedef LPWSASERVICECLASSINFOW LPWSASERVICECLASSINFO;
  1380. #else
  1381. typedef WSASERVICECLASSINFOA WSASERVICECLASSINFO;
  1382. typedef PWSASERVICECLASSINFOA PWSASERVICECLASSINFO;
  1383. typedef LPWSASERVICECLASSINFOA LPWSASERVICECLASSINFO;
  1384. #endif /* UNICODE */
  1385. typedef struct _WSANAMESPACE_INFOA {
  1386. GUID NSProviderId;
  1387. DWORD dwNameSpace;
  1388. BOOL fActive;
  1389. DWORD dwVersion;
  1390. LPSTR lpszIdentifier;
  1391. } WSANAMESPACE_INFOA, *PWSANAMESPACE_INFOA, *LPWSANAMESPACE_INFOA;
  1392. typedef struct _WSANAMESPACE_INFOW {
  1393. GUID NSProviderId;
  1394. DWORD dwNameSpace;
  1395. BOOL fActive;
  1396. DWORD dwVersion;
  1397. LPWSTR lpszIdentifier;
  1398. } WSANAMESPACE_INFOW, *PWSANAMESPACE_INFOW, *LPWSANAMESPACE_INFOW;
  1399. #ifdef UNICODE
  1400. typedef WSANAMESPACE_INFOW WSANAMESPACE_INFO;
  1401. typedef PWSANAMESPACE_INFOW PWSANAMESPACE_INFO;
  1402. typedef LPWSANAMESPACE_INFOW LPWSANAMESPACE_INFO;
  1403. #else
  1404. typedef WSANAMESPACE_INFOA WSANAMESPACE_INFO;
  1405. typedef PWSANAMESPACE_INFOA PWSANAMESPACE_INFO;
  1406. typedef LPWSANAMESPACE_INFOA LPWSANAMESPACE_INFO;
  1407. #endif /* UNICODE */
  1408. /* Socket function prototypes */
  1409. #if INCL_WINSOCK_API_PROTOTYPES
  1410. WINSOCK_API_LINKAGE
  1411. SOCKET
  1412. WSAAPI
  1413. accept(
  1414. IN SOCKET s,
  1415. OUT struct sockaddr FAR * addr,
  1416. IN OUT int FAR * addrlen
  1417. );
  1418. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1419. #if INCL_WINSOCK_API_TYPEDEFS
  1420. typedef
  1421. SOCKET
  1422. (WSAAPI * LPFN_ACCEPT)(
  1423. IN SOCKET s,
  1424. OUT struct sockaddr FAR * addr,
  1425. IN OUT int FAR * addrlen
  1426. );
  1427. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1428. #if INCL_WINSOCK_API_PROTOTYPES
  1429. WINSOCK_API_LINKAGE
  1430. int
  1431. WSAAPI
  1432. bind(
  1433. IN SOCKET s,
  1434. IN const struct sockaddr FAR * name,
  1435. IN int namelen
  1436. );
  1437. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1438. #if INCL_WINSOCK_API_TYPEDEFS
  1439. typedef
  1440. int
  1441. (WSAAPI * LPFN_BIND)(
  1442. IN SOCKET s,
  1443. IN const struct sockaddr FAR * name,
  1444. IN int namelen
  1445. );
  1446. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1447. #if INCL_WINSOCK_API_PROTOTYPES
  1448. WINSOCK_API_LINKAGE
  1449. int
  1450. WSAAPI
  1451. closesocket(
  1452. IN SOCKET s
  1453. );
  1454. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1455. #if INCL_WINSOCK_API_TYPEDEFS
  1456. typedef
  1457. int
  1458. (WSAAPI * LPFN_CLOSESOCKET)(
  1459. IN SOCKET s
  1460. );
  1461. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1462. #if INCL_WINSOCK_API_PROTOTYPES
  1463. WINSOCK_API_LINKAGE
  1464. int
  1465. WSAAPI
  1466. connect(
  1467. IN SOCKET s,
  1468. IN const struct sockaddr FAR * name,
  1469. IN int namelen
  1470. );
  1471. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1472. #if INCL_WINSOCK_API_TYPEDEFS
  1473. typedef
  1474. int
  1475. (WSAAPI * LPFN_CONNECT)(
  1476. IN SOCKET s,
  1477. IN const struct sockaddr FAR * name,
  1478. IN int namelen
  1479. );
  1480. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1481. #if INCL_WINSOCK_API_PROTOTYPES
  1482. WINSOCK_API_LINKAGE
  1483. int
  1484. WSAAPI
  1485. ioctlsocket(
  1486. IN SOCKET s,
  1487. IN long cmd,
  1488. IN OUT u_long FAR * argp
  1489. );
  1490. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1491. #if INCL_WINSOCK_API_TYPEDEFS
  1492. typedef
  1493. int
  1494. (WSAAPI * LPFN_IOCTLSOCKET)(
  1495. IN SOCKET s,
  1496. IN long cmd,
  1497. IN OUT u_long FAR * argp
  1498. );
  1499. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1500. #if INCL_WINSOCK_API_PROTOTYPES
  1501. WINSOCK_API_LINKAGE
  1502. int
  1503. WSAAPI
  1504. getpeername(
  1505. IN SOCKET s,
  1506. OUT struct sockaddr FAR * name,
  1507. IN OUT int FAR * namelen
  1508. );
  1509. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1510. #if INCL_WINSOCK_API_TYPEDEFS
  1511. typedef
  1512. int
  1513. (WSAAPI * LPFN_GETPEERNAME)(
  1514. IN SOCKET s,
  1515. IN struct sockaddr FAR * name,
  1516. IN OUT int FAR * namelen
  1517. );
  1518. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1519. #if INCL_WINSOCK_API_PROTOTYPES
  1520. WINSOCK_API_LINKAGE
  1521. int
  1522. WSAAPI
  1523. getsockname(
  1524. IN SOCKET s,
  1525. OUT struct sockaddr FAR * name,
  1526. IN OUT int FAR * namelen
  1527. );
  1528. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1529. #if INCL_WINSOCK_API_TYPEDEFS
  1530. typedef
  1531. int
  1532. (WSAAPI * LPFN_GETSOCKNAME)(
  1533. IN SOCKET s,
  1534. OUT struct sockaddr FAR * name,
  1535. IN OUT int FAR * namelen
  1536. );
  1537. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1538. #if INCL_WINSOCK_API_PROTOTYPES
  1539. WINSOCK_API_LINKAGE
  1540. int
  1541. WSAAPI
  1542. getsockopt(
  1543. IN SOCKET s,
  1544. IN int level,
  1545. IN int optname,
  1546. OUT char FAR * optval,
  1547. IN OUT int FAR * optlen
  1548. );
  1549. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1550. #if INCL_WINSOCK_API_TYPEDEFS
  1551. typedef
  1552. int
  1553. (WSAAPI * LPFN_GETSOCKOPT)(
  1554. IN SOCKET s,
  1555. IN int level,
  1556. IN int optname,
  1557. OUT char FAR * optval,
  1558. IN OUT int FAR * optlen
  1559. );
  1560. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1561. #if INCL_WINSOCK_API_PROTOTYPES
  1562. WINSOCK_API_LINKAGE
  1563. u_long
  1564. WSAAPI
  1565. htonl(
  1566. IN u_long hostlong
  1567. );
  1568. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1569. #if INCL_WINSOCK_API_TYPEDEFS
  1570. typedef
  1571. u_long
  1572. (WSAAPI * LPFN_HTONL)(
  1573. IN u_long hostlong
  1574. );
  1575. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1576. #if INCL_WINSOCK_API_PROTOTYPES
  1577. WINSOCK_API_LINKAGE
  1578. u_short
  1579. WSAAPI
  1580. htons(
  1581. IN u_short hostshort
  1582. );
  1583. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1584. #if INCL_WINSOCK_API_TYPEDEFS
  1585. typedef
  1586. u_short
  1587. (WSAAPI * LPFN_HTONS)(
  1588. IN u_short hostshort
  1589. );
  1590. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1591. #if INCL_WINSOCK_API_PROTOTYPES
  1592. WINSOCK_API_LINKAGE
  1593. unsigned long
  1594. WSAAPI
  1595. inet_addr(
  1596. IN const char FAR * cp
  1597. );
  1598. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1599. #if INCL_WINSOCK_API_TYPEDEFS
  1600. typedef
  1601. unsigned long
  1602. (WSAAPI * LPFN_INET_ADDR)(
  1603. IN const char FAR * cp
  1604. );
  1605. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1606. #if INCL_WINSOCK_API_PROTOTYPES
  1607. WINSOCK_API_LINKAGE
  1608. char FAR *
  1609. WSAAPI
  1610. inet_ntoa(
  1611. IN struct in_addr in
  1612. );
  1613. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1614. #if INCL_WINSOCK_API_TYPEDEFS
  1615. typedef
  1616. char FAR *
  1617. (WSAAPI * LPFN_INET_NTOA)(
  1618. IN struct in_addr in
  1619. );
  1620. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1621. #if INCL_WINSOCK_API_PROTOTYPES
  1622. WINSOCK_API_LINKAGE
  1623. int
  1624. WSAAPI
  1625. listen(
  1626. IN SOCKET s,
  1627. IN int backlog
  1628. );
  1629. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1630. #if INCL_WINSOCK_API_TYPEDEFS
  1631. typedef
  1632. int
  1633. (WSAAPI * LPFN_LISTEN)(
  1634. IN SOCKET s,
  1635. IN int backlog
  1636. );
  1637. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1638. #if INCL_WINSOCK_API_PROTOTYPES
  1639. WINSOCK_API_LINKAGE
  1640. u_long
  1641. WSAAPI
  1642. ntohl(
  1643. IN u_long netlong
  1644. );
  1645. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1646. #if INCL_WINSOCK_API_TYPEDEFS
  1647. typedef
  1648. u_long
  1649. (WSAAPI * LPFN_NTOHL)(
  1650. IN u_long netlong
  1651. );
  1652. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1653. #if INCL_WINSOCK_API_PROTOTYPES
  1654. WINSOCK_API_LINKAGE
  1655. u_short
  1656. WSAAPI
  1657. ntohs(
  1658. IN u_short netshort
  1659. );
  1660. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1661. #if INCL_WINSOCK_API_TYPEDEFS
  1662. typedef
  1663. u_short
  1664. (WSAAPI * LPFN_NTOHS)(
  1665. IN u_short netshort
  1666. );
  1667. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1668. #if INCL_WINSOCK_API_PROTOTYPES
  1669. WINSOCK_API_LINKAGE
  1670. int
  1671. WSAAPI
  1672. recv(
  1673. IN SOCKET s,
  1674. OUT char FAR * buf,
  1675. IN int len,
  1676. IN int flags
  1677. );
  1678. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1679. #if INCL_WINSOCK_API_TYPEDEFS
  1680. typedef
  1681. int
  1682. (WSAAPI * LPFN_RECV)(
  1683. IN SOCKET s,
  1684. OUT char FAR * buf,
  1685. IN int len,
  1686. IN int flags
  1687. );
  1688. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1689. #if INCL_WINSOCK_API_PROTOTYPES
  1690. WINSOCK_API_LINKAGE
  1691. int
  1692. WSAAPI
  1693. recvfrom(
  1694. IN SOCKET s,
  1695. OUT char FAR * buf,
  1696. IN int len,
  1697. IN int flags,
  1698. OUT struct sockaddr FAR * from,
  1699. IN OUT int FAR * fromlen
  1700. );
  1701. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1702. #if INCL_WINSOCK_API_TYPEDEFS
  1703. typedef
  1704. int
  1705. (WSAAPI * LPFN_RECVFROM)(
  1706. IN SOCKET s,
  1707. OUT char FAR * buf,
  1708. IN int len,
  1709. IN int flags,
  1710. OUT struct sockaddr FAR * from,
  1711. IN OUT int FAR * fromlen
  1712. );
  1713. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1714. #if INCL_WINSOCK_API_PROTOTYPES
  1715. WINSOCK_API_LINKAGE
  1716. int
  1717. WSAAPI
  1718. select(
  1719. IN int nfds,
  1720. IN OUT fd_set FAR * readfds,
  1721. IN OUT fd_set FAR * writefds,
  1722. IN OUT fd_set FAR *exceptfds,
  1723. IN const struct timeval FAR * timeout
  1724. );
  1725. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1726. #if INCL_WINSOCK_API_TYPEDEFS
  1727. typedef
  1728. int
  1729. (WSAAPI * LPFN_SELECT)(
  1730. IN int nfds,
  1731. IN OUT fd_set FAR * readfds,
  1732. IN OUT fd_set FAR * writefds,
  1733. IN OUT fd_set FAR *exceptfds,
  1734. IN const struct timeval FAR * timeout
  1735. );
  1736. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1737. #if INCL_WINSOCK_API_PROTOTYPES
  1738. WINSOCK_API_LINKAGE
  1739. int
  1740. WSAAPI
  1741. send(
  1742. IN SOCKET s,
  1743. IN const char FAR * buf,
  1744. IN int len,
  1745. IN int flags
  1746. );
  1747. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1748. #if INCL_WINSOCK_API_TYPEDEFS
  1749. typedef
  1750. int
  1751. (WSAAPI * LPFN_SEND)(
  1752. IN SOCKET s,
  1753. IN const char FAR * buf,
  1754. IN int len,
  1755. IN int flags
  1756. );
  1757. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1758. #if INCL_WINSOCK_API_PROTOTYPES
  1759. WINSOCK_API_LINKAGE
  1760. int
  1761. WSAAPI
  1762. sendto(
  1763. IN SOCKET s,
  1764. IN const char FAR * buf,
  1765. IN int len,
  1766. IN int flags,
  1767. IN const struct sockaddr FAR * to,
  1768. IN int tolen
  1769. );
  1770. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1771. #if INCL_WINSOCK_API_TYPEDEFS
  1772. typedef
  1773. int
  1774. (WSAAPI * LPFN_SENDTO)(
  1775. IN SOCKET s,
  1776. IN const char FAR * buf,
  1777. IN int len,
  1778. IN int flags,
  1779. IN const struct sockaddr FAR * to,
  1780. IN int tolen
  1781. );
  1782. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1783. #if INCL_WINSOCK_API_PROTOTYPES
  1784. WINSOCK_API_LINKAGE
  1785. int
  1786. WSAAPI
  1787. setsockopt(
  1788. IN SOCKET s,
  1789. IN int level,
  1790. IN int optname,
  1791. IN const char FAR * optval,
  1792. IN int optlen
  1793. );
  1794. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1795. #if INCL_WINSOCK_API_TYPEDEFS
  1796. typedef
  1797. int
  1798. (WSAAPI * LPFN_SETSOCKOPT)(
  1799. IN SOCKET s,
  1800. IN int level,
  1801. IN int optname,
  1802. IN const char FAR * optval,
  1803. IN int optlen
  1804. );
  1805. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1806. #if INCL_WINSOCK_API_PROTOTYPES
  1807. WINSOCK_API_LINKAGE
  1808. int
  1809. WSAAPI
  1810. shutdown(
  1811. IN SOCKET s,
  1812. IN int how
  1813. );
  1814. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1815. #if INCL_WINSOCK_API_TYPEDEFS
  1816. typedef
  1817. int
  1818. (WSAAPI * LPFN_SHUTDOWN)(
  1819. IN SOCKET s,
  1820. IN int how
  1821. );
  1822. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1823. #if INCL_WINSOCK_API_PROTOTYPES
  1824. WINSOCK_API_LINKAGE
  1825. SOCKET
  1826. WSAAPI
  1827. socket(
  1828. IN int af,
  1829. IN int type,
  1830. IN int protocol
  1831. );
  1832. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1833. #if INCL_WINSOCK_API_TYPEDEFS
  1834. typedef
  1835. SOCKET
  1836. (WSAAPI * LPFN_SOCKET)(
  1837. IN int af,
  1838. IN int type,
  1839. IN int protocol
  1840. );
  1841. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1842. /* Database function prototypes */
  1843. #if INCL_WINSOCK_API_PROTOTYPES
  1844. WINSOCK_API_LINKAGE
  1845. struct hostent FAR *
  1846. WSAAPI
  1847. gethostbyaddr(
  1848. IN const char FAR * addr,
  1849. IN int len,
  1850. IN int type
  1851. );
  1852. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1853. #if INCL_WINSOCK_API_TYPEDEFS
  1854. typedef
  1855. struct hostent FAR *
  1856. (WSAAPI * LPFN_GETHOSTBYADDR)(
  1857. IN const char FAR * addr,
  1858. IN int len,
  1859. IN int type
  1860. );
  1861. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1862. #if INCL_WINSOCK_API_PROTOTYPES
  1863. WINSOCK_API_LINKAGE
  1864. struct hostent FAR *
  1865. WSAAPI
  1866. gethostbyname(
  1867. IN const char FAR * name
  1868. );
  1869. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1870. #if INCL_WINSOCK_API_TYPEDEFS
  1871. typedef
  1872. struct hostent FAR *
  1873. (WSAAPI * LPFN_GETHOSTBYNAME)(
  1874. IN const char FAR * name
  1875. );
  1876. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1877. #if INCL_WINSOCK_API_PROTOTYPES
  1878. WINSOCK_API_LINKAGE
  1879. int
  1880. WSAAPI
  1881. gethostname(
  1882. OUT char FAR * name,
  1883. IN int namelen
  1884. );
  1885. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1886. #if INCL_WINSOCK_API_TYPEDEFS
  1887. typedef
  1888. int
  1889. (WSAAPI * LPFN_GETHOSTNAME)(
  1890. OUT char FAR * name,
  1891. IN int namelen
  1892. );
  1893. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1894. #if INCL_WINSOCK_API_PROTOTYPES
  1895. WINSOCK_API_LINKAGE
  1896. struct servent FAR *
  1897. WSAAPI
  1898. getservbyport(
  1899. IN int port,
  1900. IN const char FAR * proto
  1901. );
  1902. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1903. #if INCL_WINSOCK_API_TYPEDEFS
  1904. typedef
  1905. struct servent FAR *
  1906. (WSAAPI * LPFN_GETSERVBYPORT)(
  1907. IN int port,
  1908. IN const char FAR * proto
  1909. );
  1910. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1911. #if INCL_WINSOCK_API_PROTOTYPES
  1912. WINSOCK_API_LINKAGE
  1913. struct servent FAR *
  1914. WSAAPI
  1915. getservbyname(
  1916. IN const char FAR * name,
  1917. IN const char FAR * proto
  1918. );
  1919. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1920. #if INCL_WINSOCK_API_TYPEDEFS
  1921. typedef
  1922. struct servent FAR *
  1923. (WSAAPI * LPFN_GETSERVBYNAME)(
  1924. IN const char FAR * name,
  1925. IN const char FAR * proto
  1926. );
  1927. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1928. #if INCL_WINSOCK_API_PROTOTYPES
  1929. WINSOCK_API_LINKAGE
  1930. struct protoent FAR *
  1931. WSAAPI
  1932. getprotobynumber(
  1933. IN int number
  1934. );
  1935. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1936. #if INCL_WINSOCK_API_TYPEDEFS
  1937. typedef
  1938. struct protoent FAR *
  1939. (WSAAPI * LPFN_GETPROTOBYNUMBER)(
  1940. IN int number
  1941. );
  1942. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1943. #if INCL_WINSOCK_API_PROTOTYPES
  1944. WINSOCK_API_LINKAGE
  1945. struct protoent FAR *
  1946. WSAAPI
  1947. getprotobyname(
  1948. IN const char FAR * name
  1949. );
  1950. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1951. #if INCL_WINSOCK_API_TYPEDEFS
  1952. typedef
  1953. struct protoent FAR *
  1954. (WSAAPI * LPFN_GETPROTOBYNAME)(
  1955. IN const char FAR * name
  1956. );
  1957. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1958. /* Microsoft Windows Extension function prototypes */
  1959. #if INCL_WINSOCK_API_PROTOTYPES
  1960. WINSOCK_API_LINKAGE
  1961. int
  1962. WSAAPI
  1963. WSAStartup(
  1964. IN WORD wVersionRequested,
  1965. OUT LPWSADATA lpWSAData
  1966. );
  1967. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1968. #if INCL_WINSOCK_API_TYPEDEFS
  1969. typedef
  1970. int
  1971. (WSAAPI * LPFN_WSASTARTUP)(
  1972. IN WORD wVersionRequested,
  1973. OUT LPWSADATA lpWSAData
  1974. );
  1975. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1976. #if INCL_WINSOCK_API_PROTOTYPES
  1977. WINSOCK_API_LINKAGE
  1978. int
  1979. WSAAPI
  1980. WSACleanup(
  1981. void
  1982. );
  1983. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1984. #if INCL_WINSOCK_API_TYPEDEFS
  1985. typedef
  1986. int
  1987. (WSAAPI * LPFN_WSACLEANUP)(
  1988. void
  1989. );
  1990. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  1991. #if INCL_WINSOCK_API_PROTOTYPES
  1992. WINSOCK_API_LINKAGE
  1993. void
  1994. WSAAPI
  1995. WSASetLastError(
  1996. IN int iError
  1997. );
  1998. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  1999. #if INCL_WINSOCK_API_TYPEDEFS
  2000. typedef
  2001. void
  2002. (WSAAPI * LPFN_WSASETLASTERROR)(
  2003. IN int iError
  2004. );
  2005. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2006. #if INCL_WINSOCK_API_PROTOTYPES
  2007. WINSOCK_API_LINKAGE
  2008. int
  2009. WSAAPI
  2010. WSAGetLastError(
  2011. void
  2012. );
  2013. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2014. #if INCL_WINSOCK_API_TYPEDEFS
  2015. typedef
  2016. int
  2017. (WSAAPI * LPFN_WSAGETLASTERROR)(
  2018. void
  2019. );
  2020. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2021. #if INCL_WINSOCK_API_PROTOTYPES
  2022. WINSOCK_API_LINKAGE
  2023. BOOL
  2024. WSAAPI
  2025. WSAIsBlocking(
  2026. void
  2027. );
  2028. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2029. #if INCL_WINSOCK_API_TYPEDEFS
  2030. typedef
  2031. BOOL
  2032. (WSAAPI * LPFN_WSAISBLOCKING)(
  2033. void
  2034. );
  2035. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2036. #if INCL_WINSOCK_API_PROTOTYPES
  2037. WINSOCK_API_LINKAGE
  2038. int
  2039. WSAAPI
  2040. WSAUnhookBlockingHook(
  2041. void
  2042. );
  2043. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2044. #if INCL_WINSOCK_API_TYPEDEFS
  2045. typedef
  2046. int
  2047. (WSAAPI * LPFN_WSAUNHOOKBLOCKINGHOOK)(
  2048. void
  2049. );
  2050. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2051. #if INCL_WINSOCK_API_PROTOTYPES
  2052. WINSOCK_API_LINKAGE
  2053. FARPROC
  2054. WSAAPI
  2055. WSASetBlockingHook(
  2056. IN FARPROC lpBlockFunc
  2057. );
  2058. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2059. #if INCL_WINSOCK_API_TYPEDEFS
  2060. typedef
  2061. FARPROC
  2062. (WSAAPI * LPFN_WSASETBLOCKINGHOOK)(
  2063. IN FARPROC lpBlockFunc
  2064. );
  2065. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2066. #if INCL_WINSOCK_API_PROTOTYPES
  2067. WINSOCK_API_LINKAGE
  2068. int
  2069. WSAAPI
  2070. WSACancelBlockingCall(
  2071. void
  2072. );
  2073. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2074. #if INCL_WINSOCK_API_TYPEDEFS
  2075. typedef
  2076. int
  2077. (WSAAPI * LPFN_WSACANCELBLOCKINGCALL)(
  2078. void
  2079. );
  2080. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2081. #if INCL_WINSOCK_API_PROTOTYPES
  2082. WINSOCK_API_LINKAGE
  2083. HANDLE
  2084. WSAAPI
  2085. WSAAsyncGetServByName(
  2086. IN HWND hWnd,
  2087. IN u_int wMsg,
  2088. IN const char FAR * name,
  2089. IN const char FAR * proto,
  2090. OUT char FAR * buf,
  2091. IN int buflen
  2092. );
  2093. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2094. #if INCL_WINSOCK_API_TYPEDEFS
  2095. typedef
  2096. HANDLE
  2097. (WSAAPI * LPFN_WSAASYNCGETSERVBYNAME)(
  2098. IN HWND hWnd,
  2099. IN u_int wMsg,
  2100. IN const char FAR * name,
  2101. IN const char FAR * proto,
  2102. OUT char FAR * buf,
  2103. IN int buflen
  2104. );
  2105. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2106. #if INCL_WINSOCK_API_PROTOTYPES
  2107. WINSOCK_API_LINKAGE
  2108. HANDLE
  2109. WSAAPI
  2110. WSAAsyncGetServByPort(
  2111. IN HWND hWnd,
  2112. IN u_int wMsg,
  2113. IN int port,
  2114. IN const char FAR * proto,
  2115. OUT char FAR * buf,
  2116. IN int buflen
  2117. );
  2118. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2119. #if INCL_WINSOCK_API_TYPEDEFS
  2120. typedef
  2121. HANDLE
  2122. (WSAAPI * LPFN_WSAASYNCGETSERVBYPORT)(
  2123. IN HWND hWnd,
  2124. IN u_int wMsg,
  2125. IN int port,
  2126. IN const char FAR * proto,
  2127. OUT char FAR * buf,
  2128. IN int buflen
  2129. );
  2130. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2131. #if INCL_WINSOCK_API_PROTOTYPES
  2132. WINSOCK_API_LINKAGE
  2133. HANDLE
  2134. WSAAPI
  2135. WSAAsyncGetProtoByName(
  2136. IN HWND hWnd,
  2137. IN u_int wMsg,
  2138. IN const char FAR * name,
  2139. OUT char FAR * buf,
  2140. IN int buflen
  2141. );
  2142. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2143. #if INCL_WINSOCK_API_TYPEDEFS
  2144. typedef
  2145. HANDLE
  2146. (WSAAPI * LPFN_WSAASYNCGETPROTOBYNAME)(
  2147. IN HWND hWnd,
  2148. IN u_int wMsg,
  2149. IN const char FAR * name,
  2150. OUT char FAR * buf,
  2151. IN int buflen
  2152. );
  2153. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2154. #if INCL_WINSOCK_API_PROTOTYPES
  2155. WINSOCK_API_LINKAGE
  2156. HANDLE
  2157. WSAAPI
  2158. WSAAsyncGetProtoByNumber(
  2159. IN HWND hWnd,
  2160. IN u_int wMsg,
  2161. IN int number,
  2162. OUT char FAR * buf,
  2163. IN int buflen
  2164. );
  2165. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2166. #if INCL_WINSOCK_API_TYPEDEFS
  2167. typedef
  2168. HANDLE
  2169. (WSAAPI * LPFN_WSAASYNCGETPROTOBYNUMBER)(
  2170. IN HWND hWnd,
  2171. IN u_int wMsg,
  2172. IN int number,
  2173. OUT char FAR * buf,
  2174. IN int buflen
  2175. );
  2176. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2177. #if INCL_WINSOCK_API_PROTOTYPES
  2178. WINSOCK_API_LINKAGE
  2179. HANDLE
  2180. WSAAPI
  2181. WSAAsyncGetHostByName(
  2182. IN HWND hWnd,
  2183. IN u_int wMsg,
  2184. IN const char FAR * name,
  2185. OUT char FAR * buf,
  2186. IN int buflen
  2187. );
  2188. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2189. #if INCL_WINSOCK_API_TYPEDEFS
  2190. typedef
  2191. HANDLE
  2192. (WSAAPI * LPFN_WSAASYNCGETHOSTBYNAME)(
  2193. IN HWND hWnd,
  2194. IN u_int wMsg,
  2195. IN const char FAR * name,
  2196. OUT char FAR * buf,
  2197. IN int buflen
  2198. );
  2199. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2200. #if INCL_WINSOCK_API_PROTOTYPES
  2201. WINSOCK_API_LINKAGE
  2202. HANDLE
  2203. WSAAPI
  2204. WSAAsyncGetHostByAddr(
  2205. IN HWND hWnd,
  2206. IN u_int wMsg,
  2207. IN const char FAR * addr,
  2208. IN int len,
  2209. IN int type,
  2210. OUT char FAR * buf,
  2211. IN int buflen
  2212. );
  2213. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2214. #if INCL_WINSOCK_API_TYPEDEFS
  2215. typedef
  2216. HANDLE
  2217. (WSAAPI * LPFN_WSAASYNCGETHOSTBYADDR)(
  2218. IN HWND hWnd,
  2219. IN u_int wMsg,
  2220. IN const char FAR * addr,
  2221. IN int len,
  2222. IN int type,
  2223. OUT char FAR * buf,
  2224. IN int buflen
  2225. );
  2226. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2227. #if INCL_WINSOCK_API_PROTOTYPES
  2228. WINSOCK_API_LINKAGE
  2229. int
  2230. WSAAPI
  2231. WSACancelAsyncRequest(
  2232. IN HANDLE hAsyncTaskHandle
  2233. );
  2234. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2235. #if INCL_WINSOCK_API_TYPEDEFS
  2236. typedef
  2237. int
  2238. (WSAAPI * LPFN_WSACANCELASYNCREQUEST)(
  2239. IN HANDLE hAsyncTaskHandle
  2240. );
  2241. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2242. #if INCL_WINSOCK_API_PROTOTYPES
  2243. WINSOCK_API_LINKAGE
  2244. int
  2245. WSAAPI
  2246. WSAAsyncSelect(
  2247. IN SOCKET s,
  2248. IN HWND hWnd,
  2249. IN u_int wMsg,
  2250. IN long lEvent
  2251. );
  2252. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2253. #if INCL_WINSOCK_API_TYPEDEFS
  2254. typedef
  2255. int
  2256. (WSAAPI * LPFN_WSAASYNCSELECT)(
  2257. IN SOCKET s,
  2258. IN HWND hWnd,
  2259. IN u_int wMsg,
  2260. IN long lEvent
  2261. );
  2262. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2263. /* WinSock 2 API new function prototypes */
  2264. #if INCL_WINSOCK_API_PROTOTYPES
  2265. WINSOCK_API_LINKAGE
  2266. SOCKET
  2267. WSAAPI
  2268. WSAAccept(
  2269. IN SOCKET s,
  2270. OUT struct sockaddr FAR * addr,
  2271. IN OUT LPINT addrlen,
  2272. IN LPCONDITIONPROC lpfnCondition,
  2273. IN DWORD_PTR dwCallbackData
  2274. );
  2275. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2276. #if INCL_WINSOCK_API_TYPEDEFS
  2277. typedef
  2278. SOCKET
  2279. (WSAAPI * LPFN_WSAACCEPT)(
  2280. IN SOCKET s,
  2281. OUT struct sockaddr FAR * addr,
  2282. IN OUT LPINT addrlen,
  2283. IN LPCONDITIONPROC lpfnCondition,
  2284. IN DWORD_PTR dwCallbackData
  2285. );
  2286. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2287. #if INCL_WINSOCK_API_PROTOTYPES
  2288. WINSOCK_API_LINKAGE
  2289. BOOL
  2290. WSAAPI
  2291. WSACloseEvent(
  2292. IN WSAEVENT hEvent
  2293. );
  2294. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2295. #if INCL_WINSOCK_API_TYPEDEFS
  2296. typedef
  2297. BOOL
  2298. (WSAAPI * LPFN_WSACLOSEEVENT)(
  2299. IN WSAEVENT hEvent
  2300. );
  2301. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2302. #if INCL_WINSOCK_API_PROTOTYPES
  2303. WINSOCK_API_LINKAGE
  2304. int
  2305. WSAAPI
  2306. WSAConnect(
  2307. IN SOCKET s,
  2308. IN const struct sockaddr FAR * name,
  2309. IN int namelen,
  2310. IN LPWSABUF lpCallerData,
  2311. OUT LPWSABUF lpCalleeData,
  2312. IN LPQOS lpSQOS,
  2313. IN LPQOS lpGQOS
  2314. );
  2315. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2316. #if INCL_WINSOCK_API_TYPEDEFS
  2317. typedef
  2318. int
  2319. (WSAAPI * LPFN_WSACONNECT)(
  2320. IN SOCKET s,
  2321. IN const struct sockaddr FAR * name,
  2322. IN int namelen,
  2323. IN LPWSABUF lpCallerData,
  2324. OUT LPWSABUF lpCalleeData,
  2325. IN LPQOS lpSQOS,
  2326. IN LPQOS lpGQOS
  2327. );
  2328. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2329. #if INCL_WINSOCK_API_PROTOTYPES
  2330. WINSOCK_API_LINKAGE
  2331. WSAEVENT
  2332. WSAAPI
  2333. WSACreateEvent(
  2334. void
  2335. );
  2336. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2337. #if INCL_WINSOCK_API_TYPEDEFS
  2338. typedef
  2339. WSAEVENT
  2340. (WSAAPI * LPFN_WSACREATEEVENT)(
  2341. void
  2342. );
  2343. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2344. #if INCL_WINSOCK_API_PROTOTYPES
  2345. WINSOCK_API_LINKAGE
  2346. int
  2347. WSAAPI
  2348. WSADuplicateSocketA(
  2349. IN SOCKET s,
  2350. IN DWORD dwProcessId,
  2351. OUT LPWSAPROTOCOL_INFOA lpProtocolInfo
  2352. );
  2353. WINSOCK_API_LINKAGE
  2354. int
  2355. WSAAPI
  2356. WSADuplicateSocketW(
  2357. IN SOCKET s,
  2358. IN DWORD dwProcessId,
  2359. OUT LPWSAPROTOCOL_INFOW lpProtocolInfo
  2360. );
  2361. #ifdef UNICODE
  2362. #define WSADuplicateSocket WSADuplicateSocketW
  2363. #else
  2364. #define WSADuplicateSocket WSADuplicateSocketA
  2365. #endif /* !UNICODE */
  2366. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2367. #if INCL_WINSOCK_API_TYPEDEFS
  2368. typedef
  2369. int
  2370. (WSAAPI * LPFN_WSADUPLICATESOCKETA)(
  2371. IN SOCKET s,
  2372. IN DWORD dwProcessId,
  2373. OUT LPWSAPROTOCOL_INFOA lpProtocolInfo
  2374. );
  2375. typedef
  2376. int
  2377. (WSAAPI * LPFN_WSADUPLICATESOCKETW)(
  2378. IN SOCKET s,
  2379. IN DWORD dwProcessId,
  2380. OUT LPWSAPROTOCOL_INFOW lpProtocolInfo
  2381. );
  2382. #ifdef UNICODE
  2383. #define LPFN_WSADUPLICATESOCKET LPFN_WSADUPLICATESOCKETW
  2384. #else
  2385. #define LPFN_WSADUPLICATESOCKET LPFN_WSADUPLICATESOCKETA
  2386. #endif /* !UNICODE */
  2387. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2388. #if INCL_WINSOCK_API_PROTOTYPES
  2389. WINSOCK_API_LINKAGE
  2390. int
  2391. WSAAPI
  2392. WSAEnumNetworkEvents(
  2393. IN SOCKET s,
  2394. IN WSAEVENT hEventObject,
  2395. OUT LPWSANETWORKEVENTS lpNetworkEvents
  2396. );
  2397. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2398. #if INCL_WINSOCK_API_TYPEDEFS
  2399. typedef
  2400. int
  2401. (WSAAPI * LPFN_WSAENUMNETWORKEVENTS)(
  2402. IN SOCKET s,
  2403. IN WSAEVENT hEventObject,
  2404. OUT LPWSANETWORKEVENTS lpNetworkEvents
  2405. );
  2406. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2407. #if INCL_WINSOCK_API_PROTOTYPES
  2408. WINSOCK_API_LINKAGE
  2409. int
  2410. WSAAPI
  2411. WSAEnumProtocolsA(
  2412. IN LPINT lpiProtocols,
  2413. OUT LPWSAPROTOCOL_INFOA lpProtocolBuffer,
  2414. IN OUT LPDWORD lpdwBufferLength
  2415. );
  2416. WINSOCK_API_LINKAGE
  2417. int
  2418. WSAAPI
  2419. WSAEnumProtocolsW(
  2420. IN LPINT lpiProtocols,
  2421. OUT LPWSAPROTOCOL_INFOW lpProtocolBuffer,
  2422. IN OUT LPDWORD lpdwBufferLength
  2423. );
  2424. #ifdef UNICODE
  2425. #define WSAEnumProtocols WSAEnumProtocolsW
  2426. #else
  2427. #define WSAEnumProtocols WSAEnumProtocolsA
  2428. #endif /* !UNICODE */
  2429. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2430. #if INCL_WINSOCK_API_TYPEDEFS
  2431. typedef
  2432. int
  2433. (WSAAPI * LPFN_WSAENUMPROTOCOLSA)(
  2434. IN LPINT lpiProtocols,
  2435. OUT LPWSAPROTOCOL_INFOA lpProtocolBuffer,
  2436. IN OUT LPDWORD lpdwBufferLength
  2437. );
  2438. typedef
  2439. int
  2440. (WSAAPI * LPFN_WSAENUMPROTOCOLSW)(
  2441. IN LPINT lpiProtocols,
  2442. OUT LPWSAPROTOCOL_INFOW lpProtocolBuffer,
  2443. IN OUT LPDWORD lpdwBufferLength
  2444. );
  2445. #ifdef UNICODE
  2446. #define LPFN_WSAENUMPROTOCOLS LPFN_WSAENUMPROTOCOLSW
  2447. #else
  2448. #define LPFN_WSAENUMPROTOCOLS LPFN_WSAENUMPROTOCOLSA
  2449. #endif /* !UNICODE */
  2450. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2451. #if INCL_WINSOCK_API_PROTOTYPES
  2452. WINSOCK_API_LINKAGE
  2453. int
  2454. WSAAPI
  2455. WSAEventSelect(
  2456. IN SOCKET s,
  2457. IN WSAEVENT hEventObject,
  2458. IN long lNetworkEvents
  2459. );
  2460. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2461. #if INCL_WINSOCK_API_TYPEDEFS
  2462. typedef
  2463. int
  2464. (WSAAPI * LPFN_WSAEVENTSELECT)(
  2465. IN SOCKET s,
  2466. IN WSAEVENT hEventObject,
  2467. IN long lNetworkEvents
  2468. );
  2469. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2470. #if INCL_WINSOCK_API_PROTOTYPES
  2471. WINSOCK_API_LINKAGE
  2472. BOOL
  2473. WSAAPI
  2474. WSAGetOverlappedResult(
  2475. IN SOCKET s,
  2476. IN LPWSAOVERLAPPED lpOverlapped,
  2477. OUT LPDWORD lpcbTransfer,
  2478. IN BOOL fWait,
  2479. OUT LPDWORD lpdwFlags
  2480. );
  2481. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2482. #if INCL_WINSOCK_API_TYPEDEFS
  2483. typedef
  2484. BOOL
  2485. (WSAAPI * LPFN_WSAGETOVERLAPPEDRESULT)(
  2486. IN SOCKET s,
  2487. IN LPWSAOVERLAPPED lpOverlapped,
  2488. OUT LPDWORD lpcbTransfer,
  2489. IN BOOL fWait,
  2490. OUT LPDWORD lpdwFlags
  2491. );
  2492. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2493. #if INCL_WINSOCK_API_PROTOTYPES
  2494. WINSOCK_API_LINKAGE
  2495. BOOL
  2496. WSAAPI
  2497. WSAGetQOSByName(
  2498. IN SOCKET s,
  2499. IN LPWSABUF lpQOSName,
  2500. OUT LPQOS lpQOS
  2501. );
  2502. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2503. #if INCL_WINSOCK_API_TYPEDEFS
  2504. typedef
  2505. BOOL
  2506. (WSAAPI * LPFN_WSAGETQOSBYNAME)(
  2507. IN SOCKET s,
  2508. IN LPWSABUF lpQOSName,
  2509. OUT LPQOS lpQOS
  2510. );
  2511. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2512. #if INCL_WINSOCK_API_PROTOTYPES
  2513. WINSOCK_API_LINKAGE
  2514. int
  2515. WSAAPI
  2516. WSAHtonl(
  2517. IN SOCKET s,
  2518. IN u_long hostlong,
  2519. OUT u_long FAR * lpnetlong
  2520. );
  2521. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2522. #if INCL_WINSOCK_API_TYPEDEFS
  2523. typedef
  2524. int
  2525. (WSAAPI * LPFN_WSAHTONL)(
  2526. IN SOCKET s,
  2527. IN u_long hostlong,
  2528. OUT u_long FAR * lpnetlong
  2529. );
  2530. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2531. #if INCL_WINSOCK_API_PROTOTYPES
  2532. WINSOCK_API_LINKAGE
  2533. int
  2534. WSAAPI
  2535. WSAHtons(
  2536. IN SOCKET s,
  2537. IN u_short hostshort,
  2538. OUT u_short FAR * lpnetshort
  2539. );
  2540. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2541. #if INCL_WINSOCK_API_TYPEDEFS
  2542. typedef
  2543. int
  2544. (WSAAPI * LPFN_WSAHTONS)(
  2545. IN SOCKET s,
  2546. IN u_short hostshort,
  2547. OUT u_short FAR * lpnetshort
  2548. );
  2549. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2550. #if INCL_WINSOCK_API_PROTOTYPES
  2551. WINSOCK_API_LINKAGE
  2552. int
  2553. WSAAPI
  2554. WSAIoctl(
  2555. IN SOCKET s,
  2556. IN DWORD dwIoControlCode,
  2557. IN LPVOID lpvInBuffer,
  2558. IN DWORD cbInBuffer,
  2559. OUT LPVOID lpvOutBuffer,
  2560. IN DWORD cbOutBuffer,
  2561. OUT LPDWORD lpcbBytesReturned,
  2562. IN LPWSAOVERLAPPED lpOverlapped,
  2563. IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  2564. );
  2565. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2566. #if INCL_WINSOCK_API_TYPEDEFS
  2567. typedef
  2568. int
  2569. (WSAAPI * LPFN_WSAIOCTL)(
  2570. IN SOCKET s,
  2571. IN DWORD dwIoControlCode,
  2572. IN LPVOID lpvInBuffer,
  2573. IN DWORD cbInBuffer,
  2574. OUT LPVOID lpvOutBuffer,
  2575. IN DWORD cbOutBuffer,
  2576. OUT LPDWORD lpcbBytesReturned,
  2577. IN LPWSAOVERLAPPED lpOverlapped,
  2578. IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  2579. );
  2580. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2581. #if INCL_WINSOCK_API_PROTOTYPES
  2582. WINSOCK_API_LINKAGE
  2583. SOCKET
  2584. WSAAPI
  2585. WSAJoinLeaf(
  2586. IN SOCKET s,
  2587. IN const struct sockaddr FAR * name,
  2588. IN int namelen,
  2589. IN LPWSABUF lpCallerData,
  2590. OUT LPWSABUF lpCalleeData,
  2591. IN LPQOS lpSQOS,
  2592. IN LPQOS lpGQOS,
  2593. IN DWORD dwFlags
  2594. );
  2595. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2596. #if INCL_WINSOCK_API_TYPEDEFS
  2597. typedef
  2598. SOCKET
  2599. (WSAAPI * LPFN_WSAJOINLEAF)(
  2600. IN SOCKET s,
  2601. IN const struct sockaddr FAR * name,
  2602. IN int namelen,
  2603. IN LPWSABUF lpCallerData,
  2604. OUT LPWSABUF lpCalleeData,
  2605. IN LPQOS lpSQOS,
  2606. IN LPQOS lpGQOS,
  2607. IN DWORD dwFlags
  2608. );
  2609. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2610. #if INCL_WINSOCK_API_PROTOTYPES
  2611. WINSOCK_API_LINKAGE
  2612. int
  2613. WSAAPI
  2614. WSANtohl(
  2615. IN SOCKET s,
  2616. IN u_long netlong,
  2617. OUT u_long FAR * lphostlong
  2618. );
  2619. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2620. #if INCL_WINSOCK_API_TYPEDEFS
  2621. typedef
  2622. int
  2623. (WSAAPI * LPFN_WSANTOHL)(
  2624. IN SOCKET s,
  2625. IN u_long netlong,
  2626. OUT u_long FAR * lphostlong
  2627. );
  2628. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2629. #if INCL_WINSOCK_API_PROTOTYPES
  2630. WINSOCK_API_LINKAGE
  2631. int
  2632. WSAAPI
  2633. WSANtohs(
  2634. IN SOCKET s,
  2635. IN u_short netshort,
  2636. OUT u_short FAR * lphostshort
  2637. );
  2638. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2639. #if INCL_WINSOCK_API_TYPEDEFS
  2640. typedef
  2641. int
  2642. (WSAAPI * LPFN_WSANTOHS)(
  2643. IN SOCKET s,
  2644. IN u_short netshort,
  2645. OUT u_short FAR * lphostshort
  2646. );
  2647. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2648. #if INCL_WINSOCK_API_PROTOTYPES
  2649. WINSOCK_API_LINKAGE
  2650. int
  2651. WSAAPI
  2652. WSARecv(
  2653. IN SOCKET s,
  2654. IN OUT LPWSABUF lpBuffers,
  2655. IN DWORD dwBufferCount,
  2656. OUT LPDWORD lpNumberOfBytesRecvd,
  2657. IN OUT LPDWORD lpFlags,
  2658. IN LPWSAOVERLAPPED lpOverlapped,
  2659. IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  2660. );
  2661. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2662. #if INCL_WINSOCK_API_TYPEDEFS
  2663. typedef
  2664. int
  2665. (WSAAPI * LPFN_WSARECV)(
  2666. IN SOCKET s,
  2667. IN OUT LPWSABUF lpBuffers,
  2668. IN DWORD dwBufferCount,
  2669. OUT LPDWORD lpNumberOfBytesRecvd,
  2670. IN OUT LPDWORD lpFlags,
  2671. IN LPWSAOVERLAPPED lpOverlapped,
  2672. IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  2673. );
  2674. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2675. #if INCL_WINSOCK_API_PROTOTYPES
  2676. WINSOCK_API_LINKAGE
  2677. int
  2678. WSAAPI
  2679. WSARecvDisconnect(
  2680. IN SOCKET s,
  2681. OUT LPWSABUF lpInboundDisconnectData
  2682. );
  2683. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2684. #if INCL_WINSOCK_API_TYPEDEFS
  2685. typedef
  2686. int
  2687. (WSAAPI * LPFN_WSARECVDISCONNECT)(
  2688. IN SOCKET s,
  2689. OUT LPWSABUF lpInboundDisconnectData
  2690. );
  2691. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2692. #if INCL_WINSOCK_API_PROTOTYPES
  2693. WINSOCK_API_LINKAGE
  2694. int
  2695. WSAAPI
  2696. WSARecvFrom(
  2697. IN SOCKET s,
  2698. IN OUT LPWSABUF lpBuffers,
  2699. IN DWORD dwBufferCount,
  2700. OUT LPDWORD lpNumberOfBytesRecvd,
  2701. IN OUT LPDWORD lpFlags,
  2702. OUT struct sockaddr FAR * lpFrom,
  2703. IN OUT LPINT lpFromlen,
  2704. IN LPWSAOVERLAPPED lpOverlapped,
  2705. IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  2706. );
  2707. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2708. #if INCL_WINSOCK_API_TYPEDEFS
  2709. typedef
  2710. int
  2711. (WSAAPI * LPFN_WSARECVFROM)(
  2712. IN SOCKET s,
  2713. IN OUT LPWSABUF lpBuffers,
  2714. IN DWORD dwBufferCount,
  2715. OUT LPDWORD lpNumberOfBytesRecvd,
  2716. IN OUT LPDWORD lpFlags,
  2717. OUT struct sockaddr FAR * lpFrom,
  2718. IN OUT LPINT lpFromlen,
  2719. IN LPWSAOVERLAPPED lpOverlapped,
  2720. IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  2721. );
  2722. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2723. #if INCL_WINSOCK_API_PROTOTYPES
  2724. WINSOCK_API_LINKAGE
  2725. BOOL
  2726. WSAAPI
  2727. WSAResetEvent(
  2728. IN WSAEVENT hEvent
  2729. );
  2730. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2731. #if INCL_WINSOCK_API_TYPEDEFS
  2732. typedef
  2733. BOOL
  2734. (WSAAPI * LPFN_WSARESETEVENT)(
  2735. IN WSAEVENT hEvent
  2736. );
  2737. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2738. #if INCL_WINSOCK_API_PROTOTYPES
  2739. WINSOCK_API_LINKAGE
  2740. int
  2741. WSAAPI
  2742. WSASend(
  2743. IN SOCKET s,
  2744. IN LPWSABUF lpBuffers,
  2745. IN DWORD dwBufferCount,
  2746. OUT LPDWORD lpNumberOfBytesSent,
  2747. IN DWORD dwFlags,
  2748. IN LPWSAOVERLAPPED lpOverlapped,
  2749. IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  2750. );
  2751. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2752. #if INCL_WINSOCK_API_TYPEDEFS
  2753. typedef
  2754. int
  2755. (WSAAPI * LPFN_WSASEND)(
  2756. IN SOCKET s,
  2757. IN LPWSABUF lpBuffers,
  2758. IN DWORD dwBufferCount,
  2759. OUT LPDWORD lpNumberOfBytesSent,
  2760. IN DWORD dwFlags,
  2761. IN LPWSAOVERLAPPED lpOverlapped,
  2762. IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  2763. );
  2764. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2765. #if INCL_WINSOCK_API_PROTOTYPES
  2766. WINSOCK_API_LINKAGE
  2767. int
  2768. WSAAPI
  2769. WSASendDisconnect(
  2770. IN SOCKET s,
  2771. IN LPWSABUF lpOutboundDisconnectData
  2772. );
  2773. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2774. #if INCL_WINSOCK_API_TYPEDEFS
  2775. typedef
  2776. int
  2777. (WSAAPI * LPFN_WSASENDDISCONNECT)(
  2778. IN SOCKET s,
  2779. IN LPWSABUF lpOutboundDisconnectData
  2780. );
  2781. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2782. #if INCL_WINSOCK_API_PROTOTYPES
  2783. WINSOCK_API_LINKAGE
  2784. int
  2785. WSAAPI
  2786. WSASendTo(
  2787. IN SOCKET s,
  2788. IN LPWSABUF lpBuffers,
  2789. IN DWORD dwBufferCount,
  2790. OUT LPDWORD lpNumberOfBytesSent,
  2791. IN DWORD dwFlags,
  2792. IN const struct sockaddr FAR * lpTo,
  2793. IN int iTolen,
  2794. IN LPWSAOVERLAPPED lpOverlapped,
  2795. IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  2796. );
  2797. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2798. #if INCL_WINSOCK_API_TYPEDEFS
  2799. typedef
  2800. int
  2801. (WSAAPI * LPFN_WSASENDTO)(
  2802. IN SOCKET s,
  2803. IN LPWSABUF lpBuffers,
  2804. IN DWORD dwBufferCount,
  2805. OUT LPDWORD lpNumberOfBytesSent,
  2806. IN DWORD dwFlags,
  2807. IN const struct sockaddr FAR * lpTo,
  2808. IN int iTolen,
  2809. IN LPWSAOVERLAPPED lpOverlapped,
  2810. IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  2811. );
  2812. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2813. #if INCL_WINSOCK_API_PROTOTYPES
  2814. WINSOCK_API_LINKAGE
  2815. BOOL
  2816. WSAAPI
  2817. WSASetEvent(
  2818. IN WSAEVENT hEvent
  2819. );
  2820. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2821. #if INCL_WINSOCK_API_TYPEDEFS
  2822. typedef
  2823. BOOL
  2824. (WSAAPI * LPFN_WSASETEVENT)(
  2825. IN WSAEVENT hEvent
  2826. );
  2827. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2828. #if INCL_WINSOCK_API_PROTOTYPES
  2829. WINSOCK_API_LINKAGE
  2830. SOCKET
  2831. WSAAPI
  2832. WSASocketA(
  2833. IN int af,
  2834. IN int type,
  2835. IN int protocol,
  2836. IN LPWSAPROTOCOL_INFOA lpProtocolInfo,
  2837. IN GROUP g,
  2838. IN DWORD dwFlags
  2839. );
  2840. WINSOCK_API_LINKAGE
  2841. SOCKET
  2842. WSAAPI
  2843. WSASocketW(
  2844. IN int af,
  2845. IN int type,
  2846. IN int protocol,
  2847. IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
  2848. IN GROUP g,
  2849. IN DWORD dwFlags
  2850. );
  2851. #ifdef UNICODE
  2852. #define WSASocket WSASocketW
  2853. #else
  2854. #define WSASocket WSASocketA
  2855. #endif /* !UNICODE */
  2856. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2857. #if INCL_WINSOCK_API_TYPEDEFS
  2858. typedef
  2859. SOCKET
  2860. (WSAAPI * LPFN_WSASOCKETA)(
  2861. IN int af,
  2862. IN int type,
  2863. IN int protocol,
  2864. IN LPWSAPROTOCOL_INFOA lpProtocolInfo,
  2865. IN GROUP g,
  2866. IN DWORD dwFlags
  2867. );
  2868. typedef
  2869. SOCKET
  2870. (WSAAPI * LPFN_WSASOCKETW)(
  2871. IN int af,
  2872. IN int type,
  2873. IN int protocol,
  2874. IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
  2875. IN GROUP g,
  2876. IN DWORD dwFlags
  2877. );
  2878. #ifdef UNICODE
  2879. #define LPFN_WSASOCKET LPFN_WSASOCKETW
  2880. #else
  2881. #define LPFN_WSASOCKET LPFN_WSASOCKETA
  2882. #endif /* !UNICODE */
  2883. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2884. #if INCL_WINSOCK_API_PROTOTYPES
  2885. WINSOCK_API_LINKAGE
  2886. DWORD
  2887. WSAAPI
  2888. WSAWaitForMultipleEvents(
  2889. IN DWORD cEvents,
  2890. IN const WSAEVENT FAR * lphEvents,
  2891. IN BOOL fWaitAll,
  2892. IN DWORD dwTimeout,
  2893. IN BOOL fAlertable
  2894. );
  2895. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2896. #if INCL_WINSOCK_API_TYPEDEFS
  2897. typedef
  2898. DWORD
  2899. (WSAAPI * LPFN_WSAWAITFORMULTIPLEEVENTS)(
  2900. IN DWORD cEvents,
  2901. IN const WSAEVENT FAR * lphEvents,
  2902. IN BOOL fWaitAll,
  2903. IN DWORD dwTimeout,
  2904. IN BOOL fAlertable
  2905. );
  2906. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2907. #if INCL_WINSOCK_API_PROTOTYPES
  2908. WINSOCK_API_LINKAGE
  2909. INT
  2910. WSAAPI
  2911. WSAAddressToStringA(
  2912. IN LPSOCKADDR lpsaAddress,
  2913. IN DWORD dwAddressLength,
  2914. IN LPWSAPROTOCOL_INFOA lpProtocolInfo,
  2915. IN OUT LPSTR lpszAddressString,
  2916. IN OUT LPDWORD lpdwAddressStringLength
  2917. );
  2918. WINSOCK_API_LINKAGE
  2919. INT
  2920. WSAAPI
  2921. WSAAddressToStringW(
  2922. IN LPSOCKADDR lpsaAddress,
  2923. IN DWORD dwAddressLength,
  2924. IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
  2925. IN OUT LPWSTR lpszAddressString,
  2926. IN OUT LPDWORD lpdwAddressStringLength
  2927. );
  2928. #ifdef UNICODE
  2929. #define WSAAddressToString WSAAddressToStringW
  2930. #else
  2931. #define WSAAddressToString WSAAddressToStringA
  2932. #endif /* !UNICODE */
  2933. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2934. #if INCL_WINSOCK_API_TYPEDEFS
  2935. typedef
  2936. INT
  2937. (WSAAPI * LPFN_WSAADDRESSTOSTRINGA)(
  2938. IN LPSOCKADDR lpsaAddress,
  2939. IN DWORD dwAddressLength,
  2940. IN LPWSAPROTOCOL_INFOA lpProtocolInfo,
  2941. IN OUT LPSTR lpszAddressString,
  2942. IN OUT LPDWORD lpdwAddressStringLength
  2943. );
  2944. typedef
  2945. INT
  2946. (WSAAPI * LPFN_WSAADDRESSTOSTRINGW)(
  2947. IN LPSOCKADDR lpsaAddress,
  2948. IN DWORD dwAddressLength,
  2949. IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
  2950. IN OUT LPWSTR lpszAddressString,
  2951. IN OUT LPDWORD lpdwAddressStringLength
  2952. );
  2953. #ifdef UNICODE
  2954. #define LPFN_WSAADDRESSTOSTRING LPFN_WSAADDRESSTOSTRINGW
  2955. #else
  2956. #define LPFN_WSAADDRESSTOSTRING LPFN_WSAADDRESSTOSTRINGA
  2957. #endif /* !UNICODE */
  2958. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  2959. #if INCL_WINSOCK_API_PROTOTYPES
  2960. WINSOCK_API_LINKAGE
  2961. INT
  2962. WSAAPI
  2963. WSAStringToAddressA(
  2964. IN LPSTR AddressString,
  2965. IN INT AddressFamily,
  2966. IN LPWSAPROTOCOL_INFOA lpProtocolInfo,
  2967. OUT LPSOCKADDR lpAddress,
  2968. IN OUT LPINT lpAddressLength
  2969. );
  2970. WINSOCK_API_LINKAGE
  2971. INT
  2972. WSAAPI
  2973. WSAStringToAddressW(
  2974. IN LPWSTR AddressString,
  2975. IN INT AddressFamily,
  2976. IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
  2977. OUT LPSOCKADDR lpAddress,
  2978. IN OUT LPINT lpAddressLength
  2979. );
  2980. #ifdef UNICODE
  2981. #define WSAStringToAddress WSAStringToAddressW
  2982. #else
  2983. #define WSAStringToAddress WSAStringToAddressA
  2984. #endif /* !UNICODE */
  2985. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  2986. #if INCL_WINSOCK_API_TYPEDEFS
  2987. typedef
  2988. INT
  2989. (WSAAPI * LPFN_WSASTRINGTOADDRESSA)(
  2990. IN LPSTR AddressString,
  2991. IN INT AddressFamily,
  2992. IN LPWSAPROTOCOL_INFOA lpProtocolInfo,
  2993. OUT LPSOCKADDR lpAddress,
  2994. IN OUT LPINT lpAddressLength
  2995. );
  2996. typedef
  2997. INT
  2998. (WSAAPI * LPFN_WSASTRINGTOADDRESSW)(
  2999. IN LPWSTR AddressString,
  3000. IN INT AddressFamily,
  3001. IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
  3002. OUT LPSOCKADDR lpAddress,
  3003. IN OUT LPINT lpAddressLength
  3004. );
  3005. #ifdef UNICODE
  3006. #define LPFN_WSASTRINGTOADDRESS LPFN_WSASTRINGTOADDRESSW
  3007. #else
  3008. #define LPFN_WSASTRINGTOADDRESS LPFN_WSASTRINGTOADDRESSA
  3009. #endif /* !UNICODE */
  3010. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  3011. /* Registration and Name Resolution API functions */
  3012. #if INCL_WINSOCK_API_PROTOTYPES
  3013. WINSOCK_API_LINKAGE
  3014. INT
  3015. WSAAPI
  3016. WSALookupServiceBeginA(
  3017. IN LPWSAQUERYSETA lpqsRestrictions,
  3018. IN DWORD dwControlFlags,
  3019. OUT LPHANDLE lphLookup
  3020. );
  3021. WINSOCK_API_LINKAGE
  3022. INT
  3023. WSAAPI
  3024. WSALookupServiceBeginW(
  3025. IN LPWSAQUERYSETW lpqsRestrictions,
  3026. IN DWORD dwControlFlags,
  3027. OUT LPHANDLE lphLookup
  3028. );
  3029. #ifdef UNICODE
  3030. #define WSALookupServiceBegin WSALookupServiceBeginW
  3031. #else
  3032. #define WSALookupServiceBegin WSALookupServiceBeginA
  3033. #endif /* !UNICODE */
  3034. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  3035. #if INCL_WINSOCK_API_TYPEDEFS
  3036. typedef
  3037. INT
  3038. (WSAAPI * LPFN_WSALOOKUPSERVICEBEGINA)(
  3039. IN LPWSAQUERYSETA lpqsRestrictions,
  3040. IN DWORD dwControlFlags,
  3041. OUT LPHANDLE lphLookup
  3042. );
  3043. typedef
  3044. INT
  3045. (WSAAPI * LPFN_WSALOOKUPSERVICEBEGINW)(
  3046. IN LPWSAQUERYSETW lpqsRestrictions,
  3047. IN DWORD dwControlFlags,
  3048. OUT LPHANDLE lphLookup
  3049. );
  3050. #ifdef UNICODE
  3051. #define LPFN_WSALOOKUPSERVICEBEGIN LPFN_WSALOOKUPSERVICEBEGINW
  3052. #else
  3053. #define LPFN_WSALOOKUPSERVICEBEGIN LPFN_WSALOOKUPSERVICEBEGINA
  3054. #endif /* !UNICODE */
  3055. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  3056. #if INCL_WINSOCK_API_PROTOTYPES
  3057. WINSOCK_API_LINKAGE
  3058. INT
  3059. WSAAPI
  3060. WSALookupServiceNextA(
  3061. IN HANDLE hLookup,
  3062. IN DWORD dwControlFlags,
  3063. IN OUT LPDWORD lpdwBufferLength,
  3064. OUT LPWSAQUERYSETA lpqsResults
  3065. );
  3066. WINSOCK_API_LINKAGE
  3067. INT
  3068. WSAAPI
  3069. WSALookupServiceNextW(
  3070. IN HANDLE hLookup,
  3071. IN DWORD dwControlFlags,
  3072. IN OUT LPDWORD lpdwBufferLength,
  3073. OUT LPWSAQUERYSETW lpqsResults
  3074. );
  3075. #ifdef UNICODE
  3076. #define WSALookupServiceNext WSALookupServiceNextW
  3077. #else
  3078. #define WSALookupServiceNext WSALookupServiceNextA
  3079. #endif /* !UNICODE */
  3080. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  3081. #if INCL_WINSOCK_API_TYPEDEFS
  3082. typedef
  3083. INT
  3084. (WSAAPI * LPFN_WSALOOKUPSERVICENEXTA)(
  3085. IN HANDLE hLookup,
  3086. IN DWORD dwControlFlags,
  3087. IN OUT LPDWORD lpdwBufferLength,
  3088. OUT LPWSAQUERYSETA lpqsResults
  3089. );
  3090. typedef
  3091. INT
  3092. (WSAAPI * LPFN_WSALOOKUPSERVICENEXTW)(
  3093. IN HANDLE hLookup,
  3094. IN DWORD dwControlFlags,
  3095. IN OUT LPDWORD lpdwBufferLength,
  3096. OUT LPWSAQUERYSETW lpqsResults
  3097. );
  3098. #ifdef UNICODE
  3099. #define LPFN_WSALOOKUPSERVICENEXT LPFN_WSALOOKUPSERVICENEXTW
  3100. #else
  3101. #define LPFN_WSALOOKUPSERVICENEXT LPFN_WSALOOKUPSERVICENEXTA
  3102. #endif /* !UNICODE */
  3103. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  3104. #if INCL_WINSOCK_API_PROTOTYPES
  3105. WINSOCK_API_LINKAGE
  3106. INT
  3107. WSAAPI
  3108. WSANSPIoctl(
  3109. IN HANDLE hLookup,
  3110. IN DWORD dwControlCode,
  3111. IN LPVOID lpvInBuffer,
  3112. IN DWORD cbInBuffer,
  3113. OUT LPVOID lpvOutBuffer,
  3114. IN DWORD cbOutBuffer,
  3115. OUT LPDWORD lpcbBytesReturned,
  3116. IN LPWSACOMPLETION lpCompletion
  3117. );
  3118. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  3119. #if INCL_WINSOCK_API_TYPEDEFS
  3120. typedef
  3121. INT
  3122. (WSAAPI * LPFN_WSANSPIOCTL)(
  3123. IN HANDLE hLookup,
  3124. IN DWORD dwControlCode,
  3125. IN LPVOID lpvInBuffer,
  3126. IN DWORD cbInBuffer,
  3127. OUT LPVOID lpvOutBuffer,
  3128. IN DWORD cbOutBuffer,
  3129. OUT LPDWORD lpcbBytesReturned,
  3130. IN LPWSACOMPLETION lpCompletion
  3131. );
  3132. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  3133. #if INCL_WINSOCK_API_PROTOTYPES
  3134. WINSOCK_API_LINKAGE
  3135. INT
  3136. WSAAPI
  3137. WSALookupServiceEnd(
  3138. IN HANDLE hLookup
  3139. );
  3140. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  3141. #if INCL_WINSOCK_API_TYPEDEFS
  3142. typedef
  3143. INT
  3144. (WSAAPI * LPFN_WSALOOKUPSERVICEEND)(
  3145. IN HANDLE hLookup
  3146. );
  3147. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  3148. #if INCL_WINSOCK_API_PROTOTYPES
  3149. WINSOCK_API_LINKAGE
  3150. INT
  3151. WSAAPI
  3152. WSAInstallServiceClassA(
  3153. IN LPWSASERVICECLASSINFOA lpServiceClassInfo
  3154. );
  3155. WINSOCK_API_LINKAGE
  3156. INT
  3157. WSAAPI
  3158. WSAInstallServiceClassW(
  3159. IN LPWSASERVICECLASSINFOW lpServiceClassInfo
  3160. );
  3161. #ifdef UNICODE
  3162. #define WSAInstallServiceClass WSAInstallServiceClassW
  3163. #else
  3164. #define WSAInstallServiceClass WSAInstallServiceClassA
  3165. #endif /* !UNICODE */
  3166. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  3167. #if INCL_WINSOCK_API_TYPEDEFS
  3168. typedef
  3169. INT
  3170. (WSAAPI * LPFN_WSAINSTALLSERVICECLASSA)(
  3171. IN LPWSASERVICECLASSINFOA lpServiceClassInfo
  3172. );
  3173. typedef
  3174. INT
  3175. (WSAAPI * LPFN_WSAINSTALLSERVICECLASSW)(
  3176. IN LPWSASERVICECLASSINFOW lpServiceClassInfo
  3177. );
  3178. #ifdef UNICODE
  3179. #define LPFN_WSAINSTALLSERVICECLASS LPFN_WSAINSTALLSERVICECLASSW
  3180. #else
  3181. #define LPFN_WSAINSTALLSERVICECLASS LPFN_WSAINSTALLSERVICECLASSA
  3182. #endif /* !UNICODE */
  3183. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  3184. #if INCL_WINSOCK_API_PROTOTYPES
  3185. WINSOCK_API_LINKAGE
  3186. INT
  3187. WSAAPI
  3188. WSARemoveServiceClass(
  3189. IN LPGUID lpServiceClassId
  3190. );
  3191. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  3192. #if INCL_WINSOCK_API_TYPEDEFS
  3193. typedef
  3194. INT
  3195. (WSAAPI * LPFN_WSAREMOVESERVICECLASS)(
  3196. IN LPGUID lpServiceClassId
  3197. );
  3198. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  3199. #if INCL_WINSOCK_API_PROTOTYPES
  3200. WINSOCK_API_LINKAGE
  3201. INT
  3202. WSAAPI
  3203. WSAGetServiceClassInfoA(
  3204. IN LPGUID lpProviderId,
  3205. IN LPGUID lpServiceClassId,
  3206. IN OUT LPDWORD lpdwBufSize,
  3207. OUT LPWSASERVICECLASSINFOA lpServiceClassInfo
  3208. );
  3209. WINSOCK_API_LINKAGE
  3210. INT
  3211. WSAAPI
  3212. WSAGetServiceClassInfoW(
  3213. IN LPGUID lpProviderId,
  3214. IN LPGUID lpServiceClassId,
  3215. IN OUT LPDWORD lpdwBufSize,
  3216. OUT LPWSASERVICECLASSINFOW lpServiceClassInfo
  3217. );
  3218. #ifdef UNICODE
  3219. #define WSAGetServiceClassInfo WSAGetServiceClassInfoW
  3220. #else
  3221. #define WSAGetServiceClassInfo WSAGetServiceClassInfoA
  3222. #endif /* !UNICODE */
  3223. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  3224. #if INCL_WINSOCK_API_TYPEDEFS
  3225. typedef
  3226. INT
  3227. (WSAAPI * LPFN_WSAGETSERVICECLASSINFOA)(
  3228. IN LPGUID lpProviderId,
  3229. IN LPGUID lpServiceClassId,
  3230. IN OUT LPDWORD lpdwBufSize,
  3231. OUT LPWSASERVICECLASSINFOA lpServiceClassInfo
  3232. );
  3233. typedef
  3234. INT
  3235. (WSAAPI * LPFN_WSAGETSERVICECLASSINFOW)(
  3236. IN LPGUID lpProviderId,
  3237. IN LPGUID lpServiceClassId,
  3238. IN OUT LPDWORD lpdwBufSize,
  3239. OUT LPWSASERVICECLASSINFOW lpServiceClassInfo
  3240. );
  3241. #ifdef UNICODE
  3242. #define LPFN_WSAGETSERVICECLASSINFO LPFN_WSAGETSERVICECLASSINFOW
  3243. #else
  3244. #define LPFN_WSAGETSERVICECLASSINFO LPFN_WSAGETSERVICECLASSINFOA
  3245. #endif /* !UNICODE */
  3246. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  3247. #if INCL_WINSOCK_API_PROTOTYPES
  3248. WINSOCK_API_LINKAGE
  3249. INT
  3250. WSAAPI
  3251. WSAEnumNameSpaceProvidersA(
  3252. IN OUT LPDWORD lpdwBufferLength,
  3253. OUT LPWSANAMESPACE_INFOA lpnspBuffer
  3254. );
  3255. WINSOCK_API_LINKAGE
  3256. INT
  3257. WSAAPI
  3258. WSAEnumNameSpaceProvidersW(
  3259. IN OUT LPDWORD lpdwBufferLength,
  3260. OUT LPWSANAMESPACE_INFOW lpnspBuffer
  3261. );
  3262. #ifdef UNICODE
  3263. #define WSAEnumNameSpaceProviders WSAEnumNameSpaceProvidersW
  3264. #else
  3265. #define WSAEnumNameSpaceProviders WSAEnumNameSpaceProvidersA
  3266. #endif /* !UNICODE */
  3267. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  3268. #if INCL_WINSOCK_API_TYPEDEFS
  3269. typedef
  3270. INT
  3271. (WSAAPI * LPFN_WSAENUMNAMESPACEPROVIDERSA)(
  3272. IN OUT LPDWORD lpdwBufferLength,
  3273. OUT LPWSANAMESPACE_INFOA lpnspBuffer
  3274. );
  3275. typedef
  3276. INT
  3277. (WSAAPI * LPFN_WSAENUMNAMESPACEPROVIDERSW)(
  3278. IN OUT LPDWORD lpdwBufferLength,
  3279. OUT LPWSANAMESPACE_INFOW lpnspBuffer
  3280. );
  3281. #ifdef UNICODE
  3282. #define LPFN_WSAENUMNAMESPACEPROVIDERS LPFN_WSAENUMNAMESPACEPROVIDERSW
  3283. #else
  3284. #define LPFN_WSAENUMNAMESPACEPROVIDERS LPFN_WSAENUMNAMESPACEPROVIDERSA
  3285. #endif /* !UNICODE */
  3286. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  3287. #if INCL_WINSOCK_API_PROTOTYPES
  3288. WINSOCK_API_LINKAGE
  3289. INT
  3290. WSAAPI
  3291. WSAGetServiceClassNameByClassIdA(
  3292. IN LPGUID lpServiceClassId,
  3293. OUT LPSTR lpszServiceClassName,
  3294. IN OUT LPDWORD lpdwBufferLength
  3295. );
  3296. WINSOCK_API_LINKAGE
  3297. INT
  3298. WSAAPI
  3299. WSAGetServiceClassNameByClassIdW(
  3300. IN LPGUID lpServiceClassId,
  3301. OUT LPWSTR lpszServiceClassName,
  3302. IN OUT LPDWORD lpdwBufferLength
  3303. );
  3304. #ifdef UNICODE
  3305. #define WSAGetServiceClassNameByClassId WSAGetServiceClassNameByClassIdW
  3306. #else
  3307. #define WSAGetServiceClassNameByClassId WSAGetServiceClassNameByClassIdA
  3308. #endif /* !UNICODE */
  3309. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  3310. #if INCL_WINSOCK_API_TYPEDEFS
  3311. typedef
  3312. INT
  3313. (WSAAPI * LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA)(
  3314. IN LPGUID lpServiceClassId,
  3315. OUT LPSTR lpszServiceClassName,
  3316. IN OUT LPDWORD lpdwBufferLength
  3317. );
  3318. typedef
  3319. INT
  3320. (WSAAPI * LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW)(
  3321. IN LPGUID lpServiceClassId,
  3322. OUT LPWSTR lpszServiceClassName,
  3323. IN OUT LPDWORD lpdwBufferLength
  3324. );
  3325. #ifdef UNICODE
  3326. #define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW
  3327. #else
  3328. #define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA
  3329. #endif /* !UNICODE */
  3330. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  3331. #if INCL_WINSOCK_API_PROTOTYPES
  3332. WINSOCK_API_LINKAGE
  3333. INT
  3334. WSAAPI
  3335. WSASetServiceA(
  3336. IN LPWSAQUERYSETA lpqsRegInfo,
  3337. IN WSAESETSERVICEOP essoperation,
  3338. IN DWORD dwControlFlags
  3339. );
  3340. WINSOCK_API_LINKAGE
  3341. INT
  3342. WSAAPI
  3343. WSASetServiceW(
  3344. IN LPWSAQUERYSETW lpqsRegInfo,
  3345. IN WSAESETSERVICEOP essoperation,
  3346. IN DWORD dwControlFlags
  3347. );
  3348. #ifdef UNICODE
  3349. #define WSASetService WSASetServiceW
  3350. #else
  3351. #define WSASetService WSASetServiceA
  3352. #endif /* !UNICODE */
  3353. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  3354. #if INCL_WINSOCK_API_TYPEDEFS
  3355. typedef
  3356. INT
  3357. (WSAAPI * LPFN_WSASETSERVICEA)(
  3358. IN LPWSAQUERYSETA lpqsRegInfo,
  3359. IN WSAESETSERVICEOP essoperation,
  3360. IN DWORD dwControlFlags
  3361. );
  3362. typedef
  3363. INT
  3364. (WSAAPI * LPFN_WSASETSERVICEW)(
  3365. IN LPWSAQUERYSETW lpqsRegInfo,
  3366. IN WSAESETSERVICEOP essoperation,
  3367. IN DWORD dwControlFlags
  3368. );
  3369. #ifdef UNICODE
  3370. #define LPFN_WSASETSERVICE LPFN_WSASETSERVICEW
  3371. #else
  3372. #define LPFN_WSASETSERVICE LPFN_WSASETSERVICEA
  3373. #endif /* !UNICODE */
  3374. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  3375. #if INCL_WINSOCK_API_PROTOTYPES
  3376. WINSOCK_API_LINKAGE
  3377. INT
  3378. WSAAPI
  3379. WSAProviderConfigChange(
  3380. IN OUT LPHANDLE lpNotificationHandle,
  3381. IN LPWSAOVERLAPPED lpOverlapped,
  3382. IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  3383. );
  3384. #endif /* INCL_WINSOCK_API_PROTOTYPES */
  3385. #if INCL_WINSOCK_API_TYPEDEFS
  3386. typedef
  3387. INT
  3388. (WSAAPI * LPFN_WSAPROVIDERCONFIGCHANGE)(
  3389. IN OUT LPHANDLE lpNotificationHandle,
  3390. IN LPWSAOVERLAPPED lpOverlapped,
  3391. IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  3392. );
  3393. #endif /* INCL_WINSOCK_API_TYPEDEFS */
  3394. /* Microsoft Windows Extended data types */
  3395. typedef struct sockaddr_in SOCKADDR_IN;
  3396. typedef struct sockaddr_in *PSOCKADDR_IN;
  3397. typedef struct sockaddr_in FAR *LPSOCKADDR_IN;
  3398. typedef struct linger LINGER;
  3399. typedef struct linger *PLINGER;
  3400. typedef struct linger FAR *LPLINGER;
  3401. typedef struct in_addr IN_ADDR;
  3402. typedef struct in_addr *PIN_ADDR;
  3403. typedef struct in_addr FAR *LPIN_ADDR;
  3404. typedef struct fd_set FD_SET;
  3405. typedef struct fd_set *PFD_SET;
  3406. typedef struct fd_set FAR *LPFD_SET;
  3407. typedef struct hostent HOSTENT;
  3408. typedef struct hostent *PHOSTENT;
  3409. typedef struct hostent FAR *LPHOSTENT;
  3410. typedef struct servent SERVENT;
  3411. typedef struct servent *PSERVENT;
  3412. typedef struct servent FAR *LPSERVENT;
  3413. typedef struct protoent PROTOENT;
  3414. typedef struct protoent *PPROTOENT;
  3415. typedef struct protoent FAR *LPPROTOENT;
  3416. typedef struct timeval TIMEVAL;
  3417. typedef struct timeval *PTIMEVAL;
  3418. typedef struct timeval FAR *LPTIMEVAL;
  3419. /*
  3420. * Windows message parameter composition and decomposition
  3421. * macros.
  3422. *
  3423. * WSAMAKEASYNCREPLY is intended for use by the Windows Sockets implementation
  3424. * when constructing the response to a WSAAsyncGetXByY() routine.
  3425. */
  3426. #define WSAMAKEASYNCREPLY(buflen,error) MAKELONG(buflen,error)
  3427. /*
  3428. * WSAMAKESELECTREPLY is intended for use by the Windows Sockets implementation
  3429. * when constructing the response to WSAAsyncSelect().
  3430. */
  3431. #define WSAMAKESELECTREPLY(event,error) MAKELONG(event,error)
  3432. /*
  3433. * WSAGETASYNCBUFLEN is intended for use by the Windows Sockets application
  3434. * to extract the buffer length from the lParam in the response
  3435. * to a WSAAsyncGetXByY().
  3436. */
  3437. #define WSAGETASYNCBUFLEN(lParam) LOWORD(lParam)
  3438. /*
  3439. * WSAGETASYNCERROR is intended for use by the Windows Sockets application
  3440. * to extract the error code from the lParam in the response
  3441. * to a WSAGetXByY().
  3442. */
  3443. #define WSAGETASYNCERROR(lParam) HIWORD(lParam)
  3444. /*
  3445. * WSAGETSELECTEVENT is intended for use by the Windows Sockets application
  3446. * to extract the event code from the lParam in the response
  3447. * to a WSAAsyncSelect().
  3448. */
  3449. #define WSAGETSELECTEVENT(lParam) LOWORD(lParam)
  3450. /*
  3451. * WSAGETSELECTERROR is intended for use by the Windows Sockets application
  3452. * to extract the error code from the lParam in the response
  3453. * to a WSAAsyncSelect().
  3454. */
  3455. #define WSAGETSELECTERROR(lParam) HIWORD(lParam)
  3456. #ifdef __cplusplus
  3457. }
  3458. #endif
  3459. #if !defined(WIN32) && !defined(_WIN64)
  3460. #include <poppack.h>
  3461. #endif
  3462. #ifdef IPV6STRICT
  3463. #include <wsipv6ok.h>
  3464. #endif // IPV6STRICT
  3465. #endif /* _WINSOCK2API_ */