home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 May / VPR9705A.ISO / VPR_DATA / PROGRAM / CBTRIAL / SETUP / DATA.Z / WINSOCK2.H < prev    next >
C/C++ Source or Header  |  1997-02-14  |  94KB  |  3,605 lines

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