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

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

Fix: WSA async rewrite

File size: 24.1 KB
Line 
1/* $Id: wsock32.h,v 1.5 1999-10-20 10:03:54 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 _WINSOCKAPI_
16#define _WINSOCKAPI_
17
18
19#ifdef MAKELONG
20# undef MAKELONG
21#endif
22
23#ifdef MAKEWORD
24# undef MAKEWORD
25#endif
26
27#ifdef LOBYTE
28# undef LOBYTE
29#endif
30
31#ifdef LOWORD
32# undef LOWORD
33#endif
34
35#ifdef HIBYTE
36# undef HIBYTE
37#endif
38
39#ifdef HIWORD
40# undef HIWORD
41#endif
42
43#define MAKEWORD(a, b) ((WORD)(((BYTE)(a)) | ((WORD)((BYTE)(b))) << 8))
44#define MAKELONG(a, b) ((LONG)(((WORD)(a)) | ((DWORD)((WORD)(b))) << 16))
45#define LOWORD(l) ((WORD)(l))
46#define HIWORD(l) ((WORD)(((DWORD)(l) >> 16) & 0xFFFF))
47#define LOBYTE(w) ((BYTE)(w))
48#define HIBYTE(w) ((BYTE)(((WORD)(w) >> 8) & 0xFF))
49
50
51
52/*
53 * Basic system type definitions, taken from the BSD file sys/types.h.
54 */
55
56#ifdef __WATCOM__
57typedef unsigned char u_char;
58typedef unsigned short u_short;
59typedef unsigned int u_int;
60typedef unsigned long u_long;
61 typedef int ( WIN32API *PROC)();
62#else
63 typedef int (* WIN32API PROC)();
64#endif
65
66//typedef unsigned short WORD;
67//typedef unsigned long DWORD;
68//typedef ULONG HANDLE, *PHANDLE, *LPHANDLE, *SPHANDLE;
69
70/*
71 * The new type to be used in all
72 * instances which refer to sockets.
73 */
74typedef u_int SOCKET;
75
76
77
78
79typedef struct AsyncStatus {
80 HWND hwnd; // owner's hwindow
81 u_int msg; // message to send when event occurs
82 ULONG event; // event that may occur
83 SOCKET socket; // the socket
84 int status; // blocking yes/no
85 TID threadID; // Thread ID for async
86 int MsgStat; // has message been sent yet?
87 struct AsyncStatus *Next; // pointer to next AsyncStatus in the list
88 struct AsyncStatus *Prev; // pointer to previous AsyncStatus in the list
89} AsyncStatus;
90
91
92
93
94
95
96/*
97 * Select uses arrays of SOCKETs. These macros manipulate such
98 * arrays. FD_SETSIZE may be defined by the user before including
99 * this file, but the default here should be >= 64.
100 *
101 * CAVEAT IMPLEMENTOR and USER: THESE MACROS AND TYPES MUST BE
102 * INCLUDED IN WINSOCK.H EXACTLY AS SHOWN HERE.
103 */
104#ifndef FD_SETSIZE
105#define FD_SETSIZE 64
106#endif /* FD_SETSIZE */
107
108typedef struct Wfd_set {
109 u_int fd_count; /* how many are SET? */
110 SOCKET fd_array[FD_SETSIZE]; /* an array of SOCKETs */
111} Wfd_set;
112
113
114
115#ifdef __cplusplus
116extern "C" {
117#endif
118
119extern int PASCAL __WSAFDIsSet(SOCKET, Wfd_set *);
120
121#ifdef __cplusplus
122}
123#endif
124
125/*
126#define FD_CLR(fd, set) do { \
127 u_int __i; \
128 for (__i = 0; __i < ((Wfd_set *)(set))->fd_count ; __i++) { \
129 if (((Wfd_set *)(set))->fd_array[__i] == fd) { \
130 while (__i < ((Wfd_set *)(set))->fd_count-1) { \
131 ((Wfd_set *)(set))->fd_array[__i] = \
132 ((Wfd_set *)(set))->fd_array[__i+1]; \
133 __i++; \
134 } \
135 ((Wfd_set *)(set))->fd_count--; \
136 break; \
137 } \
138 } \
139} while(0)
140
141#define FD_SET(fd, set) do { \
142 if (((Wfd_set *)(set))->fd_count < FD_SETSIZE) \
143 ((Wfd_set *)(set))->fd_array[((Wfd_set *)(set))->fd_count++]=(fd);\
144} while(0)
145
146#define FD_ZERO(set) (((Wfd_set *)(set))->fd_count=0)
147
148#define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (Wfd_set *)(set))
149*/
150
151/*
152 * Structure used in select() call, taken from the BSD file sys/time.h.
153 */
154struct Wtimeval {
155 long tv_sec; /* seconds */
156 long tv_usec; /* and microseconds */
157};
158
159/*
160 * Operations on timevals.
161 *
162 * NB: timercmp does not work for >= or <=.
163 */
164#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
165#define Wtimercmp(tvp, uvp, cmp) \
166 ((tvp)->tv_sec cmp (uvp)->tv_sec || \
167 (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
168#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
169
170/*
171 * Commands for ioctlsocket(), taken from the BSD file fcntl.h.
172 *
173 *
174 * Ioctl's have the command encoded in the lower word,
175 * and the size of any in or out parameters in the upper
176 * word. The high 2 bits of the upper word are used
177 * to encode the in/out status of the parameter; for now
178 * we restrict parameters to at most 128 bytes.
179 */
180#define IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */
181#define IOC_VOID 0x20000000 /* no parameters */
182#define IOC_OUT 0x40000000 /* copy out parameters */
183#define IOC_IN 0x80000000 /* copy in parameters */
184#define IOC_INOUT (IOC_IN|IOC_OUT)
185 /* 0x20000000 distinguishes new &
186 old ioctl's */
187#define _IO(x,y) (IOC_VOID|((x)<<8)|(y))
188
189#define _IOR(x,y,t) (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
190
191#define _IOW(x,y,t) (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
192
193#define WFIONREAD _IOR('f', 127, u_long) /* get # bytes to read */
194#define WFIONBIO _IOW('f', 126, u_long) /* set/clear non-blocking i/o */
195#define WFIOASYNC _IOW('f', 125, u_long) /* set/clear async i/o */
196
197/* Socket I/O Controls */
198#define WSIOCSHIWAT _IOW('s', 0, u_long) /* set high watermark */
199#define WSIOCGHIWAT _IOR('s', 1, u_long) /* get high watermark */
200#define WSIOCSLOWAT _IOW('s', 2, u_long) /* set low watermark */
201#define WSIOCGLOWAT _IOR('s', 3, u_long) /* get low watermark */
202#define WSIOCATMARK _IOR('s', 7, u_long) /* at oob mark? */
203
204/*
205 * Structures returned by network data base library, taken from the
206 * BSD file netdb.h. All addresses are supplied in host order, and
207 * returned in network order (suitable for use in system calls).
208 */
209
210struct Whostent {
211 char * h_name; /* official name of host */
212 char * * h_aliases; /* alias list */
213 short h_addrtype; /* host address type */
214 short h_length; /* length of address */
215 char * * h_addr_list; /* list of addresses */
216#define h_addr h_addr_list[0] /* address, for backward compat */
217};
218
219/*
220 * It is assumed here that a network number
221 * fits in 32 bits.
222 */
223struct Wnetent {
224 char * n_name; /* official name of net */
225 char * * n_aliases; /* alias list */
226 short n_addrtype; /* net address type */
227 u_long n_net; /* network # */
228};
229
230struct Wservent {
231 char * s_name; /* official service name */
232 char * * s_aliases; /* alias list */
233 short s_port; /* port # */
234 char * s_proto; /* protocol to use */
235};
236
237struct Wprotoent {
238 char * p_name; /* official protocol name */
239 char * * p_aliases; /* alias list */
240 short p_proto; /* protocol # */
241};
242
243/*
244 * Constants and structures defined by the internet system,
245 * Per RFC 790, September 1981, taken from the BSD file netinet/in.h.
246 */
247
248/*
249 * Protocols
250 */
251#define IPPROTO_IP 0 /* dummy for IP */
252#define IPPROTO_ICMP 1 /* control message protocol */
253//#define IPPROTO_GGP 2 /* gateway^2 (deprecated) */
254#define IPPROTO_TCP 6 /* tcp */
255#define IPPROTO_PUP 12 /* pup */
256#define IPPROTO_UDP 17 /* user datagram protocol */
257#define IPPROTO_IDP 22 /* xns idp */
258#define IPPROTO_ND 77 /* UNOFFICIAL net disk proto */
259
260#define IPPROTO_RAW 255 /* raw IP packet */
261#define IPPROTO_MAX 256
262
263/*
264 * Port/socket numbers: network standard functions
265 */
266#define IPPORT_ECHO 7
267#define IPPORT_DISCARD 9
268#define IPPORT_SYSTAT 11
269#define IPPORT_DAYTIME 13
270#define IPPORT_NETSTAT 15
271#define IPPORT_FTP 21
272#define IPPORT_TELNET 23
273#define IPPORT_SMTP 25
274#define IPPORT_TIMESERVER 37
275#define IPPORT_NAMESERVER 42
276#define IPPORT_WHOIS 43
277#define IPPORT_MTP 57
278
279/*
280 * Port/socket numbers: host specific functions
281 */
282#define IPPORT_TFTP 69
283#define IPPORT_RJE 77
284#define IPPORT_FINGER 79
285#define IPPORT_TTYLINK 87
286#define IPPORT_SUPDUP 95
287
288/*
289 * UNIX TCP sockets
290 */
291#define IPPORT_EXECSERVER 512
292#define IPPORT_LOGINSERVER 513
293#define IPPORT_CMDSERVER 514
294#define IPPORT_EFSSERVER 520
295
296/*
297 * UNIX UDP sockets
298 */
299#define IPPORT_BIFFUDP 512
300#define IPPORT_WHOSERVER 513
301#define IPPORT_ROUTESERVER 520
302 /* 520+1 also used */
303
304/*
305 * Ports < IPPORT_RESERVED are reserved for
306 * privileged processes (e.g. root).
307 */
308#define IPPORT_RESERVED 1024
309
310/*
311 * Link numbers
312 */
313#define IMPLINK_IP 155
314#define IMPLINK_LOWEXPER 156
315#define IMPLINK_HIGHEXPER 158
316
317/*
318 * Internet address (old style... should be updated)
319 */
320struct Win_addr {
321 union {
322 struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
323 struct { u_short s_w1,s_w2; } S_un_w;
324 u_long S_addr;
325 } S_un;
326#define s_addr S_un.S_addr
327 /* can be used for most tcp & ip code */
328#define s_host S_un.S_un_b.s_b2
329 /* host on imp */
330#define s_net S_un.S_un_b.s_b1
331 /* network */
332#define s_imp S_un.S_un_w.s_w2
333 /* imp */
334#define s_impno S_un.S_un_b.s_b4
335 /* imp # */
336#define s_lh S_un.S_un_b.s_b3
337 /* logical host */
338};
339
340/*
341 * Definitions of bits in internet address integers.
342 * On subnets, the decomposition of addresses to host and net parts
343 * is done according to subnet mask, not the masks here.
344 */
345#define WIN_CLASSA(i) (((long)(i) & 0x80000000) == 0)
346#define WIN_CLASSA_NET 0xff000000
347#define WIN_CLASSA_NSHIFT 24
348#define WIN_CLASSA_HOST 0x00ffffff
349#define WIN_CLASSA_MAX 128
350
351#define WIN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000)
352#define WIN_CLASSB_NET 0xffff0000
353#define WIN_CLASSB_NSHIFT 16
354#define WIN_CLASSB_HOST 0x0000ffff
355#define WIN_CLASSB_MAX 65536
356
357#define WIN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000)
358#define WIN_CLASSC_NET 0xffffff00
359#define WIN_CLASSC_NSHIFT 8
360#define WIN_CLASSC_HOST 0x000000ff
361
362#define WINADDR_ANY (u_long)0x00000000
363#define WINADDR_LOOPBACK 0x7f000001
364#define WINADDR_BROADCAST (u_long)0xffffffff
365#define WINADDR_NONE 0xffffffff
366
367/*
368 * Socket address, internet style.
369 */
370struct Wsockaddr_in {
371 short sin_family;
372 u_short sin_port;
373 struct in_addr sin_addr;
374 char sin_zero[8];
375};
376
377#define WSADESCRIPTION_LEN 256
378#define WSASYS_STATUS_LEN 128
379
380typedef struct WSAData {
381 WORD wVersion;
382 WORD wHighVersion;
383 char szDescription[WSADESCRIPTION_LEN+1];
384 char szSystemStatus[WSASYS_STATUS_LEN+1];
385 unsigned short iMaxSockets;
386 unsigned short iMaxUdpDg;
387 char * lpVendorInfo;
388} WSADATA;
389
390typedef WSADATA *LPWSADATA;
391
392/*
393 * Options for use with [gs]etsockopt at the IP level.
394 */
395#define IP_OPTIONS 1 /* set/get IP per-packet options */
396
397/*
398 * Definitions related to sockets: types, address families, options,
399 * taken from the BSD file sys/socket.h.
400 */
401
402
403/*
404 * Types
405 */
406#define SOCK_STREAM 1 /* stream socket */
407#define SOCK_DGRAM 2 /* datagram socket */
408#define SOCK_RAW 3 /* raw-protocol interface */
409#define SOCK_RDM 4 /* reliably-delivered message */
410#define SOCK_SEQPACKET 5 /* sequenced packet stream */
411
412/*
413 * Option flags per-socket.
414 */
415#define SO_DEBUG 0x0001 /* turn on debugging info recording */
416#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */
417#define SO_REUSEADDR 0x0004 /* allow local address reuse */
418#define SO_KEEPALIVE 0x0008 /* keep connections alive */
419#define SO_DONTROUTE 0x0010 /* just use interface addresses */
420#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */
421#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */
422#define SO_LINGER 0x0080 /* linger on close if data present */
423#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */
424
425#define SO_DONTLINGER (u_int)(~SO_LINGER)
426
427/*
428 * Additional options.
429 */
430#define SO_SNDBUF 0x1001 /* send buffer size */
431#define SO_RCVBUF 0x1002 /* receive buffer size */
432#define SO_SNDLOWAT 0x1003 /* send low-water mark */
433#define SO_RCVLOWAT 0x1004 /* receive low-water mark */
434#define SO_SNDTIMEO 0x1005 /* send timeout */
435#define SO_RCVTIMEO 0x1006 /* receive timeout */
436#define SO_ERROR 0x1007 /* get error status and clear */
437#define SO_TYPE 0x1008 /* get socket type */
438
439
440/*
441 * TCP options.
442 */
443#define TCP_NODELAY 0x0001
444#define TCP_BSDURGENT 0x7000
445
446/*
447 * Address families.
448 */
449#define AF_UNSPEC 0 /* unspecified */
450#define AF_UNIX 1 /* local to host (pipes, portals) */
451#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
452#define AF_IMPLINK 3 /* arpanet imp addresses */
453#define AF_PUP 4 /* pup protocols: e.g. BSP */
454#define AF_CHAOS 5 /* mit CHAOS protocols */
455#define AF_IPX 6 /* IPX and SPX */
456#define AF_NS 6 /* XEROX NS protocols */
457#define AF_ISO 7 /* ISO protocols */
458#define AF_OSI AF_ISO /* OSI is ISO */
459#define AF_ECMA 8 /* european computer manufacturers */
460#define AF_DATAKIT 9 /* datakit protocols */
461#define AF_CCITT 10 /* CCITT protocols, X.25 etc */
462#define AF_SNA 11 /* IBM SNA */
463#define AF_DECnet 12 /* DECnet */
464#define AF_DLI 13 /* Direct data link interface */
465#define AF_LAT 14 /* LAT */
466#define AF_HYLINK 15 /* NSC Hyperchannel */
467#define AF_APPLETALK 16 /* AppleTalk */
468//#define AF_NETBIOS 17 /* NetBios-style addresses */
469#define AF_VOICEVIEW 18 /* VoiceView */
470
471//#define AF_MAX 19
472
473/*
474 * Structure used by kernel to store most
475 * addresses.
476 */
477struct Wsockaddr {
478 u_short sa_family; /* address family */
479 char sa_data[14]; /* up to 14 bytes of direct address */
480};
481
482/*
483 * Structure used by kernel to pass protocol
484 * information in raw sockets.
485 */
486struct Wsockproto {
487 u_short sp_family; /* address family */
488 u_short sp_protocol; /* protocol */
489};
490
491/*
492 * Protocol families, same as address families for now.
493 */
494#define PF_UNSPEC AF_UNSPEC
495#define PF_UNIX AF_UNIX
496#define PF_INET AF_INET
497#define PF_IMPLINK AF_IMPLINK
498#define PF_PUP AF_PUP
499#define PF_CHAOS AF_CHAOS
500#define PF_NS AF_NS
501#define PF_IPX AF_IPX
502#define PF_ISO AF_ISO
503#define PF_OSI AF_OSI
504#define PF_ECMA AF_ECMA
505#define PF_DATAKIT AF_DATAKIT
506#define PF_CCITT AF_CCITT
507#define PF_SNA AF_SNA
508#define PF_DECnet AF_DECnet
509#define PF_DLI AF_DLI
510#define PF_LAT AF_LAT
511#define PF_HYLINK AF_HYLINK
512#define PF_APPLETALK AF_APPLETALK
513#define PF_VOICEVIEW AF_VOICEVIEW
514
515#define PF_MAX AF_MAX
516
517/*
518 * Structure used for manipulating linger option.
519 */
520struct Wlinger {
521 u_short l_onoff; /* option on/off */
522 u_short l_linger; /* linger time */
523};
524
525/*
526 * Level number for (get/set)sockopt() to apply to socket itself.
527 */
528#define SOL_SOCKET 0xffff /* options for socket level */
529
530/*
531 * Maximum queue length specifiable by listen.
532 */
533#define SOMAXCONN 5
534
535#define MSG_OOB 0x1 /* process out-of-band data */
536#define MSG_PEEK 0x2 /* peek at incoming message */
537#define MSG_DONTROUTE 0x4 /* send without using routing tables */
538
539#define MSG_MAXIOVLEN 16
540
541#define MSG_PARTIAL 0x8000 /* partial send or recv for message xport */
542
543/*
544 * Define constant based on rfc883, used by gethostbyxxxx() calls.
545 */
546#define MAXGETHOSTSTRUCT 1024
547
548/*
549 * Define flags to be used with the WSAAsyncSelect() call.
550 */
551#define FD_READ 0x01
552#define FD_WRITE 0x02
553#define FD_OOB 0x04
554#define FD_ACCEPT 0x08
555#define FD_CONNECT 0x10
556#define FD_CLOSE 0x20
557
558
559/* Socket function prototypes */
560
561#ifdef __cplusplus
562extern "C" {
563#endif
564
565SOCKET WIN32API OS2accept (SOCKET s, struct sockaddr *addr, int *addrlen);
566int WIN32API OS2bind (SOCKET s, const struct sockaddr *addr, int namelen);
567int WIN32API OS2closesocket (SOCKET s);
568int WIN32API OS2connect (SOCKET s, const struct sockaddr *name, int namelen);
569int WIN32API OS2ioctlsocket (SOCKET s, long cmd, u_long *argp);
570int WIN32API OS2getpeername (SOCKET s, struct sockaddr *name, int * namelen);
571int WIN32API OS2getsockname (SOCKET s, struct sockaddr *name, int * namelen);
572int WIN32API OS2getsockopt (SOCKET s, int level, int optname, char * optval, int *optlen);
573u_long WIN32API OS2htonl (u_long hostlong);
574u_short WIN32API OS2htons (u_short hostshort);
575u_long WIN32API OS2inet_addr (const char * cp);
576char * WIN32API OS2inet_ntoa (struct in_addr in);
577int WIN32API OS2listen (SOCKET s, int backlog);
578u_long WIN32API OS2ntohl (u_long netlong);
579u_short WIN32API OS2ntohs (u_short netshort);
580int WIN32API OS2recv (SOCKET s, char * buf, int len, int flags);
581int WIN32API OS2recvfrom (SOCKET s, char * buf, int len, int flags, struct sockaddr *from, int * fromlen);
582int WIN32API OS2select (int nfds, Wfd_set *readfds, Wfd_set *writefds, Wfd_set *exceptfds, const struct Wtimeval *timeout);
583int WIN32API OS2send (SOCKET s, const char * buf, int len, int flags);
584int WIN32API OS2sendto (SOCKET s, const char * buf, int len, int flags, const struct sockaddr *to, int tolen);
585int WIN32API OS2setsockopt (SOCKET s, int level, int optname, const char * optval, int optlen);
586int WIN32API OS2shutdown (SOCKET s, int how);
587SOCKET WIN32API OS2socket (int af, int type, int protocol);
588
589/* Database function prototypes */
590struct Whostent * WIN32API OS2gethostbyaddr(const char * addr, int len, int type);
591struct Whostent * WIN32API OS2gethostbyname(const char * name);
592int WIN32API OS2gethostname (char * name, int namelen);
593struct Wservent * WIN32API OS2getservbyport(int port, const char * proto);
594struct Wservent * WIN32API OS2getservbyname(const char * name, const char * proto);
595struct Wprotoent * WIN32API OS2getprotobynumber(int proto);
596struct Wprotoent * WIN32API OS2getprotobyname(const char * name);
597
598/* Microsoft Windows Extension function prototypes */
599int WIN32API OS2WSAStartup(WORD wVersionRequired, LPWSADATA lpWSAData);
600int WIN32API OS2WSACleanup(void);
601void WIN32API OS2WSASetLastError(int iError);
602int WIN32API OS2WSAGetLastError(void);
603BOOL WIN32API OS2WSAIsBlocking(void);
604int WIN32API OS2WSAUnhookBlockingHook(void);
605PROC WIN32API OS2WSASetBlockingHook(PROC lpBlockFunc);
606int WIN32API OS2WSACancelBlockingCall(void);
607HANDLE WIN32API OS2WSAAsyncGetServByName(HWND hWnd, u_int wMsg, const char * name, const char * proto, char * buf, int buflen);
608HANDLE WIN32API OS2WSAAsyncGetServByPort(HWND hWnd, u_int wMsg, int port, const char * proto, char * buf, int buflen);
609HANDLE WIN32API OS2WSAAsyncGetProtoByName(HWND hWnd, u_int wMsg, const char * name, char * buf, int buflen);
610HANDLE WIN32API OS2WSAAsyncGetProtoByNumber(HWND hWnd, u_int wMsg, int number, char * buf, int buflen);
611HANDLE WIN32API OS2WSAAsyncGetHostByName(HWND hWnd, u_int wMsg, const char * name, char * buf, int buflen);
612HANDLE WIN32API OS2WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg, const char * addr, int len, int type, char * buf, int buflen);
613int WIN32API OS2WSACancelAsyncRequest(HANDLE hAsyncTaskHandle);
614int WIN32API OS2WSAAsyncSelect(SOCKET s, HWND hWnd, u_int wMsg, long lEvent);
615int WIN32API OS2WSARecvEx (SOCKET s, char * buf, int len, int *flags);
616
617
618
619typedef struct _TRANSMIT_FILE_BUFFERS {
620 PVOID Head;
621 DWORD HeadLength;
622 PVOID Tail;
623 DWORD TailLength;
624} TRANSMIT_FILE_BUFFERS, *PTRANSMIT_FILE_BUFFERS, *LPTRANSMIT_FILE_BUFFERS;
625
626typedef struct _OVERLAPPED {
627 DWORD Internal;
628 DWORD InternalHigh;
629 DWORD Offset;
630 DWORD OffsetHigh;
631 HANDLE hEvent;
632} OVERLAPPED, *LPOVERLAPPED;
633
634
635BOOL WIN32API OS2TransmitFile (SOCKET hSocket,
636 HANDLE hFile,
637 DWORD nNumberOfBytesToWrite,
638 DWORD nNumberOfBytesPerSend,
639 LPOVERLAPPED lpOverlapped,
640 LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers,
641 DWORD dwReserved);
642
643#ifdef __cplusplus
644}
645#endif
646
647typedef struct sockaddr SOCKADDR;
648typedef struct sockaddr *PSOCKADDR;
649typedef struct sockaddr *LPSOCKADDR;
650
651typedef struct sockaddr_in SOCKADDR_IN;
652typedef struct sockaddr_in *PSOCKADDR_IN;
653typedef struct sockaddr_in *LPSOCKADDR_IN;
654
655typedef struct linger LINGER;
656typedef struct linger *PLINGER;
657typedef struct linger *LPLINGER;
658
659typedef struct in_addr IN_ADDR;
660typedef struct in_addr *PIN_ADDR;
661typedef struct in_addr *LPIN_ADDR;
662
663typedef struct Wfd_set WFD_SET;
664typedef struct Wfd_set *PWFD_SET;
665typedef struct Wfd_set *LPWFD_SET;
666
667typedef struct Whostent WHOSTENT;
668typedef struct Whostent *PWHOSTENT;
669typedef struct Whostent *LPWHOSTENT;
670
671typedef struct Wservent WSERVENT;
672typedef struct Wservent *PWSERVENT;
673typedef struct Wservent *LPWSERVENT;
674
675typedef struct Wprotoent WPROTOENT;
676typedef struct Wprotoent *PWPROTOENT;
677typedef struct Wprotoent *LPWPROTOENT;
678
679typedef struct Wtimeval WTIMEVAL;
680typedef struct Wtimeval *PWTIMEVAL;
681typedef struct Wtimeval *LPWTIMEVAL;
682
683/*
684 * Windows message parameter composition and decomposition
685 * macros.
686 *
687 * WSAMAKEASYNCREPLY is intended for use by the Windows Sockets implementation
688 * when constructing the response to a WSAAsyncGetXByY() routine.
689 */
690#define OS2WSAMAKEASYNCREPLY(buflen,error) MAKELONG(buflen,error)
691/*
692 * WSAMAKESELECTREPLY is intended for use by the Windows Sockets implementation
693 * when constructing the response to WSAAsyncSelect().
694 */
695#define OS2WSAMAKESELECTREPLY(event,error) MAKELONG(event,error)
696/*
697 * WSAGETASYNCBUFLEN is intended for use by the Windows Sockets application
698 * to extract the buffer length from the lParam in the response
699 * to a WSAGetXByY().
700 */
701#define OS2WSAGETASYNCBUFLEN(lParam) LOWORD(lParam)
702/*
703 * WSAGETASYNCERROR is intended for use by the Windows Sockets application
704 * to extract the error code from the lParam in the response
705 * to a WSAGetXByY().
706 */
707#define OS2WSAGETASYNCERROR(lParam) HIWORD(lParam)
708/*
709 * WSAGETSELECTEVENT is intended for use by the Windows Sockets application
710 * to extract the event code from the lParam in the response
711 * to a WSAAsyncSelect().
712 */
713#define OS2WSAGETSELECTEVENT(lParam) LOWORD(lParam)
714/*
715 * WSAGETSELECTERROR is intended for use by the Windows Sockets application
716 * to extract the error code from the lParam in the response
717 * to a WSAAsyncSelect().
718 */
719#define OS2WSAGETSELECTERROR(lParam) HIWORD(lParam)
720
721#endif /* _WINSOCKAPI_ */
722
723
Note: See TracBrowser for help on using the repository browser.