Mercurial > emacs
annotate nt/inc/sys/socket.h @ 89664:5548dd3d1a7c
(auto-compose-chars): Fix previous change.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Wed, 26 Nov 2003 11:54:07 +0000 |
parents | 375f2633d815 |
children | 68c22ea6027c |
rev | line source |
---|---|
36375 | 1 /* Copyright (C) 1995 Free Software Foundation, Inc. |
2 | |
3 This file is part of GNU Emacs. | |
4 | |
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. | |
9 | |
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. | |
14 | |
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. */ | |
19 | |
20 | |
15139 | 21 /* Workable version of <sys/socket.h> based on winsock.h */ |
22 | |
23 #ifndef _SOCKET_H_ | |
24 #define _SOCKET_H_ | |
25 | |
26 /* defeat the multiple include protection */ | |
27 #ifdef _WINSOCKAPI_ | |
28 #undef _WINSOCKAPI_ | |
29 #endif | |
31091
65f455b1ab20
(_WINSOCK_H): Undefine if defined.
Andrew Innes <andrewi@gnu.org>
parents:
18726
diff
changeset
|
30 #ifdef _WINSOCK_H |
65f455b1ab20
(_WINSOCK_H): Undefine if defined.
Andrew Innes <andrewi@gnu.org>
parents:
18726
diff
changeset
|
31 #undef _WINSOCK_H |
65f455b1ab20
(_WINSOCK_H): Undefine if defined.
Andrew Innes <andrewi@gnu.org>
parents:
18726
diff
changeset
|
32 #endif |
15139 | 33 |
34 /* avoid confusion with our version of select */ | |
35 #ifdef select | |
36 #undef select | |
37 #define MUST_REDEF_SELECT | |
38 #endif | |
39 | |
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 | |
47 | |
48 /* avoid duplicate definition of timeval */ | |
49 #ifdef HAVE_TIMEVAL | |
50 #define timeval ws_timeval | |
51 #endif | |
52 | |
53 #include <winsock.h> | |
54 | |
55 /* redefine select to reference our version */ | |
56 #ifdef MUST_REDEF_SELECT | |
57 #define select sys_select | |
58 #undef MUST_REDEF_SELECT | |
59 #endif | |
60 | |
61 /* revert to our version of FD_SET */ | |
62 #undef FD_SET | |
63 #undef FD_CLR | |
64 #undef FD_ISSET | |
65 #undef FD_ZERO | |
31091
65f455b1ab20
(_WINSOCK_H): Undefine if defined.
Andrew Innes <andrewi@gnu.org>
parents:
18726
diff
changeset
|
66 |
65f455b1ab20
(_WINSOCK_H): Undefine if defined.
Andrew Innes <andrewi@gnu.org>
parents:
18726
diff
changeset
|
67 /* allow us to provide our own version of fd_set */ |
65f455b1ab20
(_WINSOCK_H): Undefine if defined.
Andrew Innes <andrewi@gnu.org>
parents:
18726
diff
changeset
|
68 #define fd_set ws_fd_set |
16594
bc3740dfe78c
Use new name w32.h for nt.h
Geoff Voelker <voelker@cs.washington.edu>
parents:
15139
diff
changeset
|
69 #include "w32.h" |
15139 | 70 |
71 #ifdef HAVE_TIMEVAL | |
72 #undef timeval | |
73 #endif | |
74 | |
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 | |
45087
43b933182a40
(F_SETFL, O_NDELAY): Define.
Jason Rumney <jasonr@gnu.org>
parents:
44040
diff
changeset
|
84 #define getpeername sys_getpeername |
15139 | 85 #define getservbyname sys_getservbyname |
18726
cfbf43d0fd54
(shutdown): Define.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16594
diff
changeset
|
86 #define shutdown sys_shutdown |
44040
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
87 #define setsockopt sys_setsockopt |
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
88 #define listen sys_listen |
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
89 #define getsockname sys_getsockname |
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
90 #define accept sys_accept |
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
91 #define recvfrom sys_recvfrom |
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
92 #define sendto sys_sendto |
15139 | 93 |
94 int sys_socket(int af, int type, int protocol); | |
95 int sys_bind (int s, const struct sockaddr *addr, int namelen); | |
96 int sys_connect (int s, const struct sockaddr *addr, int namelen); | |
97 u_short sys_htons (u_short hostshort); | |
98 u_short sys_ntohs (u_short netshort); | |
99 unsigned long sys_inet_addr (const char * cp); | |
100 int sys_gethostname (char * name, int namelen); | |
45087
43b933182a40
(F_SETFL, O_NDELAY): Define.
Jason Rumney <jasonr@gnu.org>
parents:
44040
diff
changeset
|
101 struct hostent * sys_gethostbyname (const char * name); |
43b933182a40
(F_SETFL, O_NDELAY): Define.
Jason Rumney <jasonr@gnu.org>
parents:
44040
diff
changeset
|
102 struct servent * sys_getservbyname (const char * name, const char * proto); |
43b933182a40
(F_SETFL, O_NDELAY): Define.
Jason Rumney <jasonr@gnu.org>
parents:
44040
diff
changeset
|
103 int sys_getpeername (int s, struct sockaddr *addr, int * namelen); |
18726
cfbf43d0fd54
(shutdown): Define.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16594
diff
changeset
|
104 int sys_shutdown (int socket, int how); |
44040
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
105 int sys_setsockopt (int s, int level, int oname, const char * oval, int olen); |
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
106 int sys_listen (int s, int backlog); |
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
107 int sys_getsockname (int s, struct sockaddr * name, int * namelen); |
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
108 int sys_accept (int s, struct sockaddr *addr, int *addrlen); |
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
109 int sys_recvfrom (int s, char *buf, int len, int flags, |
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
110 struct sockaddr *from, int * fromlen); |
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
111 int sys_sendto (int s, const char * buf, int len, int flags, |
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
112 const struct sockaddr *to, int tolen); |
15139 | 113 |
45087
43b933182a40
(F_SETFL, O_NDELAY): Define.
Jason Rumney <jasonr@gnu.org>
parents:
44040
diff
changeset
|
114 /* In addition to wrappers for the winsock functions, we also provide |
43b933182a40
(F_SETFL, O_NDELAY): Define.
Jason Rumney <jasonr@gnu.org>
parents:
44040
diff
changeset
|
115 an fcntl function, for setting sockets to non-blocking mode. */ |
43b933182a40
(F_SETFL, O_NDELAY): Define.
Jason Rumney <jasonr@gnu.org>
parents:
44040
diff
changeset
|
116 int fcntl (int s, int cmd, int options); |
43b933182a40
(F_SETFL, O_NDELAY): Define.
Jason Rumney <jasonr@gnu.org>
parents:
44040
diff
changeset
|
117 #define F_SETFL 4 |
43b933182a40
(F_SETFL, O_NDELAY): Define.
Jason Rumney <jasonr@gnu.org>
parents:
44040
diff
changeset
|
118 #define O_NDELAY 04000 |
43b933182a40
(F_SETFL, O_NDELAY): Define.
Jason Rumney <jasonr@gnu.org>
parents:
44040
diff
changeset
|
119 |
15139 | 120 /* we are providing a real h_errno variable */ |
121 #undef h_errno | |
122 extern int h_errno; | |
123 | |
124 /* map winsock error codes to standard names */ | |
125 #define EWOULDBLOCK WSAEWOULDBLOCK | |
126 #define EINPROGRESS WSAEINPROGRESS | |
127 #define EALREADY WSAEALREADY | |
128 #define ENOTSOCK WSAENOTSOCK | |
129 #define EDESTADDRREQ WSAEDESTADDRREQ | |
130 #define EMSGSIZE WSAEMSGSIZE | |
131 #define EPROTOTYPE WSAEPROTOTYPE | |
132 #define ENOPROTOOPT WSAENOPROTOOPT | |
133 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT | |
134 #define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT | |
135 #define EOPNOTSUPP WSAEOPNOTSUPP | |
136 #define EPFNOSUPPORT WSAEPFNOSUPPORT | |
137 #define EAFNOSUPPORT WSAEAFNOSUPPORT | |
138 #define EADDRINUSE WSAEADDRINUSE | |
139 #define EADDRNOTAVAIL WSAEADDRNOTAVAIL | |
140 #define ENETDOWN WSAENETDOWN | |
141 #define ENETUNREACH WSAENETUNREACH | |
142 #define ENETRESET WSAENETRESET | |
143 #define ECONNABORTED WSAECONNABORTED | |
144 #define ECONNRESET WSAECONNRESET | |
145 #define ENOBUFS WSAENOBUFS | |
146 #define EISCONN WSAEISCONN | |
147 #define ENOTCONN WSAENOTCONN | |
148 #define ESHUTDOWN WSAESHUTDOWN | |
149 #define ETOOMANYREFS WSAETOOMANYREFS | |
150 #define ETIMEDOUT WSAETIMEDOUT | |
151 #define ECONNREFUSED WSAECONNREFUSED | |
152 #define ELOOP WSAELOOP | |
153 /* #define ENAMETOOLONG WSAENAMETOOLONG */ | |
154 #define EHOSTDOWN WSAEHOSTDOWN | |
155 #define EHOSTUNREACH WSAEHOSTUNREACH | |
156 /* #define ENOTEMPTY WSAENOTEMPTY */ | |
157 #define EPROCLIM WSAEPROCLIM | |
158 #define EUSERS WSAEUSERS | |
159 #define EDQUOT WSAEDQUOT | |
160 #define ESTALE WSAESTALE | |
161 #define EREMOTE WSAEREMOTE | |
162 | |
163 #endif /* _SOCKET_H_ */ | |
164 | |
165 /* end of socket.h */ |