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

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

Fix: invalid structure alignment for asynchronous operations

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