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