The OpenD Programming Language

1 //Written in the D programming language
2 
3 /++
4     D header file for FreeBSD's extensions to POSIX's sys/socket.h.
5 
6     Copyright: Copyright 2023
7     License:   $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
8     Authors:   $(HTTP jmdavisprog.com, Jonathan M Davis)
9  +/
10 module core.sys.freebsd.sys.socket;
11 
12 public import core.sys.posix.sys.socket;
13 
14 version (FreeBSD):
15 extern(C):
16 @nogc:
17 nothrow:
18 
19 // Creation flags, OR'ed into socket() and socketpair() type argument.
20 enum : uint
21 {
22     SOCK_CLOEXEC  = 0x10000000,
23     SOCK_NONBLOCK = 0x20000000,
24 }
25 
26 // Option flags per-socket.
27 enum : uint
28 {
29     SO_USELOOPBACK  = 0x00000040,
30     SO_TIMESTAMP    = 0x00000400,
31     SO_ACCEPTFILTER = 0x00001000,
32     SO_BINTIME      = 0x00002000,
33 
34     SO_NO_OFFLOAD   = 0x00004000,
35     SO_NO_DDP       = 0x00008000,
36     SO_REUSEPORT_LB = 0x00010000,
37     SO_RERROR       = 0x00020000,
38 }
39 
40 
41 // Additional options, not kept in so_options.
42 enum : uint
43 {
44     SO_LABEL           = 0x1009,
45     SO_PEERLABEL       = 0x1010,
46     SO_LISTENQLIMIT    = 0x1011,
47     SO_LISTENQLEN      = 0x1012,
48     SO_LISTENINCQLEN   = 0x1013,
49     SO_SETFIB          = 0x1014,
50     SO_USER_COOKIE     = 0x1015,
51     SO_PROTOCOL        = 0x1016,
52     SO_PROTOTYPE       = SO_PROTOCOL,
53     SO_TS_CLOCK        = 0x1017,
54     SO_MAX_PACING_RATE = 0x1018,
55     SO_DOMAIN          = 0x1019,
56 
57     SO_TS_REALTIME_MICRO = 0,
58     SO_TS_BINTIME        = 1,
59     SO_TS_REALTIME       = 2,
60     SO_TS_MONOTONIC      = 3,
61     SO_TS_DEFAULT        = SO_TS_REALTIME_MICRO,
62     SO_TS_CLOCK_MAX      = SO_TS_MONOTONIC,
63 }
64 
65 /+
66    Space reserved for new socket options added by third-party vendors.
67    This range applies to all socket option levels.  New socket options
68    in FreeBSD should always use an option value less than SO_VENDOR.
69  +/
70 enum : uint
71 {
72     SO_VENDOR = 0x80000000,
73 }
74 
75 struct accept_filter_arg
76 {
77     char[16]      af_name;
78     char [256-16] af_arg;
79 }
80 
81 // Address families.
82 enum : uint
83 {
84     AF_LOCAL = AF_UNIX,
85 
86     AF_IMPLINK = 3,
87     AF_PUP     = 4,
88     AF_CHAOS   = 5,
89     AF_NETBIOS = 6,
90     AF_ISO     = 7,
91     AF_OSI     = AF_ISO,
92     AF_ECMA    = 8,
93     AF_DATAKIT = 9,
94     AF_CCITT   = 10,
95     AF_SNA     = 11,
96     AF_DECnet  = 12,
97     AF_DLI     = 13,
98     AF_LAT     = 14,
99     AF_HYLINK  = 15,
100 
101     AF_ROUTE       = 17,
102     AF_LINK        = 18,
103     pseudo_AF_XTP  = 19,
104     AF_COIP        = 20,
105     AF_CNT         = 21,
106     pseudo_AF_RTIP = 22,
107 
108     AF_SIP        = 24,
109     pseudo_AF_PIP = 25,
110     AF_ISDN       = 26,
111     AF_E164       = AF_ISDN,
112     pseudo_AF_KEY = 27,
113 
114     AF_NATM            = 29,
115     AF_ATM             = 30,
116     pseudo_AF_HDRCMPLT = 31,
117     AF_NETGRAPH        = 32,
118     AF_SLOW            = 33,
119     AF_SCLUSTER        = 34,
120     AF_ARP             = 35,
121     AF_BLUETOOTH       = 36,
122     AF_IEEE80211       = 37,
123     AF_NETLINK         = 38,
124 
125     AF_INET_SDP = 40,
126 
127     AF_INET6_SDP = 42,
128     AF_HYPERV    = 43,
129     AF_DIVERT    = 44,
130     AF_MAX       = 44,
131 }