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