#ifndef __IN6_LOADED #define __IN6_LOADED 1 /**************************************************************************** ** ** - Internet V6 protocol family ** ***************************************************************************** ** Header introduced by the X/Open CAE Specification, Issue 4, Version 2 ***************************************************************************** ** ** Copyright 2005 Hewlett-Packard Development Company, L.P. ** ** Confidential computer software. Valid license from HP and/or ** its subsidiaries required for possession, use, or copying. ** ** Consistent with FAR 12.211 and 12.212, Commercial Computer Software, ** Computer Software Documentation, and Technical Data for Commercial ** Items are licensed to the U.S. Government under vendor's standard ** commercial license. ** ** Neither HP nor any of its subsidiaries shall be liable for technical ** or editorial errors or omissions contained herein. The information ** in this document is provided "as is" without warranty of any kind and ** is subject to change without notice. The warranties for HP products ** are set forth in the express limited warranty statements accompanying ** such products. Nothing herein should be construed as constituting an ** additional warranty. ** ***************************************************************************** ** ** Copyright (c) 1982 Regents of the University of California. ** All rights reserved. The Berkeley software License Agreement ** specifies the terms and conditions for redistribution. ** ** in6.h 6.5 (Berkeley) 6/8/85 ** ****************************************************************************** */ #pragma __nostandard #include #ifdef __cplusplus extern "C" { #endif /* ** The OpenVMS V7.0 release added a second implementation of the socket ** functions which is compatible with BSD 4.4. Define a local to be ** used throughout the remaining header file which reflects which ** implementation is being used. ** ** An application program enables this support by defining _SOCKADDR_LEN ** prior to including this header file. */ #ifdef _SOCKADDR_LEN # if (__CRTL_VER < 70000000) # error " BSD 4.4 Socket package not available before OpenVMS V7.0" # undef _SOCKADDR_LEN # endif #endif /* ** All includes of other header files must be done prior to altering the ** pointer size mode. */ #include #if !defined (_XOPEN_SOURCE_EXTENDED) # include #endif #include #include #include /* ** Start processing in 32-bit addressing mode */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size __save # pragma __pointer_size 32 #endif /* ** Set __nomember_alignment to avoid internal and tail ** padding in structures; default base alignment. ** Required for consistency across programming languages. */ #pragma __member_alignment __save #pragma __nomember_alignment /* ** Define XPG4 IP typedefs */ #if !defined __IN_PORT_T && !defined _DECC_V4_SOURCE # define __IN_PORT_T 1 typedef __in_port_t in_port_t; #endif #if !defined __IN_ADDR_T && !defined _DECC_V4_SOURCE # define __IN_ADDR_T 1 typedef __in_addr_t in_addr_t; #endif #if !defined __SA_FAMILY_T && !defined _DECC_V4_SOURCE # define __SA_FAMILY_T 1 typedef __sa_family_t sa_family_t; #endif /* * IPv6 protocols */ #define IPPROTO_HOPOPTS 0 /* Hop-by-hop options */ #define IPPROTO_IPV6 41 /* IPv6 header */ #define IPPROTO_ROUTING 43 /* Routing header */ #define IPPROTO_FRAGMENT 44 /* Fragmentation header */ #define IPPROTO_ESP 50 /* Encap. security payload */ #define IPPROTO_AH 51 /* Authentication header */ #define IPPROTO_ICMPV6 58 #define IPPROTO_NONE 59 #define IPPROTO_DSTOPTS 60 /* Destination Node header */ /* * Interface token lengths (bits) */ #define IPV6_LOOPBACK_TOKEN_LENGTH 0 #define IPV6_ETHERNET_TOKEN_LENGTH 64 #define IPV6_FDDI_TOKEN_LENGTH 64 #define IPV6_IPV4_TOKEN_LENGTH 48 /* * Define the extra set/getsockopts for the IPv6 level. */ #define IP_FLOWLABEL 20 /* int; flow label in net byte order */ #define IP_RXHDR 21 /* int; include rx info in raw recv */ /* * IPv6 level socket options */ #define IPV6_UNICAST_HOPS 104 /* int; unicast hoplimit (0..255) */ #define IPV6_MULTICAST_HOPS 105 /* int; multicast hoplimit (0..255) */ #define IPV6_MULTICAST_IF 106 /* u_int; mcast interface */ #define IPV6_MULTICAST_LOOP 107 /* u_int; recv own multicast (0 or 1) */ #define IPV6_JOIN_GROUP 108 /* struct ipv6_mreq; join group */ #define IPV6_LEAVE_GROUP 109 /* struct ipv6_mreq; leave group */ #define IPV6_PKTINFO 110 /* set in6_pktinfo */ #define IPV6_HOPLIMIT 111 /* set hop limit */ #define IPV6_HOPOPTS 112 /* set hop-by-hop options */ #define IPV6_DSTOPTS 113 /* set dest. options after rt header */ #define IPV6_RTHDR 114 /* set routing header */ #define IPV6_NEXTHOP 115 /* set next hop address */ #define IPV6_CHECKSUM 116 /* int: checksum offset */ #define IPV6_PKTOPTIONS 117 /* sticky options */ #define IPV6_RXHDR 118 /* int; include rx info in raw recv */ #define IPV6_V6ONLY 119 /* int; AF_INET6 socket over IPv6 only*/ #define IPV6_RTHDRDSTOPTS 120 /* dest. options before routing header*/ #define IPV6_RECVPKTINFO 121 /* receive the in6_pktinfo */ #define IPV6_RECVHOPLIMIT 122 /* receive hop limit */ #define IPV6_RECVRTHDR 123 /* receive routing header */ #define IPV6_RECVHOPOPTS 124 /* receive hop-by-hop options */ #define IPV6_RECVDSTOPTS 125 /* receive dest opts after rt header */ #define IPV6_RECVRTHDRDSTOPTS 126 /* receive dest opts before rt header */ #define IPV6_RTHDR2 127 /* set rtng hdr t2 (kernel use only) */ #define IPV6_TCLASS 128 /* set traffic class */ #define IPV6_RECVTCLASS 129 /* receive traffic class */ #define IPV6_USE_MIN_MTU 130 /* path mtu discovery policy */ #define IPV6_DONTFRAG 131 /* don't fragment option */ #define IPV6_RECVPATHMTU 132 /* recieve path mtu information */ #define IPV6_PATHMTU 133 /* path mtu data */ #define IPV6_DEFAULT_UNICAST_HOPLIMIT 64 /* default unicast hop limit */ #define IPV6_DEFAULT_MULTICAST_HOPS 1 /* normally limit mcasts to 1 hop */ #define IPV6_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ #define IPV6_DEFAULT_MEMBERSHIPS 32 /* default per socket */ #define IPV6_MAX_MEMBERSHIPS 65536 /* max per socket */ /* * Define the IPv6 address. */ struct in6_addr { union { u_int8_t sa6_addr[16]; #define s6_addr s6_un.sa6_addr u_int16_t sa6_waddr[8]; #define s6_waddr s6_un.sa6_waddr u_int32_t sa6_laddr[4]; #define s6_laddr s6_un.sa6_laddr #ifdef IN6_HAS_64BIT_INTTYPE u_int64_t sa6_qaddr[2]; #define s6_qaddr s6_un.sa6_qaddr #endif } s6_un; }; /* * Maximum length of IPv6 address as text string */ #define INET6_ADDRSTRLEN 46 /* * IPv6 protocol specific route flags */ #define IPV6_RTF_MINMTU RTF_PROTO2 /* mtu less then 1280, use frag hdr */ /* * Structure for join/leave multicast group */ struct ipv6_mreq { struct in6_addr ipv6mr_multiaddr; /* IPv6 multicast address */ unsigned int ipv6mr_interface; /* inteface index */ }; /* * Define the macros to manipulate IPv6 addresses */ #ifdef IN6_HAS_64BIT_INTTYPE #define IN6_ARE_ADDR_EQUAL(a,b) ((a)->s6_qaddr[1] == (b)->s6_qaddr[1] && \ (a)->s6_qaddr[0] == (b)->s6_qaddr[0]) #define IN6_ARE_ADDR_SAMEPREFIX(a,b,m) (((a)->s6_qaddr[0] & (m)->s6_qaddr[0]) == (b)->s6_qaddr[0] && \ ((a)->s6_qaddr[1] & (m)->s6_qaddr[1]) == (b)->s6_qaddr[1]) #define IN6_IS_ADDR_HOSTMASK(a) (((a)->s6_qaddr[0] & (a)->s6_qaddr[1]) == ~0UL) #define IN6_IS_ADDR_LOOPBACK(a) ((a)->s6_qaddr[0] == 0UL && \ (a)->s6_qaddr[1] == IN6__MK7_MSB64_VALUE(0,0,0,0,0,0,0,1)) #define IN6_IS_ADDR_UNSPECIFIED(a) (((a)->s6_qaddr[0] | (a)->s6_qaddr[1]) == 0UL) #define IN6_IS_ADDR_V4COMPAT(a) ((a)->s6_qaddr[0] == 0UL && \ (a)->s6_laddr[2] == 0 && \ (a)->s6_laddr[3] != 0 && \ (a)->s6_laddr[3] != IN6__MK3_MSB32_VALUE(0,0,0,1)) #define IN6_IS_ADDR_V4MAPPED(a) ((a)->s6_qaddr[0] == 0UL && \ (a)->s6_laddr[2] == IN6__MK1_MSW32_VALUE(0, 0xFFFFU)) #define IN6_SET_ADDR_HOSTMASK(a) ((a)->s6_qaddr[1] = ((a)->s6_qaddr[0] = ~0UL)) #define IN6_SET_ADDR_LOOPBACK(a) ((a)->s6_qaddr[0] = 0UL, \ (a)->s6_qaddr[1] = IN6__MK7_MSB64_VALUE(0,0,0,0,0,0,0,1)) #define IN6_SET_ADDR_PREFIX(a,b,c) ((a)->s6_qaddr[0] = (b)->s6_qaddr[0] & (c)->s6_qaddr[0], \ (a)->s6_qaddr[1] = (b)->s6_qaddr[1] & (c)->s6_qaddr[1]) #define IN6_SET_ADDR_UNSPECIFIED(a) ((a)->s6_qaddr[1] = ((a)->s6_qaddr[0] = 0UL)) #define IN6_SET_ADDR_V4MAPPED(a,b) ((a)->s6_qaddr[0] = 0, \ (a)->s6_laddr[2] = IN6__MK1_MSW32_VALUE(0, 0xFFFFU), \ (a)->s6_laddr[3] = (b)) #define IN6_SET_ADDR_V4COMPAT(a,b) ((a)->s6_qaddr[0] = 0, \ (a)->s6_laddr[2] = 0, \ (a)->s6_laddr[3] = (b)) #define IN6_SET_LINKLOCAL_NETMASK(a) ((a)->s6_qaddr[0] = IN6__MK1_MSB64_VALUE(0xFF, 0xC0), \ (a)->s6_qaddr[1] = 0UL) #define IN6_SET_LINKLOCAL_PREFIX(a) ((a)->s6_qaddr[0] = IN6__MK1_MSB64_VALUE(0xFE, 0x80), \ (a)->s6_qaddr[1] = 0UL) #define IN6_SET_LOWER_64_MASK(a) ((a)->s6_qaddr[0] = 0UL, \ (a)->s6_qaddr[1] = ~0UL) #define IN6_JOIN_PREFIX_TOKEN(a,p,t) ((a)->s6_qaddr[0] = \ (p)->s6_qaddr[0] | (t)->s6_qaddr[0], \ (a)->s6_qaddr[1] = \ (p)->s6_qaddr[1] | (t)->s6_qaddr[1]) #else #define IN6_ARE_ADDR_EQUAL(a,b) ((a)->s6_laddr[3] == (b)->s6_laddr[3] && \ (a)->s6_laddr[0] == (b)->s6_laddr[0] && \ (a)->s6_laddr[2] == (b)->s6_laddr[2] && \ (a)->s6_laddr[1] == (b)->s6_laddr[1]) #define IN6_ARE_ADDR_SAMEPREFIX(a,b,m) (((a)->s6_laddr[0] & (m)->s6_laddr[0]) == (b)->s6_laddr[0] && \ ((a)->s6_laddr[1] & (m)->s6_laddr[1]) == (b)->s6_laddr[1] && \ ((a)->s6_laddr[2] & (m)->s6_laddr[2]) == (b)->s6_laddr[2] && \ ((a)->s6_laddr[3] & (m)->s6_laddr[3]) == (b)->s6_laddr[3]) #define IN6_IS_ADDR_HOSTMASK(a) ((a)->s6_laddr[3] == ~0UL && \ (a)->s6_laddr[0] == ~0UL && \ (a)->s6_laddr[2] == ~0UL && \ (a)->s6_laddr[1] == ~0UL) #define IN6_IS_ADDR_LOOPBACK(a) ((a)->s6_laddr[0] == 0UL && \ (a)->s6_laddr[1] == 0UL && \ (a)->s6_laddr[2] == 0UL && \ (a)->s6_laddr[3] == IN6__MK3_MSB32_VALUE(0,0,0,1)) #define IN6_IS_ADDR_UNSPECIFIED(a) ((a)->s6_laddr[3] == 0UL && \ (a)->s6_laddr[0] == 0UL && \ (a)->s6_laddr[2] == 0UL && \ (a)->s6_laddr[1] == 0UL) #define IN6_IS_ADDR_V4COMPAT(a) ((a)->s6_laddr[0] == 0UL && \ (a)->s6_laddr[1] == 0UL && \ (a)->s6_laddr[2] == 0UL && \ (a)->s6_laddr[3] != 0 && \ (a)->s6_laddr[3] != IN6__MK3_MSB32_VALUE(0,0,0,1)) #define IN6_IS_ADDR_V4MAPPED(a) ((a)->s6_laddr[0] == 0UL && \ (a)->s6_laddr[1] == 0UL && \ (a)->s6_laddr[2] == IN6__MK1_MSW32_VALUE(0, 0xFFFFU)) #define IN6_SET_ADDR_HOSTMASK(a) ((a)->s6_laddr[3] = ((a)->s6_laddr[2] = ((a)->s6_laddr[1] = ((a)->s6_laddr[0] = ~0UL)))) #define IN6_SET_ADDR_LOOPBACK(a) ((a)->s6_laddr[0] = ((a)->s6_laddr[1] = ((a)->s6_laddr[2] = 0UL)), \ (a)->s6_laddr[3] = IN6__MK3_MSB32_VALUE(0,0,0,1)) #define IN6_SET_ADDR_PREFIX(a,b,c) ((a)->s6_laddr[0] = (b)->s6_laddr[0] & (c)->s6_laddr[0], \ (a)->s6_laddr[1] = (b)->s6_laddr[1] & (c)->s6_laddr[1], \ (a)->s6_laddr[2] = (b)->s6_laddr[2] & (c)->s6_laddr[2], \ (a)->s6_laddr[3] = (b)->s6_laddr[3] & (c)->s6_laddr[3]) #define IN6_SET_ADDR_UNSPECIFIED(a) ((a)->s6_laddr[3] = ((a)->s6_laddr[2] = ((a)->s6_laddr[1] = ((a)->s6_laddr[0] = 0UL)))) #define IN6_SET_ADDR_V4MAPPED(a,b) ((a)->s6_laddr[0] = 0, (a)->s6_laddr[1] = 0, \ (a)->s6_laddr[2] = IN6__MK1_MSW32_VALUE(0, 0xFFFFU), \ (a)->s6_laddr[3] = (b)) #define IN6_SET_ADDR_V4COMPAT(a,b) ((a)->s6_laddr[0] = 0, (a)->s6_laddr[1] = 0, \ (a)->s6_laddr[2] = 0, \ (a)->s6_laddr[3] = (b)) #define IN6_SET_LINKLOCAL_NETMASK(a) ((a)->s6_laddr[0] = IN6__MK1_MSB32_VALUE(0xFF, 0xC0), \ (a)->s6_laddr[1] = 0, \ (a)->s6_laddr[2] = 0, \ (a)->s6_laddr[3] = 0) #define IN6_SET_LINKLOCAL_PREFIX(a) ((a)->s6_laddr[0] = IN6__MK1_MSB32_VALUE(0xFE, 0x80), \ (a)->s6_laddr[1] = 0, \ (a)->s6_laddr[2] = 0, \ (a)->s6_laddr[3] = 0) #define IN6_SET_LOWER_64_MASK(a) ((a)->s6_laddr[0] = 0, \ (a)->s6_laddr[1] = 0, \ (a)->s6_laddr[2] = IN6__MK1_MSB32_VALUE(0xFF, 0xFF), \ (a)->s6_laddr[3] = IN6__MK1_MSB32_VALUE(0xFF, 0xFF)) #define IN6_JOIN_PREFIX_TOKEN(a,p,t) ((a)->s6_laddr[0] = \ (p)->s6_laddr[0] | (t)->s6_laddr[0], \ (a)->s6_laddr[1] = \ (p)->s6_laddr[1] | (t)->s6_laddr[1], \ (a)->s6_laddr[2] = \ (p)->s6_laddr[2] | (t)->s6_laddr[2], \ (a)->s6_laddr[3] = \ (p)->s6_laddr[3] | (t)->s6_laddr[3]) #endif #define IN6_EXTRACT_V4ADDR(a) ((a)->s6_laddr[3]) #define IN6_EXTRACT_V4ADDR_624(a) (IN6__MK1_MSW32_VALUE((a)->s6_waddr[1],\ (a)->s6_waddr[2])) #define IN6_IS_ADDR_LINKLOCAL(a) (((a)->s6_laddr[0] & IN6__MK1_MSB32_VALUE(0xFF, 0xC0)) == IN6__MK1_MSB32_VALUE(0xFE, 0x80)) #define IN6_IS_ADDR_SITELOCAL(a) (((a)->s6_laddr[0] & IN6__MK1_MSB32_VALUE(0xFF, 0xC0)) == IN6__MK1_MSB32_VALUE(0xFE, 0xC0)) #define IN6_IS_ADDR_MULTICAST(a) (((a)->s6_laddr[0] & IN6__MK0_MSB32_VALUE(0xFF)) == IN6__MK0_MSB32_VALUE(0xFF)) #define IN6_IS_ADDR_MC_NODELOCAL(a) (((a)->s6_laddr[0] & IN6__MK1_MSB32_VALUE(0xFF, 0x0F)) == IN6__MK1_MSB32_VALUE(0xFF, IN6_MCSCOPE_NODELOCAL)) #define IN6_IS_ADDR_MC_LINKLOCAL(a) (((a)->s6_laddr[0] & IN6__MK1_MSB32_VALUE(0xFF, 0x0F)) == IN6__MK1_MSB32_VALUE(0xFF, IN6_MCSCOPE_LINKLOCAL)) #define IN6_IS_ADDR_MC_SITELOCAL(a) (((a)->s6_laddr[0] & IN6__MK1_MSB32_VALUE(0xFF, 0x0F)) == IN6__MK1_MSB32_VALUE(0xFF, IN6_MCSCOPE_SITELOCAL)) #define IN6_IS_ADDR_MC_ADMINLOCAL(a) (((a)->s6_laddr[0] & IN6__MK1_MSB32_VALUE(0xFF, 0x0F)) == IN6__MK1_MSB32_VALUE(0xFF, IN6_MCSCOPE_ADMINLOCAL)) #define IN6_IS_ADDR_MC_ORGLOCAL(a) (((a)->s6_laddr[0] & IN6__MK1_MSB32_VALUE(0xFF, 0x0F)) == IN6__MK1_MSB32_VALUE(0xFF, IN6_MCSCOPE_ORGLOCAL)) #define IN6_IS_ADDR_MC_GLOBAL(a) (((a)->s6_laddr[0] & IN6__MK1_MSB32_VALUE(0xFF, 0x0F)) == IN6__MK1_MSB32_VALUE(0xFF, IN6_MCSCOPE_GLOBAL)) #define IN6_SET_LINKLOCAL_PREFIX(a) ((a)->s6_laddr[0] = IN6__MK1_MSB32_VALUE(0xFE, 0x80), \ (a)->s6_laddr[1] = ((a)->s6_laddr[2] = ((a)->s6_laddr[3] = 0))) #define IPV6ADDR_LINKLOCAL_ALL_NODES_INIT { \ 0xFF, IN6_MCSCOPE_LINKLOCAL, 0, 0, \ 0, 0, 0, 0, \ 0, 0, 0, 0, \ 0, 0, 0, 1 \ } #define IPV6ADDR_LINKLOCAL_ALL_ROUTERS_INIT { \ 0xFF, IN6_MCSCOPE_LINKLOCAL, 0, 0, \ 0, 0, 0, 0, \ 0, 0, 0, 0, \ 0, 0, 0, 2 \ } extern const struct in6_addr in6addr_any; #define IN6ADDR_ANY_INIT { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } #define IN6ADDR_TLA624_INIT { 0x20, 0x02, /* IANA defined TLA */ \ 0, 0, 0, 0, /* NLA == V4ADDR */ \ 0, 0, /* SLA ID */ \ 0, 0, 0, 0, 0, 0, 0, 0 /* interface id */ } #define IN6ADDR_TLA624_PFXMASK {0xFF, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0 } extern const struct in6_addr in6addr_loopback; #define IN6ADDR_LOOPBACK_INIT { \ 0, 0, 0, 0, \ 0, 0, 0, 0, \ 0, 0, 0, 0, \ 0, 0, 0, 1 \ } #define IN6ADDR_HOMEAGENT_ANYCAST_INIT { 0, 0, 0, 0, 0, 0, 0, 0, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE } /* * IPv6 multicast scope. */ #define IN6_MCSCOPE_NODELOCAL 0x01 #define IN6_MCSCOPE_LINKLOCAL 0x02 #define IN6_MCSCOPE_ADMINLOCAL 0x04 #define IN6_MCSCOPE_SITELOCAL 0x05 #define IN6_MCSCOPE_ORGLOCAL 0x08 #define IN6_MCSCOPE_GLOBAL 0x0E #define IN6_MCFLAG_PERMANENT 0x00 #define IN6_MCFLAG_TRANSIENT 0x10 #ifdef IN6_HAS_64BIT_INTTYPE #define IN6_SET_MULTICAST_CLASS(addrp, class) \ ((void) (*(u_int64_t *) (addrp) = IN6__MK1_MSB64_VALUE(0xFF, class))) #else #define IN6_SET_MULTICAST_CLASS(addrp, class) \ ((void) ((addrp)->s6_laddr[0] = IN6__MK1_MSB32_VALUE(0xFF, class), (addrp)->s6_laddr[1] = 0)) #endif /* forward decls for C++ */ #ifdef __cplusplus struct rtentry; #endif /* ** The TCP/IP V5.4 and prior kernel checks for strict ** equality sizeof(struct sockaddr_in6) == 28. ** __nomember_alignment allows this check to pass for ** scalar variables. However arrays of struct sockaddr_in6 ** will cause compiler messages and must be avoided with ** this file. Fortunately such arrays are not a common ** programming practice. ** */ /* * Define the socket address for IPv6 */ struct sockaddr_in6 { #if defined(_SOCKADDR_LEN) #define SIN6_LEN u_char sin6_len; /* length of this struct */ u_char sin6_family; /* AF_INET6 */ #else u_int16m_t sin6_family; /* AF_INET6 */ #endif u_int16m_t sin6_port; /* Transport layer port # */ u_int32m_t sin6_flowinfo; /* IPv6 flow information */ struct in6_addr sin6_addr; /* IPv6 address */ u_int32m_t sin6_scope_id; /* set of interfaces for a scope */ }; /* * ioctl handles up to 128 bytes on stack. The max amount of generic data * this structure can hold is carefully chosen so the entire ip6ifreq does * not exceed 128 bytes, thus avoiding a kalloc(). The max size of a link- * layer address is smaller to account for a 16 byte IPv6 address, the * lladdrlen and the radv_flags. */ #define IFR6_MAX_DATA 88 /* max generic data in ip6ifreq */ #define IFR6_MAX_LLADDR 63 /* max link-layer address in un_lladdr */ /* * Define the structure used for interface ioctls with IPv6 addresses * * Caution: some code expects the first portion of the ip6ifreq to * be identical to an ifreq (i.e. the union containing the sockaddr * structures et al. must immediately follow ifr6_name) */ struct ip6ifreq { char ifr6_name[IFNAMSIZ]; /* i/f name, e.g. "ln0" */ union { struct sockaddr un_addr; /* address */ struct sockaddr_in un_addr4; /* address */ struct sockaddr_in6 un_addr6; /* address */ struct { __size_t un_datalen; /* generic data len */ char un_data[IFR6_MAX_DATA]; /* generic data */ } un_1; struct { __u_int un_value; /* generic value... */ int un_code; /* generic ... */ } un_2; struct { struct in6_addr un_dst; /* IPv6 address */ __size_t un_lladdrlen; /* link addr len */ char un_lladdr[IFR6_MAX_LLADDR]; /* link addr */ uint8_t un_radv_flags; /* radv flags */ } un_3; struct { struct in6_addr un_liid; /* local intf id */ struct in6_addr un_riid; /* remote intf id for ppp6 */ } un_4; struct { struct in6_addr un_prefix; /* prefix */ uint8_t un_prefixlen; /* prefix length */ uint8_t un_pad_5_1; /* padding */ uint16_t un_prefixflags; /* flags (see ip6_mobile.h) */ uint16_t un_pad_5_2; /* padding */ uint32_t un_validlife; /* valid prefix lifetime */ uint32_t un_preferredlife;/* preferred prefix lifetime */ } un_5; } ifr6_un; #define ifr6_addr ifr6_un.un_addr #define ifr6_addr4 ifr6_un.un_addr4 #define ifr6_addr6 ifr6_un.un_addr6 #define ifr6_datalen ifr6_un.un_1.un_datalen #define ifr6_data ifr6_un.un_1.un_data #define ifr6_value ifr6_un.un_2.un_value #define ifr6_code ifr6_un.un_2.un_code #define ifr6_dst ifr6_un.un_3.un_dst #define ifr6_radv_flags ifr6_un.un_3.un_radv_flags #define ifr6_lladdrlen ifr6_un.un_3.un_lladdrlen #define ifr6_lladdr ifr6_un.un_3.un_lladdr #define ifr6_lid ifr6_un.un_4.un_liid #define ifr6_rid ifr6_un.un_4.un_riid #define ifr6_prefix ifr6_un.un_5.un_prefix #define ifr6_prefixlen ifr6_un.un_5.un_prefixlen #define ifr6_prefixflags ifr6_un.un_5.un_prefixflags #define ifr6_validlife ifr6_un.un_5.un_validlife #define ifr6_preferredlife ifr6_un.un_5.un_preferredlife unsigned ifr6_flags; /* */ #define IFR6_NODAD 0x0001U /* suppress duplicate address detection */ #define IFR6_ADDTOKEN 0x0002U /* add token to end of prefix */ #define IFR6_DADFAILED 0x0004U #define IFR6_DADINPROGRESS 0x0008U #define IFR6_DEPRECATED 0x0010U #define IFR6_ANYCAST 0x0020U /* address is anycast */ #define IFR6_PROXY 0x0040U /* proxying for address */ #define IFR6_MOBILE 0x0080U /* mobile node home address */ __u_int ifr6_reserved[3]; /* for future use */ }; /* * Define the structure that is added as a control message to * incoming raw packets before being handed to the user. */ struct rip6_header { int rhdr_ifindex; /* ifnet index number */ int rhdr_pktflags; /* The mbuf flags (M_MCAST etc) */ u_short rhdr_offset; /* data offset in IPv6 packet */ u_char rhdr_proto; /* The protocol type */ u_char rhdr_authOK; /* TRUE if the pkt was authenticated */ }; /* * advance API defines (rfc2292) */ struct in6_pktinfo { struct in6_addr ipi6_addr; /* IPv6 address */ unsigned int ipi6_ifindex; /* interface index */ }; struct ip6_mtuinfo { struct sockaddr_in6 ip6m_addr; /* IPv6 destination address */ uint32_t ip6m_mtu; /* path mtu */ }; /* * Define constants for the routing header */ #define IPV6_RTHDR_LOOSE 0 /* this hop need not be a neighbor */ #define IPV6_RTHDR_STRICT 1 /* this hop must be a neighbor */ #define IPV6_RTHDR_TYPE_0 0 /* IPv6 Routing header type 0 */ #define IPV6_RTHDR_TYPE_2 2 /* IPv6 Routing header type 2 */ /* * function and macro prototypes */ extern int inet6_opt_init (void*, __size_t); extern int inet6_opt_append (void *, __size_t, int, u_int8_t, __size_t, u_int32_t, void **); extern int inet6_opt_finish (void *, __size_t, int); extern int inet6_opt_set_val (void *, __size_t, void *, int); extern int inet6_opt_next (void *, __size_t, int, u_int8_t *, __size_t *, void **); extern int inet6_opt_find (void *, __size_t, int, u_int8_t, __size_t *, void **); extern int inet6_opt_get_val (void *, __size_t, void *, int); extern __size_t inet6_rth_space (int, int); extern void * inet6_rth_init (void *, int, int, int); extern int inet6_rth_add (void *, const struct in6_addr *); extern int inet6_rth_reverse (const void *, void *); extern int inet6_rth_segments (const void *); extern struct in6_addr * inet6_rth_getaddr (void *, int); /* ** Restore the users pointer context */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size __restore #endif #ifdef __cplusplus } #endif #pragma __member_alignment __restore #pragma __standard #endif /* __IN6_LOADED */