(cl-do-arglist): Revert change of
[emacs.git] / nt / inc / sys / socket.h
blobbdd4db6b2fe9b41a2dc043d94bdaff640163bd01
1 /* Copyright (C) 1995 Free Software Foundation, Inc.
3 This file is part of GNU Emacs.
5 GNU Emacs is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
10 GNU Emacs is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNU Emacs; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
21 /* Workable version of <sys/socket.h> based on winsock.h */
23 #ifndef _SOCKET_H_
24 #define _SOCKET_H_
26 /* defeat the multiple include protection */
27 #ifdef _WINSOCKAPI_
28 #undef _WINSOCKAPI_
29 #endif
30 #ifdef _WINSOCK_H
31 #undef _WINSOCK_H
32 #endif
34 /* avoid confusion with our version of select */
35 #ifdef select
36 #undef select
37 #define MUST_REDEF_SELECT
38 #endif
40 /* avoid clashing with our version of FD_SET if already defined */
41 #ifdef FD_SET
42 #undef FD_SET
43 #undef FD_CLR
44 #undef FD_ISSET
45 #undef FD_ZERO
46 #endif
48 /* avoid duplicate definition of timeval */
49 #ifdef HAVE_TIMEVAL
50 #define timeval ws_timeval
51 #endif
53 #include <winsock.h>
55 /* redefine select to reference our version */
56 #ifdef MUST_REDEF_SELECT
57 #define select sys_select
58 #undef MUST_REDEF_SELECT
59 #endif
61 /* revert to our version of FD_SET */
62 #undef FD_SET
63 #undef FD_CLR
64 #undef FD_ISSET
65 #undef FD_ZERO
67 /* allow us to provide our own version of fd_set */
68 #define fd_set ws_fd_set
69 #include "w32.h"
71 #ifdef HAVE_TIMEVAL
72 #undef timeval
73 #endif
75 /* shadow functions where we provide our own wrapper */
76 #define socket sys_socket
77 #define bind sys_bind
78 #define connect sys_connect
79 #define htons sys_htons
80 #define ntohs sys_ntohs
81 #define inet_addr sys_inet_addr
82 #define gethostname sys_gethostname
83 #define gethostbyname sys_gethostbyname
84 #define getservbyname sys_getservbyname
85 #define shutdown sys_shutdown
87 int sys_socket(int af, int type, int protocol);
88 int sys_bind (int s, const struct sockaddr *addr, int namelen);
89 int sys_connect (int s, const struct sockaddr *addr, int namelen);
90 u_short sys_htons (u_short hostshort);
91 u_short sys_ntohs (u_short netshort);
92 unsigned long sys_inet_addr (const char * cp);
93 int sys_gethostname (char * name, int namelen);
94 struct hostent * sys_gethostbyname(const char * name);
95 struct servent * sys_getservbyname(const char * name, const char * proto);
96 int sys_shutdown (int socket, int how);
98 /* we are providing a real h_errno variable */
99 #undef h_errno
100 extern int h_errno;
102 /* map winsock error codes to standard names */
103 #define EWOULDBLOCK WSAEWOULDBLOCK
104 #define EINPROGRESS WSAEINPROGRESS
105 #define EALREADY WSAEALREADY
106 #define ENOTSOCK WSAENOTSOCK
107 #define EDESTADDRREQ WSAEDESTADDRREQ
108 #define EMSGSIZE WSAEMSGSIZE
109 #define EPROTOTYPE WSAEPROTOTYPE
110 #define ENOPROTOOPT WSAENOPROTOOPT
111 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
112 #define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
113 #define EOPNOTSUPP WSAEOPNOTSUPP
114 #define EPFNOSUPPORT WSAEPFNOSUPPORT
115 #define EAFNOSUPPORT WSAEAFNOSUPPORT
116 #define EADDRINUSE WSAEADDRINUSE
117 #define EADDRNOTAVAIL WSAEADDRNOTAVAIL
118 #define ENETDOWN WSAENETDOWN
119 #define ENETUNREACH WSAENETUNREACH
120 #define ENETRESET WSAENETRESET
121 #define ECONNABORTED WSAECONNABORTED
122 #define ECONNRESET WSAECONNRESET
123 #define ENOBUFS WSAENOBUFS
124 #define EISCONN WSAEISCONN
125 #define ENOTCONN WSAENOTCONN
126 #define ESHUTDOWN WSAESHUTDOWN
127 #define ETOOMANYREFS WSAETOOMANYREFS
128 #define ETIMEDOUT WSAETIMEDOUT
129 #define ECONNREFUSED WSAECONNREFUSED
130 #define ELOOP WSAELOOP
131 /* #define ENAMETOOLONG WSAENAMETOOLONG */
132 #define EHOSTDOWN WSAEHOSTDOWN
133 #define EHOSTUNREACH WSAEHOSTUNREACH
134 /* #define ENOTEMPTY WSAENOTEMPTY */
135 #define EPROCLIM WSAEPROCLIM
136 #define EUSERS WSAEUSERS
137 #define EDQUOT WSAEDQUOT
138 #define ESTALE WSAESTALE
139 #define EREMOTE WSAEREMOTE
141 #endif /* _SOCKET_H_ */
143 /* end of socket.h */