comparison nt/inc/sys/socket.h @ 282:c42ec1d1cded r21-0b39

Import from CVS: tag r21-0b39
author cvs
date Mon, 13 Aug 2007 10:33:18 +0200
parents 41f2f0e326e9
children 501cfd01ee6d
comparison
equal deleted inserted replaced
281:090b52736db2 282:c42ec1d1cded
4 #define _SOCKET_H_ 4 #define _SOCKET_H_
5 5
6 /* defeat the multiple include protection */ 6 /* defeat the multiple include protection */
7 #ifdef _WINSOCKAPI_ 7 #ifdef _WINSOCKAPI_
8 #undef _WINSOCKAPI_ 8 #undef _WINSOCKAPI_
9 #endif
10
11 /* avoid confusion with our version of select */
12 #ifdef select
13 #undef select
14 #define MUST_REDEF_SELECT
15 #endif 9 #endif
16 10
17 #if 0 /* What's wrong with winsock.h version ? - kkm */ 11 #if 0 /* What's wrong with winsock.h version ? - kkm */
18 /* avoid clashing with our version of FD_SET if already defined */ 12 /* avoid clashing with our version of FD_SET if already defined */
19 #ifdef FD_SET 13 #ifdef FD_SET
32 #define timeval ws_timeval 26 #define timeval ws_timeval
33 #endif 27 #endif
34 28
35 #include <winsock.h> 29 #include <winsock.h>
36 30
37 /* redefine select to reference our version */
38 #ifdef MUST_REDEF_SELECT
39 #define select sys_select
40 #undef MUST_REDEF_SELECT
41 #endif
42
43 #if 0 /* What's wrong with winsock.h version ? - kkm */ 31 #if 0 /* What's wrong with winsock.h version ? - kkm */
44 /* revert to our version of FD_SET */ 32 /* revert to our version of FD_SET */
45 #undef FD_SET 33 #undef FD_SET
46 #undef FD_CLR 34 #undef FD_CLR
47 #undef FD_ISSET 35 #undef FD_ISSET
51 #endif /* 0 */ 39 #endif /* 0 */
52 40
53 #ifdef HAVE_TIMEVAL 41 #ifdef HAVE_TIMEVAL
54 #undef timeval 42 #undef timeval
55 #endif 43 #endif
56
57 /* shadow functions where we provide our own wrapper */
58 #define socket sys_socket
59 #define bind sys_bind
60 #define connect sys_connect
61 #define htons sys_htons
62 #define ntohs sys_ntohs
63 #define inet_addr sys_inet_addr
64 #define gethostname sys_gethostname
65 #define gethostbyname sys_gethostbyname
66 #define getservbyname sys_getservbyname
67
68 int sys_socket(int af, int type, int protocol);
69 int sys_bind (int s, const struct sockaddr *addr, int namelen);
70 int sys_connect (int s, const struct sockaddr *addr, int namelen);
71 u_short sys_htons (u_short hostshort);
72 u_short sys_ntohs (u_short netshort);
73 unsigned long sys_inet_addr (const char * cp);
74 int sys_gethostname (char * name, int namelen);
75 struct hostent * sys_gethostbyname(const char * name);
76 struct servent * sys_getservbyname(const char * name, const char * proto);
77
78 /* we are providing a real h_errno variable */
79 #undef h_errno
80 extern int h_errno;
81 44
82 /* map winsock error codes to standard names */ 45 /* map winsock error codes to standard names */
83 #define EWOULDBLOCK WSAEWOULDBLOCK 46 #define EWOULDBLOCK WSAEWOULDBLOCK
84 #define EINPROGRESS WSAEINPROGRESS 47 #define EINPROGRESS WSAEINPROGRESS
85 #define EALREADY WSAEALREADY 48 #define EALREADY WSAEALREADY