#ifndef __IN6_LOADED #define __IN6_LOADED 1 /**************************************************************************** ** ** - Internet V6 protocol family ** ***************************************************************************** ** Header introduced by the X/Open CAE Specification, Issue 4, Version 2 ***************************************************************************** ** ** Copyright 2000 Compaq Computer Corporation ** ** Compaq and the Compaq logo Registered in U.S. Patent and Trademark Office. ** ** Confidential computer software. Valid license from Compaq 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. ** ****************************************************************************** ** ** 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 /* ** Start processing in 32-bit addressing mode */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size __save # pragma __pointer_size 32 #endif /* ** All structures should be member aligned on natural boundaries */ #pragma __member_alignment __save #pragma __member_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 */ #define IPV6_FLOWINFO_FLOWLABEL IN6__MK3_MSB32_VALUE(0, 0xFF, 0xFF, 0xFF) #define IPV6_FLOWINFO_PRIORITY IN6__MK0_MSB32_VALUE(0x0F) #define IPV6_FLOWINFO_SRFLAG IN6__MK0_MSB32_VALUE(0x30) #define IPV6_SRFLAG_NONE IN6__MK0_MSB32_VALUE(0x00) #define IPV6_SRFLAG_STRICT IN6__MK0_MSB32_VALUE(0x10) #define IPV6_SRFLAG_LOOSE IN6__MK0_MSB32_VALUE(0x20) #define IPV6_PRIORITY_UNCHARACTERIZED IN6__MK0_MSB32_VALUE(0x00) #define IPV6_PRIORITY_FILLER IN6__MK0_MSB32_VALUE(0x01) #define IPV6_PRIORITY_UNATTENDED IN6__MK0_MSB32_VALUE(0x02) #define IPV6_PRIORITY_RESERVED1 IN6__MK0_MSB32_VALUE(0x03) #define IPV6_PRIORITY_BULK IN6__MK0_MSB32_VALUE(0x04) #define IPV6_PRIORITY_RESERVED2 IN6__MK0_MSB32_VALUE(0x05) #define IPV6_PRIORITY_INTERACTIVE IN6__MK0_MSB32_VALUE(0x06) #define IPV6_PRIORITY_CONTROL IN6__MK0_MSB32_VALUE(0x07) #define IPV6_PRIORITY_8 IN6__MK0_MSB32_VALUE(0x08) #define IPV6_PRIORITY_9 IN6__MK0_MSB32_VALUE(0x09) #define IPV6_PRIORITY_10 IN6__MK0_MSB32_VALUE(0x0A) #define IPV6_PRIORITY_11 IN6__MK0_MSB32_VALUE(0x0B) #define IPV6_PRIORITY_12 IN6__MK0_MSB32_VALUE(0x0C) #define IPV6_PRIORITY_13 IN6__MK0_MSB32_VALUE(0x0D) #define IPV6_PRIORITY_14 IN6__MK0_MSB32_VALUE(0x0E) #define IPV6_PRIORITY_15 IN6__MK0_MSB32_VALUE(0x0F) /* * IPv6 level socket options */ #define IPV6_ADDRFORM 100 /* int; AF_INET or AF_INET6 */ #define IPV6_RECVSRCRT 101 #define IPV6_RECVIF 102 #define IPV6_SENDIF 103 #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_ADD_MEMBERSHIP 108 /* struct ipv6_mreq; join group */ #define IPV6_DROP_MEMBERSHIP 109 /* struct ipv6_mreq; leave group */ #define IPV6_RXINFO 110 /* int; recv ip6_pktinfo */ #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_MAX_MEMBERSHIPS 20 /* per socket */ #define IPV6_SR_MAXADDR 24 /* * 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 /* * Structure for add/drop multicast group membership */ 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) #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_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) #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_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_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_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 \ } 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 \ } /* * IPv6 multicast scope. */ #define IN6_MCSCOPE_NODELOCAL 0x01 #define IN6_MCSCOPE_LINKLOCAL 0x02 #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 /* * 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 */ }; /* * Define the route structure template. This is required because * the standard route structure uses a sockaddr structure, which is * no longer large enough to hold IPv6 addresses. * XXX This can be removed if the route structure becomes large enough */ struct ip6route { struct rtentry *ro_rt; struct sockaddr_in6 ro_dst; }; /* * Define the structure used for interface ioctls with IPv6 addresses */ #ifdef IFNAMSIZ 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 { caddr_t un_data; /* generic pointer... */ size_t un_datalen; /* generic pointer... */ } un_1; struct { int un_value; /* generic value... */ int un_code; /* generic ... */ } un_2; struct { struct in_addr un_tdst4; /* tunnel dst IPv4 address */ struct in_addr un_tsrc4; /* tunnel src IPv4 address */ } un_3; } 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_data ifr6_un.un_1.un_data #define ifr6_datalen ifr6_un.un_1.un_datalen #define ifr6_value ifr6_un.un_2.un_value #define ifr6_code ifr6_un.un_2.un_code #define ifr6_tdst4 ifr6_un.un_3.un_tdst4 #define ifr6_tsrc4 ifr6_un.un_3.un_tsrc4 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_V4TUNNEL 0x0020U /* IPv4 tunnel */ #ifdef IPV6_TOKEN_COMPAT #define IFR6_TOKEN_COMPAT 0x0040U /* use 48 bit token */ #endif }; #define SIOCIPV6IFINIT _IOWR('i', 250, struct ip6ifreq) /* init if IPv6 */ #define SIOCIPV6AIFADDR _IOWR('i', 251, struct ip6ifreq) /* add if IPv6 */ #define SIOCIPV6SIFATTR _IOW ('i', 252, struct ip6ifreq) /* set IPv6 if attributes */ #define SIOCIPV6DIFADDR _IOW ('i', 253, struct ip6ifreq) /* del if IPv6 */ #define SIOCIPV6GIFATTR _IOWR('i', 254, struct ip6ifreq) /* get IPv6 if attributes */ #define SIOCIPV6MIFADDR _IOWR('i', 255, struct ip6ifreq) /* mdfy IPv6 addr opts */ #define SIOCIPV6GIFADDR _IOWR('i', 246, struct ip6ifreq) /* get IPv6 addr opts */ #endif /* * 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 */ }; struct in6_pktinfo { int ipi6_ifindex; /* interface index */ __u_int ipi6_hoplimit; /* IPv6 hop limit */ struct in6_addr ipi6_addr; /* IPv6 address */ }; /* * 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 */ /* * function and macro prototypes */ extern uint8_t *inet6_option_alloc(struct cmsghdr *, int, int, int); extern int inet6_option_append(struct cmsghdr *, const uint8_t *, int, int); extern int inet6_option_find(const struct cmsghdr *, uint8_t **, int); extern int inet6_option_init(void *, struct cmsghdr **, int); extern int inet6_option_next(const struct cmsghdr *, uint8_t **); extern int inet6_option_space(int); extern int inet6_rthdr_add(struct cmsghdr *, const struct in6_addr *, unsigned int); extern struct in6_addr inet6_rthdr_getaddr(struct cmsghdr *, int); extern int inet6_rthdr_getflags(const struct cmsghdr *, int); extern struct cmsghdr * inet6_rthdr_init(void *, int); extern int inet6_rthdr_lasthop(struct cmsghdr *, unsigned int); extern int inet6_rthdr_reverse(const struct cmsghdr *, struct cmsghdr *); extern int inet6_rthdr_segments(const struct cmsghdr *); extern size_t inet6_rthdr_space(int, 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 */ #ifndef __IN6_MACHTYPES_LOADED #define __IN6_MACHTYPES_LOADED 1 /**************************************************************************** ** ** - Internet V6 protocol family ** ***************************************************************************** ** Header is nonstandard ***************************************************************************** ** ** Copyright 2000 Compaq Computer Corporation ** ** Compaq and the Compaq logo Registered in U.S. Patent and Trademark Office. ** ** Confidential computer software. Valid license from Compaq 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. ** ****************************************************************************** */ #pragma __nostandard #include /* * Machine or architecure specific MACROS and types * for IPv6. */ #include #ifndef OPENVMS_32BIT #if defined(__alpha) #define IN6_HAS_64BIT_INTTYPE #endif #endif #if !defined(BYTE_ORDER) || BYTE_ORDER == LITTLE_ENDIAN #define IN6_MSB16_SHIFT 0 #define IN6_MSB32_SHIFT 0 #define IN6_MSW32_SHIFT 0 #define IN6_BIT_ORDER +1 #ifdef IN6_HAS_64BIT_INTTYPE #define IN6_MSB64_SHIFT 0 #define IN6_MSW64_SHIFT 0 #define IN6_MSL64_SHIFT 0 #endif #elif BYTE_ORDER == BIG_ENDIAN #define IN6_MSB16_SHIFT (16 - 8) #define IN6_MSB32_SHIFT (32 - 8) #define IN6_MSW32_SHIFT (32 - 16) #define IN6_BIT_ORDER -1 #ifdef IN6_HAS_64BIT_INTTYPE #define IN6_MSB64_SHIFT (64 - 8) #define IN6_MSW64_SHIFT (64 - 16) #define IN6_MSL64_SHIFT (64 - 32) #endif #endif #ifdef IN6_HAS_64BIT_INTTYPE #define IN6_MSB64_OFFSET(n) (IN6_MSB64_SHIFT + ((n) * IN6_BIT_ORDER * 8)) #define IN6_MSW64_OFFSET(n) (IN6_MSB64_SHIFT + ((n) * IN6_BIT_ORDER * 16)) #define IN6_MSL64_OFFSET(n) (IN6_MSB64_SHIFT + ((n) * IN6_BIT_ORDER * 32)) #define IN6_LSB64_SHIFT IN6_MSB64_OFFSET(7) #define IN6_LSW64_SHIFT IN6_MSW64_OFFSET(3) #define IN6_LSL64_SHIFT IN6_MSL64_OFFSET(1) #define IN6__MK0_MSB64_VALUE(a) ( ((u_int64_t) (a)) << IN6_MSB64_OFFSET(0)) #define IN6__MK1_MSB64_VALUE(a,b) ((((u_int64_t) (b)) << IN6_MSB64_OFFSET(1))|IN6__MK0_MSB64_VALUE(a)) #define IN6__MK2_MSB64_VALUE(a,b,c) ((((u_int64_t) (c)) << IN6_MSB64_OFFSET(2))|IN6__MK1_MSB64_VALUE(a,b)) #define IN6__MK3_MSB64_VALUE(a,b,c,d) ((((u_int64_t) (d)) << IN6_MSB64_OFFSET(3))|IN6__MK2_MSB64_VALUE(a,b,c)) #define IN6__MK4_MSB64_VALUE(a,b,c,d,e) ((((u_int64_t) (e)) << IN6_MSB64_OFFSET(4))|IN6__MK3_MSB64_VALUE(a,b,c,d)) #define IN6__MK5_MSB64_VALUE(a,b,c,d,e,f) ((((u_int64_t) (f)) << IN6_MSB64_OFFSET(5))|IN6__MK4_MSB64_VALUE(a,b,c,d,e)) #define IN6__MK6_MSB64_VALUE(a,b,c,d,e,f,g) ((((u_int64_t) (g)) << IN6_MSB64_OFFSET(6))|IN6__MK5_MSB64_VALUE(a,b,c,d,e,f)) #define IN6__MK7_MSB64_VALUE(a,b,c,d,e,f,g,h) ((((u_int64_t) (h)) << IN6_MSB64_OFFSET(7))|IN6__MK6_MSB64_VALUE(a,b,c,d,e,f,g)) #define IN6__MK0_MSW64_VALUE(a) ( ((u_int64_t) (a)) << IN6_MSW64_OFFSET(0)) #define IN6__MK1_MSW64_VALUE(a,b) ((((u_int64_t) (b)) << IN6_MSW64_OFFSET(1))|IN6__MK0_MSW64_VALUE(a)) #define IN6__MK2_MSW64_VALUE(a,b,c) ((((u_int64_t) (c)) << IN6_MSW64_OFFSET(2))|IN6__MK1_MSW64_VALUE(a,b)) #define IN6__MK3_MSW64_VALUE(a,b,c,d) ((((u_int64_t) (d)) << IN6_MSW64_OFFSET(3))|IN6__MK2_MSW64_VALUE(a,b,c)) #define IN6__MK0_MSL64_VALUE(a) ( ((u_int64_t) (a)) << IN6_MSL64_OFFSET(0) ) #define IN6__MK1_MSL64_VALUE(a,b) ((((u_int64_t) (b)) << IN6_MSL64_OFFSET(1))|IN6__MK0_MSL64_VALUE(a)) #endif #define IN6_MSB32_OFFSET(n) (IN6_MSB32_SHIFT + ((n) * IN6_BIT_ORDER * 8)) #define IN6_MSW32_OFFSET(n) (IN6_MSB32_SHIFT + ((n) * IN6_BIT_ORDER * 16)) #define IN6_LSB32_SHIFT IN6_MSB32_OFFSET(3) #define IN6_LSW32_SHIFT IN6_MSW32_OFFSET(1) #define IN6__MK0_MSB32_VALUE(a) ( ((u_int32_t) (a)) << IN6_MSB32_OFFSET(0) ) #define IN6__MK1_MSB32_VALUE(a,b) ((((u_int32_t) (b)) << IN6_MSB32_OFFSET(1))|IN6__MK0_MSB32_VALUE(a)) #define IN6__MK2_MSB32_VALUE(a,b,c) ((((u_int32_t) (c)) << IN6_MSB32_OFFSET(2))|IN6__MK1_MSB32_VALUE(a,b)) #define IN6__MK3_MSB32_VALUE(a,b,c,d) ((((u_int32_t) (d)) << IN6_MSB32_OFFSET(3))|IN6__MK2_MSB32_VALUE(a,b,c)) #define IN6__MK0_MSW32_VALUE(a) (( (u_int32_t) (a)) << IN6_MSW32_OFFSET(0) ) #define IN6__MK1_MSW32_VALUE(a,b) ((((u_int32_t) (b)) << IN6_MSW32_OFFSET(1))|IN6__MK0_MSW32_VALUE(a)) /* * Macros for 16 bit words. */ #define IN6_MSB16_OFFSET(n) (IN6_MSB16_SHIFT + ((n) * IN6_BIT_ORDER * 8)) #define IN6_LSB16_SHIFT IN6_MSB16_OFFSET(1) #define IN6__MK0_MSB16_VALUE(a) ( ((u_int16_t) (a)) << IN6_MSB16_OFFSET(0)) #define IN6__MK1_MSB16_VALUE(a,b) ((((u_int16_t) (b)) << IN6_MSB16_OFFSET(1))|IN6__MK0_MSB16_VALUE(a)) #pragma __standard #endif /* _IN6_MACHTYPES_H */