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