1/* Copyright (C) 1991-2014 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, see
16 <http://www.gnu.org/licenses/>. */
17
18#ifndef _NETINET_IN_H
19#define _NETINET_IN_H 1
20
21#include <features.h>
22#include <stdint.h>
23#include <sys/socket.h>
24#include <bits/types.h>
25
26
27__BEGIN_DECLS
28
29/* Internet address. */
30typedef uint32_t in_addr_t;
31struct in_addr
32 {
33 in_addr_t s_addr;
34 };
35
36/* Get system-specific definitions. */
37#include <bits/in.h>
38
39/* Standard well-defined IP protocols. */
40enum
41 {
42 IPPROTO_IP = 0, /* Dummy protocol for TCP. */
43#define IPPROTO_IP IPPROTO_IP
44 IPPROTO_ICMP = 1, /* Internet Control Message Protocol. */
45#define IPPROTO_ICMP IPPROTO_ICMP
46 IPPROTO_IGMP = 2, /* Internet Group Management Protocol. */
47#define IPPROTO_IGMP IPPROTO_IGMP
48 IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94). */
49#define IPPROTO_IPIP IPPROTO_IPIP
50 IPPROTO_TCP = 6, /* Transmission Control Protocol. */
51#define IPPROTO_TCP IPPROTO_TCP
52 IPPROTO_EGP = 8, /* Exterior Gateway Protocol. */
53#define IPPROTO_EGP IPPROTO_EGP
54 IPPROTO_PUP = 12, /* PUP protocol. */
55#define IPPROTO_PUP IPPROTO_PUP
56 IPPROTO_UDP = 17, /* User Datagram Protocol. */
57#define IPPROTO_UDP IPPROTO_UDP
58 IPPROTO_IDP = 22, /* XNS IDP protocol. */
59#define IPPROTO_IDP IPPROTO_IDP
60 IPPROTO_TP = 29, /* SO Transport Protocol Class 4. */
61#define IPPROTO_TP IPPROTO_TP
62 IPPROTO_DCCP = 33, /* Datagram Congestion Control Protocol. */
63#define IPPROTO_DCCP IPPROTO_DCCP
64 IPPROTO_IPV6 = 41, /* IPv6 header. */
65#define IPPROTO_IPV6 IPPROTO_IPV6
66 IPPROTO_RSVP = 46, /* Reservation Protocol. */
67#define IPPROTO_RSVP IPPROTO_RSVP
68 IPPROTO_GRE = 47, /* General Routing Encapsulation. */
69#define IPPROTO_GRE IPPROTO_GRE
70 IPPROTO_ESP = 50, /* encapsulating security payload. */
71#define IPPROTO_ESP IPPROTO_ESP
72 IPPROTO_AH = 51, /* authentication header. */
73#define IPPROTO_AH IPPROTO_AH
74 IPPROTO_MTP = 92, /* Multicast Transport Protocol. */
75#define IPPROTO_MTP IPPROTO_MTP
76 IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET. */
77#define IPPROTO_BEETPH IPPROTO_BEETPH
78 IPPROTO_ENCAP = 98, /* Encapsulation Header. */
79#define IPPROTO_ENCAP IPPROTO_ENCAP
80 IPPROTO_PIM = 103, /* Protocol Independent Multicast. */
81#define IPPROTO_PIM IPPROTO_PIM
82 IPPROTO_COMP = 108, /* Compression Header Protocol. */
83#define IPPROTO_COMP IPPROTO_COMP
84 IPPROTO_SCTP = 132, /* Stream Control Transmission Protocol. */
85#define IPPROTO_SCTP IPPROTO_SCTP
86 IPPROTO_UDPLITE = 136, /* UDP-Lite protocol. */
87#define IPPROTO_UDPLITE IPPROTO_UDPLITE
88 IPPROTO_RAW = 255, /* Raw IP packets. */
89#define IPPROTO_RAW IPPROTO_RAW
90 IPPROTO_MAX
91 };
92
93/* If __USE_KERNEL_IPV6_DEFS is defined then the user has included the kernel
94 network headers first and we should use those ABI-identical definitions
95 instead of our own. */
96#ifndef __USE_KERNEL_IPV6_DEFS
97enum
98 {
99 IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options. */
100#define IPPROTO_HOPOPTS IPPROTO_HOPOPTS
101 IPPROTO_ROUTING = 43, /* IPv6 routing header. */
102#define IPPROTO_ROUTING IPPROTO_ROUTING
103 IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header. */
104#define IPPROTO_FRAGMENT IPPROTO_FRAGMENT
105 IPPROTO_ICMPV6 = 58, /* ICMPv6. */
106#define IPPROTO_ICMPV6 IPPROTO_ICMPV6
107 IPPROTO_NONE = 59, /* IPv6 no next header. */
108#define IPPROTO_NONE IPPROTO_NONE
109 IPPROTO_DSTOPTS = 60, /* IPv6 destination options. */
110#define IPPROTO_DSTOPTS IPPROTO_DSTOPTS
111 IPPROTO_MH = 135 /* IPv6 mobility header. */
112#define IPPROTO_MH IPPROTO_MH
113 };
114#endif /* !__USE_KERNEL_IPV6_DEFS */
115
116/* Type to represent a port. */
117typedef uint16_t in_port_t;
118
119/* Standard well-known ports. */
120enum
121 {
122 IPPORT_ECHO = 7, /* Echo service. */
123 IPPORT_DISCARD = 9, /* Discard transmissions service. */
124 IPPORT_SYSTAT = 11, /* System status service. */
125 IPPORT_DAYTIME = 13, /* Time of day service. */
126 IPPORT_NETSTAT = 15, /* Network status service. */
127 IPPORT_FTP = 21, /* File Transfer Protocol. */
128 IPPORT_TELNET = 23, /* Telnet protocol. */
129 IPPORT_SMTP = 25, /* Simple Mail Transfer Protocol. */
130 IPPORT_TIMESERVER = 37, /* Timeserver service. */
131 IPPORT_NAMESERVER = 42, /* Domain Name Service. */
132 IPPORT_WHOIS = 43, /* Internet Whois service. */
133 IPPORT_MTP = 57,
134
135 IPPORT_TFTP = 69, /* Trivial File Transfer Protocol. */
136 IPPORT_RJE = 77,
137 IPPORT_FINGER = 79, /* Finger service. */
138 IPPORT_TTYLINK = 87,
139 IPPORT_SUPDUP = 95, /* SUPDUP protocol. */
140
141
142 IPPORT_EXECSERVER = 512, /* execd service. */
143 IPPORT_LOGINSERVER = 513, /* rlogind service. */
144 IPPORT_CMDSERVER = 514,
145 IPPORT_EFSSERVER = 520,
146
147 /* UDP ports. */
148 IPPORT_BIFFUDP = 512,
149 IPPORT_WHOSERVER = 513,
150 IPPORT_ROUTESERVER = 520,
151
152 /* Ports less than this value are reserved for privileged processes. */
153 IPPORT_RESERVED = 1024,
154
155 /* Ports greater this value are reserved for (non-privileged) servers. */
156 IPPORT_USERRESERVED = 5000
157 };
158
159/* Definitions of the bits in an Internet address integer.
160
161 On subnets, host and network parts are found according to
162 the subnet mask, not these masks. */
163
164#define IN_CLASSA(a) ((((in_addr_t)(a)) & 0x80000000) == 0)
165#define IN_CLASSA_NET 0xff000000
166#define IN_CLASSA_NSHIFT 24
167#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET)
168#define IN_CLASSA_MAX 128
169
170#define IN_CLASSB(a) ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000)
171#define IN_CLASSB_NET 0xffff0000
172#define IN_CLASSB_NSHIFT 16
173#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET)
174#define IN_CLASSB_MAX 65536
175
176#define IN_CLASSC(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000)
177#define IN_CLASSC_NET 0xffffff00
178#define IN_CLASSC_NSHIFT 8
179#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET)
180
181#define IN_CLASSD(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000)
182#define IN_MULTICAST(a) IN_CLASSD(a)
183
184#define IN_EXPERIMENTAL(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000)
185#define IN_BADCLASS(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)
186
187/* Address to accept any incoming messages. */
188#define INADDR_ANY ((in_addr_t) 0x00000000)
189/* Address to send to all hosts. */
190#define INADDR_BROADCAST ((in_addr_t) 0xffffffff)
191/* Address indicating an error return. */
192#define INADDR_NONE ((in_addr_t) 0xffffffff)
193
194/* Network number for local host loopback. */
195#define IN_LOOPBACKNET 127
196/* Address to loopback in software to local host. */
197#ifndef INADDR_LOOPBACK
198# define INADDR_LOOPBACK ((in_addr_t) 0x7f000001) /* Inet 127.0.0.1. */
199#endif
200
201/* Defines for Multicast INADDR. */
202#define INADDR_UNSPEC_GROUP ((in_addr_t) 0xe0000000) /* 224.0.0.0 */
203#define INADDR_ALLHOSTS_GROUP ((in_addr_t) 0xe0000001) /* 224.0.0.1 */
204#define INADDR_ALLRTRS_GROUP ((in_addr_t) 0xe0000002) /* 224.0.0.2 */
205#define INADDR_MAX_LOCAL_GROUP ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */
206
207#ifndef __USE_KERNEL_IPV6_DEFS
208/* IPv6 address */
209struct in6_addr
210 {
211 union
212 {
213 uint8_t __u6_addr8[16];
214#if defined __USE_MISC || defined __USE_GNU
215 uint16_t __u6_addr16[8];
216 uint32_t __u6_addr32[4];
217#endif
218 } __in6_u;
219#define s6_addr __in6_u.__u6_addr8
220#if defined __USE_MISC || defined __USE_GNU
221# define s6_addr16 __in6_u.__u6_addr16
222# define s6_addr32 __in6_u.__u6_addr32
223#endif
224 };
225#endif /* !__USE_KERNEL_IPV6_DEFS */
226
227extern const struct in6_addr in6addr_any; /* :: */
228extern const struct in6_addr in6addr_loopback; /* ::1 */
229#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
230#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
231
232#define INET_ADDRSTRLEN 16
233#define INET6_ADDRSTRLEN 46
234
235
236/* Structure describing an Internet socket address. */
237struct sockaddr_in
238 {
239 __SOCKADDR_COMMON (sin_);
240 in_port_t sin_port; /* Port number. */
241 struct in_addr sin_addr; /* Internet address. */
242
243 /* Pad to size of `struct sockaddr'. */
244 unsigned char sin_zero[sizeof (struct sockaddr) -
245 __SOCKADDR_COMMON_SIZE -
246 sizeof (in_port_t) -
247 sizeof (struct in_addr)];
248 };
249
250#ifndef __USE_KERNEL_IPV6_DEFS
251/* Ditto, for IPv6. */
252struct sockaddr_in6
253 {
254 __SOCKADDR_COMMON (sin6_);
255 in_port_t sin6_port; /* Transport layer port # */
256 uint32_t sin6_flowinfo; /* IPv6 flow information */
257 struct in6_addr sin6_addr; /* IPv6 address */
258 uint32_t sin6_scope_id; /* IPv6 scope-id */
259 };
260#endif /* !__USE_KERNEL_IPV6_DEFS */
261
262#if defined __USE_MISC || defined __USE_GNU
263/* IPv4 multicast request. */
264struct ip_mreq
265 {
266 /* IP multicast address of group. */
267 struct in_addr imr_multiaddr;
268
269 /* Local IP address of interface. */
270 struct in_addr imr_interface;
271 };
272
273struct ip_mreq_source
274 {
275 /* IP multicast address of group. */
276 struct in_addr imr_multiaddr;
277
278 /* IP address of source. */
279 struct in_addr imr_interface;
280
281 /* IP address of interface. */
282 struct in_addr imr_sourceaddr;
283 };
284#endif
285
286#ifndef __USE_KERNEL_IPV6_DEFS
287/* Likewise, for IPv6. */
288struct ipv6_mreq
289 {
290 /* IPv6 multicast address of group */
291 struct in6_addr ipv6mr_multiaddr;
292
293 /* local interface */
294 unsigned int ipv6mr_interface;
295 };
296#endif /* !__USE_KERNEL_IPV6_DEFS */
297
298#if defined __USE_MISC || defined __USE_GNU
299/* Multicast group request. */
300struct group_req
301 {
302 /* Interface index. */
303 uint32_t gr_interface;
304
305 /* Group address. */
306 struct sockaddr_storage gr_group;
307 };
308
309struct group_source_req
310 {
311 /* Interface index. */
312 uint32_t gsr_interface;
313
314 /* Group address. */
315 struct sockaddr_storage gsr_group;
316
317 /* Source address. */
318 struct sockaddr_storage gsr_source;
319 };
320
321
322/* Full-state filter operations. */
323struct ip_msfilter
324 {
325 /* IP multicast address of group. */
326 struct in_addr imsf_multiaddr;
327
328 /* Local IP address of interface. */
329 struct in_addr imsf_interface;
330
331 /* Filter mode. */
332 uint32_t imsf_fmode;
333
334 /* Number of source addresses. */
335 uint32_t imsf_numsrc;
336 /* Source addresses. */
337 struct in_addr imsf_slist[1];
338 };
339
340#define IP_MSFILTER_SIZE(numsrc) (sizeof (struct ip_msfilter) \
341 - sizeof (struct in_addr) \
342 + (numsrc) * sizeof (struct in_addr))
343
344struct group_filter
345 {
346 /* Interface index. */
347 uint32_t gf_interface;
348
349 /* Group address. */
350 struct sockaddr_storage gf_group;
351
352 /* Filter mode. */
353 uint32_t gf_fmode;
354
355 /* Number of source addresses. */
356 uint32_t gf_numsrc;
357 /* Source addresses. */
358 struct sockaddr_storage gf_slist[1];
359};
360
361#define GROUP_FILTER_SIZE(numsrc) (sizeof (struct group_filter) \
362 - sizeof (struct sockaddr_storage) \
363 + ((numsrc) \
364 * sizeof (struct sockaddr_storage)))
365#endif
366
367/* Functions to convert between host and network byte order.
368
369 Please note that these functions normally take `unsigned long int' or
370 `unsigned short int' values as arguments and also return them. But
371 this was a short-sighted decision since on different systems the types
372 may have different representations but the values are always the same. */
373
374extern uint32_t ntohl (uint32_t __netlong) __THROW __attribute__ ((__const__));
375extern uint16_t ntohs (uint16_t __netshort)
376 __THROW __attribute__ ((__const__));
377extern uint32_t htonl (uint32_t __hostlong)
378 __THROW __attribute__ ((__const__));
379extern uint16_t htons (uint16_t __hostshort)
380 __THROW __attribute__ ((__const__));
381
382#include <endian.h>
383
384/* Get machine dependent optimized versions of byte swapping functions. */
385#include <bits/byteswap.h>
386
387#ifdef __OPTIMIZE__
388/* We can optimize calls to the conversion functions. Either nothing has
389 to be done or we are using directly the byte-swapping functions which
390 often can be inlined. */
391# if __BYTE_ORDER == __BIG_ENDIAN
392/* The host byte order is the same as network byte order,
393 so these functions are all just identity. */
394# define ntohl(x) (x)
395# define ntohs(x) (x)
396# define htonl(x) (x)
397# define htons(x) (x)
398# else
399# if __BYTE_ORDER == __LITTLE_ENDIAN
400# define ntohl(x) __bswap_32 (x)
401# define ntohs(x) __bswap_16 (x)
402# define htonl(x) __bswap_32 (x)
403# define htons(x) __bswap_16 (x)
404# endif
405# endif
406#endif
407
408#ifdef __GNUC__
409# define IN6_IS_ADDR_UNSPECIFIED(a) \
410 (__extension__ \
411 ({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
412 __a->s6_addr32[0] == 0 \
413 && __a->s6_addr32[1] == 0 \
414 && __a->s6_addr32[2] == 0 \
415 && __a->s6_addr32[3] == 0; }))
416
417# define IN6_IS_ADDR_LOOPBACK(a) \
418 (__extension__ \
419 ({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
420 __a->s6_addr32[0] == 0 \
421 && __a->s6_addr32[1] == 0 \
422 && __a->s6_addr32[2] == 0 \
423 && __a->s6_addr32[3] == htonl (1); }))
424
425# define IN6_IS_ADDR_LINKLOCAL(a) \
426 (__extension__ \
427 ({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
428 (__a->s6_addr32[0] & htonl (0xffc00000)) == htonl (0xfe800000); }))
429
430# define IN6_IS_ADDR_SITELOCAL(a) \
431 (__extension__ \
432 ({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
433 (__a->s6_addr32[0] & htonl (0xffc00000)) == htonl (0xfec00000); }))
434
435# define IN6_IS_ADDR_V4MAPPED(a) \
436 (__extension__ \
437 ({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
438 __a->s6_addr32[0] == 0 \
439 && __a->s6_addr32[1] == 0 \
440 && __a->s6_addr32[2] == htonl (0xffff); }))
441
442# define IN6_IS_ADDR_V4COMPAT(a) \
443 (__extension__ \
444 ({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
445 __a->s6_addr32[0] == 0 \
446 && __a->s6_addr32[1] == 0 \
447 && __a->s6_addr32[2] == 0 \
448 && ntohl (__a->s6_addr32[3]) > 1; }))
449
450# define IN6_ARE_ADDR_EQUAL(a,b) \
451 (__extension__ \
452 ({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
453 const struct in6_addr *__b = (const struct in6_addr *) (b); \
454 __a->s6_addr32[0] == __b->s6_addr32[0] \
455 && __a->s6_addr32[1] == __b->s6_addr32[1] \
456 && __a->s6_addr32[2] == __b->s6_addr32[2] \
457 && __a->s6_addr32[3] == __b->s6_addr32[3]; }))
458#else
459# define IN6_IS_ADDR_UNSPECIFIED(a) \
460 (((const uint32_t *) (a))[0] == 0 \
461 && ((const uint32_t *) (a))[1] == 0 \
462 && ((const uint32_t *) (a))[2] == 0 \
463 && ((const uint32_t *) (a))[3] == 0)
464
465# define IN6_IS_ADDR_LOOPBACK(a) \
466 (((const uint32_t *) (a))[0] == 0 \
467 && ((const uint32_t *) (a))[1] == 0 \
468 && ((const uint32_t *) (a))[2] == 0 \
469 && ((const uint32_t *) (a))[3] == htonl (1))
470
471# define IN6_IS_ADDR_LINKLOCAL(a) \
472 ((((const uint32_t *) (a))[0] & htonl (0xffc00000)) \
473 == htonl (0xfe800000))
474
475# define IN6_IS_ADDR_SITELOCAL(a) \
476 ((((const uint32_t *) (a))[0] & htonl (0xffc00000)) \
477 == htonl (0xfec00000))
478
479# define IN6_IS_ADDR_V4MAPPED(a) \
480 ((((const uint32_t *) (a))[0] == 0) \
481 && (((const uint32_t *) (a))[1] == 0) \
482 && (((const uint32_t *) (a))[2] == htonl (0xffff)))
483
484# define IN6_IS_ADDR_V4COMPAT(a) \
485 ((((const uint32_t *) (a))[0] == 0) \
486 && (((const uint32_t *) (a))[1] == 0) \
487 && (((const uint32_t *) (a))[2] == 0) \
488 && (ntohl (((const uint32_t *) (a))[3]) > 1))
489
490# define IN6_ARE_ADDR_EQUAL(a,b) \
491 ((((const uint32_t *) (a))[0] == ((const uint32_t *) (b))[0]) \
492 && (((const uint32_t *) (a))[1] == ((const uint32_t *) (b))[1]) \
493 && (((const uint32_t *) (a))[2] == ((const uint32_t *) (b))[2]) \
494 && (((const uint32_t *) (a))[3] == ((const uint32_t *) (b))[3]))
495#endif
496
497#define IN6_IS_ADDR_MULTICAST(a) (((const uint8_t *) (a))[0] == 0xff)
498
499#if defined __USE_MISC || defined __USE_GNU
500/* Bind socket to a privileged IP port. */
501extern int bindresvport (int __sockfd, struct sockaddr_in *__sock_in) __THROW;
502
503/* The IPv6 version of this function. */
504extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in)
505 __THROW;
506#endif
507
508
509#define IN6_IS_ADDR_MC_NODELOCAL(a) \
510 (IN6_IS_ADDR_MULTICAST(a) \
511 && ((((const uint8_t *) (a))[1] & 0xf) == 0x1))
512
513#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
514 (IN6_IS_ADDR_MULTICAST(a) \
515 && ((((const uint8_t *) (a))[1] & 0xf) == 0x2))
516
517#define IN6_IS_ADDR_MC_SITELOCAL(a) \
518 (IN6_IS_ADDR_MULTICAST(a) \
519 && ((((const uint8_t *) (a))[1] & 0xf) == 0x5))
520
521#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
522 (IN6_IS_ADDR_MULTICAST(a) \
523 && ((((const uint8_t *) (a))[1] & 0xf) == 0x8))
524
525#define IN6_IS_ADDR_MC_GLOBAL(a) \
526 (IN6_IS_ADDR_MULTICAST(a) \
527 && ((((const uint8_t *) (a))[1] & 0xf) == 0xe))
528
529
530#ifdef __USE_GNU
531struct cmsghdr; /* Forward declaration. */
532
533/* IPv6 packet information. */
534struct in6_pktinfo
535 {
536 struct in6_addr ipi6_addr; /* src/dst IPv6 address */
537 unsigned int ipi6_ifindex; /* send/recv interface index */
538 };
539
540/* IPv6 MTU information. */
541struct ip6_mtuinfo
542 {
543 struct sockaddr_in6 ip6m_addr; /* dst address including zone ID */
544 uint32_t ip6m_mtu; /* path MTU in host byte order */
545 };
546
547
548/* Obsolete hop-by-hop and Destination Options Processing (RFC 2292). */
549extern int inet6_option_space (int __nbytes)
550 __THROW __attribute_deprecated__;
551extern int inet6_option_init (void *__bp, struct cmsghdr **__cmsgp,
552 int __type) __THROW __attribute_deprecated__;
553extern int inet6_option_append (struct cmsghdr *__cmsg,
554 const uint8_t *__typep, int __multx,
555 int __plusy) __THROW __attribute_deprecated__;
556extern uint8_t *inet6_option_alloc (struct cmsghdr *__cmsg, int __datalen,
557 int __multx, int __plusy)
558 __THROW __attribute_deprecated__;
559extern int inet6_option_next (const struct cmsghdr *__cmsg,
560 uint8_t **__tptrp)
561 __THROW __attribute_deprecated__;
562extern int inet6_option_find (const struct cmsghdr *__cmsg,
563 uint8_t **__tptrp, int __type)
564 __THROW __attribute_deprecated__;
565
566
567/* Hop-by-Hop and Destination Options Processing (RFC 3542). */
568extern int inet6_opt_init (void *__extbuf, socklen_t __extlen) __THROW;
569extern int inet6_opt_append (void *__extbuf, socklen_t __extlen, int __offset,
570 uint8_t __type, socklen_t __len, uint8_t __align,
571 void **__databufp) __THROW;
572extern int inet6_opt_finish (void *__extbuf, socklen_t __extlen, int __offset)
573 __THROW;
574extern int inet6_opt_set_val (void *__databuf, int __offset, void *__val,
575 socklen_t __vallen) __THROW;
576extern int inet6_opt_next (void *__extbuf, socklen_t __extlen, int __offset,
577 uint8_t *__typep, socklen_t *__lenp,
578 void **__databufp) __THROW;
579extern int inet6_opt_find (void *__extbuf, socklen_t __extlen, int __offset,
580 uint8_t __type, socklen_t *__lenp,
581 void **__databufp) __THROW;
582extern int inet6_opt_get_val (void *__databuf, int __offset, void *__val,
583 socklen_t __vallen) __THROW;
584
585
586/* Routing Header Option (RFC 3542). */
587extern socklen_t inet6_rth_space (int __type, int __segments) __THROW;
588extern void *inet6_rth_init (void *__bp, socklen_t __bp_len, int __type,
589 int __segments) __THROW;
590extern int inet6_rth_add (void *__bp, const struct in6_addr *__addr) __THROW;
591extern int inet6_rth_reverse (const void *__in, void *__out) __THROW;
592extern int inet6_rth_segments (const void *__bp) __THROW;
593extern struct in6_addr *inet6_rth_getaddr (const void *__bp, int __index)
594 __THROW;
595
596
597/* Multicast source filter support. */
598
599/* Get IPv4 source filter. */
600extern int getipv4sourcefilter (int __s, struct in_addr __interface_addr,
601 struct in_addr __group, uint32_t *__fmode,
602 uint32_t *__numsrc, struct in_addr *__slist)
603 __THROW;
604
605/* Set IPv4 source filter. */
606extern int setipv4sourcefilter (int __s, struct in_addr __interface_addr,
607 struct in_addr __group, uint32_t __fmode,
608 uint32_t __numsrc,
609 const struct in_addr *__slist)
610 __THROW;
611
612
613/* Get source filter. */
614extern int getsourcefilter (int __s, uint32_t __interface_addr,
615 const struct sockaddr *__group,
616 socklen_t __grouplen, uint32_t *__fmode,
617 uint32_t *__numsrc,
618 struct sockaddr_storage *__slist) __THROW;
619
620/* Set source filter. */
621extern int setsourcefilter (int __s, uint32_t __interface_addr,
622 const struct sockaddr *__group,
623 socklen_t __grouplen, uint32_t __fmode,
624 uint32_t __numsrc,
625 const struct sockaddr_storage *__slist) __THROW;
626#endif /* use GNU */
627
628__END_DECLS
629
630#endif /* netinet/in.h */
631