source: trunk/src/wsock32/new/wsock32.h@ 10366

Last change on this file since 10366 was 3218, checked in by achimha, 25 years ago

made it compile with V5 headers

File size: 7.9 KB
Line 
1/* $Id: wsock32.h,v 1.6 2000-03-24 17:30:28 achimha 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#define TCPV40HDRS
19#include <sys\socket.h>
20#include <sys\ioctl.h>
21#include <netdb.h>
22#include <netinet\in.h>
23#include <netinet\tcp.h>
24#include <nerrno.h>
25#include <sys\time.h>
26
27#include <odinwrap.h>
28
29/*
30 * Socket state bits.
31 */
32#define SS_NOFDREF 0x0001 /* no file table ref any more */
33#define SS_ISCONNECTED 0x0002 /* socket connected to a peer */
34#define SS_ISCONNECTING 0x0004 /* in process of connecting to peer */
35#define SS_ISDISCONNECTING 0x0008 /* in process of disconnecting */
36#define SS_CANTSENDMORE 0x0010 /* can't send more data to peer */
37#define SS_CANTRCVMORE 0x0020 /* can't receive more data from peer */
38#define SS_RCVATMARK 0x0040 /* at mark on input */
39
40#define SS_NBIO 0x0100 /* non-blocking ops */
41#define SS_ASYNC 0x0200 /* async i/o notify */
42#define SS_ISCONFIRMING 0x0400 /* deciding to accept connection req */
43
44#define SS_INCOMP 0x0800 /* unaccepted, incomplete connection */
45#define SS_COMP 0x1000 /* unaccepted, complete connection */
46#define SS_ISDISCONNECTED 0x2000 /* socket disconnected from peer */
47
48//socketopt options
49#define SO_DONTLINGER (u_int)(~SO_LINGER)
50
51#define WSAMAKESELECTREPLY(event,error) MAKELONG(event,error)
52
53// WSAAsyncSelect flags
54#define FD_READ 0x01
55#define FD_WRITE 0x02
56#define FD_OOB 0x04
57#define FD_ACCEPT 0x08
58#define FD_CONNECT 0x10
59#define FD_CLOSE 0x20
60
61#define SOCKET_ERROR -1
62#define NO_ERROR 0
63
64#define WSABASEERR 10000
65
66#define WSAEINTR (WSABASEERR+4)
67#define WSAEBADF (WSABASEERR+9)
68#define WSAEACCES (WSABASEERR+13)
69#define WSAEFAULT (WSABASEERR+14)
70#define WSAEINVAL (WSABASEERR+22)
71#define WSAEMFILE (WSABASEERR+24)
72
73#define WSAEWOULDBLOCK (WSABASEERR+35)
74#define WSAEINPROGRESS (WSABASEERR+36)
75#define WSAEALREADY (WSABASEERR+37)
76#define WSAENOTSOCK (WSABASEERR+38)
77#define WSAEDESTADDRREQ (WSABASEERR+39)
78#define WSAEMSGSIZE (WSABASEERR+40)
79#define WSAEPROTOTYPE (WSABASEERR+41)
80#define WSAENOPROTOOPT (WSABASEERR+42)
81#define WSAEPROTONOSUPPORT (WSABASEERR+43)
82#define WSAESOCKTNOSUPPORT (WSABASEERR+44)
83#define WSAEOPNOTSUPP (WSABASEERR+45)
84#define WSAEPFNOSUPPORT (WSABASEERR+46)
85#define WSAEAFNOSUPPORT (WSABASEERR+47)
86#define WSAEADDRINUSE (WSABASEERR+48)
87#define WSAEADDRNOTAVAIL (WSABASEERR+49)
88#define WSAENETDOWN (WSABASEERR+50)
89#define WSAENETUNREACH (WSABASEERR+51)
90#define WSAENETRESET (WSABASEERR+52)
91#define WSAECONNABORTED (WSABASEERR+53)
92#define WSAECONNRESET (WSABASEERR+54)
93#define WSAENOBUFS (WSABASEERR+55)
94#define WSAEISCONN (WSABASEERR+56)
95#define WSAENOTCONN (WSABASEERR+57)
96#define WSAESHUTDOWN (WSABASEERR+58)
97#define WSAETOOMANYREFS (WSABASEERR+59)
98#define WSAETIMEDOUT (WSABASEERR+60)
99#define WSAECONNREFUSED (WSABASEERR+61)
100#define WSAELOOP (WSABASEERR+62)
101#define WSAENAMETOOLONG (WSABASEERR+63)
102#define WSAEHOSTDOWN (WSABASEERR+64)
103#define WSAEHOSTUNREACH (WSABASEERR+65)
104#define WSAENOTEMPTY (WSABASEERR+66)
105#define WSAEPROCLIM (WSABASEERR+67)
106#define WSAEUSERS (WSABASEERR+68)
107#define WSAEDQUOT (WSABASEERR+69)
108#define WSAESTALE (WSABASEERR+70)
109#define WSAEREMOTE (WSABASEERR+71)
110#define WSASYSNOTREADY (WSABASEERR+91)
111#define WSAVERNOTSUPPORTED (WSABASEERR+92)
112#define WSANOTINITIALISED (WSABASEERR+93)
113#define WSAHOST_NOT_FOUND (WSABASEERR+1001)
114#define WSATRY_AGAIN (WSABASEERR+1002)
115#define WSANO_RECOVERY (WSABASEERR+1003)
116#define WSANO_DATA (WSABASEERR+1004)
117#define WSANO_ADDRESS WSANO_DATA
118
119typedef u_int SOCKET;
120
121#define FD_SETSIZE 64
122
123#pragma pack(1)
124
125#define WSADESCRIPTION_LEN 256
126#define WSASYS_STATUS_LEN 128
127
128typedef struct WSAData {
129 USHORT wVersion;
130 USHORT wHighVersion;
131 char szDescription[WSADESCRIPTION_LEN+1];
132 char szSystemStatus[WSASYS_STATUS_LEN+1];
133 unsigned short iMaxSockets;
134 unsigned short iMaxUdpDg;
135 char * lpVendorInfo;
136} WSADATA;
137typedef WSADATA *PWSADATA;
138typedef WSADATA *LPWSADATA;
139
140typedef struct ws_fd_set {
141 u_int fd_count;
142 SOCKET fd_array[FD_SETSIZE];
143} _ws_fd_set;
144
145/*
146 * Structure used for manipulating linger option.
147 */
148typedef struct ws_linger {
149 u_short l_onoff; /* option on/off */
150 u_short l_linger; /* linger time */
151} _ws_linger;
152
153/*
154 * Structures returned by network data base library, taken from the
155 * BSD file netdb.h. All addresses are supplied in host order, and
156 * returned in network order (suitable for use in system calls).
157 */
158
159typedef struct ws_hostent
160{
161 char * h_name; /* official name of host */
162 char ** h_aliases; /* alias list */
163 INT16 h_addrtype; /* host address type */
164 INT16 h_length; /* length of address */
165 char ** h_addr_list; /* list of addresses from name server */
166} _ws_hostent;
167
168typedef struct ws_protoent
169{
170 char * p_name; /* official protocol name */
171 char ** p_aliases; /* alias list */
172 INT16 p_proto; /* protocol # */
173} _ws_protoent;
174
175typedef struct ws_servent
176{
177 char * s_name; /* official service name */
178 char ** s_aliases; /* alias list */
179 INT16 s_port; /* port # */
180 char * s_proto; /* protocol to use */
181} _ws_servent;
182
183typedef struct ws_netent
184{
185 char * n_name; /* official name of net */
186 char ** n_aliases; /* alias list */
187 INT16 n_addrtype; /* net address type */
188 INT n_net; /* network # */
189} _ws_netent;
190
191#pragma pack()
192
193#define WS_MAX_SOCKETS_PER_PROCESS 128 /* reasonable guess */
194#define WS_MAX_UDP_DATAGRAM 1024
195
196#define WSI_BLOCKINGCALL 0x00000001 /* per-thread info flags */
197#define WSI_BLOCKINGHOOK 0x00000002 /* 32-bit callback */
198
199typedef struct _WSINFO
200{
201 DWORD dwThisThread;
202 struct _WSINFO *lpNextIData;
203
204 unsigned flags;
205 INT16 num_startup; /* reference counter */
206 INT16 num_async_rq;
207 INT16 last_free; /* entry in the socket table */
208 USHORT buflen;
209 char* buffer; /* allocated from char * heap */
210 struct ws_hostent *he;
211 int helen;
212 struct ws_servent *se;
213 int selen;
214 struct ws_protoent *pe;
215 int pelen;
216 char* dbuffer; /* buffer for dummies (32 bytes) */
217
218 DWORD blocking_hook;
219} WSINFO, *LPWSINFO;
220
221void WIN32API WSASetLastError(int iError);
222int WIN32API WSAGetLastError(void);
223int WIN32API WSAAsyncSelect(SOCKET s, HWND hWnd, u_int wMsg, long lEvent);
224BOOL WIN32API WSAIsBlocking(void);
225
226extern BOOL fWSAInitialized;
227
228UINT wsaErrno();
229UINT wsaHerrno();
230
231#define CURRENT_THREAD -1
232void WSASetBlocking(BOOL fBlock, HANDLE tid = CURRENT_THREAD);
233
234void WINSOCK_DeleteIData(void);
235BOOL WINSOCK_CreateIData(void);
236LPWSINFO WINSOCK_GetIData(HANDLE tid = CURRENT_THREAD);
237
238#endif /* _WINSOCK32CONST_ */
239
240
Note: See TracBrowser for help on using the repository browser.