annotate nt/inc/sys/socket.h @ 239:41f2f0e326e9 r20-5b18

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