Ultibo API
C/C++ API for Ultibo Core
Loading...
Searching...
No Matches
winsock.h
Go to the documentation of this file.
1/*
2 * This file is part of the Ultibo project, https://ultibo.org/
3 *
4 * The MIT License (MIT)
5 *
6 * Copyright (c) 2026 Garry Wood <garry@softoz.com.au>
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 */
26#ifndef _ULTIBO_WINSOCK_H
27#define _ULTIBO_WINSOCK_H
28
29#define _WINSOCKAPI_
30
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39#include "ultibo/globaltypes.h"
40#include "ultibo/globalconst.h"
41#include "ultibo/ultibo.h"
42
44#ifdef _SYS_TYPES_FD_SET
45#undef _SYS_TYPES_FD_SET
46#undef NBBY
47#undef NFDBITS
48#undef fd_set
49#undef FD_SET
50#undef FD_CLR
51#undef FD_ISSET
52#undef FD_ZERO
53#endif
54
56#define WINSOCK_VERSION 0x0101
57
58#ifndef FD_SETSIZE
59#define FD_SETSIZE 64
60#endif
61
62#define IOCPARM_MASK 0x7f
63#define IOC_VOID 0x20000000
64#define IOC_OUT 0x40000000
65#define IOC_IN 0x80000000
66#define IOC_INOUT (IOC_IN | IOC_OUT)
67
68#define _IO(x,y) (IOC_VOID|((x)<<8)|(y))
69
70#define _IOR(x,y,t) (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
71
72#define _IOW(x,y,t) (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
73
74#define FIONREAD _IOR('f', 127, u_long)
75#define FIONBIO _IOW('f', 126, u_long)
76#define FIOASYNC _IOW('f', 125, u_long)
77
79#define SIOCSHIWAT _IOW('s', 0, u_long)
80#define SIOCGHIWAT _IOR('s', 1, u_long)
81#define SIOCSLOWAT _IOW('s', 2, u_long)
82#define SIOCGLOWAT _IOR('s', 3, u_long)
83#define SIOCATMARK _IOR('s', 7, u_long)
84
86#define IPPROTO_IP 0
87#define IPPROTO_ICMP 1
88#define IPPROTO_IGMP 2
89#define IPPROTO_GGP 3
90#define IPPROTO_TCP 6
91#define IPPROTO_EGP 8
92#define IPPROTO_PUP 12
93#define IPPROTO_UDP 17
94#define IPPROTO_HMP 20
95#define IPPROTO_IDP 22
96#define IPPROTO_RDP 27
97#define IPPROTO_IPV6 41
98#define IPPROTO_ROUTING 43
99#define IPPROTO_FRAGMENT 44
100#define IPPROTO_ICMPV6 58
101#define IPPROTO_RVD 66
102#define IPPROTO_ND 77
103#define IPPROTO_RAW 255
104#define IPPROTO_MAX 256
105
106#define NSPROTO_IPX 1000
107#define NSPROTO_SPX 1256
108#define NSPROTO_SPXII 1257
109
111#define IPPORT_ANY 0
112#define IPPORT_ECHO 7
113#define IPPORT_DISCARD 9
114#define IPPORT_SYSTAT 11
115#define IPPORT_DAYTIME 13
116#define IPPORT_NETSTAT 15
117#define IPPORT_FTP 21
118#define IPPORT_TELNET 23
119#define IPPORT_SMTP 25
120#define IPPORT_TIMESERVER 37
121#define IPPORT_NAMESERVER 42
122#define IPPORT_WHOIS 43
123#define IPPORT_DNS 53
124#define IPPORT_MTP 57
125#define IPPORT_BOOTPS 67
126#define IPPORT_BOOTPC 68
127
129#define IPPORT_TFTP 69
130#define IPPORT_RJE 77
131#define IPPORT_FINGER 79
132#define IPPORT_TTYLINK 87
133#define IPPORT_SUPDUP 95
134
136#define IPPORT_EXECSERVER 512
137#define IPPORT_LOGINSERVER 513
138#define IPPORT_CMDSERVER 514
139#define IPPORT_EFSSERVER 520
140
142#define IPPORT_BIFFUDP 512
143#define IPPORT_WHOSERVER 513
144#define IPPORT_ROUTESERVER 520
145
148#define IPPORT_RESERVED 1024
149
151#define IMPLINK_IP 155
152#define IMPLINK_LOWEXPER 156
153#define IMPLINK_HIGHEXPER 158
154
155#define INADDR_ANY 0x00000000
156#define INADDR_LOOPBACK 0x7F000001
157#define INADDR_BROADCAST 0xFFFFFFFF
158#define INADDR_NONE 0xFFFFFFFF
159
160#define IN_CLASSA_NET 0xff000000
161#define IN_CLASSA_NSHIFT 24
162#define IN_CLASSA_HOST 0x00ffffff
163#define IN_CLASSA_MAX 128
164#define IN_CLASSB_NET 0xffff0000
165#define IN_CLASSB_NSHIFT 16
166#define IN_CLASSB_HOST 0x0000ffff
167#define IN_CLASSB_MAX 65536
168#define IN_CLASSC_NET 0xffffff00
169#define IN_CLASSC_NSHIFT 8
170#define IN_CLASSC_HOST 0x000000ff
171
172#define WSADESCRIPTION_LEN 256
173#define WSASYS_STATUS_LEN 128
174
175#define TF_DISCONNECT 0x01
176#define TF_REUSE_SOCKET 0x02
177#define TF_WRITE_BEHIND 0x04
178
180#define IP_OPTIONS 1
181#define IP_MULTICAST_IF 2
182#define IP_MULTICAST_TTL 3
183#define IP_MULTICAST_LOOP 4
184#define IP_ADD_MEMBERSHIP 5
185#define IP_DROP_MEMBERSHIP 6
186#define IP_TTL 7
187#define IP_TOS 8
188#define IP_DONTFRAGMENT 9
189#define IP_HDRINCL 10
190
191#define IP_DEFAULT_MULTICAST_TTL 1
192#define IP_DEFAULT_MULTICAST_LOOP 1
193#define IP_MAX_MEMBERSHIPS 20
194
196#define INVALID_SOCKET (SOCKET)(~0)
197#define SOCKET_ERROR -1
198
200#define SOCK_UNSPEC 0
201#define SOCK_STREAM 1
202#define SOCK_DGRAM 2
203#define SOCK_RAW 3
204#define SOCK_RDM 4
205#define SOCK_SEQPACKET 5
206#define SOCK_PACKET 10
207 // getting packets at the dev
208 // level. For writing rarp and
209 // other similar things on the
210 // user level.
211
213#define SO_DEBUG 0x0001
214#define SO_ACCEPTCONN 0x0002
215#define SO_REUSEADDR 0x0004
216#define SO_KEEPALIVE 0x0008
217#define SO_DONTROUTE 0x0010
218#define SO_BROADCAST 0x0020
219#define SO_USELOOPBACK 0x0040
220#define SO_LINGER 0x0080
221#define SO_OOBINLINE 0x0100
222
223#define SO_DONTLINGER 0xff7f
224
226#define SO_SNDBUF 0x1001
227#define SO_RCVBUF 0x1002
228#define SO_SNDLOWAT 0x1003
229#define SO_RCVLOWAT 0x1004
230#define SO_SNDTIMEO 0x1005
231#define SO_RCVTIMEO 0x1006
232#define SO_ERROR 0x1007
233#define SO_TYPE 0x1008
234#define SO_CONNTIMEO 0x1009
235
238#define SO_CONNDATA 0x7000
239#define SO_CONNOPT 0x7001
240#define SO_DISCDATA 0x7002
241#define SO_DISCOPT 0x7003
242#define SO_CONNDATALEN 0x7004
243#define SO_CONNOPTLEN 0x7005
244#define SO_DISCDATALEN 0x7006
245#define SO_DISCOPTLEN 0x7007
246
248#define SO_OPENTYPE 0x7008
249#define SO_SYNCHRONOUS_ALERT 0x10
250#define SO_SYNCHRONOUS_NONALERT 0x20
251
253#define SO_MAXDG 0x7009
254#define SO_MAXPATHDG 0x700A
255#define SO_UPDATE_ACCEPT_CONTEXT 0x700B
256#define SO_CONNECT_TIME 0x700C
257
259#define TCP_NODELAY 0x0001
260#define TCP_MAXSEG 0x0002
261#define TCP_NOPUSH 0x0004
262#define TCP_NOOPT 0x0008
263#define TCP_BSDURGENT 0x7000
264
265#define TCP_WSCALE 0x0010
266#define TCP_NOSACK 0x0020
267
269#define UDP_NOCHECKSUM 0x0001
270
272#define AF_UNSPEC 0
273#define AF_UNIX 1
274#define AF_INET 2
275#define AF_IMPLINK 3
276#define AF_PUP 4
277#define AF_CHAOS 5
278#define AF_IPX 6
279#define AF_NS 6
280#define AF_ISO 7
281#define AF_OSI AF_ISO
282#define AF_ECMA 8
283#define AF_DATAKIT 9
284#define AF_CCITT 10
285#define AF_SNA 11
286#define AF_DECnet 12
287#define AF_DLI 13
288#define AF_LAT 14
289#define AF_HYLINK 15
290#define AF_APPLETALK 16
291#define AF_NETBIOS 17
292#define AF_VOICEVIEW 18
293#define AF_FIREFOX 19
294#define AF_UNKNOWN1 20
295#define AF_BAN 21
296#define AF_ATM 22
297#define AF_INET6 23
298#define AF_CLUSTER 24
299#define AF_12844 25
300#define AF_IRDA 26
301#define AF_NETDES 28
302
303#define AF_MAX 29
304
306#define PF_UNSPEC AF_UNSPEC
307#define PF_UNIX AF_UNIX
308#define PF_INET AF_INET
309#define PF_IMPLINK AF_IMPLINK
310#define PF_PUP AF_PUP
311#define PF_CHAOS AF_CHAOS
312#define PF_NS AF_NS
313#define PF_IPX AF_IPX
314#define PF_ISO AF_ISO
315#define PF_OSI AF_OSI
316#define PF_ECMA AF_ECMA
317#define PF_DATAKIT AF_DATAKIT
318#define PF_CCITT AF_CCITT
319#define PF_SNA AF_SNA
320#define PF_DECnet AF_DECnet
321#define PF_DLI AF_DLI
322#define PF_LAT AF_LAT
323#define PF_HYLINK AF_HYLINK
324#define PF_APPLETALK AF_APPLETALK
325#define PF_VOICEVIEW AF_VOICEVIEW
326#define PF_FIREFOX AF_FIREFOX
327#define PF_UNKNOWN1 AF_UNKNOWN1
328#define PF_BAN AF_BAN
329#define PF_ATM AF_ATM
330#define PF_INET6 AF_INET6
331#define PF_CLUSTER AF_CLUSTER
332#define PF_12844 AF_12844
333#define PF_IRDA AF_IRDA
334#define PF_NETDES AF_NETDES
335
336#define PF_MAX AF_MAX
337
339#define SOL_SOCKET 0xffff
340
342#define SOMAXCONN 5
343
344#define MSG_OOB 0x1
345#define MSG_PEEK 0x2
346#define MSG_DONTROUTE 0x4
347
348#define MSG_INTERRUPT 0x10
349#define MSG_MAXIOVLEN 16
350
351#define MSG_PARTIAL 0x8000
352
354#define MAXGETHOSTSTRUCT 1024
355
357#define FD_READ 0x01
358#define FD_WRITE 0x02
359#define FD_OOB 0x04
360#define FD_ACCEPT 0x08
361#define FD_CONNECT 0x10
362#define FD_CLOSE 0x20
363
365#define WSABASEERR 10000
366
368
369#define WSAEINTR (WSABASEERR+4)
370#define WSAEBADF (WSABASEERR+9)
371#define WSAEACCES (WSABASEERR+13)
372#define WSAEFAULT (WSABASEERR+14)
373#define WSAEINVAL (WSABASEERR+22)
374#define WSAEMFILE (WSABASEERR+24)
375
377
378#define WSAEWOULDBLOCK (WSABASEERR+35)
379#define WSAEINPROGRESS (WSABASEERR+36)
380#define WSAEALREADY (WSABASEERR+37)
381#define WSAENOTSOCK (WSABASEERR+38)
382#define WSAEDESTADDRREQ (WSABASEERR+39)
383#define WSAEMSGSIZE (WSABASEERR+40)
384#define WSAEPROTOTYPE (WSABASEERR+41)
385#define WSAENOPROTOOPT (WSABASEERR+42)
386#define WSAEPROTONOSUPPORT (WSABASEERR+43)
387#define WSAESOCKTNOSUPPORT (WSABASEERR+44)
388#define WSAEOPNOTSUPP (WSABASEERR+45)
389#define WSAEPFNOSUPPORT (WSABASEERR+46)
390#define WSAEAFNOSUPPORT (WSABASEERR+47)
391#define WSAEADDRINUSE (WSABASEERR+48)
392#define WSAEADDRNOTAVAIL (WSABASEERR+49)
393#define WSAENETDOWN (WSABASEERR+50)
394#define WSAENETUNREACH (WSABASEERR+51)
395#define WSAENETRESET (WSABASEERR+52)
396#define WSAECONNABORTED (WSABASEERR+53)
397#define WSAECONNRESET (WSABASEERR+54)
398#define WSAENOBUFS (WSABASEERR+55)
399#define WSAEISCONN (WSABASEERR+56)
400#define WSAENOTCONN (WSABASEERR+57)
401#define WSAESHUTDOWN (WSABASEERR+58)
402#define WSAETOOMANYREFS (WSABASEERR+59)
403#define WSAETIMEDOUT (WSABASEERR+60)
404#define WSAECONNREFUSED (WSABASEERR+61)
405#define WSAELOOP (WSABASEERR+62)
406#define WSAENAMETOOLONG (WSABASEERR+63)
407#define WSAEHOSTDOWN (WSABASEERR+64)
408#define WSAEHOSTUNREACH (WSABASEERR+65)
409#define WSAENOTEMPTY (WSABASEERR+66)
410#define WSAEPROCLIM (WSABASEERR+67)
411#define WSAEUSERS (WSABASEERR+68)
412#define WSAEDQUOT (WSABASEERR+69)
413#define WSAESTALE (WSABASEERR+70)
414#define WSAEREMOTE (WSABASEERR+71)
415
416#define WSAEDISCON (WSABASEERR+101)
417
419
420#define WSASYSNOTREADY (WSABASEERR+91)
421#define WSAVERNOTSUPPORTED (WSABASEERR+92)
422#define WSANOTINITIALISED (WSABASEERR+93)
423
424#define WSAENOMORE (WSABASEERR+102)
425#define WSAECANCELLED (WSABASEERR+103)
426#define WSAEINVALIDPROCTABLE (WSABASEERR+104)
427#define WSAEINVALIDPROVIDER (WSABASEERR+105)
428#define WSAEPROVIDERFAILEDINIT (WSABASEERR+106)
429#define WSASYSCALLFAILURE (WSABASEERR+107)
430#define WSASERVICE_NOT_FOUND (WSABASEERR+108)
431#define WSATYPE_NOT_FOUND (WSABASEERR+109)
432#define WSA_E_NO_MORE (WSABASEERR+110)
433#define WSA_E_CANCELLED (WSABASEERR+111)
434#define WSAEREFUSED (WSABASEERR+112)
435
444
446
447#define WSAHOST_NOT_FOUND (WSABASEERR+1001)
448#define HOST_NOT_FOUND WSAHOST_NOT_FOUND
449
451
452#define WSATRY_AGAIN (WSABASEERR+1002)
453#define TRY_AGAIN WSATRY_AGAIN
454
456
457#define WSANO_RECOVERY (WSABASEERR+1003)
458#define NO_RECOVERY WSANO_RECOVERY
459
461
462#define WSANO_DATA (WSABASEERR+1004)
463#define NO_DATA WSANO_DATA
464
466
467#define WSANO_ADDRESS WSANO_DATA
468#define NO_ADDRESS WSANO_ADDRESS
469
473
474#define EWOULDBLOCK WSAEWOULDBLOCK
475#define EINPROGRESS WSAEINPROGRESS
476#define EALREADY WSAEALREADY
477#define ENOTSOCK WSAENOTSOCK
478#define EDESTADDRREQ WSAEDESTADDRREQ
479#define EMSGSIZE WSAEMSGSIZE
480#define EPROTOTYPE WSAEPROTOTYPE
481#define ENOPROTOOPT WSAENOPROTOOPT
482#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
483#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
484#define EOPNOTSUPP WSAEOPNOTSUPP
485#define EPFNOSUPPORT WSAEPFNOSUPPORT
486#define EAFNOSUPPORT WSAEAFNOSUPPORT
487#define EADDRINUSE WSAEADDRINUSE
488#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
489#define ENETDOWN WSAENETDOWN
490#define ENETUNREACH WSAENETUNREACH
491#define ENETRESET WSAENETRESET
492#define ECONNABORTED WSAECONNABORTED
493#define ECONNRESET WSAECONNRESET
494#define ENOBUFS WSAENOBUFS
495#define EISCONN WSAEISCONN
496#define ENOTCONN WSAENOTCONN
497#define ESHUTDOWN WSAESHUTDOWN
498#define ETOOMANYREFS WSAETOOMANYREFS
499#define ETIMEDOUT WSAETIMEDOUT
500#define ECONNREFUSED WSAECONNREFUSED
501#define ELOOP WSAELOOP
502#define ENAMETOOLONG WSAENAMETOOLONG
503#define EHOSTDOWN WSAEHOSTDOWN
504#define EHOSTUNREACH WSAEHOSTUNREACH
505#define ENOTEMPTY WSAENOTEMPTY
506#define EPROCLIM WSAEPROCLIM
507#define EUSERS WSAEUSERS
508#define EDQUOT WSAEDQUOT
509#define ESTALE WSAESTALE
510#define EREMOTE WSAEREMOTE
511
512#define ENOTREADY WSASYSNOTREADY
513#define EVERNOTSUPPORTED WSAVERNOTSUPPORTED
514#define ENOTINITIALISED WSANOTINITIALISED
515
517typedef unsigned char u_char;
518typedef unsigned short u_short;
519typedef unsigned int u_int;
520typedef unsigned long u_long;
521
522typedef char MBChar;
523
529
530typedef struct _wstimeval
531{
532 int32_t tv_sec;
533 int32_t tv_usec;
535
536typedef struct _hostent
537{
538 char *h_name;
539 char **h_aliases;
540 int16_t h_addrtype;
541 int16_t h_length;
544
545typedef struct _netent
546{
547 char *n_name;
548 char **n_aliases;
549 int16_t n_addrtype;
552
553typedef struct _servent
554{
555 char *s_name;
556 char **s_aliases;
557 int16_t s_port;
558 char *s_proto;
560
561typedef struct _protoent
562{
563 char *p_name;
564 char **p_aliases;
565 int16_t p_proto;
567
568typedef struct _in_addr
569{
570 union
571 {
573 struct { u_short s_w1,s_w2; } S_un_w;
577#define s_addr S_un.S_addr
579
587
598
606
608typedef struct _sockaddr
609{
611 char sa_data[14];
613
615
622
629
636
640
641void STDCALL WSAsyncStart(void *data);
642
644
649SOCKET STDCALL accept(SOCKET s, SOCKADDR *addr, int *addrlen);
650
655int STDCALL bind(SOCKET s, SOCKADDR *addr, int namelen);
656
662
667int STDCALL connect(SOCKET s, SOCKADDR *name, int namelen);
668
673int STDCALL ioctlsocket(SOCKET s, int32_t cmd, u_long *arg);
674
679int STDCALL getpeername(SOCKET s, SOCKADDR *name, int *namelen);
680
685int STDCALL getsockname(SOCKET s, SOCKADDR *name, int *namelen);
686
691int STDCALL getsockopt(SOCKET s, int level, int optname, char *optval, int *optlen);
692
698
704
710u_long STDCALL inet_addr(const char *cp);
711
720char * STDCALL inet_ntoa(in_addr inaddr);
721
726int STDCALL listen(SOCKET s, int backlog);
727
733
739
744int STDCALL recv(SOCKET s, char *buf, int len, int flags);
745
750int STDCALL recvfrom(SOCKET s, char *buf, int len, int flags, SOCKADDR *from, int *fromlen);
751
757int STDCALL select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, wstimeval *timeout);
758
763int STDCALL send(SOCKET s, const char *buf, int len, int flags);
764
769int STDCALL sendto(SOCKET s, const char *buf, int len, int flags, SOCKADDR *toaddr, int tolen);
770
775int STDCALL setsockopt(SOCKET s, int level, int optname, const char *optval, int optlen);
776
781int STDCALL shutdown(SOCKET s, int how);
782
787SOCKET STDCALL socket(int af, int type, int protocol);
788
794hostent * STDCALL gethostbyaddr(const char *addr, int len, int family);
795
800hostent * STDCALL gethostbyname(const char *name);
801
806int STDCALL gethostname(char *name, int namelen);
807
813servent * STDCALL getservbyport(int port, const char *proto);
814
819servent * STDCALL getservbyname(const char *name, const char *proto);
820
826
831protoent * STDCALL getprotobyname(const char *name);
832
837int STDCALL WSAStartup(uint16_t wversionrequired, WSADATA *wsadata);
838
844
849void STDCALL WSASetLastError(int ierror);
850
860HANDLE STDCALL WSAAsyncGetServByName(HWND hwnd, u_int wmsg, const char *name, const char *proto, char *buf, int buflen);
861HANDLE STDCALL WSAAsyncGetServByPort(HWND hwnd, u_int wmsg, int port, const char *proto, char *buf, int buflen);
862HANDLE STDCALL WSAAsyncGetProtoByName(HWND hwnd, u_int wmsg, const char *name, char *buf, int buflen);
863HANDLE STDCALL WSAAsyncGetProtoByNumber(HWND hwnd, u_int wmsg, int number, char *buf, int buflen);
864HANDLE STDCALL WSAAsyncGetHostByName(HWND hwnd, u_int wmsg, const char *name, char *buf, int buflen);
865HANDLE STDCALL WSAAsyncGetHostByAddr(HWND hwnd, u_int wmsg, const char *addr, int len, int family, char *buf, int buflen);
867int STDCALL WSAAsyncSelect(SOCKET s, HWND hwnd, u_int wmsg, int32_t levent);
868
873int STDCALL WSARecvEx(SOCKET s, char *buf, int len, int *flags);
874
880
886
887BOOL STDCALL TransmitFile(SOCKET hsocket, HANDLE hfile, uint32_t nnumberofbytestowrite, uint32_t nnumberofbytespersend, OVERLAPPED *lpoverlapped, TRANSMIT_FILE_BUFFERS *lptransmitbuffers, uint32_t dwreserved);
888
889BOOL STDCALL AcceptEx(SOCKET slistensocket, SOCKET sacceptsocket, void *lpoutputbuffer, uint32_t dwreceivedatalength, uint32_t dwlocaladdresslength, uint32_t dwremoteaddresslength, uint32_t *lpdwbytesreceived, OVERLAPPED *lpoverlapped);
890
891void STDCALL GetAcceptExSockaddrs(void *lpoutputbuffer, uint32_t dwreceivedatalength, uint32_t dwlocaladdresslength, uint32_t dwremoteaddresslength, SOCKADDR **localsockaddr, int *localsockaddrlength, SOCKADDR **remotesockaddr, int *remotesockaddrlength);
892
893uint32_t STDCALL WSAMakeSyncReply(uint16_t buflen, uint16_t error);
894uint32_t STDCALL WSAMakeSelectReply(uint16_t event, uint16_t error);
895uint16_t STDCALL WSAGetAsyncBuflen(uint32_t param);
896uint16_t STDCALL WSAGetAsyncError(uint32_t param);
897uint16_t STDCALL WSAGetSelectEvent(uint32_t param);
898uint16_t STDCALL WSAGetSelectError(uint32_t param);
899
905
911
917
922void STDCALL FD_ZERO(fd_set *fdset);
923
925int STDCALL WsControl(uint32_t proto, uint32_t action, void *prequestinfo, uint32_t *pcbrequestinfolen, void *presponseinfo, uint32_t *pcbresponseinfolen);
926
931netent * STDCALL getnetbyaddr(void *addr, int len, int type);
932
936netent * STDCALL getnetbyname(const char *name);
937
939int STDCALL WsControlEx(uint32_t proto, uint32_t action, void *prequestinfo, uint32_t *pcbrequestinfolen, void *presponseinfo, uint32_t *pcbresponseinfolen);
940
942
951
960
961uint32_t STDCALL WinsockErrorToString(int32_t error, char *string, uint32_t len);
962
963#ifdef __cplusplus
964}
965#endif
966
967#endif // _ULTIBO_WINSOCK_H
void * FARPROC
Definition globaltypes.h:64
size_t HANDLE
Definition globaltypes.h:51
#define STDCALL
Definition globaltypes.h:45
_Bool BOOL
Built in Boolean type (1 byte) (Redeclared here for flexibility).
Definition globaltypes.h:55
struct _OVERLAPPED OVERLAPPED
Definition globaltypes.h:70
size_t SOCKET
Definition globaltypes.h:60
Definition winsock.h:600
uint32_t headlength
Definition winsock.h:602
void * tail
Definition winsock.h:603
void * head
Definition winsock.h:601
uint32_t taillength
Definition winsock.h:604
Definition winsock.h:589
uint16_t wversion
Definition winsock.h:590
char szdescription[WSADESCRIPTION_LEN+1]
Definition winsock.h:592
uint16_t whighversion
Definition winsock.h:591
uint16_t imaxsockets
Definition winsock.h:594
char szsystemstatus[WSASYS_STATUS_LEN+1]
Definition winsock.h:593
uint16_t imaxudpdg
Definition winsock.h:595
char * lpvendorinfo
Definition winsock.h:596
Definition winsock.h:525
u_int fd_count
Definition winsock.h:526
SOCKET fd_array[FD_SETSIZE]
Definition winsock.h:527
Definition winsock.h:537
char ** h_aliases
Definition winsock.h:539
char ** h_addr_list
Definition winsock.h:542
int16_t h_addrtype
Definition winsock.h:540
char * h_name
Definition winsock.h:538
int16_t h_length
Definition winsock.h:541
Definition winsock.h:569
u_short s_w1
Definition winsock.h:573
u_char S_bytes[4]
Definition winsock.h:575
u_char s_b3
Definition winsock.h:572
u_long S_addr
Definition winsock.h:574
u_char s_b1
Definition winsock.h:572
u_short s_w2
Definition winsock.h:573
struct _in_addr::@075342254321346101047366012334126230275075004224::@277110075311252260327012205042033311124245066371 S_un_w
struct _in_addr::@075342254321346101047366012334126230275075004224::@354042140363320263321207227377267012345362375137 S_un_b
u_char s_b4
Definition winsock.h:572
u_char s_b2
Definition winsock.h:572
union _in_addr::@075342254321346101047366012334126230275075004224 S_un
Definition winsock.h:632
in_addr imrmultiaddr
IP multicast address of group.
Definition winsock.h:633
in_addr imrinterface
local IP address of interface
Definition winsock.h:634
Definition winsock.h:625
u_short l_onoff
Definition winsock.h:626
u_short l_linger
Definition winsock.h:627
Definition winsock.h:546
char ** n_aliases
Definition winsock.h:548
char * n_name
Definition winsock.h:547
int16_t n_addrtype
Definition winsock.h:549
u_long n_net
Definition winsock.h:550
Definition winsock.h:562
char * p_name
Definition winsock.h:563
char ** p_aliases
Definition winsock.h:564
int16_t p_proto
Definition winsock.h:565
Definition winsock.h:554
int16_t s_port
Definition winsock.h:557
char * s_proto
Definition winsock.h:558
char ** s_aliases
Definition winsock.h:556
char * s_name
Definition winsock.h:555
Definition winsock.h:581
u_short sin_port
Definition winsock.h:583
in_addr sin_addr
Definition winsock.h:584
char sin_zero[8]
Definition winsock.h:585
u_short sin_family
Definition winsock.h:582
Definition winsock.h:609
char sa_data[14]
up to 14 bytes of direct address
Definition winsock.h:611
u_short sa_family
address family
Definition winsock.h:610
Definition winsock.h:618
u_short sp_family
Definition winsock.h:619
u_short sp_protocol
Definition winsock.h:620
Definition winsock.h:531
int32_t tv_sec
Definition winsock.h:532
int32_t tv_usec
Definition winsock.h:533
HANDLE HWND
Definition ultibo.h:212
#define FD_SETSIZE
Definition winsock2.h:61
struct _in_addr in_addr
#define WSASYS_STATUS_LEN
Definition winsock2.h:533
#define WSADESCRIPTION_LEN
Definition winsock2.h:532
void STDCALL WSASetLastError(int ierror)
Set the error code that can be retrieved through the WSAGetLastError function See the Windows Sockets...
struct _fd_set fd_set
int STDCALL ioctlsocket(SOCKET s, int32_t cmd, u_long *arg)
Control the I/O mode of a socket See the Windows Sockets documentation for additional information.
SOCKET STDCALL accept(SOCKET s, SOCKADDR *addr, int *addrlen)
Accept an incoming connection attempt on a socket See the Windows Sockets documentation for additiona...
int STDCALL getpeername(SOCKET s, SOCKADDR *name, int *namelen)
Retrieve the address of the peer to which a socket is connected See the Windows Sockets documentation...
int STDCALL recvfrom(SOCKET s, char *buf, int len, int flags, SOCKADDR *from, int *fromlen)
Receive a datagram and store the source address See the Windows Sockets documentation for additional ...
FARPROC STDCALL WSASetBlockingHook(FARPROC lpblockfunc)
SOCKET STDCALL socket(int af, int type, int protocol)
Create a socket that is bound to a specific transport service provider See the Windows Sockets docume...
int STDCALL shutdown(SOCKET s, int how)
Disable sends or receives on a socket See the Windows Sockets documentation for additional informatio...
int STDCALL sendto(SOCKET s, const char *buf, int len, int flags, SOCKADDR *toaddr, int tolen)
Send data to a specific destination See the Windows Sockets documentation for additional information.
int STDCALL WSACleanup(void)
Terminate use of Winsock by an application See the Windows Sockets documentation for additional infor...
void STDCALL WSAsyncStart(void *data)
hostent *STDCALL gethostbyaddr(const char *addr, int len, int family)
Retrieve the host information corresponding to a network address.
servent *STDCALL getservbyport(int port, const char *proto)
Retrieve service information corresponding to a port and protocol.
int STDCALL WSAUnhookBlockingHook(void)
struct _netent netent
int STDCALL WSACancelAsyncRequest(HANDLE hasynctaskhandle)
servent *STDCALL getservbyname(const char *name, const char *proto)
Retrieve service information corresponding to a service name and protocol See the Windows Sockets doc...
uint32_t STDCALL WSAMakeSelectReply(uint16_t event, uint16_t error)
uint16_t STDCALL WSAGetAsyncBuflen(uint32_t param)
char MBChar
Definition winsock.h:522
u_long STDCALL inet_addr(const char *cp)
Convert a string containing an IPv4 dotted-decimal address into a proper address for the IN_ADDR stru...
int STDCALL gethostname(char *name, int namelen)
Retrieve the standard host name for the local computer See the Windows Sockets documentation for addi...
HANDLE STDCALL WSAAsyncGetServByPort(HWND hwnd, u_int wmsg, int port, const char *proto, char *buf, int buflen)
int STDCALL recv(SOCKET s, char *buf, int len, int flags)
Receive data from a connected socket or a bound connectionless socket See the Windows Sockets documen...
int STDCALL bind(SOCKET s, SOCKADDR *addr, int namelen)
Associate a local address with a socket See the Windows Sockets documentation for additional informat...
struct _sockaddr_in sockaddr_in
int STDCALL setsockopt(SOCKET s, int level, int optname, const char *optval, int optlen)
Set a socket option See the Windows Sockets documentation for additional information.
BOOL STDCALL TransmitFile(SOCKET hsocket, HANDLE hfile, uint32_t nnumberofbytestowrite, uint32_t nnumberofbytespersend, OVERLAPPED *lpoverlapped, TRANSMIT_FILE_BUFFERS *lptransmitbuffers, uint32_t dwreserved)
int STDCALL WSARecvEx(SOCKET s, char *buf, int len, int *flags)
Receive data from a connected socket or a bound connectionless socket See the Windows Sockets documen...
int STDCALL WSAStartup(uint16_t wversionrequired, WSADATA *wsadata)
Initiate use of Winsock by an application See the Windows Sockets documentation for additional inform...
uint16_t STDCALL WSAGetSelectEvent(uint32_t param)
int STDCALL WSACancelBlockingCall(void)
struct _hostent hostent
int STDCALL getsockopt(SOCKET s, int level, int optname, char *optval, int *optlen)
Retrieve a socket option See the Windows Sockets documentation for additional information.
struct _WSADATA WSADATA
u_long STDCALL htonl(u_long hostlong)
Convert a u_long from host byte order to TCP/IP network byte order (which is big-endian) See the Wind...
uint16_t STDCALL WSAGetAsyncError(uint32_t param)
HANDLE STDCALL WSAAsyncGetProtoByName(HWND hwnd, u_int wmsg, const char *name, char *buf, int buflen)
uint32_t STDCALL WSAMakeSyncReply(uint16_t buflen, uint16_t error)
BOOL STDCALL FD_ISSET(SOCKET socket, fd_set *fdset)
Check if a socket is a member of an fd_set See the Windows Sockets documentation for additional infor...
struct _sockproto sockproto
char *STDCALL inet_ntoa(in_addr inaddr)
Convert an (IPv4) Internet network address into an ASCII string in Internet standard dotted-decimal f...
BOOL STDCALL WSStop(void)
protoent *STDCALL getprotobyname(const char *name)
Retrieve the protocol information corresponding to a protocol name See the Windows Sockets documentat...
unsigned long u_long
Definition winsock.h:520
struct _ip_mreq ip_mreq
void STDCALL FD_ZERO(fd_set *fdset)
Initialize an fd_set to null See the Windows Sockets documentation for additional information.
int STDCALL WsControl(uint32_t proto, uint32_t action, void *prequestinfo, uint32_t *pcbrequestinfolen, void *presponseinfo, uint32_t *pcbresponseinfolen)
u_long STDCALL ntohl(u_long netlong)
Convert a u_long from TCP/IP network byte order to host byte order See the Windows Sockets documentat...
int STDCALL send(SOCKET s, const char *buf, int len, int flags)
Send data on a connected socket See the Windows Sockets documentation for additional information.
int STDCALL WSAGetLastError(void)
Return the error status for the last Windows Sockets operation that failed See the Windows Sockets do...
void STDCALL GetAcceptExSockaddrs(void *lpoutputbuffer, uint32_t dwreceivedatalength, uint32_t dwlocaladdresslength, uint32_t dwremoteaddresslength, SOCKADDR **localsockaddr, int *localsockaddrlength, SOCKADDR **remotesockaddr, int *remotesockaddrlength)
void STDCALL FD_CLR(SOCKET socket, fd_set *fdset)
Remove a socket from an fd_set See the Windows Sockets documentation for additional information.
HANDLE STDCALL WSAAsyncGetHostByAddr(HWND hwnd, u_int wmsg, const char *addr, int len, int family, char *buf, int buflen)
struct _TRANSMIT_FILE_BUFFERS TRANSMIT_FILE_BUFFERS
unsigned short u_short
Definition winsock.h:518
hostent *STDCALL gethostbyname(const char *name)
Retrieve network address corresponding to a host name See the Windows Sockets documentation for addit...
int STDCALL select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, wstimeval *timeout)
Determine the status of one or more sockets, waiting if necessary, to perform synchronous I/O.
struct _servent servent
int STDCALL WSAAsyncSelect(SOCKET s, HWND hwnd, u_int wmsg, int32_t levent)
int STDCALL closesocket(SOCKET s)
Close an existing socket See the Windows Sockets documentation for additional information.
struct _linger linger
BOOL STDCALL __WSAFDIsSet(SOCKET s, fd_set *fdset)
Return a value indicating whether a socket is included in a set of socket descriptors See the Windows...
int STDCALL connect(SOCKET s, SOCKADDR *name, int namelen)
Establish a connection to a specified socket See the Windows Sockets documentation for additional inf...
int STDCALL listen(SOCKET s, int backlog)
Place a socket in a state in which it is listening for incoming connections See the Windows Sockets d...
netent *STDCALL getnetbyaddr(void *addr, int len, int type)
Retrieve the network information corresponding to a network address.
BOOL STDCALL AcceptEx(SOCKET slistensocket, SOCKET sacceptsocket, void *lpoutputbuffer, uint32_t dwreceivedatalength, uint32_t dwlocaladdresslength, uint32_t dwremoteaddresslength, uint32_t *lpdwbytesreceived, OVERLAPPED *lpoverlapped)
unsigned int u_int
Definition winsock.h:519
struct _in_addr in_addr
BOOL STDCALL WSAIsBlocking(void)
int STDCALL __WSAFDIsSet_(SOCKET s, fd_set *fdset)
Return a value indicating whether a socket is included in a set of socket descriptors See the Windows...
protoent *STDCALL getprotobynumber(int proto)
Retrieve protocol information corresponding to a protocol number See the Windows Sockets documentatio...
u_short STDCALL ntohs(u_short netshort)
Convert a u_short from TCP/IP network byte order to host byte order See the Windows Sockets documenta...
HANDLE STDCALL WSAAsyncGetServByName(HWND hwnd, u_int wmsg, const char *name, const char *proto, char *buf, int buflen)
struct _wstimeval wstimeval
u_short STDCALL htons(u_short hostshort)
Convert a u_short from host byte order to TCP/IP network byte order (which is big-endian) See the Win...
int STDCALL getsockname(SOCKET s, SOCKADDR *name, int *namelen)
Retrieve the local name for a socket See the Windows Sockets documentation for additional information...
netent *STDCALL getnetbyname(const char *name)
Retrieve network address corresponding to a network name.
unsigned char u_char
Definition winsock.h:517
BOOL STDCALL WSStart(void)
struct _sockaddr sockaddr
BOOL STDCALL WinsockRedirectInput(SOCKET s)
Redirect standard input to the socket specified by s.
HANDLE STDCALL WSAAsyncGetProtoByNumber(HWND hwnd, u_int wmsg, int number, char *buf, int buflen)
uint16_t STDCALL WSAGetSelectError(uint32_t param)
void STDCALL FD_SET(SOCKET socket, fd_set *fdset)
Add a socket to an fd_set See the Windows Sockets documentation for additional information.
HANDLE STDCALL WSAAsyncGetHostByName(HWND hwnd, u_int wmsg, const char *name, char *buf, int buflen)
struct _protoent protoent
uint32_t STDCALL WinsockErrorToString(int32_t error, char *string, uint32_t len)
int STDCALL WsControlEx(uint32_t proto, uint32_t action, void *prequestinfo, uint32_t *pcbrequestinfolen, void *presponseinfo, uint32_t *pcbresponseinfolen)
BOOL STDCALL WinsockRedirectOutput(SOCKET s)
Redirect standard output to the socket specified by s.
sockaddr SOCKADDR
Definition winsock.h:614