annotate nt/inc/sys/socket.h @ 30841:3e3ae9ba5169

*** empty log message ***
author Eli Zaretskii <eliz@gnu.org>
date Wed, 16 Aug 2000 05:22:00 +0000
parents cfbf43d0fd54
children 65f455b1ab20
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1 /* Workable version of <sys/socket.h> based on winsock.h */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3 #ifndef _SOCKET_H_
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4 #define _SOCKET_H_
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6 /* defeat the multiple include protection */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7 #ifdef _WINSOCKAPI_
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8 #undef _WINSOCKAPI_
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9 #endif
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
10
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
11 /* avoid confusion with our version of select */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12 #ifdef select
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13 #undef select
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
14 #define MUST_REDEF_SELECT
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
15 #endif
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
16
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
17 /* avoid clashing with our version of FD_SET if already defined */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
18 #ifdef FD_SET
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
19 #undef FD_SET
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
20 #undef FD_CLR
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
21 #undef FD_ISSET
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
22 #undef FD_ZERO
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
23 #endif
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
24
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
25 /* allow us to provide our own version of fd_set */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
26 #define fd_set ws_fd_set
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
27
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
28 /* avoid duplicate definition of timeval */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
29 #ifdef HAVE_TIMEVAL
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
30 #define timeval ws_timeval
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
31 #endif
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
32
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
33 #include <winsock.h>
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
34
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
35 /* redefine select to reference our version */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
36 #ifdef MUST_REDEF_SELECT
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
37 #define select sys_select
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
38 #undef MUST_REDEF_SELECT
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
39 #endif
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
40
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
41 /* revert to our version of FD_SET */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
42 #undef FD_SET
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
43 #undef FD_CLR
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
44 #undef FD_ISSET
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
45 #undef FD_ZERO
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
46 #undef fd_set
16594
bc3740dfe78c Use new name w32.h for nt.h
Geoff Voelker <voelker@cs.washington.edu>
parents: 15139
diff changeset
47 #include "w32.h"
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
48
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
49 #ifdef HAVE_TIMEVAL
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
50 #undef timeval
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
51 #endif
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
52
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
53 /* shadow functions where we provide our own wrapper */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
54 #define socket sys_socket
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
55 #define bind sys_bind
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
56 #define connect sys_connect
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
57 #define htons sys_htons
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
58 #define ntohs sys_ntohs
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
59 #define inet_addr sys_inet_addr
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
60 #define gethostname sys_gethostname
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
61 #define gethostbyname sys_gethostbyname
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
62 #define getservbyname sys_getservbyname
18726
cfbf43d0fd54 (shutdown): Define.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16594
diff changeset
63 #define shutdown sys_shutdown
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
64
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
65 int sys_socket(int af, int type, int protocol);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
66 int sys_bind (int s, const struct sockaddr *addr, int namelen);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
67 int sys_connect (int s, const struct sockaddr *addr, int namelen);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
68 u_short sys_htons (u_short hostshort);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
69 u_short sys_ntohs (u_short netshort);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
70 unsigned long sys_inet_addr (const char * cp);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
71 int sys_gethostname (char * name, int namelen);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
72 struct hostent * sys_gethostbyname(const char * name);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
73 struct servent * sys_getservbyname(const char * name, const char * proto);
18726
cfbf43d0fd54 (shutdown): Define.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16594
diff changeset
74 int sys_shutdown (int socket, int how);
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
75
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
76 /* we are providing a real h_errno variable */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
77 #undef h_errno
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
78 extern int h_errno;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
79
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
80 /* map winsock error codes to standard names */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
81 #define EWOULDBLOCK WSAEWOULDBLOCK
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
82 #define EINPROGRESS WSAEINPROGRESS
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
83 #define EALREADY WSAEALREADY
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
84 #define ENOTSOCK WSAENOTSOCK
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
85 #define EDESTADDRREQ WSAEDESTADDRREQ
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
86 #define EMSGSIZE WSAEMSGSIZE
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
87 #define EPROTOTYPE WSAEPROTOTYPE
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
88 #define ENOPROTOOPT WSAENOPROTOOPT
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
89 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
90 #define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
91 #define EOPNOTSUPP WSAEOPNOTSUPP
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
92 #define EPFNOSUPPORT WSAEPFNOSUPPORT
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
93 #define EAFNOSUPPORT WSAEAFNOSUPPORT
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
94 #define EADDRINUSE WSAEADDRINUSE
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
95 #define EADDRNOTAVAIL WSAEADDRNOTAVAIL
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
96 #define ENETDOWN WSAENETDOWN
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
97 #define ENETUNREACH WSAENETUNREACH
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
98 #define ENETRESET WSAENETRESET
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
99 #define ECONNABORTED WSAECONNABORTED
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
100 #define ECONNRESET WSAECONNRESET
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
101 #define ENOBUFS WSAENOBUFS
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
102 #define EISCONN WSAEISCONN
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
103 #define ENOTCONN WSAENOTCONN
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
104 #define ESHUTDOWN WSAESHUTDOWN
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
105 #define ETOOMANYREFS WSAETOOMANYREFS
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
106 #define ETIMEDOUT WSAETIMEDOUT
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
107 #define ECONNREFUSED WSAECONNREFUSED
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
108 #define ELOOP WSAELOOP
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
109 /* #define ENAMETOOLONG WSAENAMETOOLONG */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
110 #define EHOSTDOWN WSAEHOSTDOWN
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
111 #define EHOSTUNREACH WSAEHOSTUNREACH
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
112 /* #define ENOTEMPTY WSAENOTEMPTY */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
113 #define EPROCLIM WSAEPROCLIM
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
114 #define EUSERS WSAEUSERS
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
115 #define EDQUOT WSAEDQUOT
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
116 #define ESTALE WSAESTALE
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
117 #define EREMOTE WSAEREMOTE
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
118
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
119 #endif /* _SOCKET_H_ */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
120
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
121 /* end of socket.h */