annotate nt/inc/sys/socket.h @ 43025:32f6fb5c961f

(pc-select-save-and-set-mode): Properly use MODE-VAR.
author Richard M. Stallman <rms@gnu.org>
date Fri, 01 Feb 2002 03:59:17 +0000
parents 19b74f67a4ae
children 547d61a816e3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
36375
19b74f67a4ae Add copyright notice.
Andrew Innes <andrewi@gnu.org>
parents: 31091
diff changeset
1 /* Copyright (C) 1995 Free Software Foundation, Inc.
19b74f67a4ae Add copyright notice.
Andrew Innes <andrewi@gnu.org>
parents: 31091
diff changeset
2
19b74f67a4ae Add copyright notice.
Andrew Innes <andrewi@gnu.org>
parents: 31091
diff changeset
3 This file is part of GNU Emacs.
19b74f67a4ae Add copyright notice.
Andrew Innes <andrewi@gnu.org>
parents: 31091
diff changeset
4
19b74f67a4ae Add copyright notice.
Andrew Innes <andrewi@gnu.org>
parents: 31091
diff changeset
5 GNU Emacs is free software; you can redistribute it and/or modify
19b74f67a4ae Add copyright notice.
Andrew Innes <andrewi@gnu.org>
parents: 31091
diff changeset
6 it under the terms of the GNU General Public License as published by
19b74f67a4ae Add copyright notice.
Andrew Innes <andrewi@gnu.org>
parents: 31091
diff changeset
7 the Free Software Foundation; either version 2, or (at your option)
19b74f67a4ae Add copyright notice.
Andrew Innes <andrewi@gnu.org>
parents: 31091
diff changeset
8 any later version.
19b74f67a4ae Add copyright notice.
Andrew Innes <andrewi@gnu.org>
parents: 31091
diff changeset
9
19b74f67a4ae Add copyright notice.
Andrew Innes <andrewi@gnu.org>
parents: 31091
diff changeset
10 GNU Emacs is distributed in the hope that it will be useful,
19b74f67a4ae Add copyright notice.
Andrew Innes <andrewi@gnu.org>
parents: 31091
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
19b74f67a4ae Add copyright notice.
Andrew Innes <andrewi@gnu.org>
parents: 31091
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19b74f67a4ae Add copyright notice.
Andrew Innes <andrewi@gnu.org>
parents: 31091
diff changeset
13 GNU General Public License for more details.
19b74f67a4ae Add copyright notice.
Andrew Innes <andrewi@gnu.org>
parents: 31091
diff changeset
14
19b74f67a4ae Add copyright notice.
Andrew Innes <andrewi@gnu.org>
parents: 31091
diff changeset
15 You should have received a copy of the GNU General Public License
19b74f67a4ae Add copyright notice.
Andrew Innes <andrewi@gnu.org>
parents: 31091
diff changeset
16 along with GNU Emacs; see the file COPYING. If not, write to
19b74f67a4ae Add copyright notice.
Andrew Innes <andrewi@gnu.org>
parents: 31091
diff changeset
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19b74f67a4ae Add copyright notice.
Andrew Innes <andrewi@gnu.org>
parents: 31091
diff changeset
18 Boston, MA 02111-1307, USA. */
19b74f67a4ae Add copyright notice.
Andrew Innes <andrewi@gnu.org>
parents: 31091
diff changeset
19
19b74f67a4ae Add copyright notice.
Andrew Innes <andrewi@gnu.org>
parents: 31091
diff changeset
20
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
21 /* Workable version of <sys/socket.h> based on winsock.h */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
22
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
23 #ifndef _SOCKET_H_
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
24 #define _SOCKET_H_
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
25
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
26 /* defeat the multiple include protection */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
27 #ifdef _WINSOCKAPI_
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
28 #undef _WINSOCKAPI_
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
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
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
33
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
34 /* avoid confusion with our version of select */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
35 #ifdef select
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
36 #undef select
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
37 #define MUST_REDEF_SELECT
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
38 #endif
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
39
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
40 /* avoid clashing with our version of FD_SET if already defined */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
41 #ifdef FD_SET
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
42 #undef FD_SET
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
43 #undef FD_CLR
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
44 #undef FD_ISSET
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
45 #undef FD_ZERO
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
46 #endif
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
47
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
48 /* avoid duplicate definition of timeval */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
49 #ifdef HAVE_TIMEVAL
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
50 #define timeval ws_timeval
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
51 #endif
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
52
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
53 #include <winsock.h>
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
54
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
55 /* redefine select to reference our version */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
56 #ifdef MUST_REDEF_SELECT
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
57 #define select sys_select
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
58 #undef MUST_REDEF_SELECT
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
59 #endif
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
60
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
61 /* revert to our version of FD_SET */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
62 #undef FD_SET
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
63 #undef FD_CLR
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
64 #undef FD_ISSET
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
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
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
70
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
71 #ifdef HAVE_TIMEVAL
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
72 #undef timeval
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
73 #endif
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
74
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
75 /* shadow functions where we provide our own wrapper */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
76 #define socket sys_socket
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
77 #define bind sys_bind
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
78 #define connect sys_connect
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
79 #define htons sys_htons
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
80 #define ntohs sys_ntohs
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
81 #define inet_addr sys_inet_addr
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
82 #define gethostname sys_gethostname
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
83 #define gethostbyname sys_gethostbyname
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
84 #define getservbyname sys_getservbyname
18726
cfbf43d0fd54 (shutdown): Define.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16594
diff changeset
85 #define shutdown sys_shutdown
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
86
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
87 int sys_socket(int af, int type, int protocol);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
88 int sys_bind (int s, const struct sockaddr *addr, int namelen);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
89 int sys_connect (int s, const struct sockaddr *addr, int namelen);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
90 u_short sys_htons (u_short hostshort);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
91 u_short sys_ntohs (u_short netshort);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
92 unsigned long sys_inet_addr (const char * cp);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
93 int sys_gethostname (char * name, int namelen);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
94 struct hostent * sys_gethostbyname(const char * name);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
95 struct servent * sys_getservbyname(const char * name, const char * proto);
18726
cfbf43d0fd54 (shutdown): Define.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16594
diff changeset
96 int sys_shutdown (int socket, int how);
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
97
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
98 /* we are providing a real h_errno variable */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
99 #undef h_errno
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
100 extern int h_errno;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
101
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
102 /* map winsock error codes to standard names */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
103 #define EWOULDBLOCK WSAEWOULDBLOCK
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
104 #define EINPROGRESS WSAEINPROGRESS
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
105 #define EALREADY WSAEALREADY
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
106 #define ENOTSOCK WSAENOTSOCK
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
107 #define EDESTADDRREQ WSAEDESTADDRREQ
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
108 #define EMSGSIZE WSAEMSGSIZE
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
109 #define EPROTOTYPE WSAEPROTOTYPE
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
110 #define ENOPROTOOPT WSAENOPROTOOPT
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
111 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
112 #define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
113 #define EOPNOTSUPP WSAEOPNOTSUPP
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
114 #define EPFNOSUPPORT WSAEPFNOSUPPORT
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
115 #define EAFNOSUPPORT WSAEAFNOSUPPORT
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
116 #define EADDRINUSE WSAEADDRINUSE
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
117 #define EADDRNOTAVAIL WSAEADDRNOTAVAIL
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
118 #define ENETDOWN WSAENETDOWN
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
119 #define ENETUNREACH WSAENETUNREACH
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
120 #define ENETRESET WSAENETRESET
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
121 #define ECONNABORTED WSAECONNABORTED
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
122 #define ECONNRESET WSAECONNRESET
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
123 #define ENOBUFS WSAENOBUFS
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
124 #define EISCONN WSAEISCONN
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
125 #define ENOTCONN WSAENOTCONN
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
126 #define ESHUTDOWN WSAESHUTDOWN
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
127 #define ETOOMANYREFS WSAETOOMANYREFS
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
128 #define ETIMEDOUT WSAETIMEDOUT
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
129 #define ECONNREFUSED WSAECONNREFUSED
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
130 #define ELOOP WSAELOOP
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
131 /* #define ENAMETOOLONG WSAENAMETOOLONG */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
132 #define EHOSTDOWN WSAEHOSTDOWN
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
133 #define EHOSTUNREACH WSAEHOSTUNREACH
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
134 /* #define ENOTEMPTY WSAENOTEMPTY */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
135 #define EPROCLIM WSAEPROCLIM
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
136 #define EUSERS WSAEUSERS
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
137 #define EDQUOT WSAEDQUOT
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
138 #define ESTALE WSAESTALE
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
139 #define EREMOTE WSAEREMOTE
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
140
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
141 #endif /* _SOCKET_H_ */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
142
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
143 /* end of socket.h */