Update copyright dates with scripts/update-copyrights.
[glibc.git] / sysdeps / unix / sysv / linux / bits / in.h
blobb80a27fa43488d8f9b2693486b6a1534376d0134
1 /* Copyright (C) 1991-2015 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
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.
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.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
18 /* Linux version. */
20 #ifndef _NETINET_IN_H
21 # error "Never use <bits/in.h> directly; include <netinet/in.h> instead."
22 #endif
24 /* If the application has already included linux/in6.h from a linux-based
25 kernel then we will not define the IPv6 IPPROTO_* defines, in6_addr (nor the
26 defines), sockaddr_in6, or ipv6_mreq. The ABI used by the linux-kernel and
27 glibc match exactly. Neither the linux kernel nor glibc should break this
28 ABI without coordination. */
29 #ifdef _UAPI_LINUX_IN6_H
30 /* This is not quite the same API since the kernel always defines s6_addr16 and
31 s6_addr32. This is not a violation of POSIX since POSIX says "at least the
32 following member" and that holds true. */
33 # define __USE_KERNEL_IPV6_DEFS
34 #endif
36 /* Options for use with `getsockopt' and `setsockopt' at the IP level.
37 The first word in the comment at the right is the data type used;
38 "bool" means a boolean value stored in an `int'. */
39 #define IP_OPTIONS 4 /* ip_opts; IP per-packet options. */
40 #define IP_HDRINCL 3 /* int; Header is included with data. */
41 #define IP_TOS 1 /* int; IP type of service and precedence. */
42 #define IP_TTL 2 /* int; IP time to live. */
43 #define IP_RECVOPTS 6 /* bool; Receive all IP options w/datagram. */
44 /* For BSD compatibility. */
45 #define IP_RECVRETOPTS IP_RETOPTS /* bool; Receive IP options for response. */
46 #define IP_RETOPTS 7 /* ip_opts; Set/get IP per-packet options. */
47 #define IP_MULTICAST_IF 32 /* in_addr; set/get IP multicast i/f */
48 #define IP_MULTICAST_TTL 33 /* u_char; set/get IP multicast ttl */
49 #define IP_MULTICAST_LOOP 34 /* i_char; set/get IP multicast loopback */
50 #define IP_ADD_MEMBERSHIP 35 /* ip_mreq; add an IP group membership */
51 #define IP_DROP_MEMBERSHIP 36 /* ip_mreq; drop an IP group membership */
52 #define IP_UNBLOCK_SOURCE 37 /* ip_mreq_source: unblock data from source */
53 #define IP_BLOCK_SOURCE 38 /* ip_mreq_source: block data from source */
54 #define IP_ADD_SOURCE_MEMBERSHIP 39 /* ip_mreq_source: join source group */
55 #define IP_DROP_SOURCE_MEMBERSHIP 40 /* ip_mreq_source: leave source group */
56 #define IP_MSFILTER 41
57 #ifdef __USE_MISC
58 # define MCAST_JOIN_GROUP 42 /* group_req: join any-source group */
59 # define MCAST_BLOCK_SOURCE 43 /* group_source_req: block from given group */
60 # define MCAST_UNBLOCK_SOURCE 44 /* group_source_req: unblock from given group*/
61 # define MCAST_LEAVE_GROUP 45 /* group_req: leave any-source group */
62 # define MCAST_JOIN_SOURCE_GROUP 46 /* group_source_req: join source-spec gr */
63 # define MCAST_LEAVE_SOURCE_GROUP 47 /* group_source_req: leave source-spec gr*/
64 # define MCAST_MSFILTER 48
65 # define IP_MULTICAST_ALL 49
66 # define IP_UNICAST_IF 50
68 # define MCAST_EXCLUDE 0
69 # define MCAST_INCLUDE 1
70 #endif
72 #define IP_ROUTER_ALERT 5 /* bool */
73 #define IP_PKTINFO 8 /* bool */
74 #define IP_PKTOPTIONS 9
75 #define IP_PMTUDISC 10 /* obsolete name? */
76 #define IP_MTU_DISCOVER 10 /* int; see below */
77 #define IP_RECVERR 11 /* bool */
78 #define IP_RECVTTL 12 /* bool */
79 #define IP_RECVTOS 13 /* bool */
80 #define IP_MTU 14 /* int */
81 #define IP_FREEBIND 15
82 #define IP_IPSEC_POLICY 16
83 #define IP_XFRM_POLICY 17
84 #define IP_PASSSEC 18
85 #define IP_TRANSPARENT 19
86 #define IP_MULTICAST_ALL 49 /* bool */
88 /* TProxy original addresses */
89 #define IP_ORIGDSTADDR 20
90 #define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
92 #define IP_MINTTL 21
93 #define IP_NODEFRAG 22
95 /* IP_MTU_DISCOVER arguments. */
96 #define IP_PMTUDISC_DONT 0 /* Never send DF frames. */
97 #define IP_PMTUDISC_WANT 1 /* Use per route hints. */
98 #define IP_PMTUDISC_DO 2 /* Always DF. */
99 #define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu. */
100 /* Always use interface mtu (ignores dst pmtu) but don't set DF flag.
101 Also incoming ICMP frag_needed notifications will be ignored on
102 this socket to prevent accepting spoofed ones. */
103 #define IP_PMTUDISC_INTERFACE 4
104 /* Like IP_PMTUDISC_INTERFACE but allow packets to be fragmented. */
105 #define IP_PMTUDISC_OMIT 5
107 #define IP_MULTICAST_IF 32
108 #define IP_MULTICAST_TTL 33
109 #define IP_MULTICAST_LOOP 34
110 #define IP_ADD_MEMBERSHIP 35
111 #define IP_DROP_MEMBERSHIP 36
112 #define IP_UNBLOCK_SOURCE 37
113 #define IP_BLOCK_SOURCE 38
114 #define IP_ADD_SOURCE_MEMBERSHIP 39
115 #define IP_DROP_SOURCE_MEMBERSHIP 40
116 #define IP_MSFILTER 41
117 #define MCAST_JOIN_GROUP 42
118 #define MCAST_BLOCK_SOURCE 43
119 #define MCAST_UNBLOCK_SOURCE 44
120 #define MCAST_LEAVE_GROUP 45
121 #define MCAST_JOIN_SOURCE_GROUP 46
122 #define MCAST_LEAVE_SOURCE_GROUP 47
123 #define MCAST_MSFILTER 48
124 #define IP_MULTICAST_ALL 49
125 #define IP_UNICAST_IF 50
127 /* To select the IP level. */
128 #define SOL_IP 0
130 #define IP_DEFAULT_MULTICAST_TTL 1
131 #define IP_DEFAULT_MULTICAST_LOOP 1
132 #define IP_MAX_MEMBERSHIPS 20
134 #ifdef __USE_MISC
135 /* Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS.
136 The `ip_dst' field is used for the first-hop gateway when using a
137 source route (this gets put into the header proper). */
138 struct ip_opts
140 struct in_addr ip_dst; /* First hop; zero without source route. */
141 char ip_opts[40]; /* Actually variable in size. */
144 /* Like `struct ip_mreq' but including interface specification by index. */
145 struct ip_mreqn
147 struct in_addr imr_multiaddr; /* IP multicast address of group */
148 struct in_addr imr_address; /* local IP address of interface */
149 int imr_ifindex; /* Interface index */
152 /* Structure used for IP_PKTINFO. */
153 struct in_pktinfo
155 int ipi_ifindex; /* Interface index */
156 struct in_addr ipi_spec_dst; /* Routing destination address */
157 struct in_addr ipi_addr; /* Header destination address */
159 #endif
161 /* Options for use with `getsockopt' and `setsockopt' at the IPv6 level.
162 The first word in the comment at the right is the data type used;
163 "bool" means a boolean value stored in an `int'. */
164 #define IPV6_ADDRFORM 1
165 #define IPV6_2292PKTINFO 2
166 #define IPV6_2292HOPOPTS 3
167 #define IPV6_2292DSTOPTS 4
168 #define IPV6_2292RTHDR 5
169 #define IPV6_2292PKTOPTIONS 6
170 #define IPV6_CHECKSUM 7
171 #define IPV6_2292HOPLIMIT 8
173 #define SCM_SRCRT IPV6_RXSRCRT
175 #define IPV6_NEXTHOP 9
176 #define IPV6_AUTHHDR 10
177 #define IPV6_UNICAST_HOPS 16
178 #define IPV6_MULTICAST_IF 17
179 #define IPV6_MULTICAST_HOPS 18
180 #define IPV6_MULTICAST_LOOP 19
181 #define IPV6_JOIN_GROUP 20
182 #define IPV6_LEAVE_GROUP 21
183 #define IPV6_ROUTER_ALERT 22
184 #define IPV6_MTU_DISCOVER 23
185 #define IPV6_MTU 24
186 #define IPV6_RECVERR 25
187 #define IPV6_V6ONLY 26
188 #define IPV6_JOIN_ANYCAST 27
189 #define IPV6_LEAVE_ANYCAST 28
190 #define IPV6_IPSEC_POLICY 34
191 #define IPV6_XFRM_POLICY 35
193 #define IPV6_RECVPKTINFO 49
194 #define IPV6_PKTINFO 50
195 #define IPV6_RECVHOPLIMIT 51
196 #define IPV6_HOPLIMIT 52
197 #define IPV6_RECVHOPOPTS 53
198 #define IPV6_HOPOPTS 54
199 #define IPV6_RTHDRDSTOPTS 55
200 #define IPV6_RECVRTHDR 56
201 #define IPV6_RTHDR 57
202 #define IPV6_RECVDSTOPTS 58
203 #define IPV6_DSTOPTS 59
205 #define IPV6_RECVTCLASS 66
206 #define IPV6_TCLASS 67
208 /* Obsolete synonyms for the above. */
209 #define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
210 #define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
211 #define IPV6_RXHOPOPTS IPV6_HOPOPTS
212 #define IPV6_RXDSTOPTS IPV6_DSTOPTS
214 /* IPV6_MTU_DISCOVER values. */
215 #define IPV6_PMTUDISC_DONT 0 /* Never send DF frames. */
216 #define IPV6_PMTUDISC_WANT 1 /* Use per route hints. */
217 #define IPV6_PMTUDISC_DO 2 /* Always DF. */
218 #define IPV6_PMTUDISC_PROBE 3 /* Ignore dst pmtu. */
219 #define IPV6_PMTUDISC_INTERFACE 4 /* See IP_PMTUDISC_INTERFACE. */
220 #define IPV6_PMTUDISC_OMIT 5 /* See IP_PMTUDISC_OMIT. */
222 /* Socket level values for IPv6. */
223 #define SOL_IPV6 41
224 #define SOL_ICMPV6 58
226 /* Routing header options for IPv6. */
227 #define IPV6_RTHDR_LOOSE 0 /* Hop doesn't need to be neighbour. */
228 #define IPV6_RTHDR_STRICT 1 /* Hop must be a neighbour. */
230 #define IPV6_RTHDR_TYPE_0 0 /* IPv6 Routing header type 0. */