Back to index

glibc  2.9
in.h
Go to the documentation of this file.
00001 /* Copyright (C) 1991-2001, 2003, 2004, 2006, 2007, 2008
00002    Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #ifndef       _NETINET_IN_H
00021 #define       _NETINET_IN_H 1
00022 
00023 #include <features.h>
00024 #include <stdint.h>
00025 #include <sys/socket.h>
00026 #include <bits/types.h>
00027 
00028 
00029 __BEGIN_DECLS
00030 
00031 /* Standard well-defined IP protocols.  */
00032 enum
00033   {
00034     IPPROTO_IP = 0,     /* Dummy protocol for TCP.  */
00035 #define IPPROTO_IP          IPPROTO_IP
00036     IPPROTO_HOPOPTS = 0,   /* IPv6 Hop-by-Hop options.  */
00037 #define IPPROTO_HOPOPTS            IPPROTO_HOPOPTS
00038     IPPROTO_ICMP = 1,          /* Internet Control Message Protocol.  */
00039 #define IPPROTO_ICMP        IPPROTO_ICMP
00040     IPPROTO_IGMP = 2,          /* Internet Group Management Protocol. */
00041 #define IPPROTO_IGMP        IPPROTO_IGMP
00042     IPPROTO_IPIP = 4,          /* IPIP tunnels (older KA9Q tunnels use 94).  */
00043 #define IPPROTO_IPIP        IPPROTO_IPIP
00044     IPPROTO_TCP = 6,    /* Transmission Control Protocol.  */
00045 #define IPPROTO_TCP         IPPROTO_TCP
00046     IPPROTO_EGP = 8,    /* Exterior Gateway Protocol.  */
00047 #define IPPROTO_EGP         IPPROTO_EGP
00048     IPPROTO_PUP = 12,          /* PUP protocol.  */
00049 #define IPPROTO_PUP         IPPROTO_PUP
00050     IPPROTO_UDP = 17,          /* User Datagram Protocol.  */
00051 #define IPPROTO_UDP         IPPROTO_UDP
00052     IPPROTO_IDP = 22,          /* XNS IDP protocol.  */
00053 #define IPPROTO_IDP         IPPROTO_IDP
00054     IPPROTO_TP = 29,    /* SO Transport Protocol Class 4.  */
00055 #define IPPROTO_TP          IPPROTO_TP
00056     IPPROTO_DCCP = 33,         /* Datagram Congestion Control Protocol.  */
00057 #define IPPROTO_DCCP        IPPROTO_DCCP
00058     IPPROTO_IPV6 = 41,     /* IPv6 header.  */
00059 #define IPPROTO_IPV6        IPPROTO_IPV6
00060     IPPROTO_ROUTING = 43,  /* IPv6 routing header.  */
00061 #define IPPROTO_ROUTING            IPPROTO_ROUTING
00062     IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header.  */
00063 #define IPPROTO_FRAGMENT    IPPROTO_FRAGMENT
00064     IPPROTO_RSVP = 46,         /* Reservation Protocol.  */
00065 #define IPPROTO_RSVP        IPPROTO_RSVP
00066     IPPROTO_GRE = 47,          /* General Routing Encapsulation.  */
00067 #define IPPROTO_GRE         IPPROTO_GRE
00068     IPPROTO_ESP = 50,      /* encapsulating security payload.  */
00069 #define IPPROTO_ESP         IPPROTO_ESP
00070     IPPROTO_AH = 51,       /* authentication header.  */
00071 #define IPPROTO_AH          IPPROTO_AH
00072     IPPROTO_ICMPV6 = 58,   /* ICMPv6.  */
00073 #define IPPROTO_ICMPV6             IPPROTO_ICMPV6
00074     IPPROTO_NONE = 59,     /* IPv6 no next header.  */
00075 #define IPPROTO_NONE        IPPROTO_NONE
00076     IPPROTO_DSTOPTS = 60,  /* IPv6 destination options.  */
00077 #define IPPROTO_DSTOPTS            IPPROTO_DSTOPTS
00078     IPPROTO_MTP = 92,          /* Multicast Transport Protocol.  */
00079 #define IPPROTO_MTP         IPPROTO_MTP
00080     IPPROTO_ENCAP = 98,        /* Encapsulation Header.  */
00081 #define IPPROTO_ENCAP              IPPROTO_ENCAP
00082     IPPROTO_PIM = 103,         /* Protocol Independent Multicast.  */
00083 #define IPPROTO_PIM         IPPROTO_PIM
00084     IPPROTO_COMP = 108,        /* Compression Header Protocol.  */
00085 #define IPPROTO_COMP        IPPROTO_COMP
00086     IPPROTO_SCTP = 132,        /* Stream Control Transmission Protocol.  */
00087 #define IPPROTO_SCTP        IPPROTO_SCTP
00088     IPPROTO_UDPLITE = 136, /* UDP-Lite protocol.  */
00089 #define IPPROTO_UDPLITE            IPPROTO_UDPLITE
00090     IPPROTO_RAW = 255,         /* Raw IP packets.  */
00091 #define IPPROTO_RAW         IPPROTO_RAW
00092     IPPROTO_MAX
00093   };
00094 
00095 
00096 /* Type to represent a port.  */
00097 typedef uint16_t in_port_t;
00098 
00099 /* Standard well-known ports.  */
00100 enum
00101   {
00102     IPPORT_ECHO = 7,        /* Echo service.  */
00103     IPPORT_DISCARD = 9,            /* Discard transmissions service.  */
00104     IPPORT_SYSTAT = 11,            /* System status service.  */
00105     IPPORT_DAYTIME = 13,    /* Time of day service.  */
00106     IPPORT_NETSTAT = 15,    /* Network status service.  */
00107     IPPORT_FTP = 21,        /* File Transfer Protocol.  */
00108     IPPORT_TELNET = 23,            /* Telnet protocol.  */
00109     IPPORT_SMTP = 25,              /* Simple Mail Transfer Protocol.  */
00110     IPPORT_TIMESERVER = 37, /* Timeserver service.  */
00111     IPPORT_NAMESERVER = 42, /* Domain Name Service.  */
00112     IPPORT_WHOIS = 43,             /* Internet Whois service.  */
00113     IPPORT_MTP = 57,
00114 
00115     IPPORT_TFTP = 69,              /* Trivial File Transfer Protocol.  */
00116     IPPORT_RJE = 77,
00117     IPPORT_FINGER = 79,            /* Finger service.  */
00118     IPPORT_TTYLINK = 87,
00119     IPPORT_SUPDUP = 95,            /* SUPDUP protocol.  */
00120 
00121 
00122     IPPORT_EXECSERVER = 512,       /* execd service.  */
00123     IPPORT_LOGINSERVER = 513,      /* rlogind service.  */
00124     IPPORT_CMDSERVER = 514,
00125     IPPORT_EFSSERVER = 520,
00126 
00127     /* UDP ports.  */
00128     IPPORT_BIFFUDP = 512,
00129     IPPORT_WHOSERVER = 513,
00130     IPPORT_ROUTESERVER = 520,
00131 
00132     /* Ports less than this value are reserved for privileged processes.  */
00133     IPPORT_RESERVED = 1024,
00134 
00135     /* Ports greater this value are reserved for (non-privileged) servers.  */
00136     IPPORT_USERRESERVED = 5000
00137   };
00138 
00139 
00140 /* Internet address.  */
00141 typedef uint32_t in_addr_t;
00142 struct in_addr
00143   {
00144     in_addr_t s_addr;
00145   };
00146 
00147 
00148 /* Definitions of the bits in an Internet address integer.
00149 
00150    On subnets, host and network parts are found according to
00151    the subnet mask, not these masks.  */
00152 
00153 #define       IN_CLASSA(a)         ((((in_addr_t)(a)) & 0x80000000) == 0)
00154 #define       IN_CLASSA_NET        0xff000000
00155 #define       IN_CLASSA_NSHIFT     24
00156 #define       IN_CLASSA_HOST              (0xffffffff & ~IN_CLASSA_NET)
00157 #define       IN_CLASSA_MAX        128
00158 
00159 #define       IN_CLASSB(a)         ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000)
00160 #define       IN_CLASSB_NET        0xffff0000
00161 #define       IN_CLASSB_NSHIFT     16
00162 #define       IN_CLASSB_HOST              (0xffffffff & ~IN_CLASSB_NET)
00163 #define       IN_CLASSB_MAX        65536
00164 
00165 #define       IN_CLASSC(a)         ((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000)
00166 #define       IN_CLASSC_NET        0xffffff00
00167 #define       IN_CLASSC_NSHIFT     8
00168 #define       IN_CLASSC_HOST              (0xffffffff & ~IN_CLASSC_NET)
00169 
00170 #define       IN_CLASSD(a)         ((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000)
00171 #define       IN_MULTICAST(a)             IN_CLASSD(a)
00172 
00173 #define       IN_EXPERIMENTAL(a)   ((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000)
00174 #define       IN_BADCLASS(a)              ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)
00175 
00176 /* Address to accept any incoming messages.  */
00177 #define       INADDR_ANY           ((in_addr_t) 0x00000000)
00178 /* Address to send to all hosts.  */
00179 #define       INADDR_BROADCAST     ((in_addr_t) 0xffffffff)
00180 /* Address indicating an error return.  */
00181 #define       INADDR_NONE          ((in_addr_t) 0xffffffff)
00182 
00183 /* Network number for local host loopback.  */
00184 #define       IN_LOOPBACKNET              127
00185 /* Address to loopback in software to local host.  */
00186 #ifndef INADDR_LOOPBACK
00187 # define INADDR_LOOPBACK    ((in_addr_t) 0x7f000001) /* Inet 127.0.0.1.  */
00188 #endif
00189 
00190 /* Defines for Multicast INADDR.  */
00191 #define INADDR_UNSPEC_GROUP ((in_addr_t) 0xe0000000) /* 224.0.0.0 */
00192 #define INADDR_ALLHOSTS_GROUP      ((in_addr_t) 0xe0000001) /* 224.0.0.1 */
00193 #define INADDR_ALLRTRS_GROUP    ((in_addr_t) 0xe0000002) /* 224.0.0.2 */
00194 #define INADDR_MAX_LOCAL_GROUP  ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */
00195 
00196 
00197 /* IPv6 address */
00198 struct in6_addr
00199   {
00200     union
00201       {
00202        uint8_t       __u6_addr8[16];
00203 #if defined __USE_MISC || defined __USE_GNU
00204        uint16_t __u6_addr16[8];
00205        uint32_t __u6_addr32[4];
00206 #endif
00207       } __in6_u;
00208 #define s6_addr                    __in6_u.__u6_addr8
00209 #if defined __USE_MISC || defined __USE_GNU
00210 # define s6_addr16          __in6_u.__u6_addr16
00211 # define s6_addr32          __in6_u.__u6_addr32
00212 #endif
00213   };
00214 
00215 extern const struct in6_addr in6addr_any;        /* :: */
00216 extern const struct in6_addr in6addr_loopback;   /* ::1 */
00217 #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
00218 #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
00219 
00220 #define INET_ADDRSTRLEN 16
00221 #define INET6_ADDRSTRLEN 46
00222 
00223 
00224 /* Structure describing an Internet socket address.  */
00225 struct sockaddr_in
00226   {
00227     __SOCKADDR_COMMON (sin_);
00228     in_port_t sin_port;                   /* Port number.  */
00229     struct in_addr sin_addr;              /* Internet address.  */
00230 
00231     /* Pad to size of `struct sockaddr'.  */
00232     unsigned char sin_zero[sizeof (struct sockaddr) -
00233                         __SOCKADDR_COMMON_SIZE -
00234                         sizeof (in_port_t) -
00235                         sizeof (struct in_addr)];
00236   };
00237 
00238 /* Ditto, for IPv6.  */
00239 struct sockaddr_in6
00240   {
00241     __SOCKADDR_COMMON (sin6_);
00242     in_port_t sin6_port;    /* Transport layer port # */
00243     uint32_t sin6_flowinfo; /* IPv6 flow information */
00244     struct in6_addr sin6_addr;     /* IPv6 address */
00245     uint32_t sin6_scope_id; /* IPv6 scope-id */
00246   };
00247 
00248 
00249 #if defined __USE_MISC || defined __USE_GNU
00250 /* IPv4 multicast request.  */
00251 struct ip_mreq
00252   {
00253     /* IP multicast address of group.  */
00254     struct in_addr imr_multiaddr;
00255 
00256     /* Local IP address of interface.  */
00257     struct in_addr imr_interface;
00258   };
00259 
00260 struct ip_mreq_source
00261   {
00262     /* IP multicast address of group.  */
00263     struct in_addr imr_multiaddr;
00264 
00265     /* IP address of source.  */
00266     struct in_addr imr_interface;
00267 
00268     /* IP address of interface.  */
00269     struct in_addr imr_sourceaddr;
00270   };
00271 #endif
00272 
00273 
00274 /* Likewise, for IPv6.  */
00275 struct ipv6_mreq
00276   {
00277     /* IPv6 multicast address of group */
00278     struct in6_addr ipv6mr_multiaddr;
00279 
00280     /* local interface */
00281     unsigned int ipv6mr_interface;
00282   };
00283 
00284 
00285 #if defined __USE_MISC || defined __USE_GNU
00286 /* Multicast group request.  */
00287 struct group_req
00288   {
00289     /* Interface index.  */
00290     uint32_t gr_interface;
00291 
00292     /* Group address.  */
00293     struct sockaddr_storage gr_group;
00294   };
00295 
00296 struct group_source_req
00297   {
00298     /* Interface index.  */
00299     uint32_t gsr_interface;
00300 
00301     /* Group address.  */
00302     struct sockaddr_storage gsr_group;
00303 
00304     /* Source address.  */
00305     struct sockaddr_storage gsr_source;
00306   };
00307 
00308 
00309 /* Full-state filter operations.  */
00310 struct ip_msfilter
00311   {
00312     /* IP multicast address of group.  */
00313     struct in_addr imsf_multiaddr;
00314 
00315     /* Local IP address of interface.  */
00316     struct in_addr imsf_interface;
00317 
00318     /* Filter mode.  */
00319     uint32_t imsf_fmode;
00320 
00321     /* Number of source addresses.  */
00322     uint32_t imsf_numsrc;
00323     /* Source addresses.  */
00324     struct in_addr imsf_slist[1];
00325   };
00326 
00327 #define IP_MSFILTER_SIZE(numsrc) (sizeof (struct ip_msfilter) \
00328                               - sizeof (struct in_addr)              \
00329                               + (numsrc) * sizeof (struct in_addr))
00330 
00331 struct group_filter
00332   {
00333     /* Interface index.  */
00334     uint32_t gf_interface;
00335 
00336     /* Group address.  */
00337     struct sockaddr_storage gf_group;
00338 
00339     /* Filter mode.  */
00340     uint32_t gf_fmode;
00341 
00342     /* Number of source addresses.  */
00343     uint32_t gf_numsrc;
00344     /* Source addresses.  */
00345     struct sockaddr_storage gf_slist[1];
00346 };
00347 
00348 #define GROUP_FILTER_SIZE(numsrc) (sizeof (struct group_filter) \
00349                                - sizeof (struct sockaddr_storage)           \
00350                                + ((numsrc)                                  \
00351                                   * sizeof (struct sockaddr_storage)))
00352 #endif
00353 
00354 
00355 /* Get system-specific definitions.  */
00356 #include <bits/in.h>
00357 
00358 /* Functions to convert between host and network byte order.
00359 
00360    Please note that these functions normally take `unsigned long int' or
00361    `unsigned short int' values as arguments and also return them.  But
00362    this was a short-sighted decision since on different systems the types
00363    may have different representations but the values are always the same.  */
00364 
00365 extern uint32_t ntohl (uint32_t __netlong) __THROW __attribute__ ((__const__));
00366 extern uint16_t ntohs (uint16_t __netshort)
00367      __THROW __attribute__ ((__const__));
00368 extern uint32_t htonl (uint32_t __hostlong)
00369      __THROW __attribute__ ((__const__));
00370 extern uint16_t htons (uint16_t __hostshort)
00371      __THROW __attribute__ ((__const__));
00372 
00373 #include <endian.h>
00374 
00375 /* Get machine dependent optimized versions of byte swapping functions.  */
00376 #include <bits/byteswap.h>
00377 
00378 #ifdef __OPTIMIZE__
00379 /* We can optimize calls to the conversion functions.  Either nothing has
00380    to be done or we are using directly the byte-swapping functions which
00381    often can be inlined.  */
00382 # if __BYTE_ORDER == __BIG_ENDIAN
00383 /* The host byte order is the same as network byte order,
00384    so these functions are all just identity.  */
00385 # define ntohl(x)    (x)
00386 # define ntohs(x)    (x)
00387 # define htonl(x)    (x)
00388 # define htons(x)    (x)
00389 # else
00390 #  if __BYTE_ORDER == __LITTLE_ENDIAN
00391 #   define ntohl(x)  __bswap_32 (x)
00392 #   define ntohs(x)  __bswap_16 (x)
00393 #   define htonl(x)  __bswap_32 (x)
00394 #   define htons(x)  __bswap_16 (x)
00395 #  endif
00396 # endif
00397 #endif
00398 
00399 #define IN6_IS_ADDR_UNSPECIFIED(a) \
00400        (((__const uint32_t *) (a))[0] == 0                                  \
00401         && ((__const uint32_t *) (a))[1] == 0                               \
00402         && ((__const uint32_t *) (a))[2] == 0                               \
00403         && ((__const uint32_t *) (a))[3] == 0)
00404 
00405 #define IN6_IS_ADDR_LOOPBACK(a) \
00406        (((__const uint32_t *) (a))[0] == 0                                  \
00407         && ((__const uint32_t *) (a))[1] == 0                               \
00408         && ((__const uint32_t *) (a))[2] == 0                               \
00409         && ((__const uint32_t *) (a))[3] == htonl (1))
00410 
00411 #define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff)
00412 
00413 #define IN6_IS_ADDR_LINKLOCAL(a) \
00414        ((((__const uint32_t *) (a))[0] & htonl (0xffc00000))                \
00415         == htonl (0xfe800000))
00416 
00417 #define IN6_IS_ADDR_SITELOCAL(a) \
00418        ((((__const uint32_t *) (a))[0] & htonl (0xffc00000))                \
00419         == htonl (0xfec00000))
00420 
00421 #define IN6_IS_ADDR_V4MAPPED(a) \
00422        ((((__const uint32_t *) (a))[0] == 0)                                \
00423         && (((__const uint32_t *) (a))[1] == 0)                      \
00424         && (((__const uint32_t *) (a))[2] == htonl (0xffff)))
00425 
00426 #define IN6_IS_ADDR_V4COMPAT(a) \
00427        ((((__const uint32_t *) (a))[0] == 0)                                \
00428         && (((__const uint32_t *) (a))[1] == 0)                      \
00429         && (((__const uint32_t *) (a))[2] == 0)                      \
00430         && (ntohl (((__const uint32_t *) (a))[3]) > 1))
00431 
00432 #define IN6_ARE_ADDR_EQUAL(a,b) \
00433        ((((__const uint32_t *) (a))[0] == ((__const uint32_t *) (b))[0])     \
00434         && (((__const uint32_t *) (a))[1] == ((__const uint32_t *) (b))[1])  \
00435         && (((__const uint32_t *) (a))[2] == ((__const uint32_t *) (b))[2])  \
00436         && (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3]))
00437 
00438 #if defined __USE_MISC || defined __USE_GNU
00439 /* Bind socket to a privileged IP port.  */
00440 extern int bindresvport (int __sockfd, struct sockaddr_in *__sock_in) __THROW;
00441 
00442 /* The IPv6 version of this function.  */
00443 extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in)
00444      __THROW;
00445 #endif
00446 
00447 
00448 #define IN6_IS_ADDR_MC_NODELOCAL(a) \
00449        (IN6_IS_ADDR_MULTICAST(a)                                     \
00450         && ((((__const uint8_t *) (a))[1] & 0xf) == 0x1))
00451 
00452 #define IN6_IS_ADDR_MC_LINKLOCAL(a) \
00453        (IN6_IS_ADDR_MULTICAST(a)                                     \
00454         && ((((__const uint8_t *) (a))[1] & 0xf) == 0x2))
00455 
00456 #define IN6_IS_ADDR_MC_SITELOCAL(a) \
00457        (IN6_IS_ADDR_MULTICAST(a)                                     \
00458         && ((((__const uint8_t *) (a))[1] & 0xf) == 0x5))
00459 
00460 #define IN6_IS_ADDR_MC_ORGLOCAL(a) \
00461        (IN6_IS_ADDR_MULTICAST(a)                                     \
00462         && ((((__const uint8_t *) (a))[1] & 0xf) == 0x8))
00463 
00464 #define IN6_IS_ADDR_MC_GLOBAL(a) \
00465        (IN6_IS_ADDR_MULTICAST(a)                                     \
00466         && ((((__const uint8_t *) (a))[1] & 0xf) == 0xe))
00467 
00468 
00469 #ifdef __USE_GNU
00470 /* IPv6 packet information.  */
00471 struct in6_pktinfo
00472   {
00473     struct in6_addr ipi6_addr;     /* src/dst IPv6 address */
00474     unsigned int ipi6_ifindex;     /* send/recv interface index */
00475   };
00476 
00477 /* IPv6 MTU information.  */
00478 struct ip6_mtuinfo
00479   {
00480     struct sockaddr_in6 ip6m_addr; /* dst address including zone ID */
00481     uint32_t ip6m_mtu;                /* path MTU in host byte order */
00482   };
00483 
00484 
00485 /* Obsolete hop-by-hop and Destination Options Processing (RFC 2292).  */
00486 extern int inet6_option_space (int __nbytes)
00487      __THROW __attribute_deprecated__;
00488 extern int inet6_option_init (void *__bp, struct cmsghdr **__cmsgp,
00489                            int __type) __THROW __attribute_deprecated__;
00490 extern int inet6_option_append (struct cmsghdr *__cmsg,
00491                             __const uint8_t *__typep, int __multx,
00492                             int __plusy) __THROW __attribute_deprecated__;
00493 extern uint8_t *inet6_option_alloc (struct cmsghdr *__cmsg, int __datalen,
00494                                 int __multx, int __plusy)
00495      __THROW __attribute_deprecated__;
00496 extern int inet6_option_next (__const struct cmsghdr *__cmsg,
00497                            uint8_t **__tptrp)
00498      __THROW __attribute_deprecated__;
00499 extern int inet6_option_find (__const struct cmsghdr *__cmsg,
00500                            uint8_t **__tptrp, int __type)
00501      __THROW __attribute_deprecated__;
00502 
00503 
00504 /* Hop-by-Hop and Destination Options Processing (RFC 3542).  */
00505 extern int inet6_opt_init (void *__extbuf, socklen_t __extlen) __THROW;
00506 extern int inet6_opt_append (void *__extbuf, socklen_t __extlen, int __offset,
00507                           uint8_t __type, socklen_t __len, uint8_t __align,
00508                           void **__databufp) __THROW;
00509 extern int inet6_opt_finish (void *__extbuf, socklen_t __extlen, int __offset)
00510      __THROW;
00511 extern int inet6_opt_set_val (void *__databuf, int __offset, void *__val,
00512                            socklen_t __vallen) __THROW;
00513 extern int inet6_opt_next (void *__extbuf, socklen_t __extlen, int __offset,
00514                         uint8_t *__typep, socklen_t *__lenp,
00515                         void **__databufp) __THROW;
00516 extern int inet6_opt_find (void *__extbuf, socklen_t __extlen, int __offset,
00517                         uint8_t __type, socklen_t *__lenp,
00518                         void **__databufp) __THROW;
00519 extern int inet6_opt_get_val (void *__databuf, int __offset, void *__val,
00520                            socklen_t __vallen) __THROW;
00521 
00522 
00523 /* Routing Header Option (RFC 3542).  */
00524 extern socklen_t inet6_rth_space (int __type, int __segments) __THROW;
00525 extern void *inet6_rth_init (void *__bp, socklen_t __bp_len, int __type,
00526                           int __segments) __THROW;
00527 extern int inet6_rth_add (void *__bp, __const struct in6_addr *__addr) __THROW;
00528 extern int inet6_rth_reverse (__const void *__in, void *__out) __THROW;
00529 extern int inet6_rth_segments (__const void *__bp) __THROW;
00530 extern struct in6_addr *inet6_rth_getaddr (__const void *__bp, int __index)
00531      __THROW;
00532 
00533 
00534 /* Multicast source filter support.  */
00535 
00536 /* Get IPv4 source filter.  */
00537 extern int getipv4sourcefilter (int __s, struct in_addr __interface_addr,
00538                             struct in_addr __group, uint32_t *__fmode,
00539                             uint32_t *__numsrc, struct in_addr *__slist)
00540      __THROW;
00541 
00542 /* Set IPv4 source filter.  */
00543 extern int setipv4sourcefilter (int __s, struct in_addr __interface_addr,
00544                             struct in_addr __group, uint32_t __fmode,
00545                             uint32_t __numsrc,
00546                             __const struct in_addr *__slist)
00547      __THROW;
00548 
00549 
00550 /* Get source filter.  */
00551 extern int getsourcefilter (int __s, uint32_t __interface_addr,
00552                          __const struct sockaddr *__group,
00553                          socklen_t __grouplen, uint32_t *__fmode,
00554                          uint32_t *__numsrc,
00555                          struct sockaddr_storage *__slist) __THROW;
00556 
00557 /* Set source filter.  */
00558 extern int setsourcefilter (int __s, uint32_t __interface_addr,
00559                          __const struct sockaddr *__group,
00560                          socklen_t __grouplen, uint32_t __fmode,
00561                          uint32_t __numsrc,
00562                          __const struct sockaddr_storage *__slist) __THROW;
00563 #endif /* use GNU */
00564 
00565 __END_DECLS
00566 
00567 #endif /* netinet/in.h */