source: trunk/src/wsock32/wsock32const.h@ 1691

Last change on this file since 1691 was 1691, checked in by phaller, 26 years ago

Fix: SetLastError/GetLastError behaviour changed

File size: 7.6 KB
Line 
1/* $Id: wsock32const.h,v 1.4 1999-11-10 16:36:16 phaller Exp $ */
2
3/* WSOCK32.H--definitions & conversions for Odin's wsock32.dll.
4 * Unused/unneeded Microsoft declarations removed.
5 *
6 * This header file corresponds to version 1.1 of the Windows Sockets specification.
7 *
8 * This file includes parts which are Copyright (c) 1982-1986 Regents
9 * of the University of California. All rights reserved. The
10 * Berkeley Software License Agreement specifies the terms and
11 * conditions for redistribution.
12 *
13 */
14
15#ifndef _WINSOCK32CONST_
16#define _WINSOCK32CONST_
17
18
19/* Microsoft Windows Extension function prototypes */
20void WIN32API WSASetLastError(int iError);
21int WIN32API WSAGetLastError(void);
22
23
24/*
25 * Definitions related to sockets: types, address families, options,
26 * taken from the BSD file sys/socket.h.
27 */
28
29/* WSAAsyncSelect flags */
30#define FD_READ 0x01
31#define FD_WRITE 0x02
32#define FD_OOB 0x04
33#define FD_ACCEPT 0x08
34#define FD_CONNECT 0x10
35#define FD_CLOSE 0x20
36
37
38/*
39 * This is used instead of -1, since the
40 * SOCKET type is unsigned.
41 */
42#define INVALID_SOCKET (SOCKET)(~0)
43#define SOCKET_ERROR (-1)
44
45/*
46 * All Windows Sockets error constants are biased by WSABASEERR from
47 * the "normal"
48 */
49#define WSABASEERR 10000
50/*
51 * Windows Sockets definitions of regular Microsoft C error constants
52 */
53#define WSAEINTR (WSABASEERR+4)
54#define WSAEBADF (WSABASEERR+9)
55#define WSAEACCES (WSABASEERR+13)
56#define WSAEFAULT (WSABASEERR+14)
57#define WSAEINVAL (WSABASEERR+22)
58#define WSAEMFILE (WSABASEERR+24)
59
60/*
61 * Windows Sockets definitions of regular Berkeley error constants
62 */
63#define WSAEWOULDBLOCK (WSABASEERR+35)
64#define WSAEINPROGRESS (WSABASEERR+36)
65#define WSAEALREADY (WSABASEERR+37)
66#define WSAENOTSOCK (WSABASEERR+38)
67#define WSAEDESTADDRREQ (WSABASEERR+39)
68#define WSAEMSGSIZE (WSABASEERR+40)
69#define WSAEPROTOTYPE (WSABASEERR+41)
70#define WSAENOPROTOOPT (WSABASEERR+42)
71#define WSAEPROTONOSUPPORT (WSABASEERR+43)
72#define WSAESOCKTNOSUPPORT (WSABASEERR+44)
73#define WSAEOPNOTSUPP (WSABASEERR+45)
74#define WSAEPFNOSUPPORT (WSABASEERR+46)
75#define WSAEAFNOSUPPORT (WSABASEERR+47)
76#define WSAEADDRINUSE (WSABASEERR+48)
77#define WSAEADDRNOTAVAIL (WSABASEERR+49)
78#define WSAENETDOWN (WSABASEERR+50)
79#define WSAENETUNREACH (WSABASEERR+51)
80#define WSAENETRESET (WSABASEERR+52)
81#define WSAECONNABORTED (WSABASEERR+53)
82#define WSAECONNRESET (WSABASEERR+54)
83#define WSAENOBUFS (WSABASEERR+55)
84#define WSAEISCONN (WSABASEERR+56)
85#define WSAENOTCONN (WSABASEERR+57)
86#define WSAESHUTDOWN (WSABASEERR+58)
87#define WSAETOOMANYREFS (WSABASEERR+59)
88#define WSAETIMEDOUT (WSABASEERR+60)
89#define WSAECONNREFUSED (WSABASEERR+61)
90#define WSAELOOP (WSABASEERR+62)
91#define WSAENAMETOOLONG (WSABASEERR+63)
92#define WSAEHOSTDOWN (WSABASEERR+64)
93#define WSAEHOSTUNREACH (WSABASEERR+65)
94#define WSAENOTEMPTY (WSABASEERR+66)
95#define WSAEPROCLIM (WSABASEERR+67)
96#define WSAEUSERS (WSABASEERR+68)
97#define WSAEDQUOT (WSABASEERR+69)
98#define WSAESTALE (WSABASEERR+70)
99#define WSAEREMOTE (WSABASEERR+71)
100
101#define WSAEDISCON (WSABASEERR+101)
102
103/*
104 * Extended Windows Sockets error constant definitions
105 */
106#define WSASYSNOTREADY (WSABASEERR+91)
107#define WSAVERNOTSUPPORTED (WSABASEERR+92)
108#define WSANOTINITIALISED (WSABASEERR+93)
109
110/*
111 * Error return codes from gethostbyname() and gethostbyaddr()
112 * (when using the resolver). Note that these errors are
113 * retrieved via WSAGetLastError() and must therefore follow
114 * the rules for avoiding clashes with error numbers from
115 * specific implementations or language run-time systems.
116 * For this reason the codes are based at WSABASEERR+1001.
117 * Note also that [WSA]NO_ADDRESS is defined only for
118 * compatibility purposes.
119 */
120
121#define Wh_errno WSAGetLastError()
122
123/* Authoritative Answer: Host not found */
124#define WSAHOST_NOT_FOUND (WSABASEERR+1001)
125#define WHOST_NOT_FOUND WSAHOST_NOT_FOUND
126
127/* Non-Authoritative: Host not found, or SERVERFAIL */
128#define WSATRY_AGAIN (WSABASEERR+1002)
129#define WTRY_AGAIN WSATRY_AGAIN
130
131/* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
132#define WSANO_RECOVERY (WSABASEERR+1003)
133#define WNO_RECOVERY WSANO_RECOVERY
134
135/* Valid name, no data record of requested type */
136#define WSANO_DATA (WSABASEERR+1004)
137#define WNO_DATA WSANO_DATA
138
139/* no address, look for MX record */
140#define WSANO_ADDRESS WSANO_DATA
141#define WNO_ADDRESS WSANO_ADDRESS
142
143
144/*
145 * Windows message parameter composition and decomposition
146 * macros.
147 *
148 * WSAMAKEASYNCREPLY is intended for use by the Windows Sockets implementation
149 * when constructing the response to a WSAAsyncGetXByY() routine.
150 */
151#define OS2WSAMAKEASYNCREPLY(buflen,error) MAKELONG(buflen,error)
152/*
153 * WSAMAKESELECTREPLY is intended for use by the Windows Sockets implementation
154 * when constructing the response to WSAAsyncSelect().
155 */
156#define OS2WSAMAKESELECTREPLY(event,error) MAKELONG(event,error)
157/*
158 * WSAGETASYNCBUFLEN is intended for use by the Windows Sockets application
159 * to extract the buffer length from the lParam in the response
160 * to a WSAGetXByY().
161 */
162#define OS2WSAGETASYNCBUFLEN(lParam) LOWORD(lParam)
163/*
164 * WSAGETASYNCERROR is intended for use by the Windows Sockets application
165 * to extract the error code from the lParam in the response
166 * to a WSAGetXByY().
167 */
168#define OS2WSAGETASYNCERROR(lParam) HIWORD(lParam)
169/*
170 * WSAGETSELECTEVENT is intended for use by the Windows Sockets application
171 * to extract the event code from the lParam in the response
172 * to a WSAAsyncSelect().
173 */
174#define OS2WSAGETSELECTEVENT(lParam) LOWORD(lParam)
175/*
176 * WSAGETSELECTERROR is intended for use by the Windows Sockets application
177 * to extract the error code from the lParam in the response
178 * to a WSAAsyncSelect().
179 */
180#define OS2WSAGETSELECTERROR(lParam) HIWORD(lParam)
181
182
183/*
184 * Structures returned by network data base library, taken from the
185 * BSD file netdb.h. All addresses are supplied in host order, and
186 * returned in network order (suitable for use in system calls).
187 */
188
189struct Whostent {
190 char * h_name; /* official name of host */
191 char * * h_aliases; /* alias list */
192 short h_addrtype; /* host address type */
193 short h_length; /* length of address */
194 char * * h_addr_list; /* list of addresses */
195#define h_addr h_addr_list[0] /* address, for backward compat */
196};
197
198/*
199 * It is assumed here that a network number
200 * fits in 32 bits.
201 */
202struct Wnetent {
203 char * n_name; /* official name of net */
204 char * * n_aliases; /* alias list */
205 short n_addrtype; /* net address type */
206 u_long n_net; /* network # */
207};
208
209struct Wservent {
210 char * s_name; /* official service name */
211 char * * s_aliases; /* alias list */
212 short s_port; /* port # */
213 char * s_proto; /* protocol to use */
214};
215
216struct Wprotoent {
217 char * p_name; /* official protocol name */
218 char * * p_aliases; /* alias list */
219 short p_proto; /* protocol # */
220};
221
222
223#endif /* _WINSOCK32CONST_ */
224
225
Note: See TracBrowser for help on using the repository browser.