Path: blob/buildjre8/ios-missing-include/netinet6/in6.h
861 views
/*1* Copyright (c) 2008-2020 Apple Inc. All rights reserved.2*3* @APPLE_OSREFERENCE_LICENSE_HEADER_START@4*5* This file contains Original Code and/or Modifications of Original Code6* as defined in and that are subject to the Apple Public Source License7* Version 2.0 (the 'License'). You may not use this file except in8* compliance with the License. The rights granted to you under the License9* may not be used to create, or enable the creation or redistribution of,10* unlawful or unlicensed copies of an Apple operating system, or to11* circumvent, violate, or enable the circumvention or violation of, any12* terms of an Apple operating system software license agreement.13*14* Please obtain a copy of the License at15* http://www.opensource.apple.com/apsl/ and read it before using this file.16*17* The Original Code and all software distributed under the License are18* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER19* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,20* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,21* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.22* Please see the License for the specific language governing rights and23* limitations under the License.24*25* @APPLE_OSREFERENCE_LICENSE_HEADER_END@26*/2728/*29* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.30* All rights reserved.31*32* Redistribution and use in source and binary forms, with or without33* modification, are permitted provided that the following conditions34* are met:35* 1. Redistributions of source code must retain the above copyright36* notice, this list of conditions and the following disclaimer.37* 2. Redistributions in binary form must reproduce the above copyright38* notice, this list of conditions and the following disclaimer in the39* documentation and/or other materials provided with the distribution.40* 3. Neither the name of the project nor the names of its contributors41* may be used to endorse or promote products derived from this software42* without specific prior written permission.43*44* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND45* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE46* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE47* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE48* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL49* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS50* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)51* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT52* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY53* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF54* SUCH DAMAGE.55*/5657/*58* Copyright (c) 1982, 1986, 1990, 199359* The Regents of the University of California. All rights reserved.60*61* Redistribution and use in source and binary forms, with or without62* modification, are permitted provided that the following conditions63* are met:64* 1. Redistributions of source code must retain the above copyright65* notice, this list of conditions and the following disclaimer.66* 2. Redistributions in binary form must reproduce the above copyright67* notice, this list of conditions and the following disclaimer in the68* documentation and/or other materials provided with the distribution.69* 3. All advertising materials mentioning features or use of this software70* must display the following acknowledgement:71* This product includes software developed by the University of72* California, Berkeley and its contributors.73* 4. Neither the name of the University nor the names of its contributors74* may be used to endorse or promote products derived from this software75* without specific prior written permission.76*77* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND78* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE79* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE80* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE81* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL82* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS83* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)84* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT85* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY86* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF87* SUCH DAMAGE.88*89* @(#)in.h 8.3 (Berkeley) 1/3/9490*/9192#ifndef __KAME_NETINET_IN_H_INCLUDED_93#error "do not include netinet6/in6.h directly, include netinet/in.h. " \94" see RFC2553"95#endif9697#ifndef _NETINET6_IN6_H_98#define _NETINET6_IN6_H_99#include <sys/appleapiopts.h>100101#include <sys/_types.h>102#include <sys/_types/_sa_family_t.h>103104/*105* Identification of the network protocol stack106* for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE107* has the table of implementation/integration differences.108*/109#define __KAME__110#define __KAME_VERSION "2009/apple-darwin"111112#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)113/*114* Local port number conventions:115*116* Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root),117* unless a kernel is compiled with IPNOPRIVPORTS defined.118*119* When a user does a bind(2) or connect(2) with a port number of zero,120* a non-conflicting local port address is chosen.121*122* The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although123* that is settable by sysctl(3); net.inet.ip.anonportmin and124* net.inet.ip.anonportmax respectively.125*126* A user may set the IPPROTO_IP option IP_PORTRANGE to change this127* default assignment range.128*129* The value IP_PORTRANGE_DEFAULT causes the default behavior.130*131* The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT,132* and exists only for FreeBSD compatibility purposes.133*134* The value IP_PORTRANGE_LOW changes the range to the "low" are135* that is (by convention) restricted to privileged processes.136* This convention is based on "vouchsafe" principles only.137* It is only secure if you trust the remote host to restrict these ports.138* The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX.139*/140141#define IPV6PORT_RESERVED 1024142#define IPV6PORT_ANONMIN 49152143#define IPV6PORT_ANONMAX 65535144#define IPV6PORT_RESERVEDMIN 600145#define IPV6PORT_RESERVEDMAX (IPV6PORT_RESERVED-1)146#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */147148/*149* IPv6 address150*/151typedef struct in6_addr {152union {153__uint8_t __u6_addr8[16];154__uint16_t __u6_addr16[8];155__uint32_t __u6_addr32[4];156} __u6_addr; /* 128-bit IP6 address */157} in6_addr_t;158159#define s6_addr __u6_addr.__u6_addr8160161#define INET6_ADDRSTRLEN 46162163/*164* Socket address for IPv6165*/166#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)167#define SIN6_LEN168#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */169struct sockaddr_in6 {170__uint8_t sin6_len; /* length of this struct(sa_family_t) */171sa_family_t sin6_family; /* AF_INET6 (sa_family_t) */172in_port_t sin6_port; /* Transport layer port # (in_port_t) */173__uint32_t sin6_flowinfo; /* IP6 flow information */174struct in6_addr sin6_addr; /* IP6 address */175__uint32_t sin6_scope_id; /* scope zone index */176};177178179180181182/*183* Definition of some useful macros to handle IP6 addresses184*/185#define IN6ADDR_ANY_INIT \186{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \1870x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}188#define IN6ADDR_LOOPBACK_INIT \189{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \1900x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}191#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)192#define IN6ADDR_NODELOCAL_ALLNODES_INIT \193{{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \1940x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}195#define IN6ADDR_INTFACELOCAL_ALLNODES_INIT \196{{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \1970x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}198#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \199{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \2000x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}201#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \202{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \2030x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}204#define IN6ADDR_LINKLOCAL_ALLV2ROUTERS_INIT \205{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \2060x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16 }}}207#define IN6ADDR_V4MAPPED_INIT \208{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \2090x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}}210#define IN6ADDR_MULTICAST_PREFIX IN6MASK8211#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */212213extern const struct in6_addr in6addr_any;214extern const struct in6_addr in6addr_loopback;215#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)216extern const struct in6_addr in6addr_nodelocal_allnodes;217extern const struct in6_addr in6addr_linklocal_allnodes;218extern const struct in6_addr in6addr_linklocal_allrouters;219extern const struct in6_addr in6addr_linklocal_allv2routers;220#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */221222/*223* Equality224* NOTE: Some of kernel programming environment (for example, openbsd/sparc)225* does not supply memcmp(). For userland memcmp() is preferred as it is226* in ANSI standard.227*/228#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)229#define IN6_ARE_ADDR_EQUAL(a, b) \230(memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof (struct in6_addr)) \231== 0)232#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */233234235/*236* Unspecified237*/238#define IN6_IS_ADDR_UNSPECIFIED(a) \239((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \240(*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \241(*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \242(*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) == 0))243244/*245* Loopback246*/247#define IN6_IS_ADDR_LOOPBACK(a) \248((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \249(*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \250(*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \251(*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) == ntohl(1)))252253/*254* IPv4 compatible255*/256#define IN6_IS_ADDR_V4COMPAT(a) \257((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \258(*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \259(*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \260(*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) != 0) && \261(*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) != ntohl(1)))262263/*264* Mapped265*/266#define IN6_IS_ADDR_V4MAPPED(a) \267((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \268(*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \269(*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == \270ntohl(0x0000ffff)))271272/*273* 6to4274*/275#define IN6_IS_ADDR_6TO4(x) (ntohs((x)->s6_addr16[0]) == 0x2002)276277/*278* KAME Scope Values279*/280281#define __IPV6_ADDR_SCOPE_NODELOCAL 0x01282#define __IPV6_ADDR_SCOPE_INTFACELOCAL 0x01283#define __IPV6_ADDR_SCOPE_LINKLOCAL 0x02284#define __IPV6_ADDR_SCOPE_SITELOCAL 0x05285#define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */286#define __IPV6_ADDR_SCOPE_GLOBAL 0x0e287288/*289* Unicast Scope290* Note that we must check topmost 10 bits only, not 16 bits (see RFC2373).291*/292#define IN6_IS_ADDR_LINKLOCAL(a) \293(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))294#define IN6_IS_ADDR_SITELOCAL(a) \295(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))296297/*298* Multicast299*/300#define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff)301302#define IPV6_ADDR_MC_FLAGS(a) ((a)->s6_addr[1] & 0xf0)303304#define IPV6_ADDR_MC_FLAGS_TRANSIENT 0x10305#define IPV6_ADDR_MC_FLAGS_PREFIX 0x20306#define IPV6_ADDR_MC_FLAGS_UNICAST_BASED (IPV6_ADDR_MC_FLAGS_TRANSIENT | IPV6_ADDR_MC_FLAGS_PREFIX)307308#define IN6_IS_ADDR_UNICAST_BASED_MULTICAST(a) \309(IN6_IS_ADDR_MULTICAST(a) && \310(IPV6_ADDR_MC_FLAGS(a) == IPV6_ADDR_MC_FLAGS_UNICAST_BASED))311312/*313* Unique Local IPv6 Unicast Addresses (per RFC 4193)314*/315#define IN6_IS_ADDR_UNIQUE_LOCAL(a) \316(((a)->s6_addr[0] == 0xfc) || ((a)->s6_addr[0] == 0xfd))317318#define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)319320/*321* Multicast Scope322*/323#define IN6_IS_ADDR_MC_NODELOCAL(a) \324(IN6_IS_ADDR_MULTICAST(a) && \325(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL))326#define IN6_IS_ADDR_MC_LINKLOCAL(a) \327(IN6_IS_ADDR_MULTICAST(a) && \328(IPV6_ADDR_MC_FLAGS(a) != IPV6_ADDR_MC_FLAGS_UNICAST_BASED) && \329(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL))330#define IN6_IS_ADDR_MC_SITELOCAL(a) \331(IN6_IS_ADDR_MULTICAST(a) && \332(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))333#define IN6_IS_ADDR_MC_ORGLOCAL(a) \334(IN6_IS_ADDR_MULTICAST(a) && \335(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))336#define IN6_IS_ADDR_MC_GLOBAL(a) \337(IN6_IS_ADDR_MULTICAST(a) && \338(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL))339340341342343/*344* Options for use with [gs]etsockopt at the IPV6 level.345* First word of comment is data type; bool is stored in int.346*/347/* no hdrincl */348#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)349/*350* RFC 3542 define the following socket options in a manner incompatible351* with RFC 2292:352* IPV6_PKTINFO353* IPV6_HOPLIMIT354* IPV6_NEXTHOP355* IPV6_HOPOPTS356* IPV6_DSTOPTS357* IPV6_RTHDR358*359* To use the new IPv6 Sockets options introduced by RFC 3542360* the constant __APPLE_USE_RFC_3542 must be defined before361* including <netinet/in.h>362*363* To use the old IPv6 Sockets options from RFC 2292364* the constant __APPLE_USE_RFC_2292 must be defined before365* including <netinet/in.h>366*367* Note that eventually RFC 3542 is going to be the368* default and RFC 2292 will be obsolete.369*/370371#if defined(__APPLE_USE_RFC_3542) && defined(__APPLE_USE_RFC_2292)372#error "__APPLE_USE_RFC_3542 and __APPLE_USE_RFC_2292 cannot be both defined"373#endif374375#if 0 /* the followings are relic in IPv4 and hence are disabled */376#define IPV6_OPTIONS 1 /* buf/ip6_opts; set/get IP6 options */377#define IPV6_RECVOPTS 5 /* bool; receive all IP6 opts w/dgram */378#define IPV6_RECVRETOPTS 6 /* bool; receive IP6 opts for response */379#define IPV6_RECVDSTADDR 7 /* bool; receive IP6 dst addr w/dgram */380#define IPV6_RETOPTS 8 /* ip6_opts; set/get IP6 options */381#endif /* 0 */382#define IPV6_SOCKOPT_RESERVED1 3 /* reserved for future use */383#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */384#define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */385#define IPV6_MULTICAST_IF 9 /* u_int; set/get IP6 multicast i/f */386#define IPV6_MULTICAST_HOPS 10 /* int; set/get IP6 multicast hops */387#define IPV6_MULTICAST_LOOP 11 /* u_int; set/get IP6 mcast loopback */388#define IPV6_JOIN_GROUP 12 /* ip6_mreq; join a group membership */389#define IPV6_LEAVE_GROUP 13 /* ip6_mreq; leave a group membership */390391#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)392#define IPV6_PORTRANGE 14 /* int; range to choose for unspec port */393#define ICMP6_FILTER 18 /* icmp6_filter; icmp6 filter */394#define IPV6_2292PKTINFO 19 /* bool; send/recv if, src/dst addr */395#define IPV6_2292HOPLIMIT 20 /* bool; hop limit */396#define IPV6_2292NEXTHOP 21 /* bool; next hop addr */397#define IPV6_2292HOPOPTS 22 /* bool; hop-by-hop option */398#define IPV6_2292DSTOPTS 23 /* bool; destinaion option */399#define IPV6_2292RTHDR 24 /* ip6_rthdr: routing header */400401/* buf/cmsghdr; set/get IPv6 options [obsoleted by RFC3542] */402#define IPV6_2292PKTOPTIONS 25403404#ifdef __APPLE_USE_RFC_2292405#define IPV6_PKTINFO IPV6_2292PKTINFO406#define IPV6_HOPLIMIT IPV6_2292HOPLIMIT407#define IPV6_NEXTHOP IPV6_2292NEXTHOP408#define IPV6_HOPOPTS IPV6_2292HOPOPTS409#define IPV6_DSTOPTS IPV6_2292DSTOPTS410#define IPV6_RTHDR IPV6_2292RTHDR411#define IPV6_PKTOPTIONS IPV6_2292PKTOPTIONS412#endif /* __APPLE_USE_RFC_2292 */413414#define IPV6_CHECKSUM 26 /* int; checksum offset for raw socket */415#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */416#define IPV6_V6ONLY 27 /* bool; only bind INET6 at wildcard bind */417#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)418#define IPV6_BINDV6ONLY IPV6_V6ONLY419420421#if 1 /* IPSEC */422#define IPV6_IPSEC_POLICY 28 /* struct; get/set security policy */423#endif /* 1 */424#define IPV6_FAITH 29 /* deprecated */425426#if 1 /* IPV6FIREWALL */427#define IPV6_FW_ADD 30 /* add a firewall rule to chain */428#define IPV6_FW_DEL 31 /* delete a firewall rule from chain */429#define IPV6_FW_FLUSH 32 /* flush firewall rule chain */430#define IPV6_FW_ZERO 33 /* clear single/all firewall counter(s) */431#define IPV6_FW_GET 34 /* get entire firewall rule chain */432#endif /* 1 */433434/*435* APPLE: NOTE the value of those 2 options is kept unchanged from436* previous version of darwin/OS X for binary compatibility reasons437* and differ from FreeBSD (values 57 and 61). See below.438*/439#define IPV6_RECVTCLASS 35 /* bool; recv traffic class values */440#define IPV6_TCLASS 36 /* int; send traffic class value */441442#ifdef __APPLE_USE_RFC_3542443/* new socket options introduced in RFC3542 */444/*445* ip6_dest; send dst option before rthdr446* APPLE: Value purposely different than FreeBSD (35) to avoid447* collision with definition of IPV6_RECVTCLASS in previous448* darwin implementations449*/450#define IPV6_RTHDRDSTOPTS 57451452/*453* bool; recv if, dst addr454* APPLE: Value purposely different than FreeBSD(36) to avoid455* collision with definition of IPV6_TCLASS in previous456* darwin implementations457*/458#define IPV6_RECVPKTINFO 61459460#define IPV6_RECVHOPLIMIT 37 /* bool; recv hop limit */461#define IPV6_RECVRTHDR 38 /* bool; recv routing header */462#define IPV6_RECVHOPOPTS 39 /* bool; recv hop-by-hop option */463#define IPV6_RECVDSTOPTS 40 /* bool; recv dst option after rthdr */464465#define IPV6_USE_MIN_MTU 42 /* bool; send packets at the minimum MTU */466#define IPV6_RECVPATHMTU 43 /* bool; notify an according MTU */467468/*469* mtuinfo; get the current path MTU (sopt), 4 bytes int;470* MTU notification (cmsg)471*/472#define IPV6_PATHMTU 44473474#if 0 /* obsoleted during 2292bis -> 3542 */475/* no data; ND reachability confirm (cmsg only/not in of RFC3542) */476#define IPV6_REACHCONF 45477#endif478/* more new socket options introduced in RFC3542 */479#define IPV6_3542PKTINFO 46 /* in6_pktinfo; send if, src addr */480#define IPV6_3542HOPLIMIT 47 /* int; send hop limit */481#define IPV6_3542NEXTHOP 48 /* sockaddr; next hop addr */482#define IPV6_3542HOPOPTS 49 /* ip6_hbh; send hop-by-hop option */483#define IPV6_3542DSTOPTS 50 /* ip6_dest; send dst option befor rthdr */484#define IPV6_3542RTHDR 51 /* ip6_rthdr; send routing header */485486#define IPV6_PKTINFO IPV6_3542PKTINFO487#define IPV6_HOPLIMIT IPV6_3542HOPLIMIT488#define IPV6_NEXTHOP IPV6_3542NEXTHOP489#define IPV6_HOPOPTS IPV6_3542HOPOPTS490#define IPV6_DSTOPTS IPV6_3542DSTOPTS491#define IPV6_RTHDR IPV6_3542RTHDR492493#define IPV6_AUTOFLOWLABEL 59 /* bool; attach flowlabel automagically */494495#define IPV6_DONTFRAG 62 /* bool; disable IPv6 fragmentation */496497/* int; prefer temporary addresses as the source address. */498#define IPV6_PREFER_TEMPADDR 63499500/*501* The following option is private; do not use it from user applications.502* It is deliberately defined to the same value as IP_MSFILTER.503*/504#define IPV6_MSFILTER 74 /* struct __msfilterreq; */505#endif /* __APPLE_USE_RFC_3542 */506507#define IPV6_BOUND_IF 125 /* int; set/get bound interface */508509510/* to define items, should talk with KAME guys first, for *BSD compatibility */511512#define IPV6_RTHDR_LOOSE 0 /* this hop need not be a neighbor. */513#define IPV6_RTHDR_STRICT 1 /* this hop must be a neighbor. */514#define IPV6_RTHDR_TYPE_0 0 /* IPv6 routing header type 0 */515516/*517* Defaults and limits for options518*/519#define IPV6_DEFAULT_MULTICAST_HOPS 1 /* normally limit m'casts to 1 hop */520#define IPV6_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */521522/*523* The im6o_membership vector for each socket is now dynamically allocated at524* run-time, bounded by USHRT_MAX, and is reallocated when needed, sized525* according to a power-of-two increment.526*/527#define IPV6_MIN_MEMBERSHIPS 31528#define IPV6_MAX_MEMBERSHIPS 4095529530/*531* Default resource limits for IPv6 multicast source filtering.532* These may be modified by sysctl.533*/534#define IPV6_MAX_GROUP_SRC_FILTER 512 /* sources per group */535#define IPV6_MAX_SOCK_SRC_FILTER 128 /* sources per socket/group */536537/*538* Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.539*/540struct ipv6_mreq {541struct in6_addr ipv6mr_multiaddr;542unsigned int ipv6mr_interface;543};544545/*546* IPV6_2292PKTINFO: Packet information(RFC2292 sec 5)547*/548struct in6_pktinfo {549struct in6_addr ipi6_addr; /* src/dst IPv6 address */550unsigned int ipi6_ifindex; /* send/recv interface index */551};552553/*554* Control structure for IPV6_RECVPATHMTU socket option.555*/556struct ip6_mtuinfo {557struct sockaddr_in6 ip6m_addr; /* or sockaddr_storage? */558uint32_t ip6m_mtu;559};560561/*562* Argument for IPV6_PORTRANGE:563* - which range to search when port is unspecified at bind() or connect()564*/565#define IPV6_PORTRANGE_DEFAULT 0 /* default range */566#define IPV6_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */567#define IPV6_PORTRANGE_LOW 2 /* "low" - vouchsafe security */568569/*570* Definitions for inet6 sysctl operations.571*572* Third level is protocol number.573* Fourth level is desired variable within that protocol.574*/575#define IPV6PROTO_MAXID (IPPROTO_PIM + 1) /* don't list to IPV6PROTO_MAX */576577/*578* Names for IP sysctl objects579*/580#define IPV6CTL_FORWARDING 1 /* act as router */581#define IPV6CTL_SENDREDIRECTS 2 /* may send redirects when forwarding */582#define IPV6CTL_DEFHLIM 3 /* default Hop-Limit */583#ifdef notyet584#define IPV6CTL_DEFMTU 4 /* default MTU */585#endif586#define IPV6CTL_FORWSRCRT 5 /* forward source-routed dgrams */587#define IPV6CTL_STATS 6 /* stats */588#define IPV6CTL_MRTSTATS 7 /* multicast forwarding stats */589#define IPV6CTL_MRTPROTO 8 /* multicast routing protocol */590#define IPV6CTL_MAXFRAGPACKETS 9 /* max packets reassembly queue */591#define IPV6CTL_SOURCECHECK 10 /* verify source route and intf */592#define IPV6CTL_SOURCECHECK_LOGINT 11 /* minimume logging interval */593#define IPV6CTL_ACCEPT_RTADV 12594#define IPV6CTL_KEEPFAITH 13 /* deprecated */595#define IPV6CTL_LOG_INTERVAL 14596#define IPV6CTL_HDRNESTLIMIT 15597#define IPV6CTL_DAD_COUNT 16598#define IPV6CTL_AUTO_FLOWLABEL 17599#define IPV6CTL_DEFMCASTHLIM 18600#define IPV6CTL_GIF_HLIM 19 /* default HLIM for gif encap packet */601#define IPV6CTL_KAME_VERSION 20602#define IPV6CTL_USE_DEPRECATED 21 /* use deprec addr (RFC2462 5.5.4) */603#define IPV6CTL_RR_PRUNE 22 /* walk timer for router renumbering */604#if 0 /* obsolete */605#define IPV6CTL_MAPPED_ADDR 23606#endif607#define IPV6CTL_V6ONLY 24608#define IPV6CTL_RTEXPIRE 25 /* cloned route expiration time */609#define IPV6CTL_RTMINEXPIRE 26 /* min value for expiration time */610#define IPV6CTL_RTMAXCACHE 27 /* trigger level for dynamic expire */611612#define IPV6CTL_USETEMPADDR 32 /* use temporary addresses [RFC 4941] */613#define IPV6CTL_TEMPPLTIME 33 /* preferred lifetime for tmpaddrs */614#define IPV6CTL_TEMPVLTIME 34 /* valid lifetime for tmpaddrs */615#define IPV6CTL_AUTO_LINKLOCAL 35 /* automatic link-local addr assign */616#define IPV6CTL_RIP6STATS 36 /* raw_ip6 stats */617#define IPV6CTL_PREFER_TEMPADDR 37 /* prefer temporary addr as src */618#define IPV6CTL_ADDRCTLPOLICY 38 /* get/set address selection policy */619#define IPV6CTL_USE_DEFAULTZONE 39 /* use default scope zone */620621#define IPV6CTL_MAXFRAGS 41 /* max fragments */622#define IPV6CTL_MCAST_PMTU 44 /* enable pMTU discovery for mcast? */623624#define IPV6CTL_NEIGHBORGCTHRESH 46625#define IPV6CTL_MAXIFPREFIXES 47626#define IPV6CTL_MAXIFDEFROUTERS 48627#define IPV6CTL_MAXDYNROUTES 49628#define ICMPV6CTL_ND6_ONLINKNSRFC4861 50629630/* New entries should be added here from current IPV6CTL_MAXID value. */631/* to define items, should talk with KAME guys first, for *BSD compatibility */632#define IPV6CTL_MAXID 51633634635636637638__BEGIN_DECLS639struct cmsghdr;640641extern int inet6_option_space(int);642extern int inet6_option_init(void *, struct cmsghdr **, int);643extern int inet6_option_append(struct cmsghdr *, const __uint8_t *, int, int);644extern __uint8_t *inet6_option_alloc(struct cmsghdr *, int, int, int);645extern int inet6_option_next(const struct cmsghdr *, __uint8_t **);646extern int inet6_option_find(const struct cmsghdr *, __uint8_t **, int);647648extern size_t inet6_rthdr_space(int, int);649extern struct cmsghdr *inet6_rthdr_init(void *, int);650extern int inet6_rthdr_add(struct cmsghdr *, const struct in6_addr *,651unsigned int);652extern int inet6_rthdr_lasthop(struct cmsghdr *, unsigned int);653#if 0 /* not implemented yet */654extern int inet6_rthdr_reverse(const struct cmsghdr *, struct cmsghdr *);655#endif656extern int inet6_rthdr_segments(const struct cmsghdr *);657extern struct in6_addr *inet6_rthdr_getaddr(struct cmsghdr *, int);658extern int inet6_rthdr_getflags(const struct cmsghdr *, int);659660extern int inet6_opt_init(void *, socklen_t);661extern int inet6_opt_append(void *, socklen_t, int, __uint8_t, socklen_t,662__uint8_t, void **);663extern int inet6_opt_finish(void *, socklen_t, int);664extern int inet6_opt_set_val(void *, int, void *, socklen_t);665666extern int inet6_opt_next(void *, socklen_t, int, __uint8_t *, socklen_t *,667void **);668extern int inet6_opt_find(void *, socklen_t, int, __uint8_t, socklen_t *,669void **);670extern int inet6_opt_get_val(void *, int, void *, socklen_t);671extern socklen_t inet6_rth_space(int, int);672extern void *inet6_rth_init(void *, socklen_t, int, int);673extern int inet6_rth_add(void *, const struct in6_addr *);674extern int inet6_rth_reverse(const void *, void *);675extern int inet6_rth_segments(const void *);676extern struct in6_addr *inet6_rth_getaddr(const void *, int);677678__END_DECLS679#endif /* PLATFORM_DriverKit */680#endif /* !_NETINET6_IN6_H_ */681682683