source: trunk/src/wsock32/wsock32.h@ 5655

Last change on this file since 5655 was 5279, checked in by sandervl, 24 years ago

update

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