Source code of Windows XP (NT5)
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.

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