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