- fix _EXTPUSH (DUMMYUNIONNAME was used twice, like in the broken ms headers)
[reactos.git] / include / psdk / winsock.h
1 /*
2 Definitions for winsock 1.1
3
4 Portions Copyright (c) 1980, 1983, 1988, 1993
5 The Regents of the University of California. All rights reserved.
6
7 Portions Copyright (c) 1993 by Digital Equipment Corporation.
8 */
9
10 #pragma once
11
12 #define _WINSOCKAPI_
13
14 #ifndef _INC_WINDOWS
15 #include <windows.h>
16 #endif
17
18 #ifndef _M_AMD64
19 #if !defined(__ROS_LONG64__)
20 #ifdef __WINESRC__
21 #define __ROS_LONG64__
22 #endif
23 #endif
24 #endif
25
26 #define _GNU_H_WINDOWS32_SOCKETS
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 #if !defined ( _BSDTYPES_DEFINED )
33
34 /* also defined in gmon.h and in cygwin's sys/types */
35 typedef unsigned char u_char;
36 typedef unsigned short u_short;
37 typedef unsigned int u_int;
38
39 #ifndef __ROS_LONG64__
40 typedef unsigned long u_long;
41 #else
42 typedef unsigned int u_long;
43 #endif
44
45 #define _BSDTYPES_DEFINED
46
47 #endif /* !defined ( _BSDTYPES_DEFINED ) */
48
49 typedef UINT_PTR SOCKET;
50
51 #ifndef FD_SETSIZE
52 #define FD_SETSIZE 64
53 #endif
54
55 /* shutdown() how types */
56 #define SD_RECEIVE 0x00
57 #define SD_SEND 0x01
58 #define SD_BOTH 0x02
59
60 #ifndef _SYS_TYPES_FD_SET
61
62 /* fd_set may have be defined by the newlib <sys/types.h>
63 * if __USE_W32_SOCKETS not defined.
64 */
65 #ifdef fd_set
66 #undef fd_set
67 #endif
68 typedef struct fd_set {
69 u_int fd_count;
70 SOCKET fd_array[FD_SETSIZE];
71 } fd_set;
72
73 extern int PASCAL __WSAFDIsSet(SOCKET,fd_set FAR*);
74
75 #ifndef FD_CLR
76 #define FD_CLR(fd,set) do { u_int __i;\
77 for (__i = 0; __i < ((fd_set FAR*)(set))->fd_count ; __i++) {\
78 if (((fd_set FAR*)(set))->fd_array[__i] == (fd)) {\
79 while (__i < ((fd_set FAR*)(set))->fd_count-1) {\
80 ((fd_set FAR*)(set))->fd_array[__i] = ((fd_set FAR*)(set))->fd_array[__i+1];\
81 __i++;\
82 }\
83 ((fd_set FAR*)(set))->fd_count--;\
84 break;\
85 }\
86 }\
87 } while (0)
88 #endif /* FD_CLR */
89
90 #ifndef FD_SET
91 #define FD_SET(fd, set) do { \
92 if (((fd_set FAR*)(set))->fd_count < FD_SETSIZE) \
93 ((fd_set FAR*)(set))->fd_array[((fd_set FAR*)(set))->fd_count++]=(fd);\
94 }while (0)
95 #endif
96
97 #ifndef FD_ZERO
98 #define FD_ZERO(set) (((fd_set FAR*)(set))->fd_count=0)
99 #endif
100
101 #ifndef FD_ISSET
102 #define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (fd_set FAR*)(set))
103 #endif
104
105
106
107 #elif !defined(USE_SYS_TYPES_FD_SET)
108 #warning "fd_set and associated macros have been defined in sys/types. \
109 This can cause runtime problems with W32 sockets"
110 #endif /* ndef _SYS_TYPES_FD_SET */
111
112 #if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__))
113
114 #ifndef _TIMEVAL_DEFINED /* also in sys/time.h */
115 #define _TIMEVAL_DEFINED
116
117 struct timeval {
118 LONG tv_sec;
119 LONG tv_usec;
120 };
121
122 #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
123
124 #define timercmp(tvp, uvp, cmp) \
125 (((tvp)->tv_sec != (uvp)->tv_sec) ? \
126 ((tvp)->tv_sec cmp (uvp)->tv_sec) : \
127 ((tvp)->tv_usec cmp (uvp)->tv_usec))
128
129 #define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
130
131 #endif /* _TIMEVAL_DEFINED */
132
133 #define h_addr h_addr_list[0]
134
135 struct hostent {
136 char *h_name;
137 char **h_aliases;
138 short h_addrtype;
139 short h_length;
140 char **h_addr_list;
141 };
142
143 struct linger {
144 u_short l_onoff;
145 u_short l_linger;
146 };
147
148 #define _IO(x,y) (IOC_VOID|((x)<<8)|(y))
149 #define _IOR(x,y,t) (IOC_OUT|(((LONG)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
150 #define _IOW(x,y,t) (IOC_IN|(((LONG)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
151 #define FIONBIO _IOW('f', 126, u_long)
152
153 struct netent {
154 char * n_name;
155 char **n_aliases;
156 short n_addrtype;
157 u_long n_net;
158 };
159
160 struct servent {
161 char *s_name;
162 char **s_aliases;
163 #ifdef _WIN64
164 char *s_proto;
165 short s_port;
166 #else
167 short s_port;
168 char *s_proto;
169 };
170
171 struct protoent {
172 char *p_name;
173 char **p_aliases;
174 short p_proto;
175 };
176
177 #define IP_OPTIONS 1
178
179 #define SO_DEBUG 1
180 #define SO_ACCEPTCONN 2
181 #define SO_REUSEADDR 4
182 #define SO_KEEPALIVE 8
183 #define SO_DONTROUTE 16
184 #define SO_BROADCAST 32
185 #define SO_USELOOPBACK 64
186 #define SO_LINGER 128
187 #define SO_OOBINLINE 256
188 #define SO_DONTLINGER (u_int)(~SO_LINGER)
189 #define SO_SNDBUF 0x1001
190 #define SO_RCVBUF 0x1002
191 #define SO_SNDLOWAT 0x1003
192 #define SO_RCVLOWAT 0x1004
193 #define SO_SNDTIMEO 0x1005
194 #define SO_RCVTIMEO 0x1006
195 #define SO_ERROR 0x1007
196 #define SO_TYPE 0x1008
197
198 #define SO_CONNDATA 0x7000
199 #define SO_CONNOPT 0x7001
200 #define SO_DISCDATA 0x7002
201 #define SO_DISCOPT 0x7003
202 #define SO_CONNDATALEN 0x7004
203 #define SO_CONNOPTLEN 0x7005
204 #define SO_DISCDATALEN 0x7006
205 #define SO_DISCOPTLEN 0x7007
206 #define SO_OPENTYPE 0x7008
207 #define SO_MAXDG 0x7009
208 #define SO_MAXPATHDG 0x700A
209 #define SO_UPDATE_ACCEPT_CONTEXT 0x700B
210 #define SO_CONNECT_TIME 0x700C
211
212 #define SO_SYNCHRONOUS_ALERT 0x10
213 #define SO_SYNCHRONOUS_NONALERT 0x20
214
215 #define AF_MAX 24
216
217 struct sockaddr {
218 u_short sa_family;
219 char sa_data[14];
220 };
221
222 #define MSG_OOB 1
223 #define MSG_PEEK 2
224 #define MSG_DONTROUTE 4
225
226 #define h_errno WSAGetLastError()
227 #define HOST_NOT_FOUND WSAHOST_NOT_FOUND
228 #define TRY_AGAIN WSATRY_AGAIN
229 #define NO_RECOVERY WSANO_RECOVERY
230 #define NO_DATA WSANO_DATA
231 #define NO_ADDRES WSANO_ADDRESS
232
233 u_long PASCAL htonl(u_long);
234 u_long PASCAL ntohl(u_long);
235 u_short PASCAL htons(u_short);
236 u_short PASCAL ntohs(u_short);
237 int PASCAL select(int nfds,fd_set*,fd_set*,fd_set*,const struct timeval*);
238 int PASCAL gethostname(char*,int);
239
240 #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */
241
242 #define IOCPARM_MASK 0x7f
243 #define IOC_VOID 0x20000000
244 #define IOC_OUT 0x40000000
245 #define IOC_IN 0x80000000
246 #define IOC_INOUT (IOC_IN|IOC_OUT)
247
248 #define FIONREAD _IOR('f', 127, u_long)
249 #define FIOASYNC _IOW('f', 125, u_long)
250 #define SIOCSHIWAT _IOW('s', 0, u_long)
251 #define SIOCGHIWAT _IOR('s', 1, u_long)
252 #define SIOCSLOWAT _IOW('s', 2, u_long)
253 #define SIOCGLOWAT _IOR('s', 3, u_long)
254 #define SIOCATMARK _IOR('s', 7, u_long)
255
256 #define IPPROTO_IP 0
257 #define IPPROTO_ICMP 1
258 #define IPPROTO_IGMP 2
259 #define IPPROTO_GGP 3
260 #define IPPROTO_TCP 6
261 #define IPPROTO_PUP 12
262 #define IPPROTO_UDP 17
263 #define IPPROTO_IDP 22
264 #define IPPROTO_ND 77
265 #define IPPROTO_RAW 255
266 #define IPPROTO_MAX 256
267 #define IPPORT_ECHO 7
268 #define IPPORT_DISCARD 9
269 #define IPPORT_SYSTAT 11
270 #define IPPORT_DAYTIME 13
271 #define IPPORT_NETSTAT 15
272 #define IPPORT_FTP 21
273 #define IPPORT_TELNET 23
274 #define IPPORT_SMTP 25
275 #define IPPORT_TIMESERVER 37
276 #define IPPORT_NAMESERVER 42
277 #define IPPORT_WHOIS 43
278 #define IPPORT_MTP 57
279 #define IPPORT_TFTP 69
280 #define IPPORT_RJE 77
281 #define IPPORT_FINGER 79
282 #define IPPORT_TTYLINK 87
283 #define IPPORT_SUPDUP 95
284 #define IPPORT_EXECSERVER 512
285 #define IPPORT_LOGINSERVER 513
286 #define IPPORT_CMDSERVER 514
287 #define IPPORT_EFSSERVER 520
288 #define IPPORT_BIFFUDP 512
289 #define IPPORT_WHOSERVER 513
290 #define IPPORT_ROUTESERVER 520
291 #define IPPORT_RESERVED 1024
292 #define IMPLINK_IP 155
293 #define IMPLINK_LOWEXPER 156
294 #define IMPLINK_HIGHEXPER 158
295
296 #include <inaddr.h>
297
298 #define IN_CLASSA(i) ((LONG)(i)&0x80000000)
299 #define IN_CLASSA_NET 0xff000000
300 #define IN_CLASSA_NSHIFT 24
301 #define IN_CLASSA_HOST 0x00ffffff
302 #define IN_CLASSA_MAX 128
303 #define IN_CLASSB(i) (((LONG)(i)&0xc0000000)==0x80000000)
304 #define IN_CLASSB_NET 0xffff0000
305 #define IN_CLASSB_NSHIFT 16
306 #define IN_CLASSB_HOST 0x0000ffff
307 #define IN_CLASSB_MAX 65536
308 #define IN_CLASSC(i) (((LONG)(i)&0xe0000000)==0xc0000000)
309 #define IN_CLASSC_NET 0xffffff00
310 #define IN_CLASSC_NSHIFT 8
311 #define IN_CLASSC_HOST 0xff
312 #define INADDR_ANY (u_long)0
313 #define INADDR_LOOPBACK 0x7f000001
314 #define INADDR_BROADCAST (u_long)0xffffffff
315 #define INADDR_NONE 0xffffffff
316
317 #define WSADESCRIPTION_LEN 256
318 #define WSASYS_STATUS_LEN 128
319
320 #define IP_MULTICAST_IF 2
321 #define IP_MULTICAST_TTL 3
322 #define IP_MULTICAST_LOOP 4
323 #define IP_ADD_MEMBERSHIP 5
324 #define IP_DROP_MEMBERSHIP 6
325 #define IP_TTL 7
326 #define IP_TOS 8
327 #define IP_DONTFRAGMENT 9
328
329 #define IP_DEFAULT_MULTICAST_TTL 1
330 #define IP_DEFAULT_MULTICAST_LOOP 1
331 #define IP_MAX_MEMBERSHIPS 20
332
333 #define INVALID_SOCKET (SOCKET)(~0)
334 #define SOCKET_ERROR (-1)
335
336 #define SOCK_STREAM 1
337 #define SOCK_DGRAM 2
338 #define SOCK_RAW 3
339 #define SOCK_RDM 4
340 #define SOCK_SEQPACKET 5
341
342 #define TCP_NODELAY 0x0001
343 #define TCP_BSDURGENT 0x7000
344
345 #define AF_UNSPEC 0
346 #define AF_UNIX 1
347 #define AF_INET 2
348 #define AF_IMPLINK 3
349 #define AF_PUP 4
350 #define AF_CHAOS 5
351 #define AF_IPX 6
352 #define AF_NS 6
353 #define AF_ISO 7
354 #define AF_OSI AF_ISO
355 #define AF_ECMA 8
356 #define AF_DATAKIT 9
357 #define AF_CCITT 10
358 #define AF_SNA 11
359 #define AF_DECnet 12
360 #define AF_DLI 13
361 #define AF_LAT 14
362 #define AF_HYLINK 15
363 #define AF_APPLETALK 16
364 #define AF_NETBIOS 17
365 #define AF_VOICEVIEW 18
366 #define AF_FIREFOX 19
367 #define AF_UNKNOWN1 20
368 #define AF_BAN 21
369 #define AF_ATM 22
370 #define AF_INET6 23
371
372 #define PF_UNSPEC AF_UNSPEC
373 #define PF_UNIX AF_UNIX
374 #define PF_INET AF_INET
375 #define PF_IMPLINK AF_IMPLINK
376 #define PF_PUP AF_PUP
377 #define PF_CHAOS AF_CHAOS
378 #define PF_NS AF_NS
379 #define PF_IPX AF_IPX
380 #define PF_ISO AF_ISO
381 #define PF_OSI AF_OSI
382 #define PF_ECMA AF_ECMA
383 #define PF_DATAKIT AF_DATAKIT
384 #define PF_CCITT AF_CCITT
385 #define PF_SNA AF_SNA
386 #define PF_DECnet AF_DECnet
387 #define PF_DLI AF_DLI
388 #define PF_LAT AF_LAT
389 #define PF_HYLINK AF_HYLINK
390 #define PF_APPLETALK AF_APPLETALK
391 #define PF_VOICEVIEW AF_VOICEVIEW
392 #define PF_FIREFOX AF_FIREFOX
393 #define PF_UNKNOWN1 AF_UNKNOWN1
394 #define PF_BAN AF_BAN
395 #define PF_ATM AF_ATM
396 #define PF_INET6 AF_INET6
397 #define PF_MAX AF_MAX
398
399 #define SOL_SOCKET 0xffff
400 #define SOMAXCONN 5
401
402 #define MSG_MAXIOVLEN 16
403 #define MSG_PARTIAL 0x8000
404 #define MAXGETHOSTSTRUCT 1024
405
406 #define FD_READ 1
407 #define FD_WRITE 2
408 #define FD_OOB 4
409 #define FD_ACCEPT 8
410 #define FD_CONNECT 16
411 #define FD_CLOSE 32
412
413 #ifndef WSABASEERR
414
415 #define WSABASEERR 10000
416 #define WSAEINTR (WSABASEERR+4)
417 #define WSAEBADF (WSABASEERR+9)
418 #define WSAEACCES (WSABASEERR+13)
419 #define WSAEFAULT (WSABASEERR+14)
420 #define WSAEINVAL (WSABASEERR+22)
421 #define WSAEMFILE (WSABASEERR+24)
422 #define WSAEWOULDBLOCK (WSABASEERR+35)
423 #define WSAEINPROGRESS (WSABASEERR+36)
424 #define WSAEALREADY (WSABASEERR+37)
425 #define WSAENOTSOCK (WSABASEERR+38)
426 #define WSAEDESTADDRREQ (WSABASEERR+39)
427 #define WSAEMSGSIZE (WSABASEERR+40)
428 #define WSAEPROTOTYPE (WSABASEERR+41)
429 #define WSAENOPROTOOPT (WSABASEERR+42)
430 #define WSAEPROTONOSUPPORT (WSABASEERR+43)
431 #define WSAESOCKTNOSUPPORT (WSABASEERR+44)
432 #define WSAEOPNOTSUPP (WSABASEERR+45)
433 #define WSAEPFNOSUPPORT (WSABASEERR+46)
434 #define WSAEAFNOSUPPORT (WSABASEERR+47)
435 #define WSAEADDRINUSE (WSABASEERR+48)
436 #define WSAEADDRNOTAVAIL (WSABASEERR+49)
437 #define WSAENETDOWN (WSABASEERR+50)
438 #define WSAENETUNREACH (WSABASEERR+51)
439 #define WSAENETRESET (WSABASEERR+52)
440 #define WSAECONNABORTED (WSABASEERR+53)
441 #define WSAECONNRESET (WSABASEERR+54)
442 #define WSAENOBUFS (WSABASEERR+55)
443 #define WSAEISCONN (WSABASEERR+56)
444 #define WSAENOTCONN (WSABASEERR+57)
445 #define WSAESHUTDOWN (WSABASEERR+58)
446 #define WSAETOOMANYREFS (WSABASEERR+59)
447 #define WSAETIMEDOUT (WSABASEERR+60)
448 #define WSAECONNREFUSED (WSABASEERR+61)
449 #define WSAELOOP (WSABASEERR+62)
450 #define WSAENAMETOOLONG (WSABASEERR+63)
451 #define WSAEHOSTDOWN (WSABASEERR+64)
452 #define WSAEHOSTUNREACH (WSABASEERR+65)
453 #define WSAENOTEMPTY (WSABASEERR+66)
454 #define WSAEPROCLIM (WSABASEERR+67)
455 #define WSAEUSERS (WSABASEERR+68)
456 #define WSAEDQUOT (WSABASEERR+69)
457 #define WSAESTALE (WSABASEERR+70)
458 #define WSAEREMOTE (WSABASEERR+71)
459 #define WSASYSNOTREADY (WSABASEERR+91)
460 #define WSAVERNOTSUPPORTED (WSABASEERR+92)
461 #define WSANOTINITIALISED (WSABASEERR+93)
462 #define WSAEDISCON (WSABASEERR+101)
463 #define WSAHOST_NOT_FOUND (WSABASEERR+1001)
464 #define WSATRY_AGAIN (WSABASEERR+1002)
465 #define WSANO_RECOVERY (WSABASEERR+1003)
466 #define WSANO_DATA (WSABASEERR+1004)
467 #define WSA_SECURE_HOST_NOT_FOUND (WSABASEERR+1032)
468 #define WSA_IPSEC_NAME_POLICY_ERROR (WSABASEERR+1033)
469
470 #endif /* !WSABASEERR */
471
472 #define WSANO_ADDRESS WSANO_DATA
473
474 #define TF_DISCONNECT 0x01
475 #define TF_REUSE_SOCKET 0x02
476 #define TF_WRITE_BEHIND 0x04
477
478 #define WSAMAKEASYNCREPLY(b,e) MAKELONG(b,e)
479 #define WSAMAKESELECTREPLY(e,error) MAKELONG(e,error)
480 #define WSAGETASYNCBUFLEN(l) LOWORD(l)
481 #define WSAGETASYNCERROR(l) HIWORD(l)
482 #define WSAGETSELECTEVENT(l) LOWORD(l)
483 #define WSAGETSELECTERROR(l) HIWORD(l)
484
485 typedef struct sockaddr SOCKADDR;
486 typedef struct sockaddr *PSOCKADDR;
487 typedef struct sockaddr *LPSOCKADDR;
488 typedef struct sockaddr_in SOCKADDR_IN;
489 typedef struct sockaddr_in *PSOCKADDR_IN;
490 typedef struct sockaddr_in *LPSOCKADDR_IN;
491 typedef struct linger LINGER;
492 typedef struct linger *PLINGER;
493 typedef struct linger *LPLINGER;
494 typedef struct in_addr IN_ADDR;
495 typedef struct in_addr *PIN_ADDR;
496 typedef struct in_addr *LPIN_ADDR;
497 typedef struct fd_set FD_SET;
498 typedef struct fd_set *PFD_SET;
499 typedef struct fd_set *LPFD_SET;
500 typedef struct hostent HOSTENT;
501 typedef struct hostent *PHOSTENT;
502 typedef struct hostent *LPHOSTENT;
503 typedef struct servent SERVENT;
504 typedef struct servent *PSERVENT;
505 typedef struct servent *LPSERVENT;
506 typedef struct protoent PROTOENT;
507 typedef struct protoent *PPROTOENT;
508 typedef struct protoent *LPPROTOENT;
509 typedef struct timeval TIMEVAL;
510 typedef struct timeval *PTIMEVAL;
511 typedef struct timeval *LPTIMEVAL;
512
513 struct sockaddr_in {
514 short sin_family;
515 u_short sin_port;
516 struct in_addr sin_addr;
517 char sin_zero[8];
518 };
519
520 typedef struct WSAData {
521 WORD wVersion;
522 WORD wHighVersion;
523 #ifdef _WIN64
524 unsigned short iMaxSockets;
525 unsigned short iMaxUdpDg;
526 char *lpVendorInfo;
527 char szDescription[WSADESCRIPTION_LEN+1];
528 char szSystemStatus[WSASYS_STATUS_LEN+1];
529 #else
530 char szDescription[WSADESCRIPTION_LEN+1];
531 char szSystemStatus[WSASYS_STATUS_LEN+1];
532 unsigned short iMaxSockets;
533 unsigned short iMaxUdpDg;
534 char *lpVendorInfo;
535 } WSADATA, FAR *LPWSADATA;
536
537 struct ip_mreq {
538 struct in_addr imr_multiaddr;
539 struct in_addr imr_interface;
540 };
541
542 struct sockproto {
543 u_short sp_family;
544 u_short sp_protocol;
545 };
546
547 SOCKET
548 PASCAL FAR
549 accept(
550 IN SOCKET s,
551 OUT struct sockaddr FAR *addr OPTIONAL,
552 IN OUT int FAR *addrlen OPTIONAL);
553
554 int
555 PASCAL FAR
556 bind(
557 IN SOCKET s,
558 IN const struct sockaddr FAR *addr,
559 IN int namelen);
560
561 int
562 PASCAL FAR
563 closesocket(
564 IN SOCKET s);
565
566 int
567 PASCAL FAR
568 connect(
569 IN SOCKET s,
570 IN const struct sockaddr FAR *name,
571 IN int namelen);
572
573 int
574 PASCAL FAR
575 ioctlsocket(
576 IN SOCKET s,
577 IN long cmd,
578 IN OUT u_long FAR *argp);
579
580 int
581 PASCAL FAR
582 getpeername(
583 IN SOCKET s,
584 OUT struct sockaddr FAR *name,
585 IN OUT int FAR *namelen);
586
587 int
588 PASCAL FAR
589 getsockname(
590 IN SOCKET s,
591 OUT struct sockaddr FAR *name,
592 IN OUT int FAR *namelen);
593
594 int
595 PASCAL FAR
596 getsockopt(
597 IN SOCKET s,
598 IN int level,
599 IN int optname,
600 OUT char FAR *optval,
601 IN OUT int FAR *optlen);
602
603 u_long
604 PASCAL FAR
605 htonl(
606 IN u_long hostlong);
607
608 u_short
609 PASCAL FAR
610 htons(
611 IN u_short hostshort);
612
613 unsigned long
614 PASCAL FAR
615 inet_addr(
616 IN const char FAR *cp);
617
618 char FAR
619 *PASCAL FAR
620 inet_ntoa(
621 IN struct in_addr in);
622
623 int
624 PASCAL FAR
625 listen(
626 IN SOCKET s,
627 IN int backlog);
628
629 u_long
630 PASCAL FAR
631 ntohl(
632 IN u_long netlong);
633
634 u_short
635 PASCAL FAR
636 ntohs(
637 IN u_short netshort);
638
639 int
640 PASCAL FAR
641 recv(
642 IN SOCKET s,
643 OUT char FAR *buf,
644 IN int len,
645 IN int flags);
646
647 int
648 PASCAL FAR
649 recvfrom(
650 IN SOCKET s,
651 OUT char FAR *buf,
652 IN int len,
653 IN int flags,
654 OUT struct sockaddr FAR *from OPTIONAL,
655 IN OUT int FAR * fromlen OPTIONAL);
656
657 int
658 PASCAL FAR
659 select(
660 IN int nfds,
661 IN OUT fd_set FAR *readfds OPTIONAL,
662 IN OUT fd_set FAR *writefds OPTIONAL,
663 IN OUT fd_set FAR *exceptfds OPTIONAL,
664 IN const struct timeval FAR *timeout OPTIONAL);
665
666 int
667 PASCAL FAR
668 send(
669 IN SOCKET s,
670 IN const char FAR *buf,
671 IN int len,
672 IN int flags);
673
674 int
675 PASCAL FAR
676 sendto(
677 IN SOCKET s,
678 IN const char FAR *buf,
679 IN int len,
680 IN int flags,
681 IN const struct sockaddr FAR *to OPTIONAL,
682 IN int tolen);
683
684 int
685 PASCAL FAR
686 setsockopt(
687 IN SOCKET s,
688 IN int level,
689 IN int optname,
690 IN const char FAR *optval OPTIONAL,
691 IN int optlen);
692
693 int
694 PASCAL FAR
695 shutdown(
696 IN SOCKET s,
697 IN int how);
698
699 SOCKET
700 PASCAL FAR
701 socket(
702 IN int af,
703 IN int type,
704 IN int protocol);
705
706 struct hostent FAR
707 *PASCAL FAR
708 gethostbyaddr(
709 IN const char FAR *addr,
710 IN int len,
711 IN int type);
712
713 struct hostent FAR
714 *PASCAL FAR
715 gethostbyname(
716 IN const char FAR *name);
717
718 int
719 PASCAL FAR
720 gethostname(
721 OUT char FAR *name,
722 IN int namelen);
723
724 struct servent FAR
725 *PASCAL FAR
726 getservbyport(
727 IN int port,
728 IN const char FAR *proto);
729
730 struct servent FAR
731 *PASCAL FAR
732 getservbyname(
733 IN const char FAR *name,
734 IN const char FAR *proto);
735
736 struct protoent FAR
737 *PASCAL FAR
738 getprotobynumber(
739 IN int number);
740
741 struct protoent FAR
742 *PASCAL FAR
743 getprotobyname(
744 IN const char FAR *name);
745
746 int
747 PASCAL FAR
748 WSAStartup(
749 IN WORD wVersionRequired,
750 OUT LPWSADATA lpWSAData);
751
752 int
753 PASCAL FAR
754 WSACleanup(void);
755
756 void
757 PASCAL FAR
758 WSASetLastError(
759 IN int iError);
760
761 int
762 PASCAL FAR
763 WSAGetLastError(void);
764
765 BOOL
766 PASCAL FAR
767 WSAIsBlocking(void);
768
769 int
770 PASCAL FAR
771 WSAUnhookBlockingHook(void);
772
773 FARPROC
774 PASCAL FAR
775 WSASetBlockingHook(
776 IN FARPROC lpBlockFunc);
777
778 int
779 PASCAL FAR
780 WSACancelBlockingCall(void);
781
782 HANDLE
783 PASCAL FAR
784 WSAAsyncGetServByName(
785 IN HWND hWnd,
786 IN u_int wMsg,
787 IN const char FAR *name,
788 IN const char FAR *proto,
789 OUT char FAR *buf,
790 IN int buflen);
791
792 HANDLE
793 PASCAL FAR
794 WSAAsyncGetServByPort(
795 IN HWND hWnd,
796 IN u_int wMsg,
797 IN int port,
798 IN const char FAR *proto,
799 OUT char FAR *buf,
800 IN int buflen);
801
802 HANDLE
803 PASCAL FAR
804 WSAAsyncGetProtoByName(
805 IN HWND hWnd,
806 IN u_int wMsg,
807 IN const char FAR *name,
808 OUT char FAR *buf,
809 IN int buflen);
810
811 HANDLE
812 PASCAL FAR
813 WSAAsyncGetProtoByNumber(
814 IN HWND hWnd,
815 IN u_int wMsg,
816 IN int number,
817 OUT char FAR *buf,
818 IN int buflen);
819
820 HANDLE
821 PASCAL FAR
822 WSAAsyncGetHostByName(
823 IN HWND hWnd,
824 IN u_int wMsg,
825 IN const char FAR *name,
826 OUT char FAR *buf,
827 IN int buflen);
828
829 HANDLE
830 PASCAL FAR
831 WSAAsyncGetHostByAddr(
832 IN HWND hWnd,
833 IN u_int wMsg,
834 IN const char FAR *addr,
835 IN int len,
836 IN int type,
837 OUT char FAR *buf,
838 IN int buflen);
839
840 int
841 PASCAL FAR
842 WSACancelAsyncRequest(
843 IN HANDLE hAsyncTaskHandle);
844
845 int
846 PASCAL FAR
847 WSAAsyncSelect(
848 IN SOCKET s,
849 IN HWND hWnd,
850 IN u_int wMsg,
851 IN long lEvent);
852
853 int
854 PASCAL FAR
855 WSARecvEx(
856 IN SOCKET s,
857 OUT char FAR *buf,
858 IN int len,
859 IN OUT int FAR *flags);
860
861 typedef struct _TRANSMIT_FILE_BUFFERS {
862 PVOID Head;
863 DWORD HeadLength;
864 PVOID Tail;
865 DWORD TailLength;
866 } TRANSMIT_FILE_BUFFERS, *PTRANSMIT_FILE_BUFFERS, *LPTRANSMIT_FILE_BUFFERS;
867
868 BOOL
869 PASCAL FAR
870 TransmitFile(
871 IN SOCKET hSocket,
872 IN HANDLE hFile,
873 IN DWORD nNumberOfBytesToWrite,
874 IN DWORD nNumberOfBytesPerSend,
875 IN OUT LPOVERLAPPED lpOverlapped OPTIONAL,
876 IN LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers OPTIONAL,
877 IN DWORD dwReserved);
878
879 BOOL
880 PASCAL FAR
881 AcceptEx(
882 IN SOCKET sListenSocket,
883 IN SOCKET sAcceptSocket,
884 OUT PVOID lpOutputBuffer,
885 IN DWORD dwReceiveDataLength,
886 IN DWORD dwLocalAddressLength,
887 IN DWORD dwRemoteAddressLength,
888 OUT LPDWORD lpdwBytesReceived,
889 IN OUT LPOVERLAPPED lpOverlapped);
890
891 VOID
892 PASCAL FAR
893 GetAcceptExSockaddrs(
894 IN PVOID lpOutputBuffer,
895 IN DWORD dwReceiveDataLength,
896 IN DWORD dwLocalAddressLength,
897 IN DWORD dwRemoteAddressLength,
898 OUT struct sockaddr **LocalSockaddr,
899 OUT LPINT LocalSockaddrLength,
900 OUT struct sockaddr **RemoteSockaddr,
901 OUT LPINT RemoteSockaddrLength);
902
903 #if(_WIN32_WINNT >= 0x0501)
904
905 #ifdef IPV6STRICT
906 #error WINSOCK2 required.
907 #endif
908
909 #endif /* (_WIN32_WINNT >= 0x0501) */
910
911 #ifdef __cplusplus
912 }
913 #endif