master
 1#ifndef __wasilibc___header_sys_socket_h
 2#define __wasilibc___header_sys_socket_h
 3
 4#include <__wasi_snapshot.h>
 5#include <__struct_msghdr.h>
 6#include <__struct_sockaddr.h>
 7#include <__struct_sockaddr_storage.h>
 8
 9#include <wasi/api.h>
10
11#define SHUT_RD __WASI_SDFLAGS_RD
12#define SHUT_WR __WASI_SDFLAGS_WR
13#define SHUT_RDWR (SHUT_RD | SHUT_WR)
14
15#ifdef __wasilibc_use_wasip2
16#define MSG_DONTWAIT  0x0040
17#define MSG_NOSIGNAL  0x4000
18#define MSG_PEEK      0x0002
19#define MSG_WAITALL   0x0100
20#define MSG_TRUNC     0x0020
21
22#define SOL_IP     0
23#define SOL_TCP    6
24#define SOL_UDP    17
25#define SOL_IPV6   41
26
27#define SOMAXCONN 128
28
29#define SO_REUSEADDR 2
30#define SO_ERROR 4
31#define SO_SNDBUF 7
32#define SO_RCVBUF 8
33#define SO_KEEPALIVE 9
34#define SO_ACCEPTCONN 30
35#define SO_PROTOCOL 38
36#define SO_DOMAIN 39
37 
38#if __LONG_MAX == 0x7fffffff
39#define SO_RCVTIMEO     66
40#define SO_SNDTIMEO     67
41#else
42#define SO_RCVTIMEO     20
43#define SO_SNDTIMEO     21
44#endif
45
46#else // __wasilibc_use_wasip2
47#define MSG_PEEK __WASI_RIFLAGS_RECV_PEEK
48#define MSG_WAITALL __WASI_RIFLAGS_RECV_WAITALL
49#define MSG_TRUNC __WASI_ROFLAGS_RECV_DATA_TRUNCATED
50#endif // __wasilibc_use_wasip2
51
52#define SOCK_DGRAM __WASI_FILETYPE_SOCKET_DGRAM
53#define SOCK_STREAM __WASI_FILETYPE_SOCKET_STREAM
54
55#define SOCK_NONBLOCK (0x00004000)
56#define SOCK_CLOEXEC (0x00002000)
57
58#define SOL_SOCKET 0x7fffffff
59
60#define SO_TYPE 3
61
62#define PF_UNSPEC 0
63#define PF_INET 1
64#define PF_INET6 2
65
66#define AF_UNSPEC PF_UNSPEC
67#define AF_INET PF_INET
68#define AF_INET6 PF_INET6
69#define AF_UNIX 3
70
71#ifdef __cplusplus
72extern "C" {
73#endif
74
75#ifdef __cplusplus
76}
77#endif
78
79#endif