1 //Written in the D programming language
2 
3 /++
4     D header file for FreeBSD's extensions to POSIX's netinet/in.h.
5 
6     Copyright: Copyright 2017 -
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.netinet.in_;
11 
12 import core.sys.freebsd.sys.cdefs;
13 
14 public import core.sys.posix.netinet.in_;
15 
16 version (FreeBSD):
17 
18 extern(C) nothrow @nogc:
19 
20 static if (__BSD_VISIBLE)
21 {
22     enum IPPROTO_HOPOPTS   = 0;
23 
24     enum IPPROTO_IPV4      = 4;
25     enum IPPROTO_IPIP      = IPPROTO_IPV4;
26     enum IPPROTO_ST        = 7;
27     enum IPPROTO_EGP       = 8;
28     enum IPPROTO_PIGP      = 9;
29     enum IPPROTO_RCCMON    = 10;
30     enum IPPROTO_NVPII     = 11;
31 
32     enum IPPROTO_ARGUS     = 13;
33     enum IPPROTO_EMCON     = 14;
34     enum IPPROTO_XNET      = 15;
35     enum IPPROTO_CHAOS     = 16;
36     enum IPPROTO_MUX       = 18;
37     enum IPPROTO_MEAS      = 19;
38     enum IPPROTO_HMP       = 20;
39     enum IPPROTO_PRM       = 21;
40 
41     enum IPPROTO_TRUNK1    = 23;
42     enum IPPROTO_TRUNK2    = 24;
43     enum IPPROTO_LEAF1     = 25;
44     enum IPPROTO_LEAF2     = 26;
45     enum IPPROTO_RDP       = 27;
46     enum IPPROTO_IRTP      = 28;
47     enum IPPROTO_TP        = 29;
48     enum IPPROTO_BLT       = 30;
49     enum IPPROTO_NSP       = 31;
50     enum IPPROTO_INP       = 32;
51     enum IPPROTO_SEP       = 33;
52     enum IPPROTO_3PC       = 34;
53     enum IPPROTO_IDPR      = 35;
54     enum IPPROTO_XTP       = 36;
55     enum IPPROTO_DDP       = 37;
56     enum IPPROTO_CMTP      = 38;
57     enum IPPROTO_TPXX      = 39;
58     enum IPPROTO_IL        = 40;
59     enum IPPROTO_SDRP      = 42;
60     enum IPPROTO_ROUTING   = 43;
61     enum IPPROTO_FRAGMENT  = 44;
62     enum IPPROTO_IDRP      = 45;
63     enum IPPROTO_RSVP      = 46;
64     enum IPPROTO_GRE       = 47;
65     enum IPPROTO_MHRP      = 48;
66     enum IPPROTO_BHA       = 49;
67     enum IPPROTO_ESP       = 50;
68     enum IPPROTO_AH        = 51;
69     enum IPPROTO_INLSP     = 52;
70     enum IPPROTO_SWIPE     = 53;
71     enum IPPROTO_NHRP      = 54;
72     enum IPPROTO_MOBILE    = 55;
73     enum IPPROTO_TLSP      = 56;
74     enum IPPROTO_SKIP      = 57;
75     enum IPPROTO_ICMPV6    = 58;
76     enum IPPROTO_NONE      = 59;
77     enum IPPROTO_DSTOPTS   = 60;
78     enum IPPROTO_AHIP      = 61;
79     enum IPPROTO_CFTP      = 62;
80     enum IPPROTO_HELLO     = 63;
81     enum IPPROTO_SATEXPAK  = 64;
82     enum IPPROTO_KRYPTOLAN = 65;
83     enum IPPROTO_RVD       = 66;
84     enum IPPROTO_IPPC      = 67;
85     enum IPPROTO_ADFS      = 68;
86     enum IPPROTO_SATMON    = 69;
87     enum IPPROTO_VISA      = 70;
88     enum IPPROTO_IPCV      = 71;
89     enum IPPROTO_CPNX      = 72;
90     enum IPPROTO_CPHB      = 73;
91     enum IPPROTO_WSN       = 74;
92     enum IPPROTO_PVP       = 75;
93     enum IPPROTO_BRSATMON  = 76;
94 
95     enum IPPROTO_WBMON     = 78;
96     enum IPPROTO_WBEXPAK   = 79;
97     enum IPPROTO_EON       = 80;
98     enum IPPROTO_VMTP      = 81;
99     enum IPPROTO_SVMTP     = 82;
100     enum IPPROTO_VINES     = 83;
101     enum IPPROTO_TTP       = 84;
102     enum IPPROTO_IGP       = 85;
103     enum IPPROTO_DGP       = 86;
104     enum IPPROTO_TCF       = 87;
105     enum IPPROTO_IGRP      = 88;
106     enum IPPROTO_OSPFIGP   = 89;
107     enum IPPROTO_SRPC      = 90;
108     enum IPPROTO_LARP      = 91;
109     enum IPPROTO_MTP       = 92;
110     enum IPPROTO_AX25      = 93;
111     enum IPPROTO_IPEIP     = 94;
112     enum IPPROTO_MICP      = 95;
113     enum IPPROTO_SCCSP     = 96;
114     enum IPPROTO_ETHERIP   = 97;
115     enum IPPROTO_ENCAP     = 98;
116     enum IPPROTO_APES      = 99;
117     enum IPPROTO_GMTP      = 100;
118     enum IPPROTO_IPCOMP    = 108;
119     enum IPPROTO_SCTP      = 132;
120     enum IPPROTO_MH        = 135;
121     enum IPPROTO_UDPLITE   = 136;
122     enum IPPROTO_HIP       = 139;
123     enum IPPROTO_SHIM6     = 140;
124 
125     enum IPPROTO_PIM          = 103;
126     enum IPPROTO_CARP         = 112;
127     enum IPPROTO_PGM          = 113;
128     enum IPPROTO_MPLS         = 137;
129     enum IPPROTO_PFSYNC       = 240;
130     enum IPPROTO_RESERVED_253 = 253;
131     enum IPPROTO_RESERVED_254 = 254;
132 
133     enum IPPROTO_DONE = 257;
134 
135     enum IPPORT_RESERVED = 1024;
136 
137     enum IPPORT_EPHEMERALFIRST = 10000;
138     enum IPPORT_EPHEMERALLAST  = 65535;
139 
140     enum IPPORT_HIFIRSTAUTO = 49152;
141     enum IPPORT_HILASTAUTO  = 65535;
142 
143     enum IPPORT_RESERVEDSTART = 600;
144 
145     enum IPPORT_MAX = 65535;
146 
147     extern(D) bool IN_CLASSA(in_addr_t i) pure @safe { return (i & 0x80000000) == 0; }
148     enum IN_CLASSA_NET    = 0xff000000;
149     enum IN_CLASSA_NSHIFT = 24;
150     enum IN_CLASSA_HOST   = 0x00ffffff;
151     enum IN_CLASSA_MAX    = 128;
152 
153     extern(D) bool IN_CLASSB(in_addr_t i) pure @safe { return (i & 0xc0000000) == 0x80000000; }
154     enum IN_CLASSB_NET    = 0xffff0000;
155     enum IN_CLASSB_NSHIFT = 16;
156     enum IN_CLASSB_HOST   = 0x0000ffff;
157     enum IN_CLASSB_MAX    = 65536;
158 
159     extern(D) bool IN_CLASSC(in_addr_t i) pure @safe { return (i & 0xe0000000) == 0xc0000000; }
160     enum IN_CLASSC_NET    = 0xffffff00;
161     enum IN_CLASSC_NSHIFT = 8;
162     enum IN_CLASSC_HOST   = 0x000000ff;
163 
164     extern(D) bool IN_CLASSD(in_addr_t i) pure @safe { return (i & 0xf0000000) == 0xe0000000; }
165     enum IN_CLASSD_NET     = 0xf0000000;
166     enum IN_CLASSD_NSHIFT  = 28;
167     enum IN_CLASSD_HOST    = 0x0fffffff;
168     extern(D) bool IN_MULTICAST(in_addr_t i) { return IN_CLASSD(i); }
169 
170     // The fact that these are identical looks suspicious (they're not quite
171     // identical on Linux). However, this _is_ how they're defined in FreeBSD
172     // and on OS X. So, while it _might_ be a bug, if it is, it's an upstream
173     // one, and we're compatible with it.
174     extern(D) bool IN_EXPERIMENTAL(in_addr_t i) pure @safe { return (i & 0xf0000000) == 0xf0000000; }
175     extern(D) bool IN_BADCLASS(in_addr_t i) pure @safe { return (i & 0xf0000000) == 0xf0000000; }
176 
177     extern(D) bool IN_LINKLOCAL(in_addr_t i) pure @safe { return (i & 0xffff0000) == 0xa9fe0000; }
178     extern(D) bool IN_LOOPBACK(in_addr_t i) pure @safe { return (i & 0xff000000) == 0x7f000000; }
179     extern(D) bool IN_ZERONET(in_addr_t i) pure @safe { return (i & 0xff000000) == 0; }
180 
181     extern(D) bool IN_PRIVATE(in_addr_t i) pure @safe
182     {
183         return  (i & 0xff000000) == 0x0a000000 ||
184                 (i & 0xfff00000) == 0xac100000 ||
185                 (i & 0xffff0000) == 0xc0a80000;
186     }
187 
188     extern(D) bool IN_LOCAL_GROUP(in_addr_t i) pure @safe { return (i & 0xffffff00) == 0xe0000000; }
189 
190     extern(D) bool IN_ANY_LOCAL(in_addr_t i) pure @safe { return IN_LINKLOCAL(i) || IN_LOCAL_GROUP(i); }
191 
192     enum INADDR_UNSPEC_GROUP    = 0xe0000000;
193     enum INADDR_ALLHOSTS_GROUP  = 0xe0000001;
194     enum INADDR_ALLRTRS_GROUP   = 0xe0000002;
195     enum INADDR_ALLRPTS_GROUP   = 0xe0000016;
196     enum INADDR_CARP_GROUP      = 0xe0000012;
197     enum INADDR_PFSYNC_GROUP    = 0xe00000f0;
198     enum INADDR_ALLMDNS_GROUP   = 0xe00000fb;
199     enum INADDR_MAX_LOCAL_GROUP = 0xe00000ff;
200 
201     enum IN_LOOPBACKNET = 127;
202 
203     enum IN_RFC3021_MASK = 0xfffffffe;
204 
205     enum IP_OPTIONS      = 1;
206     enum IP_HDRINCL      = 2;
207     enum IP_TOS          = 3;
208     enum IP_TTL          = 4;
209     enum IP_RECVOPTS     = 5;
210     enum IP_RECVRETOPTS  = 6;
211     enum IP_RECVDSTADDR  = 7;
212     enum IP_SENDSRCADDR  = IP_RECVDSTADDR;
213     enum IP_RETOPTS      = 8;
214     enum IP_MULTICAST_IF = 9;
215 
216     enum IP_MULTICAST_TTL   = 10;
217     enum IP_MULTICAST_LOOP  = 11;
218     enum IP_ADD_MEMBERSHIP  = 12;
219     enum IP_DROP_MEMBERSHIP = 13;
220     enum IP_MULTICAST_VIF   = 14;
221     enum IP_RSVP_ON         = 15;
222     enum IP_RSVP_OFF        = 16;
223     enum IP_RSVP_VIF_ON     = 17;
224     enum IP_RSVP_VIF_OFF    = 18;
225     enum IP_PORTRANGE       = 19;
226     enum IP_RECVIF          = 20;
227 
228     enum IP_IPSEC_POLICY = 21;
229 
230     enum IP_ONESBCAST         = 23;
231     enum IP_BINDANY           = 24;
232     enum IP_BINDMULTI         = 25;
233     enum IP_RSS_LISTEN_BUCKET = 26;
234     enum IP_ORIGDSTADDR       = 27;
235     enum IP_RECVORIGDSTADDR   = IP_ORIGDSTADDR;
236 
237     enum IP_FW3       = 48;
238     enum IP_DUMMYNET3 = 49;
239 
240     enum IP_ADD_SOURCE_MEMBERSHIP  = 70;
241     enum IP_DROP_SOURCE_MEMBERSHIP = 71;
242     enum IP_BLOCK_SOURCE           = 72;
243     enum IP_UNBLOCK_SOURCE         = 73;
244 
245     enum MCAST_JOIN_GROUP         = 80;
246     enum MCAST_LEAVE_GROUP        = 81;
247     enum MCAST_JOIN_SOURCE_GROUP  = 82;
248     enum MCAST_LEAVE_SOURCE_GROUP = 83;
249     enum MCAST_BLOCK_SOURCE       = 84;
250     enum MCAST_UNBLOCK_SOURCE     = 85;
251 
252     enum IP_FLOWID          = 90;
253     enum IP_FLOWTYPE        = 91;
254     enum IP_RSSBUCKETID     = 92;
255     enum IP_RECVFLOWID      = 93;
256     enum IP_RECVRSSBUCKETID = 94;
257 
258     enum IP_DEFAULT_MULTICAST_TTL  = 1;
259     enum IP_DEFAULT_MULTICAST_LOOP = 1;
260 
261     enum IP_MIN_MEMBERSHIPS   = 31;
262     enum IP_MAX_MEMBERSHIPS   = 4095;
263 
264     enum IP_MAX_GROUP_SRC_FILTER = 512;
265     enum IP_MAX_SOCK_SRC_FILTER  = 128;
266 
267     struct ip_mreq
268     {
269         in_addr imr_multiaddr;
270         in_addr imr_interface;
271     }
272 
273     struct ip_mreqn
274     {
275         in_addr imr_multiaddr;
276         in_addr imr_address;
277         int     imr_ifindex;
278     }
279 
280     struct ip_mreq_source
281     {
282         in_addr imr_multiaddr;
283         in_addr imr_sourceaddr;
284         in_addr imr_interface;
285     }
286 
287     struct group_req
288     {
289         uint gr_interface;
290         sockaddr_storage gr_group;
291     }
292 
293     struct group_source_req
294     {
295         uint gsr_interface;
296         sockaddr_storage gsr_group;
297         sockaddr_storage gsr_source;
298     }
299 
300     int setipv4sourcefilter(int, in_addr, in_addr, uint, uint, in_addr*);
301     int getipv4sourcefilter(int, in_addr, in_addr, uint*, uint*, in_addr*);
302     int setsourcefilter(int, uint, sockaddr*, socklen_t, uint, uint, sockaddr_storage*);
303     int getsourcefilter(int, uint, sockaddr*, socklen_t, uint*, uint*, sockaddr_storage*);
304 
305     enum MCAST_UNDEFINED = 0;
306     enum MCAST_INCLUDE   = 1;
307     enum MCAST_EXCLUDE   = 2;
308 
309     enum IP_PORTRANGE_DEFAULT = 0;
310     enum IP_PORTRANGE_HIGH    = 1;
311     enum IP_PORTRANGE_LOW     = 2;
312 
313     enum IPCTL_FORWARDING        = 1;
314     enum IPCTL_SENDREDIRECTS     = 2;
315     enum IPCTL_DEFTTL            = 3;
316     enum IPCTL_DEFMTU            = 4;
317     enum IPCTL_SOURCEROUTE       = 8;
318     enum IPCTL_DIRECTEDBROADCAST = 9;
319     enum IPCTL_INTRQMAXLEN       = 10;
320     enum IPCTL_INTRQDROPS        = 11;
321     enum IPCTL_STATS             = 12;
322     enum IPCTL_ACCEPTSOURCEROUTE = 13;
323     enum IPCTL_FASTFORWARDING    = 14;
324     enum IPCTL_GIF_TTL           = 16;
325     enum IPCTL_INTRDQMAXLEN      = 17;
326     enum IPCTL_INTRDQDROPS       = 18;
327 }
328 
329 // =============================================================================
330 // What follows is from netinet6/in6.h, but since netinet6/in6.h specifically
331 // says that it should only be #included by #including netinet/in.h, it makes
332 // more sense to put them in here so that the way they're imported corresponds
333 // with the correct way of #including them in C/C++.
334 // =============================================================================
335 
336 // The #if was around the #include of in6.h at the end of in.h.
337 static if (__POSIX_VISIBLE)
338 {
339     static if (__BSD_VISIBLE)
340     {
341         enum IPV6PORT_RESERVED    = 1024;
342         enum IPV6PORT_ANONMIN     = 49152;
343         enum IPV6PORT_ANONMAX     = 65535;
344         enum IPV6PORT_RESERVEDMIN = 600;
345         enum IPV6PORT_RESERVEDMAX = IPV6PORT_RESERVED - 1;
346 
347         enum IN6ADDR_ANY_INIT = in6_addr.init;
348         enum IN6ADDR_LOOPBACK_INIT = in6_addr([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
349                                                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01]);
350         enum IN6ADDR_NODELOCAL_ALLNODES_INIT = in6_addr([0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
351                                                          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01]);
352         enum IN6ADDR_INTFACELOCAL_ALLNODES_INIT = in6_addr([0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
353                                                             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01]);
354         enum IN6ADDR_LINKLOCAL_ALLNODES_INIT = in6_addr([0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
355                                                          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01]);
356         enum IN6ADDR_LINKLOCAL_ALLROUTERS_INIT = in6_addr([0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
357                                                            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02]);
358         enum IN6ADDR_LINKLOCAL_ALLV2ROUTERS_INIT = in6_addr([0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
359                                                              0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16]);
360 
361         __gshared const in6_addr in6addr_nodelocal_allnodes;
362         __gshared const in6_addr in6addr_linklocal_allnodes;
363         __gshared const in6_addr in6addr_linklocal_allrouters;
364         __gshared const in6_addr in6addr_linklocal_allv2routers;
365 
366         extern(D) bool IN6_ARE_ADDR_EQUAL(in6_addr* a, in6_addr* b) pure @safe { return *a == *b; }
367     }
368 
369     enum __IPV6_ADDR_SCOPE_NODELOCAL    = 0x01;
370     enum __IPV6_ADDR_SCOPE_INTFACELOCAL = 0x01;
371     enum __IPV6_ADDR_SCOPE_LINKLOCAL    = 0x02;
372     enum __IPV6_ADDR_SCOPE_SITELOCAL    = 0x05;
373     enum __IPV6_ADDR_SCOPE_GLOBAL       = 0x0e;
374 
375     static if (__BSD_VISIBLE)
376     {
377 // TODO - requires declarations from elsewhere that we don't currently have bindings for.
378 /+
379         struct route_in6
380         {
381             rtentry* ro_rt;
382             llentry* ro_lle;
383             char*    ro_prepend;
384             ushort   ro_plen;
385             ushort   ro_flags;
386             ushort   ro_mtu;
387             ushort   spare;
388             sockaddr_in6 ro_dst;
389         };
390  +/
391     }
392 
393     enum IPV6_SOCKOPT_RESERVED1 = 3;
394     enum IPV6_PORTRANGE         = 14;
395     enum ICMP6_FILTER           = 18;
396 
397     enum IPV6_CHECKSUM = 26;
398 
399     enum IPV6_IPSEC_POLICY = 28;
400 
401     enum IPV6_FW_ADD   = 30;
402     enum IPV6_FW_DEL   = 31;
403     enum IPV6_FW_FLUSH = 32;
404     enum IPV6_FW_ZERO  = 33;
405     enum IPV6_FW_GET   = 34;
406 
407     enum IPV6_RTHDRDSTOPTS = 35;
408 
409     enum IPV6_RECVPKTINFO  = 36;
410     enum IPV6_RECVHOPLIMIT = 37;
411     enum IPV6_RECVRTHDR    = 38;
412     enum IPV6_RECVHOPOPTS  = 39;
413     enum IPV6_RECVDSTOPTS  = 40;
414 
415     enum IPV6_USE_MIN_MTU = 42;
416     enum IPV6_RECVPATHMTU = 43;
417 
418     enum IPV6_PATHMTU = 44;
419 
420     enum IPV6_PKTINFO  = 46;
421     enum IPV6_HOPLIMIT = 47;
422     enum IPV6_NEXTHOP  = 48;
423     enum IPV6_HOPOPTS  = 49;
424     enum IPV6_DSTOPTS  = 50;
425     enum IPV6_RTHDR    = 51;
426 
427     enum IPV6_RECVTCLASS = 57;
428 
429     enum IPV6_AUTOFLOWLABEL = 59;
430 
431     enum IPV6_TCLASS   = 61;
432     enum IPV6_DONTFRAG = 62;
433 
434     enum IPV6_PREFER_TEMPADDR = 63;
435 
436     enum IPV6_BINDANY   = 64;
437 
438     enum IPV6_BINDMULTI         = 65;
439     enum IPV6_RSS_LISTEN_BUCKET = 66;
440     enum IPV6_FLOWID            = 67;
441     enum IPV6_FLOWTYPE          = 68;
442     enum IPV6_RSSBUCKETID       = 69;
443     enum IPV6_RECVFLOWID        = 70;
444     enum IPV6_RECVRSSBUCKETID   = 71;
445 
446     enum IPV6_ORIGDSTADDR     = 72;
447     enum IPV6_RECVORIGDSTADDR = IPV6_ORIGDSTADDR;
448 
449     enum IPV6_RTHDR_LOOSE  = 0;
450     enum IPV6_RTHDR_STRICT = 1;
451     enum IPV6_RTHDR_TYPE_0 = 0;
452 
453     enum IPV6_DEFAULT_MULTICAST_HOPS = 1;
454     enum IPV6_DEFAULT_MULTICAST_LOOP = 1;
455 
456     enum IPV6_MIN_MEMBERSHIPS = 31;
457     enum IPV6_MAX_MEMBERSHIPS = 4095;
458 
459     enum IPV6_MAX_GROUP_SRC_FILTER = 512;
460     enum IPV6_MAX_SOCK_SRC_FILTER  = 128;
461 
462     struct in6_pktinfo
463     {
464         in6_addr ipi6_addr;
465         uint     ipi6_ifindex;
466     }
467 
468     struct ip6_mtuinfo
469     {
470         sockaddr_in6 ip6m_addr;
471         uint         ip6m_mtu;
472     }
473 
474     enum IPV6_PORTRANGE_DEFAULT = 0;
475     enum IPV6_PORTRANGE_HIGH    = 1;
476     enum IPV6_PORTRANGE_LOW     = 2;
477 
478     static if (__BSD_VISIBLE)
479     {
480         enum IPV6PROTO_MAXID =  IPPROTO_PIM + 1;
481 
482         enum IPV6CTL_FORWARDING         = 1;
483         enum IPV6CTL_SENDREDIRECTS      = 2;
484         enum IPV6CTL_DEFHLIM            = 3;
485         enum IPV6CTL_DEFMTU             = 4;
486         enum IPV6CTL_FORWSRCRT          = 5;
487         enum IPV6CTL_STATS              = 6;
488         enum IPV6CTL_MRTSTATS           = 7;
489         enum IPV6CTL_MRTPROTO           = 8;
490         enum IPV6CTL_MAXFRAGPACKETS     = 9;
491         enum IPV6CTL_SOURCECHECK        = 10;
492         enum IPV6CTL_SOURCECHECK_LOGINT = 11;
493         enum IPV6CTL_ACCEPT_RTADV       = 12;
494 
495         enum IPV6CTL_LOG_INTERVAL   = 14;
496         enum IPV6CTL_HDRNESTLIMIT   = 15;
497         enum IPV6CTL_DAD_COUNT      = 16;
498         enum IPV6CTL_AUTO_FLOWLABEL = 17;
499         enum IPV6CTL_DEFMCASTHLIM   = 18;
500         enum IPV6CTL_GIF_HLIM       = 19;
501         enum IPV6CTL_KAME_VERSION   = 20;
502         enum IPV6CTL_USE_DEPRECATED = 21;
503         enum IPV6CTL_RR_PRUNE       = 22;
504         enum IPV6CTL_V6ONLY         = 24;
505 
506         enum IPV6CTL_USETEMPADDR     = 32;
507         enum IPV6CTL_TEMPPLTIME      = 33;
508         enum IPV6CTL_TEMPVLTIME      = 34;
509         enum IPV6CTL_AUTO_LINKLOCAL  = 35;
510         enum IPV6CTL_RIP6STATS       = 36;
511         enum IPV6CTL_PREFER_TEMPADDR = 37;
512         enum IPV6CTL_ADDRCTLPOLICY   = 38;
513         enum IPV6CTL_USE_DEFAULTZONE = 39;
514 
515         enum IPV6CTL_MAXFRAGS   = 41;
516         enum IPV6CTL_MCAST_PMTU = 44;
517 
518         enum IPV6CTL_STEALTH = 45;
519 
520         enum ICMPV6CTL_ND6_ONLINKNSRFC4861 = 47;
521         enum IPV6CTL_NO_RADR     = 48;
522         enum IPV6CTL_NORBIT_RAIF = 49;
523 
524         enum IPV6CTL_RFC6204W3 = 50;
525 
526         enum IPV6CTL_INTRQMAXLEN  = 51;
527         enum IPV6CTL_INTRDQMAXLEN = 52;
528 
529         enum IPV6CTL_MAXID = 53;
530     }
531 
532 // TODO - require declarations from elsewhere that we don't currently have bindings for.
533 /+
534     enum M_FASTFWD_OURS  = M_PROTO1;
535     enum M_IP6_NEXTHOP   = M_PROTO2;
536     enum M_IP_NEXTHOP    = M_PROTO2;
537     enum M_SKIP_FIREWALL = M_PROTO3;
538     enum M_AUTHIPHDR     = M_PROTO4;
539     enum M_DECRYPTED     = M_PROTO5;
540     enum M_LOOP          = M_PROTO6;
541     enum M_AUTHIPDGM     = M_PROTO7;
542     enum M_RTALERT_MLD   = M_PROTO8;
543  +/
544 
545     static if (__BSD_VISIBLE)
546     {
547         size_t inet6_rthdr_space(int, int) @trusted;
548         cmsghdr* inet6_rthdr_init(void*, int);
549         int inet6_rthdr_add(cmsghdr*, const in6_addr*, uint);
550         int inet6_rthdr_lasthop(cmsghdr*, uint);
551         int inet6_rthdr_segments(const cmsghdr*);
552         in6_addr* inet6_rthdr_getaddr(cmsghdr*, int);
553         int inet6_rthdr_getflags(const cmsghdr*, int);
554 
555         int inet6_opt_init(void*, socklen_t);
556         int inet6_opt_append(void*, socklen_t, int, ubyte, socklen_t, ubyte, void**);
557         int inet6_opt_finish(void*, socklen_t, int);
558         int inet6_opt_set_val(void*, int, void*, socklen_t);
559 
560         int inet6_opt_next(void*, socklen_t, int, ubyte*, socklen_t*, void**);
561         int inet6_opt_find(void*, socklen_t, int, ubyte, socklen_t*, void**);
562         int inet6_opt_get_val(void*, int, void*, socklen_t);
563         socklen_t inet6_rth_space(int, int) @trusted;
564         void* inet6_rth_init(void*, socklen_t, int, int);
565         int inet6_rth_add(void*, const in6_addr*);
566         int inet6_rth_reverse(const void*, void*);
567         int inet6_rth_segments(const void*);
568         in6_addr* inet6_rth_getaddr(const void*, int);
569     }
570 }