initial commit
[glibc.git] / sysdeps / unix / bsd / bsd4.4 / kfreebsd / bits / in.h
1 /* Copyright (C) 1997, 2000, 2002 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA. */
18
19 /* FreeBSD version. */
20
21 #ifndef _NETINET_IN_H
22 # error "Never use <bits/in.h> directly; include <netinet/in.h> instead."
23 #endif
24
25 /* This is the FreeBSD version, do not assume a linux-based kernel. */
26 #define __USE_KERNEL_IPV6_DEFS 0
27
28 /* Link numbers. */
29 #define IMPLINK_IP 155
30 #define IMPLINK_LOWEXPER 156
31 #define IMPLINK_HIGHEXPER 158
32
33 #define IPPROTO_DIVERT 258 /* divert pseudo-protocol */
34
35 /* To select the IP level. */
36 #define SOL_IP 0
37
38 /*
39 * Options for use with [gs]etsockopt at the IP level.
40 * First word of comment is data type; bool is stored in int.
41 */
42 #define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */
43 #define IP_HDRINCL 2 /* int; header is included with data */
44 #define IP_TOS 3 /* int; IP type of service and preced. */
45 #define IP_TTL 4 /* int; IP time to live */
46 #define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */
47 #define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */
48 #define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */
49 #define IP_SENDSRCADDR IP_RECVDSTADDR /* cmsg_type to set src addr */
50 #define IP_RETOPTS 8 /* ip_opts; set/get IP options */
51 #define IP_MULTICAST_IF 9 /* struct in_addr *or* struct ip_mreqn;
52 * set/get IP multicast i/f */
53 #define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */
54 #define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */
55 #define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */
56 #define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */
57 #define IP_MULTICAST_VIF 14 /* set/get IP mcast virt. iface */
58 #define IP_RSVP_ON 15 /* enable RSVP in kernel */
59 #define IP_RSVP_OFF 16 /* disable RSVP in kernel */
60 #define IP_RSVP_VIF_ON 17 /* set RSVP per-vif socket */
61 #define IP_RSVP_VIF_OFF 18 /* unset RSVP per-vif socket */
62 #define IP_PORTRANGE 19 /* int; range to choose for unspec port */
63 #define IP_RECVIF 20 /* bool; receive reception if w/dgram */
64 /* for IPSEC */
65 #define IP_IPSEC_POLICY 21 /* int; set/get security policy */
66 #define IP_FAITH 22 /* bool; accept FAITH'ed connections */
67
68 #define IP_ONESBCAST 23 /* bool: send all-ones broadcast */
69 #define IP_NONLOCALOK 24 /* bool: allow bind to spoof non-local addresses;
70 requires kernel compile option IP_NONLOCALBIND */
71
72 #define IP_FW_TABLE_ADD 40 /* add entry */
73 #define IP_FW_TABLE_DEL 41 /* delete entry */
74 #define IP_FW_TABLE_FLUSH 42 /* flush table */
75 #define IP_FW_TABLE_GETSIZE 43 /* get table size */
76 #define IP_FW_TABLE_LIST 44 /* list table contents */
77
78 #define IP_FW_ADD 50 /* add a firewall rule to chain */
79 #define IP_FW_DEL 51 /* delete a firewall rule from chain */
80 #define IP_FW_FLUSH 52 /* flush firewall rule chain */
81 #define IP_FW_ZERO 53 /* clear single/all firewall counter(s) */
82 #define IP_FW_GET 54 /* get entire firewall rule chain */
83 #define IP_FW_RESETLOG 55 /* reset logging counters */
84
85 #define IP_FW_NAT_CFG 56 /* add/config a nat rule */
86 #define IP_FW_NAT_DEL 57 /* delete a nat rule */
87 #define IP_FW_NAT_GET_CONFIG 58 /* get configuration of a nat rule */
88 #define IP_FW_NAT_GET_LOG 59 /* get log of a nat rule */
89
90 #define IP_DUMMYNET_CONFIGURE 60 /* add/configure a dummynet pipe */
91 #define IP_DUMMYNET_DEL 61 /* delete a dummynet pipe from chain */
92 #define IP_DUMMYNET_FLUSH 62 /* flush dummynet */
93 #define IP_DUMMYNET_GET 64 /* get entire dummynet pipes */
94
95 #define IP_RECVTTL 65 /* bool; receive IP TTL w/dgram */
96 #define IP_MINTTL 66 /* minimum TTL for packet or drop */
97 #define IP_DONTFRAG 67 /* don't fragment packet */
98
99 /* IPv4 Source Filter Multicast API [RFC3678] */
100 #define IP_ADD_SOURCE_MEMBERSHIP 70 /* join a source-specific group */
101 #define IP_DROP_SOURCE_MEMBERSHIP 71 /* drop a single source */
102 #define IP_BLOCK_SOURCE 72 /* block a source */
103 #define IP_UNBLOCK_SOURCE 73 /* unblock a source */
104
105 /* The following option is private; do not use it from user applications. */
106 #define IP_MSFILTER 74 /* set/get filter list */
107
108 /* Protocol Independent Multicast API [RFC3678] */
109 #define MCAST_JOIN_GROUP 80 /* join an any-source group */
110 #define MCAST_LEAVE_GROUP 81 /* leave all sources for group */
111 #define MCAST_JOIN_SOURCE_GROUP 82 /* join a source-specific group */
112 #define MCAST_LEAVE_SOURCE_GROUP 83 /* leave a single source */
113 #define MCAST_BLOCK_SOURCE 84 /* block a source */
114 #define MCAST_UNBLOCK_SOURCE 85 /* unblock a source */
115
116 /*
117 * Defaults and limits for options
118 */
119 #define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */
120 #define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
121
122 /*
123 * The imo_membership vector for each socket is now dynamically allocated at
124 * run-time, bounded by USHRT_MAX, and is reallocated when needed, sized
125 * according to a power-of-two increment.
126 */
127 #define IP_MIN_MEMBERSHIPS 31
128 #define IP_MAX_MEMBERSHIPS 4095
129 #define IP_MAX_SOURCE_FILTER 1024 /* # of filters per socket, per group */
130
131 /*
132 * Filter modes; also used to represent per-socket filter mode internally.
133 */
134
135 #define MCAST_UNDEFINED 0 /* fmode: not yet defined */
136 #define MCAST_INCLUDE 1 /* fmode: include these source(s) */
137 #define MCAST_EXCLUDE 2 /* fmode: exclude these source(s) */
138
139 /*
140 * Argument for IP_PORTRANGE:
141 * - which range to search when port is unspecified at bind() or connect()
142 */
143 #define IP_PORTRANGE_DEFAULT 0 /* default range */
144 #define IP_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */
145 #define IP_PORTRANGE_LOW 2 /* "low" - vouchsafe security */
146
147 /*
148 * Names for IP sysctl objects
149 */
150 #define IPCTL_FORWARDING 1 /* act as router */
151 #define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */
152 #define IPCTL_DEFTTL 3 /* default TTL */
153 #ifdef notyet
154 #define IPCTL_DEFMTU 4 /* default MTU */
155 #endif
156 #define IPCTL_RTEXPIRE 5 /* cloned route expiration time */
157 #define IPCTL_RTMINEXPIRE 6 /* min value for expiration time */
158 #define IPCTL_RTMAXCACHE 7 /* trigger level for dynamic expire */
159 #define IPCTL_SOURCEROUTE 8 /* may perform source routes */
160 #define IPCTL_DIRECTEDBROADCAST 9 /* may re-broadcast received packets */
161 #define IPCTL_INTRQMAXLEN 10 /* max length of netisr queue */
162 #define IPCTL_INTRQDROPS 11 /* number of netisr q drops */
163 #define IPCTL_STATS 12 /* ipstat structure */
164 #define IPCTL_ACCEPTSOURCEROUTE 13 /* may accept source routed packets */
165 #define IPCTL_FASTFORWARDING 14 /* use fast IP forwarding code */
166 #define IPCTL_KEEPFAITH 15 /* FAITH IPv4->IPv6 translater ctl */
167 #define IPCTL_GIF_TTL 16 /* default TTL for gif encap packet */
168 #define IPCTL_MAXID 17
169
170 /* Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS.
171 The `ip_dst' field is used for the first-hop gateway when using a
172 source route (this gets put into the header proper). */
173 struct ip_opts
174 {
175 struct in_addr ip_dst; /* First hop; zero without source route. */
176 char ip_opts[40]; /* Actually variable in size. */
177 };
178
179 /* Options for use with `getsockopt' and `setsockopt' at the IPv6 level.
180 The first word in the comment at the right is the data type used;
181 "bool" means a boolean value stored in an `int'. */
182 #define IPV6_SOCKOPT_RESERVED1 3 /* reserved for future use */
183 #define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */
184 #define IPV6_MULTICAST_IF 9 /* u_int; set/get IP6 multicast i/f */
185 #define IPV6_MULTICAST_HOPS 10 /* int; set/get IP6 multicast hops */
186 #define IPV6_MULTICAST_LOOP 11 /* u_int; set/get IP6 multicast loopback */
187 #define IPV6_JOIN_GROUP 12 /* ip6_mreq; join a group membership */
188 #define IPV6_LEAVE_GROUP 13 /* ip6_mreq; leave a group membership */
189 #define IPV6_PORTRANGE 14 /* int; range to choose for unspec port */
190 #define ICMP6_FILTER 18 /* icmp6_filter; icmp6 filter */
191
192 #define IPV6_CHECKSUM 26 /* int; checksum offset for raw socket */
193 #define IPV6_V6ONLY 27 /* bool; make AF_INET6 sockets v6 only */
194
195 #define IPV6_IPSEC_POLICY 28 /* struct; get/set security policy */
196 #define IPV6_FAITH 29 /* bool; accept FAITH'ed connections */
197
198 #define IPV6_FW_ADD 30 /* add a firewall rule to chain */
199 #define IPV6_FW_DEL 31 /* delete a firewall rule from chain */
200 #define IPV6_FW_FLUSH 32 /* flush firewall rule chain */
201 #define IPV6_FW_ZERO 33 /* clear single/all firewall counter(s) */
202 #define IPV6_FW_GET 34 /* get entire firewall rule chain */
203 #define IPV6_RTHDRDSTOPTS 35 /* ip6_dest; send dst option before rthdr */
204
205 #define IPV6_RECVPKTINFO 36 /* bool; recv if, dst addr */
206 #define IPV6_RECVHOPLIMIT 37 /* bool; recv hop limit */
207 #define IPV6_RECVRTHDR 38 /* bool; recv routing header */
208 #define IPV6_RECVHOPOPTS 39 /* bool; recv hop-by-hop option */
209 #define IPV6_RECVDSTOPTS 40 /* bool; recv dst option after rthdr */
210
211 #define IPV6_USE_MIN_MTU 42 /* bool; send packets at the minimum MTU */
212 #define IPV6_RECVPATHMTU 43 /* bool; notify an according MTU */
213 #define IPV6_PATHMTU 44 /* mtuinfo; get the current path MTU (sopt),
214 4 bytes int; MTU notification (cmsg) */
215
216 #define IPV6_PKTINFO 46 /* in6_pktinfo; send if, src addr */
217 #define IPV6_HOPLIMIT 47 /* int; send hop limit */
218 #define IPV6_NEXTHOP 48 /* sockaddr; next hop addr */
219 #define IPV6_HOPOPTS 49 /* ip6_hbh; send hop-by-hop option */
220 #define IPV6_DSTOPTS 50 /* ip6_dest; send dst option befor rthdr */
221 #define IPV6_RTHDR 51 /* ip6_rthdr; send routing header */
222
223 #define IPV6_RECVTCLASS 57 /* bool; recv traffic class values */
224
225 #define IPV6_AUTOFLOWLABEL 59 /* bool; attach flowlabel automagically */
226
227 #define IPV6_TCLASS 61 /* int; send traffic class value */
228 #define IPV6_DONTFRAG 62 /* bool; disable IPv6 fragmentation */
229
230 #define IPV6_PREFER_TEMPADDR 63 /* int; prefer temporary addresses as
231 * the source address.
232 */
233
234 /* Obsolete synonyms for the above. */
235 #define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
236 #define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
237 #define IPV6_RXHOPOPTS IPV6_HOPOPTS
238 #define IPV6_RXDSTOPTS IPV6_DSTOPTS
239
240 /* Socket level values for IPv6. */
241 #define SOL_IPV6 41
242 #define SOL_ICMPV6 58
243
244 /*
245 * Defaults and limits for options
246 */
247 #define IPV6_DEFAULT_MULTICAST_HOPS 1 /* normally limit m'casts to 1 hop */
248 #define IPV6_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
249
250 /*
251 * Argument for IPV6_PORTRANGE:
252 * - which range to search when port is unspecified at bind() or connect()
253 */
254 #define IPV6_PORTRANGE_DEFAULT 0 /* default range */
255 #define IPV6_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */
256 #define IPV6_PORTRANGE_LOW 2 /* "low" - vouchsafe security */
257
258 /* Routing header options for IPv6. */
259 #define IPV6_RTHDR_LOOSE 0 /* Hop doesn't need to be neighbour. */
260 #define IPV6_RTHDR_STRICT 1 /* Hop must be a neighbour. */
261
262 #define IPV6_RTHDR_TYPE_0 0 /* IPv6 Routing header type 0. */
263
264 /*
265 * Names for IP sysctl objects
266 */
267 #define IPV6CTL_FORWARDING 1 /* act as router */
268 #define IPV6CTL_SENDREDIRECTS 2 /* may send redirects when forwarding*/
269 #define IPV6CTL_DEFHLIM 3 /* default Hop-Limit */
270 #define IPV6CTL_FORWSRCRT 5 /* forward source-routed dgrams */
271 #define IPV6CTL_STATS 6 /* stats */
272 #define IPV6CTL_MRTSTATS 7 /* multicast forwarding stats */
273 #define IPV6CTL_MRTPROTO 8 /* multicast routing protocol */
274 #define IPV6CTL_MAXFRAGPACKETS 9 /* max packets reassembly queue */
275 #define IPV6CTL_SOURCECHECK 10 /* verify source route and intf */
276 #define IPV6CTL_SOURCECHECK_LOGINT 11 /* minimume logging interval */
277 #define IPV6CTL_ACCEPT_RTADV 12
278 #define IPV6CTL_KEEPFAITH 13
279 #define IPV6CTL_LOG_INTERVAL 14
280 #define IPV6CTL_HDRNESTLIMIT 15
281 #define IPV6CTL_DAD_COUNT 16
282 #define IPV6CTL_AUTO_FLOWLABEL 17
283 #define IPV6CTL_DEFMCASTHLIM 18
284 #define IPV6CTL_GIF_HLIM 19 /* default HLIM for gif encap packet */
285 #define IPV6CTL_KAME_VERSION 20
286 #define IPV6CTL_USE_DEPRECATED 21 /* use deprecated addr (RFC2462 5.5.4) */
287 #define IPV6CTL_RR_PRUNE 22 /* walk timer for router renumbering */
288 #define IPV6CTL_V6ONLY 24
289 #define IPV6CTL_RTEXPIRE 25 /* cloned route expiration time */
290 #define IPV6CTL_RTMINEXPIRE 26 /* min value for expiration time */
291 #define IPV6CTL_RTMAXCACHE 27 /* trigger level for dynamic expire */
292
293 #define IPV6CTL_USETEMPADDR 32 /* use temporary addresses (RFC3041) */
294 #define IPV6CTL_TEMPPLTIME 33 /* preferred lifetime for tmpaddrs */
295 #define IPV6CTL_TEMPVLTIME 34 /* valid lifetime for tmpaddrs */
296 #define IPV6CTL_AUTO_LINKLOCAL 35 /* automatic link-local addr assign */
297 #define IPV6CTL_RIP6STATS 36 /* raw_ip6 stats */
298 #define IPV6CTL_PREFER_TEMPADDR 37 /* prefer temporary addr as src */
299 #define IPV6CTL_ADDRCTLPOLICY 38 /* get/set address selection policy */
300 #define IPV6CTL_USE_DEFAULTZONE 39 /* use default scope zone */
301
302 #define IPV6CTL_MAXFRAGS 41 /* max fragments */
303 #define IPV6CTL_MCAST_PMTU 44 /* enable pMTU discovery for multicast? */
304
305 /* New entries should be added here from current IPV6CTL_MAXID value. */
306 /* to define items, should talk with KAME guys first, for *BSD compatibility */
307 /* 42-44 is already used in KAME */
308 #define IPV6CTL_STEALTH 45
309 #define ICMPV6CTL_ND6_ONLINKNSRFC4861 47
310 #define IPV6CTL_MAXID 48