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