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