source: trunk/include/win/winsock.h@ 1036

Last change on this file since 1036 was 4, checked in by ktk, 26 years ago

Import

File size: 20.6 KB
Line 
1/* $Id: winsock.h,v 1.1 1999-05-24 20:19:23 ktk Exp $ */
2
3/* WINSOCK.H--definitions to be used with the WINSOCK.DLL
4 *
5 * This header file corresponds to version 1.1 of the Windows Sockets
6 * specification.
7 */
8
9#ifndef _WINSOCKAPI_
10#define _WINSOCKAPI_
11
12#include <netinet/in.h>
13#include <arpa/inet.h>
14#include <sys/types.h>
15#include <sys/time.h>
16#include <fcntl.h>
17#include <netdb.h>
18#include <sys/socket.h>
19
20#ifdef HAVE_IPX_GNU
21# include <netipx/ipx.h>
22# define HAVE_IPX
23#endif
24
25#ifdef HAVE_IPX_LINUX
26# include <asm/types.h>
27# include <linux/ipx.h>
28# define HAVE_IPX
29#endif
30
31#include "windef.h"
32#include "task.h"
33
34#include "pshpack1.h"
35
36/* Win16 socket-related types */
37
38typedef UINT16 SOCKET16;
39typedef UINT SOCKET;
40
41typedef struct ws_hostent
42{
43 SEGPTR h_name; /* official name of host */
44 SEGPTR h_aliases; /* alias list */
45 INT16 h_addrtype; /* host address type */
46 INT16 h_length; /* length of address */
47 SEGPTR h_addr_list; /* list of addresses from name server */
48} _ws_hostent;
49
50typedef struct ws_protoent
51{
52 SEGPTR p_name; /* official protocol name */
53 SEGPTR p_aliases; /* alias list */
54 INT16 p_proto; /* protocol # */
55} _ws_protoent;
56
57typedef struct ws_servent
58{
59 SEGPTR s_name; /* official service name */
60 SEGPTR s_aliases; /* alias list */
61 INT16 s_port; /* port # */
62 SEGPTR s_proto; /* protocol to use */
63} _ws_servent;
64
65typedef struct ws_netent
66{
67 SEGPTR n_name; /* official name of net */
68 SEGPTR n_aliases; /* alias list */
69 INT16 n_addrtype; /* net address type */
70 INT n_net; /* network # */
71} _ws_netent;
72
73typedef struct sockaddr ws_sockaddr;
74
75typedef struct
76{
77 UINT16 fd_count; /* how many are SET? */
78 SOCKET16 fd_array[FD_SETSIZE]; /* an array of SOCKETs */
79} ws_fd_set16;
80
81typedef struct
82{
83 UINT fd_count; /* how many are SET? */
84 SOCKET fd_array[FD_SETSIZE]; /* an array of SOCKETs */
85} ws_fd_set32;
86
87/* ws_fd_set operations */
88
89INT16 WINAPI __WSAFDIsSet16( SOCKET16, ws_fd_set16 * );
90INT WINAPI __WSAFDIsSet( SOCKET, ws_fd_set32 * );
91
92#define __WS_FD_CLR(fd, set, cast) do { \
93 UINT16 __i; \
94 for (__i = 0; __i < ((cast*)(set))->fd_count ; __i++) \
95 { \
96 if (((cast*)(set))->fd_array[__i] == fd) \
97 { \
98 while (__i < ((cast*)(set))->fd_count-1) \
99 { \
100 ((cast*)(set))->fd_array[__i] = \
101 ((cast*)(set))->fd_array[__i+1]; \
102 __i++; \
103 } \
104 ((cast*)(set))->fd_count--; \
105 break; \
106 } \
107 } \
108} while(0)
109#define WS_FD_CLR16(fd, set) __WS_FD_CLR((fd),(set), ws_fd_set16)
110#define WS_FD_CLR(fd, set) __WS_FD_CLR((fd),(set), ws_fd_set32)
111
112#define __WS_FD_SET(fd, set, cast) do { \
113 if (((cast*)(set))->fd_count < FD_SETSIZE) \
114 ((cast*)(set))->fd_array[((cast*)(set))->fd_count++]=(fd);\
115} while(0)
116#define WS_FD_SET16(fd, set) __WS_FD_SET((fd),(set), ws_fd_set16)
117#define WS_FD_SET(fd, set) __WS_FD_SET((fd),(set), ws_fd_set32)
118
119#define WS_FD_ZERO16(set) (((ws_fd_set16*)(set))->fd_count=0)
120#define WS_FD_ZERO(set) (((ws_fd_set32*)(set))->fd_count=0)
121
122#define WS_FD_ISSET16(fd, set) __WSAFDIsSet16((SOCKET16)(fd), (ws_fd_set16*)(set))
123#define WS_FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (ws_fd_set32*)(set))
124
125/*
126 * Internet address (old style... should be updated)
127 */
128
129struct ws_in_addr
130{
131 union {
132 struct { BYTE s_b1,s_b2,s_b3,s_b4; } S_un_b;
133 struct { UINT16 s_w1,s_w2; } S_un_w;
134 UINT S_addr;
135 } S_un;
136#define ws_addr S_un.S_addr /* can be used for most tcp & ip code */
137#define ws_host S_un.S_un_b.s_b2 /* host on imp */
138#define ws_net S_un.S_un_b.s_b1 /* network */
139#define ws_imp S_un.S_un_w.s_w2 /* imp */
140#define ws_impno S_un.S_un_b.s_b4 /* imp # */
141#define ws_lh S_un.S_un_b.s_b3 /* logical host */
142};
143
144struct ws_sockaddr_in
145{
146 INT16 sin_family;
147 UINT16 sin_port;
148 struct ws_in_addr sin_addr;
149 BYTE sin_zero[8];
150};
151
152#define WSADESCRIPTION_LEN 256
153#define WSASYS_STATUS_LEN 128
154
155typedef struct WSAData {
156 WORD wVersion;
157 WORD wHighVersion;
158 char szDescription[WSADESCRIPTION_LEN+1];
159 char szSystemStatus[WSASYS_STATUS_LEN+1];
160 UINT16 iMaxSockets;
161 UINT16 iMaxUdpDg;
162 SEGPTR lpVendorInfo;
163} WSADATA, *LPWSADATA;
164
165#include "poppack.h"
166
167/* ----------------------------------- no Win16 structure defs beyond this line! */
168
169/*
170 * This is used instead of -1, since the
171 * SOCKET type is unsigned.
172 */
173#define INVALID_SOCKET16 (~0)
174#define INVALID_SOCKET (~0)
175#define SOCKET_ERROR (-1)
176
177
178/*
179 * Types
180 */
181#define WS_SOCK_STREAM 1 /* stream socket */
182#define WS_SOCK_DGRAM 2 /* datagram socket */
183#define WS_SOCK_RAW 3 /* raw-protocol interface */
184#define WS_SOCK_RDM 4 /* reliably-delivered message */
185#define WS_SOCK_SEQPACKET 5 /* sequenced packet stream */
186
187#define WS_SOL_SOCKET 0xffff
188#define WS_IPPROTO_TCP 6
189
190/*
191 * Option flags per-socket.
192 */
193#define WS_SO_DEBUG 0x0001 /* turn on debugging info recording */
194#define WS_SO_ACCEPTCONN 0x0002 /* socket has had listen() */
195#define WS_SO_REUSEADDR 0x0004 /* allow local address reuse */
196#define WS_SO_KEEPALIVE 0x0008 /* keep connections alive */
197#define WS_SO_DONTROUTE 0x0010 /* just use interface addresses */
198#define WS_SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */
199#define WS_SO_USELOOPBACK 0x0040 /* bypass hardware when possible */
200#define WS_SO_LINGER 0x0080 /* linger on close if data present */
201#define WS_SO_OOBINLINE 0x0100 /* leave received OOB data in line */
202
203#define WS_SO_DONTLINGER (UINT)(~WS_SO_LINGER)
204
205/*
206 * Additional options.
207 */
208#define WS_SO_SNDBUF 0x1001 /* send buffer size */
209#define WS_SO_RCVBUF 0x1002 /* receive buffer size */
210#define WS_SO_SNDLOWAT 0x1003 /* send low-water mark */
211#define WS_SO_RCVLOWAT 0x1004 /* receive low-water mark */
212#define WS_SO_SNDTIMEO 0x1005 /* send timeout */
213#define WS_SO_RCVTIMEO 0x1006 /* receive timeout */
214#define WS_SO_ERROR 0x1007 /* get error status and clear */
215#define WS_SO_TYPE 0x1008 /* get socket type */
216
217#define WS_IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */
218#define WS_IOC_VOID 0x20000000 /* no parameters */
219#define WS_IOC_OUT 0x40000000 /* copy out parameters */
220#define WS_IOC_IN 0x80000000 /* copy in parameters */
221#define WS_IOC_INOUT (WS_IOC_IN|WS_IOC_OUT)
222#define WS_IOR(x,y,t) (WS_IOC_OUT|(((UINT)sizeof(t)&WS_IOCPARM_MASK)<<16)|((x)<<8)|(y))
223#define WS_IOW(x,y,t) (WS_IOC_IN|(((UINT)sizeof(t)&WS_IOCPARM_MASK)<<16)|((x)<<8)|(y))
224
225/* IPPROTO_TCP options */
226#define WS_TCP_NODELAY 1 /* do not apply nagle algorithm */
227
228/*
229 * Socket I/O flags (supported by spec 1.1)
230 */
231
232#define WS_FIONREAD WS_IOR('f', 127, u_long)
233#define WS_FIONBIO WS_IOW('f', 126, u_long)
234
235#define WS_SIOCATMARK WS_IOR('s', 7, u_long)
236
237/*
238 * Maximum queue length specifiable by listen.
239 */
240#ifdef SOMAXCONN
241#undef SOMAXCONN
242#endif
243#define SOMAXCONN 5
244
245#ifndef MSG_DONTROUTE
246#define MSG_DONTROUTE 0x4 /* send without using routing tables */
247#endif
248#define MSG_MAXIOVLEN 16
249
250/*
251 * Define constant based on rfc883, used by gethostbyxxxx() calls.
252 */
253#define MAXGETHOSTSTRUCT 1024
254
255/*
256 * Define flags to be used with the WSAAsyncSelect() call.
257 */
258#define FD_READ WS_FD_READ
259#define FD_WRITE WS_FD_WRITE
260#define FD_OOB WS_FD_OOB
261#define FD_ACCEPT WS_FD_ACCEPT
262#define FD_CONNECT WS_FD_CONNECT
263#define FD_CLOSE WS_FD_CLOSE
264#define WS_FD_READ 0x0001
265#define WS_FD_WRITE 0x0002
266#define WS_FD_OOB 0x0004
267#define WS_FD_ACCEPT 0x0008
268#define WS_FD_CONNECT 0x0010
269#define WS_FD_CLOSE 0x0020
270
271#define WS_FD_LISTENING 0x10000000 /* internal per-socket flags */
272#define WS_FD_INACTIVE 0x20000000
273#define WS_FD_CONNECTED 0x40000000
274#define WS_FD_RAW 0x80000000
275#define WS_FD_INTERNAL 0xFFFF0000
276
277/*
278 * All Windows Sockets error constants are biased by WSABASEERR from
279 * the "normal"
280 */
281#define WSABASEERR 10000
282/*
283 * Windows Sockets definitions of regular Microsoft C error constants
284 */
285#define WSAEINTR (WSABASEERR+4)
286#define WSAEBADF (WSABASEERR+9)
287#define WSAEACCES (WSABASEERR+13)
288#define WSAEFAULT (WSABASEERR+14)
289#define WSAEINVAL (WSABASEERR+22)
290#define WSAEMFILE (WSABASEERR+24)
291
292/*
293 * Windows Sockets definitions of regular Berkeley error constants
294 */
295#define WSAEWOULDBLOCK (WSABASEERR+35)
296#define WSAEINPROGRESS (WSABASEERR+36)
297#define WSAEALREADY (WSABASEERR+37)
298#define WSAENOTSOCK (WSABASEERR+38)
299#define WSAEDESTADDRREQ (WSABASEERR+39)
300#define WSAEMSGSIZE (WSABASEERR+40)
301#define WSAEPROTOTYPE (WSABASEERR+41)
302#define WSAENOPROTOOPT (WSABASEERR+42)
303#define WSAEPROTONOSUPPORT (WSABASEERR+43)
304#define WSAESOCKTNOSUPPORT (WSABASEERR+44)
305#define WSAEOPNOTSUPP (WSABASEERR+45)
306#define WSAEPFNOSUPPORT (WSABASEERR+46)
307#define WSAEAFNOSUPPORT (WSABASEERR+47)
308#define WSAEADDRINUSE (WSABASEERR+48)
309#define WSAEADDRNOTAVAIL (WSABASEERR+49)
310#define WSAENETDOWN (WSABASEERR+50)
311#define WSAENETUNREACH (WSABASEERR+51)
312#define WSAENETRESET (WSABASEERR+52)
313#define WSAECONNABORTED (WSABASEERR+53)
314#define WSAECONNRESET (WSABASEERR+54)
315#define WSAENOBUFS (WSABASEERR+55)
316#define WSAEISCONN (WSABASEERR+56)
317#define WSAENOTCONN (WSABASEERR+57)
318#define WSAESHUTDOWN (WSABASEERR+58)
319#define WSAETOOMANYREFS (WSABASEERR+59)
320#define WSAETIMEDOUT (WSABASEERR+60)
321#define WSAECONNREFUSED (WSABASEERR+61)
322#define WSAELOOP (WSABASEERR+62)
323#define WSAENAMETOOLONG (WSABASEERR+63)
324#define WSAEHOSTDOWN (WSABASEERR+64)
325#define WSAEHOSTUNREACH (WSABASEERR+65)
326#define WSAENOTEMPTY (WSABASEERR+66)
327#define WSAEPROCLIM (WSABASEERR+67)
328#define WSAEUSERS (WSABASEERR+68)
329#define WSAEDQUOT (WSABASEERR+69)
330#define WSAESTALE (WSABASEERR+70)
331#define WSAEREMOTE (WSABASEERR+71)
332
333/*
334 * Extended Windows Sockets error constant definitions
335 */
336#define WSASYSNOTREADY (WSABASEERR+91)
337#define WSAVERNOTSUPPORTED (WSABASEERR+92)
338#define WSANOTINITIALISED (WSABASEERR+93)
339
340/*
341 * Error return codes from gethostbyname() and gethostbyaddr()
342 * (when using the resolver). Note that these errors are
343 * retrieved via WSAGetLastError() and must therefore follow
344 * the rules for avoiding clashes with error numbers from
345 * specific implementations or language run-time systems.
346 * For this reason the codes are based at WSABASEERR+1001.
347 * Note also that [WSA]NO_ADDRESS is defined only for
348 * compatibility purposes.
349 */
350
351/* #define h_errno WSAGetLastError() */
352
353/* Authoritative Answer: Host not found */
354#define WSAHOST_NOT_FOUND (WSABASEERR+1001)
355
356/* Non-Authoritative: Host not found, or SERVERFAIL */
357#define WSATRY_AGAIN (WSABASEERR+1002)
358
359/* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
360#define WSANO_RECOVERY (WSABASEERR+1003)
361
362/* Valid name, no data record of requested type */
363#define WSANO_DATA (WSABASEERR+1004)
364
365/* no address, look for MX record */
366#define WSANO_ADDRESS WSANO_DATA
367
368/* Socket function prototypes */
369
370#ifdef __cplusplus
371extern "C" {
372#endif
373
374/* Microsoft Windows Extension function prototypes */
375
376INT16 WINAPI WSAStartup16(UINT16 wVersionRequired, LPWSADATA lpWSAData);
377INT WINAPI WSAStartup(UINT wVersionRequired, LPWSADATA lpWSAData);
378void WINAPI WSASetLastError16(INT16 iError);
379void WINAPI WSASetLastError(INT iError);
380INT WINAPI WSACleanup(void);
381INT WINAPI WSAGetLastError(void);
382BOOL WINAPI WSAIsBlocking(void);
383INT WINAPI WSACancelBlockingCall(void);
384INT16 WINAPI WSAUnhookBlockingHook16(void);
385INT WINAPI WSAUnhookBlockingHook(void);
386FARPROC16 WINAPI WSASetBlockingHook16(FARPROC16 lpBlockFunc);
387FARPROC WINAPI WSASetBlockingHook(FARPROC lpBlockFunc);
388
389HANDLE16 WINAPI WSAAsyncGetServByName16(HWND16 hWnd, UINT16 wMsg, LPCSTR name, LPCSTR proto,
390 SEGPTR buf, INT16 buflen);
391HANDLE WINAPI WSAAsyncGetServByName(HWND hWnd, UINT uMsg, LPCSTR name, LPCSTR proto,
392 LPSTR sbuf, INT buflen);
393
394HANDLE16 WINAPI WSAAsyncGetServByPort16(HWND16 hWnd, UINT16 wMsg, INT16 port,
395 LPCSTR proto, SEGPTR buf, INT16 buflen);
396HANDLE WINAPI WSAAsyncGetServByPort(HWND hWnd, UINT uMsg, INT port,
397 LPCSTR proto, LPSTR sbuf, INT buflen);
398
399HANDLE16 WINAPI WSAAsyncGetProtoByName16(HWND16 hWnd, UINT16 wMsg,
400 LPCSTR name, SEGPTR buf, INT16 buflen);
401HANDLE WINAPI WSAAsyncGetProtoByName(HWND hWnd, UINT uMsg,
402 LPCSTR name, LPSTR sbuf, INT buflen);
403
404HANDLE16 WINAPI WSAAsyncGetProtoByNumber16(HWND16 hWnd, UINT16 wMsg,
405 INT16 number, SEGPTR buf, INT16 buflen);
406HANDLE WINAPI WSAAsyncGetProtoByNumber(HWND hWnd, UINT uMsg,
407 INT number, LPSTR sbuf, INT buflen);
408
409HANDLE16 WINAPI WSAAsyncGetHostByName16(HWND16 hWnd, UINT16 wMsg,
410 LPCSTR name, SEGPTR buf, INT16 buflen);
411HANDLE WINAPI WSAAsyncGetHostByName(HWND hWnd, UINT uMsg,
412 LPCSTR name, LPSTR sbuf, INT buflen);
413
414HANDLE16 WINAPI WSAAsyncGetHostByAddr16(HWND16 hWnd, UINT16 wMsg, LPCSTR addr,
415 INT16 len, INT16 type, SEGPTR buf, INT16 buflen);
416HANDLE WINAPI WSAAsyncGetHostByAddr(HWND hWnd, UINT uMsg, LPCSTR addr,
417 INT len, INT type, LPSTR sbuf, INT buflen);
418
419INT16 WINAPI WSACancelAsyncRequest16(HANDLE16 hAsyncTaskHandle);
420INT WINAPI WSACancelAsyncRequest(HANDLE hAsyncTaskHandle);
421
422INT16 WINAPI WSAAsyncSelect16(SOCKET16 s, HWND16 hWnd, UINT16 wMsg, UINT lEvent);
423INT WINAPI WSAAsyncSelect(SOCKET s, HWND hWnd, UINT uMsg, UINT lEvent);
424
425
426/*
427 * Address families
428 */
429#define WS_AF_UNSPEC 0 /* unspecified */
430#define WS_AF_UNIX 1 /* local to host (pipes, portals) */
431#define WS_AF_INET 2 /* internetwork: UDP, TCP, etc. */
432#define WS_AF_IMPLINK 3 /* arpanet imp addresses */
433#define WS_AF_PUP 4 /* pup protocols: e.g. BSP */
434#define WS_AF_CHAOS 5 /* mit CHAOS protocols */
435#define WS_AF_NS 6 /* XEROX NS protocols */
436#define WS_AF_IPX WS_AF_NS /* IPX protocols: IPX, SPX, etc. */
437#define WS_AF_ISO 7 /* ISO protocols */
438#define WS_AF_OSI AF_ISO /* OSI is ISO */
439#define WS_AF_ECMA 8 /* european computer manufacturers */
440#define WS_AF_DATAKIT 9 /* datakit protocols */
441#define WS_AF_CCITT 10 /* CCITT protocols, X.25 etc */
442#define WS_AF_SNA 11 /* IBM SNA */
443#define WS_AF_DECnet 12 /* DECnet */
444#define WS_AF_DLI 13 /* Direct data link interface */
445#define WS_AF_LAT 14 /* LAT */
446#define WS_AF_HYLINK 15 /* NSC Hyperchannel */
447#define WS_AF_APPLETALK 16 /* AppleTalk */
448#define WS_AF_NETBIOS 17 /* NetBios-style addresses */
449#define WS_AF_VOICEVIEW 18 /* VoiceView */
450#define WS_AF_FIREFOX 19 /* Protocols from Firefox */
451#define WS_AF_UNKNOWN1 20 /* Somebody is using this! */
452#define WS_AF_BAN 21 /* Banyan */
453#define WS_AF_ATM 22 /* Native ATM Services */
454#define WS_AF_INET6 23 /* Internetwork Version 6 */
455#define WS_AF_CLUSTER 24 /* Microsoft Wolfpack */
456#define WS_AF_12844 25 /* IEEE 1284.4 WG AF */
457#define WS_AF_IRDA 26 /* IrDA */
458
459#define WS_AF_MAX 27
460
461struct ws_sockaddr_ipx
462{
463 INT16 sipx_family __attribute__((packed));
464 UINT sipx_network __attribute__((packed));
465 CHAR sipx_node[6] __attribute__((packed));
466 UINT16 sipx_port __attribute__((packed));
467};
468
469#ifdef __cplusplus
470}
471#endif
472
473/* Microsoft Windows Extended data types */
474typedef struct sockaddr SOCKADDR, *PSOCKADDR, *LPSOCKADDR;
475typedef struct sockaddr_in SOCKADDR_IN, *PSOCKADDR_IN, *LPSOCKADDR_IN;
476typedef struct linger LINGER, *PLINGER, *LPLINGER;
477typedef struct in_addr IN_ADDR, *PIN_ADDR, *LPIN_ADDR;
478typedef struct fd_set FD_SET, *PFD_SET, *LPFD_SET;
479typedef struct hostent HOSTENT, *PHOSTENT, *LPHOSTENT;
480typedef struct servent SERVENT, *PSERVENT, *LPSERVENT;
481typedef struct protoent PROTOENT, *PPROTOENT, *LPPROTOENT;
482typedef struct timeval TIMEVAL, *PTIMEVAL, *LPTIMEVAL;
483
484/*
485 * Windows message parameter composition and decomposition
486 * macros.
487 *
488 * WSAMAKEASYNCREPLY is intended for use by the Windows Sockets implementation
489 * when constructing the response to a WSAAsyncGetXByY() routine.
490 */
491#define WSAMAKEASYNCREPLY(buflen,error) MAKELONG(buflen,error)
492/*
493 * WSAMAKESELECTREPLY is intended for use by the Windows Sockets implementation
494 * when constructing the response to WSAAsyncSelect().
495 */
496#define WSAMAKESELECTREPLY(event,error) MAKELONG(event,error)
497/*
498 * WSAGETASYNCBUFLEN is intended for use by the Windows Sockets application
499 * to extract the buffer length from the lParam in the response
500 * to a WSAGetXByY().
501 */
502#define WSAGETASYNCBUFLEN(lParam) LOWORD(lParam)
503/*
504 * WSAGETASYNCERROR is intended for use by the Windows Sockets application
505 * to extract the error code from the lParam in the response
506 * to a WSAGetXByY().
507 */
508#define WSAGETASYNCERROR(lParam) HIWORD(lParam)
509/*
510 * WSAGETSELECTEVENT is intended for use by the Windows Sockets application
511 * to extract the event code from the lParam in the response
512 * to a WSAAsyncSelect().
513 */
514#define WSAGETSELECTEVENT(lParam) LOWORD(lParam)
515/*
516 * WSAGETSELECTERROR is intended for use by the Windows Sockets application
517 * to extract the error code from the lParam in the response
518 * to a WSAAsyncSelect().
519 */
520#define WSAGETSELECTERROR(lParam) HIWORD(lParam)
521
522/* ----------------------------------- internal structures */
523
524/* ws_... struct conversion flags */
525
526#define WS_DUP_LINEAR 0x0001
527#define WS_DUP_NATIVE 0x0000 /* not used anymore */
528#define WS_DUP_OFFSET 0x0002 /* internal pointers are offsets */
529#define WS_DUP_SEGPTR 0x0004 /* internal pointers are SEGPTRs */
530 /* by default, internal pointers are linear */
531
532typedef struct __sop /* WSAAsyncSelect() control struct */
533{
534 struct __sop *next, *prev;
535
536 struct __ws* pws;
537 HWND hWnd;
538 UINT uMsg;
539} ws_select_op;
540
541typedef struct __ws /* socket */
542{
543 int fd;
544 unsigned flags;
545 ws_select_op* psop;
546} ws_socket;
547
548#define WS_MAX_SOCKETS_PER_PROCESS 16
549#define WS_MAX_UDP_DATAGRAM 1024
550
551#define WSI_BLOCKINGCALL 0x00000001 /* per-thread info flags */
552#define WSI_BLOCKINGHOOK 0x00000002 /* 32-bit callback */
553
554typedef struct _WSINFO
555{
556 struct _WSINFO* prev,*next;
557
558 unsigned flags;
559 INT err; /* WSAGetLastError() return value */
560 INT16 num_startup; /* reference counter */
561 INT16 num_async_rq;
562 INT16 last_free; /* entry in the socket table */
563 UINT16 buflen;
564 char* buffer; /* allocated from SEGPTR heap */
565 struct ws_hostent *he;
566 int helen;
567 struct ws_servent *se;
568 int selen;
569 struct ws_protoent *pe;
570 int pelen;
571 char* dbuffer; /* buffer for dummies (32 bytes) */
572
573 ws_socket sock[WS_MAX_SOCKETS_PER_PROCESS];
574 DWORD blocking_hook;
575 HTASK16 tid; /* owning task id - process might be better */
576} WSINFO, *LPWSINFO;
577
578/* function prototypes */
579int WS_dup_he(LPWSINFO pwsi, struct hostent* p_he, int flag);
580int WS_dup_pe(LPWSINFO pwsi, struct protoent* p_pe, int flag);
581int WS_dup_se(LPWSINFO pwsi, struct servent* p_se, int flag);
582
583BOOL WINSOCK_HandleIO(int* fd_max, int num_pending, fd_set pending_set[3], fd_set master_set[3] );
584void WINSOCK_Shutdown(void);
585UINT16 wsaErrno(void);
586UINT16 wsaHerrno(void);
587
588extern INT WINSOCK_DeleteTaskWSI( TDB* pTask, struct _WSINFO* );
589
590#endif /* _WINSOCKAPI_ */
591
Note: See TracBrowser for help on using the repository browser.