home *** CD-ROM | disk | FTP | other *** search
/ Beginning C++ Through Gam…rogramming (2nd Edition) / BCGP2E.ISO / bloodshed / devcpp-4.9.9.2_setup.exe / winsock.h < prev    next >
C/C++ Source or Header  |  2005-01-29  |  16KB  |  536 lines

  1. /*
  2.  
  3.   Definitions for winsock 1.1
  4.   
  5.   Portions Copyright (c) 1980, 1983, 1988, 1993
  6.   The Regents of the University of California.  All rights reserved.
  7.  
  8.   Portions Copyright (c) 1993 by Digital Equipment Corporation.
  9.  */
  10.  
  11. #ifndef _WINSOCK_H
  12. #define _WINSOCK_H
  13. #if __GNUC__ >=3
  14. #pragma GCC system_header
  15. #endif
  16.  
  17. #define _GNU_H_WINDOWS32_SOCKETS
  18. #include <windows.h>
  19.  
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23.  
  24. #if !defined ( _BSDTYPES_DEFINED )
  25. /* also defined in gmon.h and in cygwin's sys/types */
  26. typedef unsigned char    u_char;
  27. typedef unsigned short    u_short;
  28. typedef unsigned int    u_int;
  29. typedef unsigned long    u_long;
  30. #define _BSDTYPES_DEFINED
  31. #endif /* !defined  _BSDTYPES_DEFINED */
  32. typedef u_int    SOCKET;
  33. #ifndef FD_SETSIZE
  34. #define FD_SETSIZE    64
  35. #endif
  36.  
  37. /* shutdown() how types */
  38. #define SD_RECEIVE      0x00
  39. #define SD_SEND         0x01
  40. #define SD_BOTH         0x02
  41.  
  42. #ifndef _SYS_TYPES_FD_SET
  43. /* fd_set may have be defined by the newlib <sys/types.h>
  44.  * if  __USE_W32_SOCKETS not defined.
  45.  */
  46. #ifdef fd_set
  47. #undef fd_set
  48. #endif
  49. typedef struct fd_set {
  50.     u_int   fd_count;
  51.     SOCKET  fd_array[FD_SETSIZE];
  52. } fd_set;
  53. int PASCAL __WSAFDIsSet(SOCKET,fd_set*);
  54. #ifndef FD_CLR
  55. #define FD_CLR(fd,set) do { u_int __i;\
  56. for (__i = 0; __i < ((fd_set *)(set))->fd_count ; __i++) {\
  57.     if (((fd_set *)(set))->fd_array[__i] == (fd)) {\
  58.     while (__i < ((fd_set *)(set))->fd_count-1) {\
  59.         ((fd_set*)(set))->fd_array[__i] = ((fd_set*)(set))->fd_array[__i+1];\
  60.         __i++;\
  61.     }\
  62.     ((fd_set*)(set))->fd_count--;\
  63.     break;\
  64.     }\
  65. }\
  66. } while (0)
  67. #endif
  68. #ifndef FD_SET
  69. #define FD_SET(fd, set) do { \
  70.     if (((fd_set *)(set))->fd_count < FD_SETSIZE) \
  71.     ((fd_set *)(set))->fd_array[((fd_set *)(set))->fd_count++]=(fd);\
  72. }while (0)
  73. #endif
  74. #ifndef FD_ZERO
  75. #define FD_ZERO(set) (((fd_set *)(set))->fd_count=0)
  76. #endif
  77. #ifndef FD_ISSET
  78. #define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (fd_set *)(set))
  79. #endif
  80. #elif !defined(USE_SYS_TYPES_FD_SET)
  81. #warning "fd_set and associated macros have been defined in sys/types.  \
  82.     This can cause runtime problems with W32 sockets" 
  83. #endif /* ndef _SYS_TYPES_FD_SET */
  84.  
  85. #if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
  86. #ifndef _TIMEVAL_DEFINED /* also in sys/time.h */
  87. #define _TIMEVAL_DEFINED
  88. struct timeval {
  89.     long    tv_sec;
  90.     long    tv_usec;
  91. };
  92. #define timerisset(tvp)     ((tvp)->tv_sec || (tvp)->tv_usec)
  93. #define timercmp(tvp, uvp, cmp) \
  94.     (((tvp)->tv_sec != (uvp)->tv_sec) ? \
  95.     ((tvp)->tv_sec cmp (uvp)->tv_sec) : \
  96.     ((tvp)->tv_usec cmp (uvp)->tv_usec))
  97. #define timerclear(tvp)     (tvp)->tv_sec = (tvp)->tv_usec = 0
  98. #endif /* _TIMEVAL_DEFINED */
  99. struct  hostent {
  100.     char    *h_name;
  101.     char    **h_aliases;
  102.     short    h_addrtype;
  103.     short    h_length;
  104.     char    **h_addr_list;
  105. #define h_addr h_addr_list[0]
  106. };
  107. struct linger {
  108.     u_short l_onoff;
  109.     u_short l_linger;
  110. };
  111. #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
  112. #define IOCPARM_MASK    0x7f
  113. #define IOC_VOID    0x20000000
  114. #define IOC_OUT    0x40000000
  115. #define IOC_IN    0x80000000
  116. #define IOC_INOUT    (IOC_IN|IOC_OUT)
  117.  
  118. #if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
  119. #define _IO(x,y)    (IOC_VOID|((x)<<8)|(y))
  120. #define _IOR(x,y,t)    (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
  121. #define _IOW(x,y,t)    (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
  122. #define FIONBIO    _IOW('f', 126, u_long)
  123. #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
  124.  
  125. #define FIONREAD    _IOR('f', 127, u_long)
  126. #define FIOASYNC    _IOW('f', 125, u_long)
  127. #define SIOCSHIWAT    _IOW('s',  0, u_long)
  128. #define SIOCGHIWAT    _IOR('s',  1, u_long)
  129. #define SIOCSLOWAT    _IOW('s',  2, u_long)
  130. #define SIOCGLOWAT    _IOR('s',  3, u_long)
  131. #define SIOCATMARK    _IOR('s',  7, u_long)
  132.  
  133. #if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
  134. struct netent {
  135.     char    * n_name;
  136.     char    **n_aliases;
  137.     short    n_addrtype;
  138.     u_long n_net;
  139. };
  140. struct  servent {
  141.     char    *s_name;
  142.     char    **s_aliases;
  143.     short    s_port;
  144.     char    *s_proto;
  145. };
  146. struct  protoent {
  147.     char    *p_name;
  148.     char    **p_aliases;
  149.     short    p_proto;
  150. };
  151. #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
  152.  
  153. #define IPPROTO_IP    0
  154. #define IPPROTO_ICMP    1
  155. #define IPPROTO_IGMP 2
  156. #define IPPROTO_GGP 3
  157. #define IPPROTO_TCP    6
  158. #define IPPROTO_PUP    12
  159. #define IPPROTO_UDP    17
  160. #define IPPROTO_IDP    22
  161. #define IPPROTO_ND    77
  162. #define IPPROTO_RAW    255
  163. #define IPPROTO_MAX    256
  164. #define IPPORT_ECHO    7
  165. #define IPPORT_DISCARD    9
  166. #define IPPORT_SYSTAT    11
  167. #define IPPORT_DAYTIME  13
  168. #define IPPORT_NETSTAT  15
  169. #define IPPORT_FTP      21
  170. #define IPPORT_TELNET   23
  171. #define IPPORT_SMTP     25
  172. #define IPPORT_TIMESERVER 37
  173. #define IPPORT_NAMESERVER 42
  174. #define IPPORT_WHOIS    43
  175. #define IPPORT_MTP    57
  176. #define IPPORT_TFTP    69
  177. #define IPPORT_RJE    77
  178. #define IPPORT_FINGER    79
  179. #define IPPORT_TTYLINK    87
  180. #define IPPORT_SUPDUP    95
  181. #define IPPORT_EXECSERVER    512
  182. #define IPPORT_LOGINSERVER    513
  183. #define IPPORT_CMDSERVER    514
  184. #define IPPORT_EFSSERVER    520
  185. #define IPPORT_BIFFUDP    512
  186. #define IPPORT_WHOSERVER    513
  187. #define IPPORT_ROUTESERVER    520
  188. #define IPPORT_RESERVED    1024
  189. #define IMPLINK_IP    155
  190. #define IMPLINK_LOWEXPER    156
  191. #define IMPLINK_HIGHEXPER       158
  192. struct in_addr {
  193.     union {
  194.         struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
  195.         struct { u_short s_w1,s_w2; } S_un_w;
  196.         u_long S_addr;
  197.     } S_un;
  198. #define s_addr  S_un.S_addr
  199. #define s_host  S_un.S_un_b.s_b2
  200. #define s_net   S_un.S_un_b.s_b1
  201. #define s_imp   S_un.S_un_w.s_w2
  202. #define s_impno S_un.S_un_b.s_b4
  203. #define s_lh    S_un.S_un_b.s_b3
  204. };
  205. #define IN_CLASSA(i)    (((long)(i)&0x80000000) == 0)
  206. #define IN_CLASSA_NET    0xff000000
  207. #define IN_CLASSA_NSHIFT    24
  208. #define IN_CLASSA_HOST    0x00ffffff
  209. #define IN_CLASSA_MAX    128
  210. #define IN_CLASSB(i)    (((long)(i)&0xc0000000)==0x80000000)
  211. #define IN_CLASSB_NET       0xffff0000
  212. #define IN_CLASSB_NSHIFT    16
  213. #define IN_CLASSB_HOST      0x0000ffff
  214. #define IN_CLASSB_MAX       65536
  215. #define IN_CLASSC(i)    (((long)(i)&0xe0000000)==0xc0000000)
  216. #define IN_CLASSC_NET       0xffffff00
  217. #define IN_CLASSC_NSHIFT    8
  218. #define IN_CLASSC_HOST      0xff
  219. #define INADDR_ANY          (u_long)0
  220. #define INADDR_LOOPBACK     0x7f000001
  221. #define INADDR_BROADCAST    (u_long)0xffffffff
  222. #define INADDR_NONE    0xffffffff
  223. struct sockaddr_in {
  224.     short    sin_family;
  225.     u_short    sin_port;
  226.     struct    in_addr sin_addr;
  227.     char    sin_zero[8];
  228. };
  229. #define WSADESCRIPTION_LEN    256
  230. #define WSASYS_STATUS_LEN    128
  231. typedef struct WSAData {
  232.     WORD    wVersion;
  233.     WORD    wHighVersion;
  234.     char    szDescription[WSADESCRIPTION_LEN+1];
  235.     char    szSystemStatus[WSASYS_STATUS_LEN+1];
  236.     unsigned short    iMaxSockets;
  237.     unsigned short    iMaxUdpDg;
  238.     char *     lpVendorInfo;
  239. } WSADATA;
  240. typedef WSADATA *LPWSADATA;
  241.  
  242. #if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
  243. #define IP_OPTIONS    1
  244. #define SO_DEBUG    1
  245. #define SO_ACCEPTCONN    2
  246. #define SO_REUSEADDR    4
  247. #define SO_KEEPALIVE    8
  248. #define SO_DONTROUTE    16
  249. #define SO_BROADCAST    32
  250. #define SO_USELOOPBACK    64
  251. #define SO_LINGER    128
  252. #define SO_OOBINLINE    256
  253. #define SO_DONTLINGER    (u_int)(~SO_LINGER)
  254. #define SO_SNDBUF    0x1001
  255. #define SO_RCVBUF    0x1002
  256. #define SO_SNDLOWAT    0x1003
  257. #define SO_RCVLOWAT    0x1004
  258. #define SO_SNDTIMEO    0x1005
  259. #define SO_RCVTIMEO    0x1006
  260. #define SO_ERROR    0x1007
  261. #define SO_TYPE    0x1008
  262. #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
  263. /*
  264.  * Note that the next 5 IP defines are specific to WinSock 1.1 (wsock32.dll).
  265.  * They will cause errors or unexpected results if used with the
  266.  * (gs)etsockopts exported from the WinSock 2 lib, ws2_32.dll. Refer ws2tcpip.h.
  267.  */         
  268. #define IP_MULTICAST_IF    2
  269. #define IP_MULTICAST_TTL    3
  270. #define IP_MULTICAST_LOOP    4
  271. #define IP_ADD_MEMBERSHIP    5
  272. #define IP_DROP_MEMBERSHIP  6
  273.  
  274. #define IP_DEFAULT_MULTICAST_TTL   1
  275. #define IP_DEFAULT_MULTICAST_LOOP  1
  276. #define IP_MAX_MEMBERSHIPS     20
  277. struct ip_mreq {
  278.     struct in_addr imr_multiaddr;
  279.     struct in_addr imr_interface;
  280. };
  281. #define INVALID_SOCKET (SOCKET)(~0)
  282. #define SOCKET_ERROR    (-1)
  283. #define SOCK_STREAM    1
  284. #define SOCK_DGRAM    2
  285. #define SOCK_RAW    3
  286. #define SOCK_RDM    4
  287. #define SOCK_SEQPACKET    5
  288. #define TCP_NODELAY    0x0001
  289. #define AF_UNSPEC    0
  290. #define AF_UNIX    1
  291. #define AF_INET    2
  292. #define AF_IMPLINK    3
  293. #define AF_PUP    4
  294. #define AF_CHAOS    5
  295. #define AF_IPX    6
  296. #define AF_NS    6
  297. #define AF_ISO    7
  298. #define AF_OSI    AF_ISO
  299. #define AF_ECMA    8
  300. #define AF_DATAKIT    9
  301. #define AF_CCITT    10
  302. #define AF_SNA    11
  303. #define AF_DECnet    12
  304. #define AF_DLI    13
  305. #define AF_LAT    14
  306. #define AF_HYLINK    15
  307. #define AF_APPLETALK    16
  308. #define AF_NETBIOS    17
  309. #define AF_VOICEVIEW    18
  310. #define    AF_FIREFOX    19
  311. #define    AF_UNKNOWN1    20
  312. #define    AF_BAN    21
  313. #define AF_ATM    22
  314. #define AF_INET6    23
  315. #if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
  316. #define AF_MAX    24
  317. struct sockaddr {
  318.     u_short sa_family;
  319.     char    sa_data[14];
  320. };
  321. #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
  322.  
  323. struct sockproto {
  324.     u_short sp_family;
  325.     u_short sp_protocol;
  326. };
  327. #define PF_UNSPEC    AF_UNSPEC
  328. #define PF_UNIX    AF_UNIX
  329. #define PF_INET    AF_INET
  330. #define PF_IMPLINK    AF_IMPLINK
  331. #define PF_PUP    AF_PUP
  332. #define PF_CHAOS    AF_CHAOS
  333. #define PF_NS    AF_NS
  334. #define PF_IPX    AF_IPX
  335. #define PF_ISO    AF_ISO
  336. #define PF_OSI    AF_OSI
  337. #define PF_ECMA    AF_ECMA
  338. #define PF_DATAKIT    AF_DATAKIT
  339. #define PF_CCITT    AF_CCITT
  340. #define PF_SNA    AF_SNA
  341. #define PF_DECnet    AF_DECnet
  342. #define PF_DLI    AF_DLI
  343. #define PF_LAT    AF_LAT
  344. #define PF_HYLINK    AF_HYLINK
  345. #define PF_APPLETALK    AF_APPLETALK
  346. #define PF_VOICEVIEW    AF_VOICEVIEW
  347. #define PF_FIREFOX    AF_FIREFOX
  348. #define PF_UNKNOWN1    AF_UNKNOWN1
  349. #define PF_BAN    AF_BAN
  350. #define PF_ATM    AF_ATM
  351. #define PF_INET6    AF_INET6
  352. #define PF_MAX    AF_MAX
  353. #define SOL_SOCKET    0xffff
  354. #define SOMAXCONN    5
  355. #if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
  356. #define MSG_OOB    1
  357. #define MSG_PEEK    2
  358. #define MSG_DONTROUTE    4
  359. #endif  /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
  360. #define MSG_MAXIOVLEN    16
  361. #define MSG_PARTIAL    0x8000
  362. #define MAXGETHOSTSTRUCT    1024
  363. #define FD_READ    1
  364. #define FD_WRITE    2
  365. #define FD_OOB    4
  366. #define FD_ACCEPT    8
  367. #define FD_CONNECT    16
  368. #define FD_CLOSE    32
  369. #ifndef WSABASEERR
  370. #define WSABASEERR    10000
  371. #define WSAEINTR    (WSABASEERR+4)
  372. #define WSAEBADF    (WSABASEERR+9)
  373. #define WSAEACCES    (WSABASEERR+13)
  374. #define WSAEFAULT    (WSABASEERR+14)
  375. #define WSAEINVAL    (WSABASEERR+22)
  376. #define WSAEMFILE    (WSABASEERR+24)
  377. #define WSAEWOULDBLOCK    (WSABASEERR+35)
  378. #define WSAEINPROGRESS    (WSABASEERR+36)
  379. #define WSAEALREADY    (WSABASEERR+37)
  380. #define WSAENOTSOCK    (WSABASEERR+38)
  381. #define WSAEDESTADDRREQ    (WSABASEERR+39)
  382. #define WSAEMSGSIZE    (WSABASEERR+40)
  383. #define WSAEPROTOTYPE    (WSABASEERR+41)
  384. #define WSAENOPROTOOPT    (WSABASEERR+42)
  385. #define WSAEPROTONOSUPPORT    (WSABASEERR+43)
  386. #define WSAESOCKTNOSUPPORT    (WSABASEERR+44)
  387. #define WSAEOPNOTSUPP    (WSABASEERR+45)
  388. #define WSAEPFNOSUPPORT    (WSABASEERR+46)
  389. #define WSAEAFNOSUPPORT    (WSABASEERR+47)
  390. #define WSAEADDRINUSE    (WSABASEERR+48)
  391. #define WSAEADDRNOTAVAIL    (WSABASEERR+49)
  392. #define WSAENETDOWN    (WSABASEERR+50)
  393. #define WSAENETUNREACH    (WSABASEERR+51)
  394. #define WSAENETRESET    (WSABASEERR+52)
  395. #define WSAECONNABORTED    (WSABASEERR+53)
  396. #define WSAECONNRESET    (WSABASEERR+54)
  397. #define WSAENOBUFS    (WSABASEERR+55)
  398. #define WSAEISCONN    (WSABASEERR+56)
  399. #define WSAENOTCONN    (WSABASEERR+57)
  400. #define WSAESHUTDOWN    (WSABASEERR+58)
  401. #define WSAETOOMANYREFS    (WSABASEERR+59)
  402. #define WSAETIMEDOUT    (WSABASEERR+60)
  403. #define WSAECONNREFUSED    (WSABASEERR+61)
  404. #define WSAELOOP    (WSABASEERR+62)
  405. #define WSAENAMETOOLONG    (WSABASEERR+63)
  406. #define WSAEHOSTDOWN    (WSABASEERR+64)
  407. #define WSAEHOSTUNREACH    (WSABASEERR+65)
  408. #define WSAENOTEMPTY    (WSABASEERR+66)
  409. #define WSAEPROCLIM    (WSABASEERR+67)
  410. #define WSAEUSERS    (WSABASEERR+68)
  411. #define WSAEDQUOT    (WSABASEERR+69)
  412. #define WSAESTALE    (WSABASEERR+70)
  413. #define WSAEREMOTE    (WSABASEERR+71)
  414. #define WSAEDISCON    (WSABASEERR+101)
  415. #define WSASYSNOTREADY    (WSABASEERR+91)
  416. #define WSAVERNOTSUPPORTED    (WSABASEERR+92)
  417. #define WSANOTINITIALISED    (WSABASEERR+93)
  418. #define WSAHOST_NOT_FOUND    (WSABASEERR+1001)
  419. #define WSATRY_AGAIN    (WSABASEERR+1002)
  420. #define WSANO_RECOVERY    (WSABASEERR+1003)
  421. #define WSANO_DATA    (WSABASEERR+1004)
  422. #endif /* !WSABASEERR */
  423.  
  424. #define WSANO_ADDRESS    WSANO_DATA
  425. #if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
  426. #define h_errno WSAGetLastError()
  427. #define HOST_NOT_FOUND    WSAHOST_NOT_FOUND
  428. #define TRY_AGAIN    WSATRY_AGAIN
  429. #define NO_RECOVERY    WSANO_RECOVERY
  430. #define NO_DATA    WSANO_DATA
  431. #define NO_ADDRESS    WSANO_ADDRESS
  432. #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
  433. SOCKET PASCAL accept(SOCKET,struct sockaddr*,int*);
  434. int PASCAL bind(SOCKET,const struct sockaddr*,int);
  435. int PASCAL closesocket(SOCKET);
  436. int PASCAL connect(SOCKET,const struct sockaddr*,int);
  437. int PASCAL ioctlsocket(SOCKET,long,u_long *);
  438. int PASCAL getpeername(SOCKET,struct sockaddr*,int*);
  439. int PASCAL getsockname(SOCKET,struct sockaddr*,int*);
  440. int PASCAL getsockopt(SOCKET,int,int,char*,int*);
  441. unsigned long PASCAL inet_addr(const char*);
  442. DECLARE_STDCALL_P(char *) inet_ntoa(struct in_addr);
  443. int PASCAL listen(SOCKET,int);
  444. int PASCAL recv(SOCKET,char*,int,int);
  445. int PASCAL recvfrom(SOCKET,char*,int,int,struct sockaddr*,int*);
  446. int PASCAL send(SOCKET,const char*,int,int);
  447. int PASCAL sendto(SOCKET,const char*,int,int,const struct sockaddr*,int);
  448. int PASCAL setsockopt(SOCKET,int,int,const char*,int);
  449. int PASCAL shutdown(SOCKET,int);
  450. SOCKET PASCAL socket(int,int,int);
  451. DECLARE_STDCALL_P(struct hostent *) gethostbyaddr(const char*,int,int);
  452. DECLARE_STDCALL_P(struct hostent *) gethostbyname(const char*);
  453. DECLARE_STDCALL_P(struct servent *) getservbyport(int,const char*);
  454. DECLARE_STDCALL_P(struct servent *) getservbyname(const char*,const char*);
  455. DECLARE_STDCALL_P(struct protoent *) getprotobynumber(int);
  456. DECLARE_STDCALL_P(struct protoent *) getprotobyname(const char*);
  457. int PASCAL WSAStartup(WORD,LPWSADATA);
  458. int PASCAL WSACleanup(void);
  459. void PASCAL WSASetLastError(int);
  460. int PASCAL WSAGetLastError(void);
  461. BOOL PASCAL WSAIsBlocking(void);
  462. int PASCAL WSAUnhookBlockingHook(void);
  463. FARPROC PASCAL WSASetBlockingHook(FARPROC);
  464. int PASCAL WSACancelBlockingCall(void);
  465. HANDLE PASCAL WSAAsyncGetServByName(HWND,u_int,const char*,const char*,char*,int);
  466. HANDLE PASCAL WSAAsyncGetServByPort(HWND,u_int,int,const char*,char*,int);
  467. HANDLE PASCAL WSAAsyncGetProtoByName(HWND,u_int,const char*,char*,int);
  468. HANDLE PASCAL WSAAsyncGetProtoByNumber(HWND,u_int,int,char*,int);
  469. HANDLE PASCAL WSAAsyncGetHostByName(HWND,u_int,const char*,char*,int);
  470. HANDLE PASCAL WSAAsyncGetHostByAddr(HWND,u_int,const char*,int,int,char*,int);
  471. int PASCAL WSACancelAsyncRequest(HANDLE);
  472. int PASCAL WSAAsyncSelect(SOCKET,HWND,u_int,long);
  473. #if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
  474. u_long PASCAL htonl(u_long);
  475. u_long PASCAL ntohl(u_long);
  476. u_short PASCAL htons(u_short);
  477. u_short PASCAL ntohs(u_short);
  478. int PASCAL select(int nfds,fd_set*,fd_set*,fd_set*,const struct timeval*);
  479. int PASCAL gethostname(char*,int);
  480. #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
  481.  
  482. #define WSAMAKEASYNCREPLY(b,e)    MAKELONG(b,e)
  483. #define WSAMAKESELECTREPLY(e,error)    MAKELONG(e,error)
  484. #define WSAGETASYNCBUFLEN(l)    LOWORD(l)
  485. #define WSAGETASYNCERROR(l)    HIWORD(l)
  486. #define WSAGETSELECTEVENT(l)    LOWORD(l)
  487. #define WSAGETSELECTERROR(l)    HIWORD(l)
  488.  
  489. typedef struct sockaddr SOCKADDR;
  490. typedef struct sockaddr *PSOCKADDR;
  491. typedef struct sockaddr *LPSOCKADDR;
  492. typedef struct sockaddr_in SOCKADDR_IN;
  493. typedef struct sockaddr_in *PSOCKADDR_IN;
  494. typedef struct sockaddr_in *LPSOCKADDR_IN;
  495. typedef struct linger LINGER;
  496. typedef struct linger *PLINGER;
  497. typedef struct linger *LPLINGER;
  498. typedef struct in_addr IN_ADDR;
  499. typedef struct in_addr *PIN_ADDR;
  500. typedef struct in_addr *LPIN_ADDR;
  501. typedef struct fd_set FD_SET;
  502. typedef struct fd_set *PFD_SET;
  503. typedef struct fd_set *LPFD_SET;
  504. typedef struct hostent HOSTENT;
  505. typedef struct hostent *PHOSTENT;
  506. typedef struct hostent *LPHOSTENT;
  507. typedef struct servent SERVENT;
  508. typedef struct servent *PSERVENT;
  509. typedef struct servent *LPSERVENT;
  510. typedef struct protoent PROTOENT;
  511. typedef struct protoent *PPROTOENT;
  512. typedef struct protoent *LPPROTOENT;
  513. typedef struct timeval TIMEVAL;
  514. typedef struct timeval *PTIMEVAL;
  515. typedef struct timeval *LPTIMEVAL;
  516.  
  517. #ifdef __cplusplus
  518. }
  519. #endif
  520. /*
  521.  * Recent MSDN docs indicate that the MS-specific extensions exported from
  522.  * mswsock.dll (AcceptEx, TransmitFile. WSARecEx and GetAcceptExSockaddrs) are
  523.  * declared in mswsock.h. These extensions are not supported on W9x or WinCE.
  524.  * However, code using WinSock 1.1 API may expect the declarations and
  525.  * associated defines to be in this header. Thus we include mswsock.h here.
  526.  *
  527.  * When linking against the WinSock 1.1 lib, wsock32.dll, the mswsock functions
  528.  * are automatically routed to mswsock.dll (on platforms with support).
  529.  * The WinSock 2 lib, ws2_32.dll, does not contain any references to
  530.  * the mswsock extensions. 
  531.  */
  532.  
  533. #include <mswsock.h>
  534.  
  535. #endif
  536.