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