PageRenderTime 55ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/include/winsock.h

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