1 /* Copyright (C) 1991-2024 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 <https://www.gnu.org/licenses/>. */
19 #define _NETINET_IN_H 1
22 #include <bits/stdint-uintn.h>
23 #include <sys/socket.h>
24 #include <bits/types.h>
29 /* Internet address. */
30 typedef uint32_t in_addr_t
;
36 /* Get system-specific definitions. */
39 /* Standard well-defined IP protocols. */
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_L2TP
= 115, /* Layer 2 Tunnelling Protocol. */
85 #define IPPROTO_L2TP IPPROTO_L2TP
86 IPPROTO_SCTP
= 132, /* Stream Control Transmission Protocol. */
87 #define IPPROTO_SCTP IPPROTO_SCTP
88 IPPROTO_UDPLITE
= 136, /* UDP-Lite protocol. */
89 #define IPPROTO_UDPLITE IPPROTO_UDPLITE
90 IPPROTO_MPLS
= 137, /* MPLS in IP. */
91 #define IPPROTO_MPLS IPPROTO_MPLS
92 IPPROTO_ETHERNET
= 143, /* Ethernet-within-IPv6 Encapsulation. */
93 #define IPPROTO_ETHERNET IPPROTO_ETHERNET
94 IPPROTO_RAW
= 255, /* Raw IP packets. */
95 #define IPPROTO_RAW IPPROTO_RAW
96 IPPROTO_SMC
= 256, /* Shared Memory Communications. */
97 #define IPPROTO_SMC IPPROTO_SMC
98 IPPROTO_MPTCP
= 262, /* Multipath TCP connection. */
99 #define IPPROTO_MPTCP IPPROTO_MPTCP
103 /* If __USE_KERNEL_IPV6_DEFS is 1 then the user has included the kernel
104 network headers first and we should use those ABI-identical definitions
105 instead of our own, otherwise 0. */
106 #if !__USE_KERNEL_IPV6_DEFS
109 IPPROTO_HOPOPTS
= 0, /* IPv6 Hop-by-Hop options. */
110 #define IPPROTO_HOPOPTS IPPROTO_HOPOPTS
111 IPPROTO_ROUTING
= 43, /* IPv6 routing header. */
112 #define IPPROTO_ROUTING IPPROTO_ROUTING
113 IPPROTO_FRAGMENT
= 44, /* IPv6 fragmentation header. */
114 #define IPPROTO_FRAGMENT IPPROTO_FRAGMENT
115 IPPROTO_ICMPV6
= 58, /* ICMPv6. */
116 #define IPPROTO_ICMPV6 IPPROTO_ICMPV6
117 IPPROTO_NONE
= 59, /* IPv6 no next header. */
118 #define IPPROTO_NONE IPPROTO_NONE
119 IPPROTO_DSTOPTS
= 60, /* IPv6 destination options. */
120 #define IPPROTO_DSTOPTS IPPROTO_DSTOPTS
121 IPPROTO_MH
= 135 /* IPv6 mobility header. */
122 #define IPPROTO_MH IPPROTO_MH
124 #endif /* !__USE_KERNEL_IPV6_DEFS */
126 /* Type to represent a port. */
127 typedef uint16_t in_port_t
;
129 /* Standard well-known ports. */
132 IPPORT_ECHO
= 7, /* Echo service. */
133 IPPORT_DISCARD
= 9, /* Discard transmissions service. */
134 IPPORT_SYSTAT
= 11, /* System status service. */
135 IPPORT_DAYTIME
= 13, /* Time of day service. */
136 IPPORT_NETSTAT
= 15, /* Network status service. */
137 IPPORT_FTP
= 21, /* File Transfer Protocol. */
138 IPPORT_TELNET
= 23, /* Telnet protocol. */
139 IPPORT_SMTP
= 25, /* Simple Mail Transfer Protocol. */
140 IPPORT_TIMESERVER
= 37, /* Timeserver service. */
141 IPPORT_NAMESERVER
= 42, /* Domain Name Service. */
142 IPPORT_WHOIS
= 43, /* Internet Whois service. */
145 IPPORT_TFTP
= 69, /* Trivial File Transfer Protocol. */
147 IPPORT_FINGER
= 79, /* Finger service. */
149 IPPORT_SUPDUP
= 95, /* SUPDUP protocol. */
152 IPPORT_EXECSERVER
= 512, /* execd service. */
153 IPPORT_LOGINSERVER
= 513, /* rlogind service. */
154 IPPORT_CMDSERVER
= 514,
155 IPPORT_EFSSERVER
= 520,
158 IPPORT_BIFFUDP
= 512,
159 IPPORT_WHOSERVER
= 513,
160 IPPORT_ROUTESERVER
= 520,
162 /* Ports less than this value are reserved for privileged processes. */
163 IPPORT_RESERVED
= 1024,
165 /* Ports greater this value are reserved for (non-privileged) servers. */
166 IPPORT_USERRESERVED
= 5000
169 /* Definitions of the bits in an Internet address integer.
171 On subnets, host and network parts are found according to
172 the subnet mask, not these masks. */
174 #define IN_CLASSA(a) ((((in_addr_t)(a)) & 0x80000000) == 0)
175 #define IN_CLASSA_NET 0xff000000
176 #define IN_CLASSA_NSHIFT 24
177 #define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET)
178 #define IN_CLASSA_MAX 128
180 #define IN_CLASSB(a) ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000)
181 #define IN_CLASSB_NET 0xffff0000
182 #define IN_CLASSB_NSHIFT 16
183 #define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET)
184 #define IN_CLASSB_MAX 65536
186 #define IN_CLASSC(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000)
187 #define IN_CLASSC_NET 0xffffff00
188 #define IN_CLASSC_NSHIFT 8
189 #define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET)
191 #define IN_CLASSD(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000)
192 #define IN_MULTICAST(a) IN_CLASSD(a)
194 #define IN_EXPERIMENTAL(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000)
195 #define IN_BADCLASS(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)
197 /* Address to accept any incoming messages. */
198 #define INADDR_ANY ((in_addr_t) 0x00000000)
199 /* Address to send to all hosts. */
200 #define INADDR_BROADCAST ((in_addr_t) 0xffffffff)
201 /* Address indicating an error return. */
202 #define INADDR_NONE ((in_addr_t) 0xffffffff)
203 /* Dummy address for source of ICMPv6 errors converted to IPv4 (RFC
205 #define INADDR_DUMMY ((in_addr_t) 0xc0000008)
207 /* Network number for local host loopback. */
208 #define IN_LOOPBACKNET 127
209 /* Address to loopback in software to local host. */
210 #ifndef INADDR_LOOPBACK
211 # define INADDR_LOOPBACK ((in_addr_t) 0x7f000001) /* Inet 127.0.0.1. */
214 /* Defines for Multicast INADDR. */
215 #define INADDR_UNSPEC_GROUP ((in_addr_t) 0xe0000000) /* 224.0.0.0 */
216 #define INADDR_ALLHOSTS_GROUP ((in_addr_t) 0xe0000001) /* 224.0.0.1 */
217 #define INADDR_ALLRTRS_GROUP ((in_addr_t) 0xe0000002) /* 224.0.0.2 */
218 #define INADDR_ALLSNOOPERS_GROUP ((in_addr_t) 0xe000006a) /* 224.0.0.106 */
219 #define INADDR_MAX_LOCAL_GROUP ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */
221 #if !__USE_KERNEL_IPV6_DEFS
227 uint8_t __u6_addr8
[16];
228 uint16_t __u6_addr16
[8];
229 uint32_t __u6_addr32
[4];
231 #define s6_addr __in6_u.__u6_addr8
233 # define s6_addr16 __in6_u.__u6_addr16
234 # define s6_addr32 __in6_u.__u6_addr32
237 #endif /* !__USE_KERNEL_IPV6_DEFS */
239 extern const struct in6_addr in6addr_any
; /* :: */
240 extern const struct in6_addr in6addr_loopback
; /* ::1 */
241 #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
242 #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
244 #define INET_ADDRSTRLEN 16
245 #define INET6_ADDRSTRLEN 46
248 /* Structure describing an Internet socket address. */
249 struct __attribute_struct_may_alias__ sockaddr_in
251 __SOCKADDR_COMMON (sin_
);
252 in_port_t sin_port
; /* Port number. */
253 struct in_addr sin_addr
; /* Internet address. */
255 /* Pad to size of `struct sockaddr'. */
256 unsigned char sin_zero
[sizeof (struct sockaddr
)
257 - __SOCKADDR_COMMON_SIZE
259 - sizeof (struct in_addr
)];
262 #if __USE_KERNEL_IPV6_DEFS
263 struct __attribute_struct_may_alias__ sockaddr_in6
;
265 /* Ditto, for IPv6. */
266 struct __attribute_struct_may_alias__ sockaddr_in6
268 __SOCKADDR_COMMON (sin6_
);
269 in_port_t sin6_port
; /* Transport layer port # */
270 uint32_t sin6_flowinfo
; /* IPv6 flow information */
271 struct in6_addr sin6_addr
; /* IPv6 address */
272 uint32_t sin6_scope_id
; /* IPv6 scope-id */
274 #endif /* !__USE_KERNEL_IPV6_DEFS */
277 /* IPv4 multicast request. */
280 /* IP multicast address of group. */
281 struct in_addr imr_multiaddr
;
283 /* Local IP address of interface. */
284 struct in_addr imr_interface
;
287 /* IPv4 multicast request with interface index. */
290 /* IP multicast address of group. */
291 struct in_addr imr_multiaddr
;
293 /* Local IP address of interface. */
294 struct in_addr imr_address
;
296 /* Interface index. */
300 struct ip_mreq_source
302 /* IP multicast address of group. */
303 struct in_addr imr_multiaddr
;
305 /* IP address of interface. */
306 struct in_addr imr_interface
;
308 /* IP address of source. */
309 struct in_addr imr_sourceaddr
;
313 #if !__USE_KERNEL_IPV6_DEFS
314 /* Likewise, for IPv6. */
317 /* IPv6 multicast address of group */
318 struct in6_addr ipv6mr_multiaddr
;
320 /* local interface */
321 unsigned int ipv6mr_interface
;
323 #endif /* !__USE_KERNEL_IPV6_DEFS */
326 /* Multicast group request. */
329 /* Interface index. */
330 uint32_t gr_interface
;
333 struct sockaddr_storage gr_group
;
336 struct group_source_req
338 /* Interface index. */
339 uint32_t gsr_interface
;
342 struct sockaddr_storage gsr_group
;
344 /* Source address. */
345 struct sockaddr_storage gsr_source
;
349 /* Full-state filter operations. */
352 /* IP multicast address of group. */
353 struct in_addr imsf_multiaddr
;
355 /* Local IP address of interface. */
356 struct in_addr imsf_interface
;
361 /* Number of source addresses. */
362 uint32_t imsf_numsrc
;
363 /* Source addresses. */
364 struct in_addr imsf_slist
[1];
367 #define IP_MSFILTER_SIZE(numsrc) (sizeof (struct ip_msfilter) \
368 - sizeof (struct in_addr) \
369 + (numsrc) * sizeof (struct in_addr))
373 /* Interface index. */
374 uint32_t gf_interface
;
377 struct sockaddr_storage gf_group
;
382 /* Number of source addresses. */
384 /* Source addresses. */
385 struct sockaddr_storage gf_slist
[1];
388 #define GROUP_FILTER_SIZE(numsrc) (sizeof (struct group_filter) \
389 - sizeof (struct sockaddr_storage) \
391 * sizeof (struct sockaddr_storage)))
394 /* Functions to convert between host and network byte order.
396 Please note that these functions normally take `unsigned long int' or
397 `unsigned short int' values as arguments and also return them. But
398 this was a short-sighted decision since on different systems the types
399 may have different representations but the values are always the same. */
401 extern uint32_t ntohl (uint32_t __netlong
) __THROW
__attribute__ ((__const__
));
402 extern uint16_t ntohs (uint16_t __netshort
)
403 __THROW
__attribute__ ((__const__
));
404 extern uint32_t htonl (uint32_t __hostlong
)
405 __THROW
__attribute__ ((__const__
));
406 extern uint16_t htons (uint16_t __hostshort
)
407 __THROW
__attribute__ ((__const__
));
411 /* Get machine dependent optimized versions of byte swapping functions. */
412 #include <bits/byteswap.h>
413 #include <bits/uintn-identity.h>
416 /* We can optimize calls to the conversion functions. Either nothing has
417 to be done or we are using directly the byte-swapping functions which
418 often can be inlined. */
419 # if __BYTE_ORDER == __BIG_ENDIAN
420 /* The host byte order is the same as network byte order,
421 so these functions are all just identity. */
422 # define ntohl(x) __uint32_identity (x)
423 # define ntohs(x) __uint16_identity (x)
424 # define htonl(x) __uint32_identity (x)
425 # define htons(x) __uint16_identity (x)
427 # if __BYTE_ORDER == __LITTLE_ENDIAN
428 # define ntohl(x) __bswap_32 (x)
429 # define ntohs(x) __bswap_16 (x)
430 # define htonl(x) __bswap_32 (x)
431 # define htons(x) __bswap_16 (x)
437 # define IN6_IS_ADDR_UNSPECIFIED(a) \
439 ({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
440 __a->__in6_u.__u6_addr32[0] == 0 \
441 && __a->__in6_u.__u6_addr32[1] == 0 \
442 && __a->__in6_u.__u6_addr32[2] == 0 \
443 && __a->__in6_u.__u6_addr32[3] == 0; }))
445 # define IN6_IS_ADDR_LOOPBACK(a) \
447 ({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
448 __a->__in6_u.__u6_addr32[0] == 0 \
449 && __a->__in6_u.__u6_addr32[1] == 0 \
450 && __a->__in6_u.__u6_addr32[2] == 0 \
451 && __a->__in6_u.__u6_addr32[3] == htonl (1); }))
453 # define IN6_IS_ADDR_LINKLOCAL(a) \
455 ({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
456 (__a->__in6_u.__u6_addr32[0] & htonl (0xffc00000)) == htonl (0xfe800000); }))
458 # define IN6_IS_ADDR_SITELOCAL(a) \
460 ({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
461 (__a->__in6_u.__u6_addr32[0] & htonl (0xffc00000)) == htonl (0xfec00000); }))
463 # define IN6_IS_ADDR_V4MAPPED(a) \
465 ({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
466 __a->__in6_u.__u6_addr32[0] == 0 \
467 && __a->__in6_u.__u6_addr32[1] == 0 \
468 && __a->__in6_u.__u6_addr32[2] == htonl (0xffff); }))
470 # define IN6_IS_ADDR_V4COMPAT(a) \
472 ({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
473 __a->__in6_u.__u6_addr32[0] == 0 \
474 && __a->__in6_u.__u6_addr32[1] == 0 \
475 && __a->__in6_u.__u6_addr32[2] == 0 \
476 && ntohl (__a->__in6_u.__u6_addr32[3]) > 1; }))
478 # define IN6_ARE_ADDR_EQUAL(a,b) \
480 ({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
481 const struct in6_addr *__b = (const struct in6_addr *) (b); \
482 __a->__in6_u.__u6_addr32[0] == __b->__in6_u.__u6_addr32[0] \
483 && __a->__in6_u.__u6_addr32[1] == __b->__in6_u.__u6_addr32[1] \
484 && __a->__in6_u.__u6_addr32[2] == __b->__in6_u.__u6_addr32[2] \
485 && __a->__in6_u.__u6_addr32[3] == __b->__in6_u.__u6_addr32[3]; }))
487 # define IN6_IS_ADDR_UNSPECIFIED(a) \
488 (((const uint32_t *) (a))[0] == 0 \
489 && ((const uint32_t *) (a))[1] == 0 \
490 && ((const uint32_t *) (a))[2] == 0 \
491 && ((const uint32_t *) (a))[3] == 0)
493 # define IN6_IS_ADDR_LOOPBACK(a) \
494 (((const uint32_t *) (a))[0] == 0 \
495 && ((const uint32_t *) (a))[1] == 0 \
496 && ((const uint32_t *) (a))[2] == 0 \
497 && ((const uint32_t *) (a))[3] == htonl (1))
499 # define IN6_IS_ADDR_LINKLOCAL(a) \
500 ((((const uint32_t *) (a))[0] & htonl (0xffc00000)) \
501 == htonl (0xfe800000))
503 # define IN6_IS_ADDR_SITELOCAL(a) \
504 ((((const uint32_t *) (a))[0] & htonl (0xffc00000)) \
505 == htonl (0xfec00000))
507 # define IN6_IS_ADDR_V4MAPPED(a) \
508 ((((const uint32_t *) (a))[0] == 0) \
509 && (((const uint32_t *) (a))[1] == 0) \
510 && (((const uint32_t *) (a))[2] == htonl (0xffff)))
512 # define IN6_IS_ADDR_V4COMPAT(a) \
513 ((((const uint32_t *) (a))[0] == 0) \
514 && (((const uint32_t *) (a))[1] == 0) \
515 && (((const uint32_t *) (a))[2] == 0) \
516 && (ntohl (((const uint32_t *) (a))[3]) > 1))
518 # define IN6_ARE_ADDR_EQUAL(a,b) \
519 ((((const uint32_t *) (a))[0] == ((const uint32_t *) (b))[0]) \
520 && (((const uint32_t *) (a))[1] == ((const uint32_t *) (b))[1]) \
521 && (((const uint32_t *) (a))[2] == ((const uint32_t *) (b))[2]) \
522 && (((const uint32_t *) (a))[3] == ((const uint32_t *) (b))[3]))
525 #define IN6_IS_ADDR_MULTICAST(a) (((const uint8_t *) (a))[0] == 0xff)
528 /* Bind socket to a privileged IP port. */
529 extern int bindresvport (int __sockfd
, struct sockaddr_in
*__sock_in
) __THROW
;
531 /* The IPv6 version of this function. */
532 extern int bindresvport6 (int __sockfd
, struct sockaddr_in6
*__sock_in
)
537 #define IN6_IS_ADDR_MC_NODELOCAL(a) \
538 (IN6_IS_ADDR_MULTICAST(a) \
539 && ((((const uint8_t *) (a))[1] & 0xf) == 0x1))
541 #define IN6_IS_ADDR_MC_LINKLOCAL(a) \
542 (IN6_IS_ADDR_MULTICAST(a) \
543 && ((((const uint8_t *) (a))[1] & 0xf) == 0x2))
545 #define IN6_IS_ADDR_MC_SITELOCAL(a) \
546 (IN6_IS_ADDR_MULTICAST(a) \
547 && ((((const uint8_t *) (a))[1] & 0xf) == 0x5))
549 #define IN6_IS_ADDR_MC_ORGLOCAL(a) \
550 (IN6_IS_ADDR_MULTICAST(a) \
551 && ((((const uint8_t *) (a))[1] & 0xf) == 0x8))
553 #define IN6_IS_ADDR_MC_GLOBAL(a) \
554 (IN6_IS_ADDR_MULTICAST(a) \
555 && ((((const uint8_t *) (a))[1] & 0xf) == 0xe))
559 struct cmsghdr
; /* Forward declaration. */
561 #if !__USE_KERNEL_IPV6_DEFS
562 /* IPv6 packet information. */
565 struct in6_addr ipi6_addr
; /* src/dst IPv6 address */
566 unsigned int ipi6_ifindex
; /* send/recv interface index */
569 /* IPv6 MTU information. */
572 struct sockaddr_in6 ip6m_addr
; /* dst address including zone ID */
573 uint32_t ip6m_mtu
; /* path MTU in host byte order */
575 #endif /* !__USE_KERNEL_IPV6_DEFS */
577 /* Obsolete hop-by-hop and Destination Options Processing (RFC 2292). */
578 extern int inet6_option_space (int __nbytes
)
579 __THROW __attribute_deprecated__
;
580 extern int inet6_option_init (void *__bp
, struct cmsghdr
**__cmsgp
,
581 int __type
) __THROW __attribute_deprecated__
;
582 extern int inet6_option_append (struct cmsghdr
*__cmsg
,
583 const uint8_t *__typep
, int __multx
,
584 int __plusy
) __THROW __attribute_deprecated__
;
585 extern uint8_t *inet6_option_alloc (struct cmsghdr
*__cmsg
, int __datalen
,
586 int __multx
, int __plusy
)
587 __THROW __attribute_deprecated__
;
588 extern int inet6_option_next (const struct cmsghdr
*__cmsg
,
590 __THROW __attribute_deprecated__
;
591 extern int inet6_option_find (const struct cmsghdr
*__cmsg
,
592 uint8_t **__tptrp
, int __type
)
593 __THROW __attribute_deprecated__
;
596 /* Hop-by-Hop and Destination Options Processing (RFC 3542). */
597 extern int inet6_opt_init (void *__extbuf
, socklen_t __extlen
) __THROW
;
598 extern int inet6_opt_append (void *__extbuf
, socklen_t __extlen
, int __offset
,
599 uint8_t __type
, socklen_t __len
, uint8_t __align
,
600 void **__databufp
) __THROW
;
601 extern int inet6_opt_finish (void *__extbuf
, socklen_t __extlen
, int __offset
)
603 extern int inet6_opt_set_val (void *__databuf
, int __offset
, void *__val
,
604 socklen_t __vallen
) __THROW
;
605 extern int inet6_opt_next (void *__extbuf
, socklen_t __extlen
, int __offset
,
606 uint8_t *__typep
, socklen_t
*__lenp
,
607 void **__databufp
) __THROW
;
608 extern int inet6_opt_find (void *__extbuf
, socklen_t __extlen
, int __offset
,
609 uint8_t __type
, socklen_t
*__lenp
,
610 void **__databufp
) __THROW
;
611 extern int inet6_opt_get_val (void *__databuf
, int __offset
, void *__val
,
612 socklen_t __vallen
) __THROW
;
615 /* Routing Header Option (RFC 3542). */
616 extern socklen_t
inet6_rth_space (int __type
, int __segments
) __THROW
;
617 extern void *inet6_rth_init (void *__bp
, socklen_t __bp_len
, int __type
,
618 int __segments
) __THROW
;
619 extern int inet6_rth_add (void *__bp
, const struct in6_addr
*__addr
) __THROW
;
620 extern int inet6_rth_reverse (const void *__in
, void *__out
) __THROW
;
621 extern int inet6_rth_segments (const void *__bp
) __THROW
;
622 extern struct in6_addr
*inet6_rth_getaddr (const void *__bp
, int __index
)
626 /* Multicast source filter support. */
628 /* Get IPv4 source filter. */
629 extern int getipv4sourcefilter (int __s
, struct in_addr __interface_addr
,
630 struct in_addr __group
, uint32_t *__fmode
,
631 uint32_t *__numsrc
, struct in_addr
*__slist
)
634 /* Set IPv4 source filter. */
635 extern int setipv4sourcefilter (int __s
, struct in_addr __interface_addr
,
636 struct in_addr __group
, uint32_t __fmode
,
638 const struct in_addr
*__slist
)
642 /* Get source filter. */
643 extern int getsourcefilter (int __s
, uint32_t __interface_addr
,
644 const struct sockaddr
*__group
,
645 socklen_t __grouplen
, uint32_t *__fmode
,
647 struct sockaddr_storage
*__slist
) __THROW
;
649 /* Set source filter. */
650 extern int setsourcefilter (int __s
, uint32_t __interface_addr
,
651 const struct sockaddr
*__group
,
652 socklen_t __grouplen
, uint32_t __fmode
,
654 const struct sockaddr_storage
*__slist
) __THROW
;
659 #endif /* netinet/in.h */