/abis/linux/x86_64/socket.h

https://github.com/managarm/mlibc · C Header · 283 lines · 258 code · 25 blank · 0 comment · 0 complexity · b92fbf9dcecf74b588be4b31d45c606f MD5 · raw file

  1. #ifndef _ABIBITS_SOCKET_H
  2. #define _ABIBITS_SOCKET_H
  3. #include <stddef.h>
  4. #include <bits/posix/iovec.h>
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. typedef unsigned short sa_family_t;
  9. struct msghdr {
  10. void *msg_name;
  11. int msg_namelen;
  12. struct iovec *msg_iov;
  13. size_t msg_iovlen;
  14. void *msg_control;
  15. size_t msg_controllen;
  16. unsigned int msg_flags;
  17. };
  18. struct sockaddr_storage {
  19. sa_family_t ss_family;
  20. char __padding[128 - sizeof(sa_family_t)];
  21. };
  22. #ifdef __cplusplus
  23. }
  24. #endif
  25. #define SHUT_RD 0
  26. #define SHUT_WR 1
  27. #define SHUT_RDWR 2
  28. #ifndef SOCK_STREAM
  29. #define SOCK_STREAM 1
  30. #define SOCK_DGRAM 2
  31. #endif
  32. #define SOCK_RAW 3
  33. #define SOCK_RDM 4
  34. #define SOCK_SEQPACKET 5
  35. #define SOCK_DCCP 6
  36. #define SOCK_PACKET 10
  37. #ifndef SOCK_CLOEXEC
  38. #define SOCK_CLOEXEC 02000000
  39. #define SOCK_NONBLOCK 04000
  40. #endif
  41. #define PF_UNSPEC 0
  42. #define PF_LOCAL 1
  43. #define PF_UNIX PF_LOCAL
  44. #define PF_FILE PF_LOCAL
  45. #define PF_INET 2
  46. #define PF_AX25 3
  47. #define PF_IPX 4
  48. #define PF_APPLETALK 5
  49. #define PF_NETROM 6
  50. #define PF_BRIDGE 7
  51. #define PF_ATMPVC 8
  52. #define PF_X25 9
  53. #define PF_INET6 10
  54. #define PF_ROSE 11
  55. #define PF_DECnet 12
  56. #define PF_NETBEUI 13
  57. #define PF_SECURITY 14
  58. #define PF_KEY 15
  59. #define PF_NETLINK 16
  60. #define PF_ROUTE PF_NETLINK
  61. #define PF_PACKET 17
  62. #define PF_ASH 18
  63. #define PF_ECONET 19
  64. #define PF_ATMSVC 20
  65. #define PF_RDS 21
  66. #define PF_SNA 22
  67. #define PF_IRDA 23
  68. #define PF_PPPOX 24
  69. #define PF_WANPIPE 25
  70. #define PF_LLC 26
  71. #define PF_IB 27
  72. #define PF_MPLS 28
  73. #define PF_CAN 29
  74. #define PF_TIPC 30
  75. #define PF_BLUETOOTH 31
  76. #define PF_IUCV 32
  77. #define PF_RXRPC 33
  78. #define PF_ISDN 34
  79. #define PF_PHONET 35
  80. #define PF_IEEE802154 36
  81. #define PF_CAIF 37
  82. #define PF_ALG 38
  83. #define PF_NFC 39
  84. #define PF_VSOCK 40
  85. #define PF_KCM 41
  86. #define PF_QIPCRTR 42
  87. #define PF_SMC 43
  88. #define PF_XDP 44
  89. #define PF_MAX 45
  90. #define AF_UNSPEC PF_UNSPEC
  91. #define AF_LOCAL PF_LOCAL
  92. #define AF_UNIX AF_LOCAL
  93. #define AF_FILE AF_LOCAL
  94. #define AF_INET PF_INET
  95. #define AF_AX25 PF_AX25
  96. #define AF_IPX PF_IPX
  97. #define AF_APPLETALK PF_APPLETALK
  98. #define AF_NETROM PF_NETROM
  99. #define AF_BRIDGE PF_BRIDGE
  100. #define AF_ATMPVC PF_ATMPVC
  101. #define AF_X25 PF_X25
  102. #define AF_INET6 PF_INET6
  103. #define AF_ROSE PF_ROSE
  104. #define AF_DECnet PF_DECnet
  105. #define AF_NETBEUI PF_NETBEUI
  106. #define AF_SECURITY PF_SECURITY
  107. #define AF_KEY PF_KEY
  108. #define AF_NETLINK PF_NETLINK
  109. #define AF_ROUTE PF_ROUTE
  110. #define AF_PACKET PF_PACKET
  111. #define AF_ASH PF_ASH
  112. #define AF_ECONET PF_ECONET
  113. #define AF_ATMSVC PF_ATMSVC
  114. #define AF_RDS PF_RDS
  115. #define AF_SNA PF_SNA
  116. #define AF_IRDA PF_IRDA
  117. #define AF_PPPOX PF_PPPOX
  118. #define AF_WANPIPE PF_WANPIPE
  119. #define AF_LLC PF_LLC
  120. #define AF_IB PF_IB
  121. #define AF_MPLS PF_MPLS
  122. #define AF_CAN PF_CAN
  123. #define AF_TIPC PF_TIPC
  124. #define AF_BLUETOOTH PF_BLUETOOTH
  125. #define AF_IUCV PF_IUCV
  126. #define AF_RXRPC PF_RXRPC
  127. #define AF_ISDN PF_ISDN
  128. #define AF_PHONET PF_PHONET
  129. #define AF_IEEE802154 PF_IEEE802154
  130. #define AF_CAIF PF_CAIF
  131. #define AF_ALG PF_ALG
  132. #define AF_NFC PF_NFC
  133. #define AF_VSOCK PF_VSOCK
  134. #define AF_KCM PF_KCM
  135. #define AF_QIPCRTR PF_QIPCRTR
  136. #define AF_SMC PF_SMC
  137. #define AF_XDP PF_XDP
  138. #define AF_MAX PF_MAX
  139. #define SO_REUSEADDR 2
  140. #define SO_TYPE 3
  141. #define SO_ERROR 4
  142. #define SO_DONTROUTE 5
  143. #define SO_BROADCAST 6
  144. #define SO_SNDBUF 7
  145. #define SO_RCVBUF 8
  146. #define SO_KEEPALIVE 9
  147. #define SO_OOBINLINE 10
  148. #define SO_NO_CHECK 11
  149. #define SO_PRIORITY 12
  150. #define SO_LINGER 13
  151. #define SO_BSDCOMPAT 14
  152. #define SO_REUSEPORT 15
  153. #define SO_PASSCRED 16
  154. #define SO_PEERCRED 17
  155. #define SO_RCVLOWAT 18
  156. #define SO_SNDLOWAT 19
  157. #define SO_ACCEPTCONN 30
  158. #define SO_PEERSEC 31
  159. #define SO_SNDBUFFORCE 32
  160. #define SO_RCVBUFFORCE 33
  161. #define SO_PROTOCOL 38
  162. #define SO_DOMAIN 39
  163. #define SO_RCVTIMEO 20
  164. #define SO_SNDTIMEO 21
  165. #define SO_TIMESTAMP 29
  166. #define SO_TIMESTAMPNS 35
  167. #define SO_TIMESTAMPING 37
  168. #define SO_SECURITY_AUTHENTICATION 22
  169. #define SO_SECURITY_ENCRYPTION_TRANSPORT 23
  170. #define SO_SECURITY_ENCRYPTION_NETWORK 24
  171. #define SO_BINDTODEVICE 25
  172. #define SO_ATTACH_FILTER 26
  173. #define SO_DETACH_FILTER 27
  174. #define SO_GET_FILTER SO_ATTACH_FILTER
  175. #define SO_PEERNAME 28
  176. #define SCM_TIMESTAMP SO_TIMESTAMP
  177. #define SO_PASSSEC 34
  178. #define SCM_TIMESTAMPNS SO_TIMESTAMPNS
  179. #define SO_MARK 36
  180. #define SCM_TIMESTAMPING SO_TIMESTAMPING
  181. #define SO_RXQ_OVFL 40
  182. #define SO_WIFI_STATUS 41
  183. #define SCM_WIFI_STATUS SO_WIFI_STATUS
  184. #define SO_PEEK_OFF 42
  185. #define SO_NOFCS 43
  186. #define SO_LOCK_FILTER 44
  187. #define SO_SELECT_ERR_QUEUE 45
  188. #define SO_BUSY_POLL 46
  189. #define SO_MAX_PACING_RATE 47
  190. #define SO_BPF_EXTENSIONS 48
  191. #define SO_INCOMING_CPU 49
  192. #define SO_ATTACH_BPF 50
  193. #define SO_DETACH_BPF SO_DETACH_FILTER
  194. #define SO_ATTACH_REUSEPORT_CBPF 51
  195. #define SO_ATTACH_REUSEPORT_EBPF 52
  196. #define SO_CNX_ADVICE 53
  197. #define SCM_TIMESTAMPING_OPT_STATS 54
  198. #define SO_MEMINFO 55
  199. #define SO_INCOMING_NAPI_ID 56
  200. #define SO_COOKIE 57
  201. #define SCM_TIMESTAMPING_PKTINFO 58
  202. #define SO_PEERGROUPS 59
  203. #define SO_ZEROCOPY 60
  204. #define SO_TXTIME 61
  205. #define SCM_TXTIME SO_TXTIME
  206. #define SO_BINDTOIFINDEX 62
  207. #define SO_DETACH_REUSEPORT_BPF 68
  208. #define SOL_SOCKET 1
  209. #define SOL_IP 0
  210. #define SOL_IPV6 41
  211. #define SOL_ICMPV6 58
  212. #define SOL_RAW 255
  213. #define SOL_DECNET 261
  214. #define SOL_X25 262
  215. #define SOL_PACKET 263
  216. #define SOL_ATM 264
  217. #define SOL_AAL 265
  218. #define SOL_IRDA 266
  219. #define SOL_NETBEUI 267
  220. #define SOL_LLC 268
  221. #define SOL_DCCP 269
  222. #define SOL_NETLINK 270
  223. #define SOL_TIPC 271
  224. #define SOL_RXRPC 272
  225. #define SOL_PPPOL2TP 273
  226. #define SOL_BLUETOOTH 274
  227. #define SOL_PNPIPE 275
  228. #define SOL_RDS 276
  229. #define SOL_IUCV 277
  230. #define SOL_CAIF 278
  231. #define SOL_ALG 279
  232. #define SOL_NFC 280
  233. #define SOL_KCM 281
  234. #define SOL_TLS 282
  235. #define SOL_XDP 283
  236. #define SOMAXCONN 128
  237. #define MSG_OOB 0x0001
  238. #define MSG_PEEK 0x0002
  239. #define MSG_DONTROUTE 0x0004
  240. #define MSG_CTRUNC 0x0008
  241. #define MSG_PROXY 0x0010
  242. #define MSG_TRUNC 0x0020
  243. #define MSG_DONTWAIT 0x0040
  244. #define MSG_EOR 0x0080
  245. #define MSG_WAITALL 0x0100
  246. #define MSG_FIN 0x0200
  247. #define MSG_SYN 0x0400
  248. #define MSG_CONFIRM 0x0800
  249. #define MSG_RST 0x1000
  250. #define MSG_ERRQUEUE 0x2000
  251. #define MSG_NOSIGNAL 0x4000
  252. #define MSG_MORE 0x8000
  253. #define MSG_WAITFORONE 0x10000
  254. #define MSG_BATCH 0x40000
  255. #define MSG_ZEROCOPY 0x4000000
  256. #define MSG_FASTOPEN 0x20000000
  257. #define MSG_CMSG_CLOEXEC 0x40000000
  258. #endif