Mercurial > emacs
annotate nt/inc/sys/socket.h @ 112295:2108d829c749
* xfns.c (x_real_positions): Fix signedness of local var 'ign'.
XGetGeometry wants unsigned int *, not int *, for its last 4 args,
so change the type of 'ign' to unsigned int from int.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Sun, 16 Jan 2011 23:45:28 -0800 |
parents | 376148b31b5e |
children |
rev | line source |
---|---|
94793
a9cdaa557fee
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
1 /* Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007, |
112218
376148b31b5e
Add 2011 to FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents:
100954
diff
changeset
|
2 2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
36375 | 3 |
4 This file is part of GNU Emacs. | |
5 | |
94793
a9cdaa557fee
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
6 GNU Emacs is free software: you can redistribute it and/or modify |
36375 | 7 it under the terms of the GNU General Public License as published by |
94793
a9cdaa557fee
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
8 the Free Software Foundation, either version 3 of the License, or |
a9cdaa557fee
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
9 (at your option) any later version. |
36375 | 10 |
11 GNU Emacs is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
94793
a9cdaa557fee
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
17 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
36375 | 18 |
19 | |
15139 | 20 /* Workable version of <sys/socket.h> based on winsock.h */ |
21 | |
22 #ifndef _SOCKET_H_ | |
23 #define _SOCKET_H_ | |
24 | |
25 /* defeat the multiple include protection */ | |
26 #ifdef _WINSOCKAPI_ | |
27 #undef _WINSOCKAPI_ | |
28 #endif | |
31091
65f455b1ab20
(_WINSOCK_H): Undefine if defined.
Andrew Innes <andrewi@gnu.org>
parents:
18726
diff
changeset
|
29 #ifdef _WINSOCK_H |
65f455b1ab20
(_WINSOCK_H): Undefine if defined.
Andrew Innes <andrewi@gnu.org>
parents:
18726
diff
changeset
|
30 #undef _WINSOCK_H |
65f455b1ab20
(_WINSOCK_H): Undefine if defined.
Andrew Innes <andrewi@gnu.org>
parents:
18726
diff
changeset
|
31 #endif |
15139 | 32 |
33 /* avoid confusion with our version of select */ | |
34 #ifdef select | |
35 #undef select | |
36 #define MUST_REDEF_SELECT | |
37 #endif | |
38 | |
39 /* avoid clashing with our version of FD_SET if already defined */ | |
40 #ifdef FD_SET | |
41 #undef FD_SET | |
42 #undef FD_CLR | |
43 #undef FD_ISSET | |
44 #undef FD_ZERO | |
45 #endif | |
46 | |
47 /* avoid duplicate definition of timeval */ | |
48 #ifdef HAVE_TIMEVAL | |
49 #define timeval ws_timeval | |
50 #endif | |
51 | |
81874
361abf526407
Include winsock2.h and ws2tcpip.h instead of winsock.h.
Jason Rumney <jasonr@gnu.org>
parents:
75245
diff
changeset
|
52 #include <winsock2.h> |
361abf526407
Include winsock2.h and ws2tcpip.h instead of winsock.h.
Jason Rumney <jasonr@gnu.org>
parents:
75245
diff
changeset
|
53 #include <ws2tcpip.h> |
81888
699eb2ba8cef
(uint16_t): Define if C99 does not appear to be fully supported.
Jason Rumney <jasonr@gnu.org>
parents:
81874
diff
changeset
|
54 /* process.c uses uint16_t (from C99) for IPv6, but |
699eb2ba8cef
(uint16_t): Define if C99 does not appear to be fully supported.
Jason Rumney <jasonr@gnu.org>
parents:
81874
diff
changeset
|
55 apparently it is not defined in some versions of mingw and msvc. */ |
699eb2ba8cef
(uint16_t): Define if C99 does not appear to be fully supported.
Jason Rumney <jasonr@gnu.org>
parents:
81874
diff
changeset
|
56 #ifndef UINT16_C |
699eb2ba8cef
(uint16_t): Define if C99 does not appear to be fully supported.
Jason Rumney <jasonr@gnu.org>
parents:
81874
diff
changeset
|
57 typedef unsigned short uint16_t; |
699eb2ba8cef
(uint16_t): Define if C99 does not appear to be fully supported.
Jason Rumney <jasonr@gnu.org>
parents:
81874
diff
changeset
|
58 #endif |
15139 | 59 |
60 /* redefine select to reference our version */ | |
61 #ifdef MUST_REDEF_SELECT | |
62 #define select sys_select | |
63 #undef MUST_REDEF_SELECT | |
64 #endif | |
65 | |
66 /* revert to our version of FD_SET */ | |
67 #undef FD_SET | |
68 #undef FD_CLR | |
69 #undef FD_ISSET | |
70 #undef FD_ZERO | |
31091
65f455b1ab20
(_WINSOCK_H): Undefine if defined.
Andrew Innes <andrewi@gnu.org>
parents:
18726
diff
changeset
|
71 |
65f455b1ab20
(_WINSOCK_H): Undefine if defined.
Andrew Innes <andrewi@gnu.org>
parents:
18726
diff
changeset
|
72 /* 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
|
73 #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
|
74 #include "w32.h" |
15139 | 75 |
76 #ifdef HAVE_TIMEVAL | |
77 #undef timeval | |
78 #endif | |
79 | |
80 /* shadow functions where we provide our own wrapper */ | |
81 #define socket sys_socket | |
82 #define bind sys_bind | |
83 #define connect sys_connect | |
84 #define htons sys_htons | |
85 #define ntohs sys_ntohs | |
86 #define inet_addr sys_inet_addr | |
87 #define gethostname sys_gethostname | |
88 #define gethostbyname sys_gethostbyname | |
45087
43b933182a40
(F_SETFL, O_NDELAY): Define.
Jason Rumney <jasonr@gnu.org>
parents:
44040
diff
changeset
|
89 #define getpeername sys_getpeername |
15139 | 90 #define getservbyname sys_getservbyname |
18726
cfbf43d0fd54
(shutdown): Define.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16594
diff
changeset
|
91 #define shutdown sys_shutdown |
44040
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
92 #define setsockopt sys_setsockopt |
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
93 #define listen sys_listen |
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
94 #define getsockname sys_getsockname |
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
95 #define accept sys_accept |
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
96 #define recvfrom sys_recvfrom |
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
97 #define sendto sys_sendto |
15139 | 98 |
99 int sys_socket(int af, int type, int protocol); | |
100 int sys_bind (int s, const struct sockaddr *addr, int namelen); | |
101 int sys_connect (int s, const struct sockaddr *addr, int namelen); | |
102 u_short sys_htons (u_short hostshort); | |
103 u_short sys_ntohs (u_short netshort); | |
104 unsigned long sys_inet_addr (const char * cp); | |
105 int sys_gethostname (char * name, int namelen); | |
45087
43b933182a40
(F_SETFL, O_NDELAY): Define.
Jason Rumney <jasonr@gnu.org>
parents:
44040
diff
changeset
|
106 struct hostent * sys_gethostbyname (const char * name); |
43b933182a40
(F_SETFL, O_NDELAY): Define.
Jason Rumney <jasonr@gnu.org>
parents:
44040
diff
changeset
|
107 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
|
108 int sys_getpeername (int s, struct sockaddr *addr, int * namelen); |
18726
cfbf43d0fd54
(shutdown): Define.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16594
diff
changeset
|
109 int sys_shutdown (int socket, int how); |
63039
3b68a0c4a187
Change arg 4 of sys_setsockopt to `const void *',
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
110 int sys_setsockopt (int s, int level, int oname, const void * oval, int olen); |
44040
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
111 int sys_listen (int s, int backlog); |
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
112 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
|
113 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
|
114 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
|
115 struct sockaddr *from, int * fromlen); |
547d61a816e3
(sys_setsockopt, sys_listen, sys_getsockname)
Jason Rumney <jasonr@gnu.org>
parents:
36375
diff
changeset
|
116 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
|
117 const struct sockaddr *to, int tolen); |
15139 | 118 |
45087
43b933182a40
(F_SETFL, O_NDELAY): Define.
Jason Rumney <jasonr@gnu.org>
parents:
44040
diff
changeset
|
119 /* 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
|
120 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
|
121 int fcntl (int s, int cmd, int options); |
43b933182a40
(F_SETFL, O_NDELAY): Define.
Jason Rumney <jasonr@gnu.org>
parents:
44040
diff
changeset
|
122 #define F_SETFL 4 |
43b933182a40
(F_SETFL, O_NDELAY): Define.
Jason Rumney <jasonr@gnu.org>
parents:
44040
diff
changeset
|
123 #define O_NDELAY 04000 |
43b933182a40
(F_SETFL, O_NDELAY): Define.
Jason Rumney <jasonr@gnu.org>
parents:
44040
diff
changeset
|
124 |
15139 | 125 /* we are providing a real h_errno variable */ |
126 #undef h_errno | |
127 extern int h_errno; | |
128 | |
129 /* map winsock error codes to standard names */ | |
130 #define EWOULDBLOCK WSAEWOULDBLOCK | |
131 #define EINPROGRESS WSAEINPROGRESS | |
132 #define EALREADY WSAEALREADY | |
133 #define ENOTSOCK WSAENOTSOCK | |
134 #define EDESTADDRREQ WSAEDESTADDRREQ | |
135 #define EMSGSIZE WSAEMSGSIZE | |
136 #define EPROTOTYPE WSAEPROTOTYPE | |
137 #define ENOPROTOOPT WSAENOPROTOOPT | |
138 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT | |
139 #define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT | |
140 #define EOPNOTSUPP WSAEOPNOTSUPP | |
141 #define EPFNOSUPPORT WSAEPFNOSUPPORT | |
142 #define EAFNOSUPPORT WSAEAFNOSUPPORT | |
143 #define EADDRINUSE WSAEADDRINUSE | |
144 #define EADDRNOTAVAIL WSAEADDRNOTAVAIL | |
145 #define ENETDOWN WSAENETDOWN | |
146 #define ENETUNREACH WSAENETUNREACH | |
147 #define ENETRESET WSAENETRESET | |
148 #define ECONNABORTED WSAECONNABORTED | |
149 #define ECONNRESET WSAECONNRESET | |
150 #define ENOBUFS WSAENOBUFS | |
151 #define EISCONN WSAEISCONN | |
152 #define ENOTCONN WSAENOTCONN | |
153 #define ESHUTDOWN WSAESHUTDOWN | |
154 #define ETOOMANYREFS WSAETOOMANYREFS | |
155 #define ETIMEDOUT WSAETIMEDOUT | |
156 #define ECONNREFUSED WSAECONNREFUSED | |
157 #define ELOOP WSAELOOP | |
158 /* #define ENAMETOOLONG WSAENAMETOOLONG */ | |
159 #define EHOSTDOWN WSAEHOSTDOWN | |
160 #define EHOSTUNREACH WSAEHOSTUNREACH | |
161 /* #define ENOTEMPTY WSAENOTEMPTY */ | |
162 #define EPROCLIM WSAEPROCLIM | |
163 #define EUSERS WSAEUSERS | |
164 #define EDQUOT WSAEDQUOT | |
165 #define ESTALE WSAESTALE | |
166 #define EREMOTE WSAEREMOTE | |
167 | |
168 #endif /* _SOCKET_H_ */ | |
169 | |
170 /* end of socket.h */ |