Home | History | Annotate | Line # | Download | only in netinet6
in6.h revision 1.6.8.1
      1  1.6.8.1  wrstuden /*	$NetBSD: in6.h,v 1.6.8.1 1999/12/27 18:36:23 wrstuden Exp $	*/
      2      1.5   thorpej 
      3      1.2    itojun /*
      4      1.2    itojun  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
      5      1.2    itojun  * All rights reserved.
      6      1.2    itojun  *
      7      1.2    itojun  * Redistribution and use in source and binary forms, with or without
      8      1.2    itojun  * modification, are permitted provided that the following conditions
      9      1.2    itojun  * are met:
     10      1.2    itojun  * 1. Redistributions of source code must retain the above copyright
     11      1.2    itojun  *    notice, this list of conditions and the following disclaimer.
     12      1.2    itojun  * 2. Redistributions in binary form must reproduce the above copyright
     13      1.2    itojun  *    notice, this list of conditions and the following disclaimer in the
     14      1.2    itojun  *    documentation and/or other materials provided with the distribution.
     15      1.2    itojun  * 3. Neither the name of the project nor the names of its contributors
     16      1.2    itojun  *    may be used to endorse or promote products derived from this software
     17      1.2    itojun  *    without specific prior written permission.
     18      1.2    itojun  *
     19      1.2    itojun  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
     20      1.2    itojun  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21      1.2    itojun  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22      1.2    itojun  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
     23      1.2    itojun  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24      1.2    itojun  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25      1.2    itojun  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26      1.2    itojun  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27      1.2    itojun  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28      1.2    itojun  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29      1.2    itojun  * SUCH DAMAGE.
     30      1.2    itojun  */
     31      1.2    itojun 
     32      1.2    itojun /*
     33      1.2    itojun  * Copyright (c) 1982, 1986, 1990, 1993
     34      1.2    itojun  *	The Regents of the University of California.  All rights reserved.
     35      1.2    itojun  *
     36      1.2    itojun  * Redistribution and use in source and binary forms, with or without
     37      1.2    itojun  * modification, are permitted provided that the following conditions
     38      1.2    itojun  * are met:
     39      1.2    itojun  * 1. Redistributions of source code must retain the above copyright
     40      1.2    itojun  *    notice, this list of conditions and the following disclaimer.
     41      1.2    itojun  * 2. Redistributions in binary form must reproduce the above copyright
     42      1.2    itojun  *    notice, this list of conditions and the following disclaimer in the
     43      1.2    itojun  *    documentation and/or other materials provided with the distribution.
     44      1.2    itojun  * 3. All advertising materials mentioning features or use of this software
     45      1.2    itojun  *    must display the following acknowledgement:
     46      1.2    itojun  *	This product includes software developed by the University of
     47      1.2    itojun  *	California, Berkeley and its contributors.
     48      1.2    itojun  * 4. Neither the name of the University nor the names of its contributors
     49      1.2    itojun  *    may be used to endorse or promote products derived from this software
     50      1.2    itojun  *    without specific prior written permission.
     51      1.2    itojun  *
     52      1.2    itojun  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     53      1.2    itojun  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     54      1.2    itojun  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     55      1.2    itojun  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     56      1.2    itojun  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     57      1.2    itojun  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     58      1.2    itojun  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     59      1.2    itojun  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     60      1.2    itojun  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     61      1.2    itojun  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     62      1.2    itojun  * SUCH DAMAGE.
     63      1.2    itojun  *
     64      1.2    itojun  *	@(#)in.h	8.3 (Berkeley) 1/3/94
     65      1.2    itojun  */
     66      1.2    itojun 
     67      1.2    itojun #ifndef _NETINET6_IN6_H_
     68      1.2    itojun #define _NETINET6_IN6_H_
     69      1.2    itojun 
     70      1.4    kleink #if !defined(_XOPEN_SOURCE)
     71      1.2    itojun #include <sys/queue.h>
     72      1.4    kleink #endif
     73      1.2    itojun 
     74      1.2    itojun /*
     75      1.2    itojun  * Identification of the network protocol stack
     76      1.2    itojun  */
     77      1.2    itojun #define __KAME__
     78  1.6.8.1  wrstuden #define __KAME_VERSION		"19991213/NetBSD-current"
     79      1.2    itojun 
     80      1.2    itojun /*
     81      1.2    itojun  * Local port number conventions:
     82      1.2    itojun  *
     83      1.2    itojun  * Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root),
     84      1.2    itojun  * unless a kernel is compiled with IPNOPRIVPORTS defined.
     85      1.2    itojun  *
     86      1.2    itojun  * When a user does a bind(2) or connect(2) with a port number of zero,
     87      1.2    itojun  * a non-conflicting local port address is chosen.
     88      1.2    itojun  *
     89      1.2    itojun  * The default range is IPPORT_ANONMIX to IPPORT_ANONMAX, although
     90      1.2    itojun  * that is settable by sysctl(3); net.inet.ip.anonportmin and
     91      1.2    itojun  * net.inet.ip.anonportmax respectively.
     92      1.2    itojun  *
     93      1.2    itojun  * A user may set the IPPROTO_IP option IP_PORTRANGE to change this
     94      1.2    itojun  * default assignment range.
     95      1.2    itojun  *
     96      1.2    itojun  * The value IP_PORTRANGE_DEFAULT causes the default behavior.
     97      1.2    itojun  *
     98      1.2    itojun  * The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT,
     99      1.2    itojun  * and exists only for FreeBSD compatibility purposes.
    100      1.2    itojun  *
    101      1.2    itojun  * The value IP_PORTRANGE_LOW changes the range to the "low" are
    102      1.2    itojun  * that is (by convention) restricted to privileged processes.
    103      1.2    itojun  * This convention is based on "vouchsafe" principles only.
    104      1.2    itojun  * It is only secure if you trust the remote host to restrict these ports.
    105      1.2    itojun  * The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX.
    106      1.2    itojun  */
    107      1.2    itojun 
    108      1.2    itojun #define	IPV6PORT_RESERVED	1024
    109      1.2    itojun #define	IPV6PORT_ANONMIN	49152
    110      1.2    itojun #define	IPV6PORT_ANONMAX	65535
    111      1.2    itojun #define	IPV6PORT_RESERVEDMIN	600
    112      1.2    itojun #define	IPV6PORT_RESERVEDMAX	(IPV6PORT_RESERVED-1)
    113      1.2    itojun 
    114      1.2    itojun /*
    115      1.2    itojun  * IPv6 address
    116      1.2    itojun  */
    117      1.4    kleink struct in6_addr {
    118      1.2    itojun 	union {
    119      1.4    kleink 		u_int8_t   __u6_addr8[16];
    120  1.6.8.1  wrstuden 		u_int16_t  __u6_addr16[8];
    121  1.6.8.1  wrstuden 		u_int32_t  __u6_addr32[4];
    122      1.4    kleink 	} __u6_addr;			/* 128-bit IP6 address */
    123      1.2    itojun };
    124      1.2    itojun 
    125      1.4    kleink #define s6_addr   __u6_addr.__u6_addr8
    126  1.6.8.1  wrstuden #ifdef _KERNEL	/*XXX nonstandard*/
    127  1.6.8.1  wrstuden #define s6_addr8  __u6_addr.__u6_addr8
    128  1.6.8.1  wrstuden #define s6_addr16 __u6_addr.__u6_addr16
    129  1.6.8.1  wrstuden #define s6_addr32 __u6_addr.__u6_addr32
    130  1.6.8.1  wrstuden #endif
    131      1.2    itojun 
    132      1.2    itojun #define INET6_ADDRSTRLEN	46
    133      1.2    itojun 
    134      1.2    itojun /*
    135      1.2    itojun  * Socket address for IPv6
    136      1.2    itojun  */
    137      1.4    kleink #if !defined(_XOPEN_SOURCE)
    138      1.2    itojun #define SIN6_LEN
    139      1.4    kleink #endif
    140      1.2    itojun struct sockaddr_in6 {
    141      1.2    itojun 	u_char		sin6_len;	/* length of this struct(sa_family_t)*/
    142      1.2    itojun 	u_char		sin6_family;	/* AF_INET6 (sa_family_t) */
    143      1.2    itojun 	u_int16_t	sin6_port;	/* Transport layer port # (in_port_t)*/
    144      1.2    itojun 	u_int32_t	sin6_flowinfo;	/* IP6 flow information */
    145      1.2    itojun 	struct in6_addr	sin6_addr;	/* IP6 address */
    146      1.2    itojun 	u_int32_t	sin6_scope_id;	/* intface scope id */
    147      1.2    itojun };
    148      1.2    itojun 
    149      1.2    itojun /*
    150      1.2    itojun  * Local definition for masks
    151      1.2    itojun  */
    152  1.6.8.1  wrstuden #ifdef _KERNEL	/*XXX nonstandard*/
    153  1.6.8.1  wrstuden #define IN6MASK0	{{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}}
    154  1.6.8.1  wrstuden #define IN6MASK32	{{{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, \
    155  1.6.8.1  wrstuden 			    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
    156  1.6.8.1  wrstuden #define IN6MASK64	{{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
    157  1.6.8.1  wrstuden 			    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
    158  1.6.8.1  wrstuden #define IN6MASK96	{{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
    159  1.6.8.1  wrstuden 			    0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}}
    160  1.6.8.1  wrstuden #define IN6MASK128	{{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
    161  1.6.8.1  wrstuden 			    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}}
    162  1.6.8.1  wrstuden #endif
    163      1.2    itojun 
    164      1.2    itojun #ifdef _KERNEL
    165      1.2    itojun extern const struct in6_addr in6mask0;
    166      1.2    itojun extern const struct in6_addr in6mask32;
    167      1.2    itojun extern const struct in6_addr in6mask64;
    168      1.2    itojun extern const struct in6_addr in6mask96;
    169      1.2    itojun extern const struct in6_addr in6mask128;
    170      1.2    itojun #endif /* _KERNEL */
    171      1.2    itojun 
    172      1.2    itojun /*
    173      1.2    itojun  * Macros started with IPV6_ADDR is KAME local
    174      1.2    itojun  */
    175  1.6.8.1  wrstuden #ifdef _KERNEL	/*XXX nonstandard*/
    176      1.2    itojun #if BYTE_ORDER == BIG_ENDIAN
    177      1.2    itojun #define IPV6_ADDR_INT32_ONE	1
    178      1.2    itojun #define IPV6_ADDR_INT32_TWO	2
    179      1.2    itojun #define IPV6_ADDR_INT32_MNL	0xff010000
    180      1.2    itojun #define IPV6_ADDR_INT32_MLL	0xff020000
    181      1.2    itojun #define IPV6_ADDR_INT32_SMP	0x0000ffff
    182      1.2    itojun #define IPV6_ADDR_INT16_ULL	0xfe80
    183      1.2    itojun #define IPV6_ADDR_INT16_USL	0xfec0
    184      1.2    itojun #define IPV6_ADDR_INT16_MLL	0xff02
    185      1.2    itojun #elif BYTE_ORDER == LITTLE_ENDIAN
    186      1.2    itojun #define IPV6_ADDR_INT32_ONE	0x01000000
    187      1.2    itojun #define IPV6_ADDR_INT32_TWO	0x02000000
    188      1.2    itojun #define IPV6_ADDR_INT32_MNL	0x000001ff
    189      1.2    itojun #define IPV6_ADDR_INT32_MLL	0x000002ff
    190      1.2    itojun #define IPV6_ADDR_INT32_SMP	0xffff0000
    191      1.2    itojun #define IPV6_ADDR_INT16_ULL	0x80fe
    192      1.2    itojun #define IPV6_ADDR_INT16_USL	0xc0fe
    193      1.2    itojun #define IPV6_ADDR_INT16_MLL	0x02ff
    194      1.2    itojun #endif
    195  1.6.8.1  wrstuden #endif
    196      1.2    itojun 
    197      1.2    itojun /*
    198      1.2    itojun  * Definition of some useful macros to handle IP6 addresses
    199      1.2    itojun  */
    200  1.6.8.1  wrstuden #define IN6ADDR_ANY_INIT \
    201  1.6.8.1  wrstuden 	{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
    202  1.6.8.1  wrstuden 	    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
    203  1.6.8.1  wrstuden #define IN6ADDR_LOOPBACK_INIT \
    204  1.6.8.1  wrstuden 	{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
    205  1.6.8.1  wrstuden 	    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
    206  1.6.8.1  wrstuden #define IN6ADDR_NODELOCAL_ALLNODES_INIT \
    207  1.6.8.1  wrstuden 	{{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
    208  1.6.8.1  wrstuden 	    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
    209  1.6.8.1  wrstuden #define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
    210  1.6.8.1  wrstuden 	{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
    211  1.6.8.1  wrstuden 	    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
    212      1.2    itojun #define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
    213  1.6.8.1  wrstuden 	{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
    214  1.6.8.1  wrstuden 	    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
    215      1.2    itojun 
    216      1.2    itojun extern const struct in6_addr in6addr_any;
    217      1.2    itojun extern const struct in6_addr in6addr_loopback;
    218      1.2    itojun extern const struct in6_addr in6addr_nodelocal_allnodes;
    219      1.2    itojun extern const struct in6_addr in6addr_linklocal_allnodes;
    220      1.2    itojun extern const struct in6_addr in6addr_linklocal_allrouters;
    221      1.2    itojun 
    222      1.2    itojun /*
    223      1.2    itojun  * Equality
    224  1.6.8.1  wrstuden  * NOTE: Some of kernel programming environment (for example, openbsd/sparc)
    225  1.6.8.1  wrstuden  * does not supply memcmp().  For userland memcmp() is preferred as it is
    226  1.6.8.1  wrstuden  * in ANSI standard.
    227      1.2    itojun  */
    228  1.6.8.1  wrstuden #ifdef _KERNEL
    229      1.2    itojun #define IN6_ARE_ADDR_EQUAL(a, b)			\
    230  1.6.8.1  wrstuden 	(bcmp((a), (b), sizeof(struct in6_addr)) == 0)
    231  1.6.8.1  wrstuden #else
    232  1.6.8.1  wrstuden #define IN6_ARE_ADDR_EQUAL(a, b)			\
    233  1.6.8.1  wrstuden 	(memcmp((a), (b), sizeof(struct in6_addr)) == 0)
    234  1.6.8.1  wrstuden #endif
    235      1.2    itojun 
    236      1.2    itojun /*
    237      1.2    itojun  * Unspecified
    238      1.2    itojun  */
    239      1.2    itojun #define IN6_IS_ADDR_UNSPECIFIED(a)	\
    240  1.6.8.1  wrstuden 	((*(u_int32_t *)(&(a)->s6_addr[0]) == 0) &&	\
    241  1.6.8.1  wrstuden 	 (*(u_int32_t *)(&(a)->s6_addr[4]) == 0) &&	\
    242  1.6.8.1  wrstuden 	 (*(u_int32_t *)(&(a)->s6_addr[8]) == 0) &&	\
    243  1.6.8.1  wrstuden 	 (*(u_int32_t *)(&(a)->s6_addr[12]) == 0))
    244      1.2    itojun 
    245      1.2    itojun /*
    246      1.2    itojun  * Loopback
    247      1.2    itojun  */
    248      1.2    itojun #define IN6_IS_ADDR_LOOPBACK(a)		\
    249  1.6.8.1  wrstuden 	((*(u_int32_t *)(&(a)->s6_addr[0]) == 0) &&	\
    250  1.6.8.1  wrstuden 	 (*(u_int32_t *)(&(a)->s6_addr[4]) == 0) &&	\
    251  1.6.8.1  wrstuden 	 (*(u_int32_t *)(&(a)->s6_addr[8]) == 0) &&	\
    252  1.6.8.1  wrstuden 	 (*(u_int32_t *)(&(a)->s6_addr[12]) == ntohl(1)))
    253      1.2    itojun 
    254      1.2    itojun /*
    255      1.2    itojun  * IPv4 compatible
    256      1.2    itojun  */
    257      1.2    itojun #define IN6_IS_ADDR_V4COMPAT(a)		\
    258  1.6.8.1  wrstuden 	((*(u_int32_t *)(&(a)->s6_addr[0]) == 0) &&	\
    259  1.6.8.1  wrstuden 	 (*(u_int32_t *)(&(a)->s6_addr[4]) == 0) &&	\
    260  1.6.8.1  wrstuden 	 (*(u_int32_t *)(&(a)->s6_addr[8]) == 0) &&	\
    261  1.6.8.1  wrstuden 	 (*(u_int32_t *)(&(a)->s6_addr[12]) != 0) &&	\
    262  1.6.8.1  wrstuden 	 (*(u_int32_t *)(&(a)->s6_addr[12]) != ntohl(1)))
    263      1.2    itojun 
    264      1.2    itojun /*
    265      1.2    itojun  * Mapped
    266      1.2    itojun  */
    267      1.2    itojun #define IN6_IS_ADDR_V4MAPPED(a)		      \
    268  1.6.8.1  wrstuden 	((*(u_int32_t *)(&(a)->s6_addr[0]) == 0) &&	\
    269  1.6.8.1  wrstuden 	 (*(u_int32_t *)(&(a)->s6_addr[4]) == 0) &&	\
    270  1.6.8.1  wrstuden 	 (*(u_int32_t *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff)))
    271      1.2    itojun 
    272      1.2    itojun /*
    273      1.2    itojun  * KAME Scope Values
    274      1.2    itojun  */
    275      1.2    itojun 
    276  1.6.8.1  wrstuden #ifdef _KERNEL	/*XXX nonstandard*/
    277      1.2    itojun #define IPV6_ADDR_SCOPE_NODELOCAL	0x01
    278      1.2    itojun #define IPV6_ADDR_SCOPE_LINKLOCAL	0x02
    279      1.2    itojun #define IPV6_ADDR_SCOPE_SITELOCAL	0x05
    280      1.2    itojun #define IPV6_ADDR_SCOPE_ORGLOCAL	0x08	/* just used in this file */
    281      1.2    itojun #define IPV6_ADDR_SCOPE_GLOBAL		0x0e
    282  1.6.8.1  wrstuden #else
    283  1.6.8.1  wrstuden #define __IPV6_ADDR_SCOPE_NODELOCAL	0x01
    284  1.6.8.1  wrstuden #define __IPV6_ADDR_SCOPE_LINKLOCAL	0x02
    285  1.6.8.1  wrstuden #define __IPV6_ADDR_SCOPE_SITELOCAL	0x05
    286  1.6.8.1  wrstuden #define __IPV6_ADDR_SCOPE_ORGLOCAL	0x08	/* just used in this file */
    287  1.6.8.1  wrstuden #define __IPV6_ADDR_SCOPE_GLOBAL	0x0e
    288  1.6.8.1  wrstuden #endif
    289      1.2    itojun 
    290      1.2    itojun /*
    291      1.2    itojun  * Unicast Scope
    292  1.6.8.1  wrstuden  * Note that we must check topmost 10 bits only, not 16 bits (see RFC2373).
    293      1.2    itojun  */
    294      1.2    itojun #define IN6_IS_ADDR_LINKLOCAL(a)	\
    295  1.6.8.1  wrstuden 	(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
    296      1.2    itojun #define IN6_IS_ADDR_SITELOCAL(a)	\
    297  1.6.8.1  wrstuden 	(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
    298      1.2    itojun 
    299      1.2    itojun /*
    300      1.2    itojun  * Multicast
    301      1.2    itojun  */
    302  1.6.8.1  wrstuden #define IN6_IS_ADDR_MULTICAST(a)	((a)->s6_addr[0] == 0xff)
    303      1.2    itojun 
    304  1.6.8.1  wrstuden #ifdef _KERNEL	/*XXX nonstandard*/
    305  1.6.8.1  wrstuden #define IPV6_ADDR_MC_SCOPE(a)		((a)->s6_addr[1] & 0x0f)
    306  1.6.8.1  wrstuden #else
    307  1.6.8.1  wrstuden #define __IPV6_ADDR_MC_SCOPE(a)		((a)->s6_addr[1] & 0x0f)
    308  1.6.8.1  wrstuden #endif
    309      1.2    itojun 
    310      1.2    itojun /*
    311      1.2    itojun  * Multicast Scope
    312      1.2    itojun  */
    313  1.6.8.1  wrstuden #ifdef _KERNEL	/*refers nonstandard items */
    314      1.2    itojun #define IN6_IS_ADDR_MC_NODELOCAL(a)	\
    315      1.2    itojun 	(IN6_IS_ADDR_MULTICAST(a) &&	\
    316      1.2    itojun 	 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_NODELOCAL))
    317      1.2    itojun #define IN6_IS_ADDR_MC_LINKLOCAL(a)	\
    318      1.2    itojun 	(IN6_IS_ADDR_MULTICAST(a) &&	\
    319      1.2    itojun 	 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL))
    320      1.2    itojun #define IN6_IS_ADDR_MC_SITELOCAL(a)	\
    321      1.2    itojun 	(IN6_IS_ADDR_MULTICAST(a) && 	\
    322      1.2    itojun 	 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_SITELOCAL))
    323      1.2    itojun #define IN6_IS_ADDR_MC_ORGLOCAL(a)	\
    324      1.2    itojun 	(IN6_IS_ADDR_MULTICAST(a) &&	\
    325      1.2    itojun 	 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_ORGLOCAL))
    326      1.2    itojun #define IN6_IS_ADDR_MC_GLOBAL(a)	\
    327      1.2    itojun 	(IN6_IS_ADDR_MULTICAST(a) &&	\
    328      1.2    itojun 	 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_GLOBAL))
    329  1.6.8.1  wrstuden #else
    330  1.6.8.1  wrstuden #define IN6_IS_ADDR_MC_NODELOCAL(a)	\
    331  1.6.8.1  wrstuden 	(IN6_IS_ADDR_MULTICAST(a) &&	\
    332  1.6.8.1  wrstuden 	 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL))
    333  1.6.8.1  wrstuden #define IN6_IS_ADDR_MC_LINKLOCAL(a)	\
    334  1.6.8.1  wrstuden 	(IN6_IS_ADDR_MULTICAST(a) &&	\
    335  1.6.8.1  wrstuden 	 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL))
    336  1.6.8.1  wrstuden #define IN6_IS_ADDR_MC_SITELOCAL(a)	\
    337  1.6.8.1  wrstuden 	(IN6_IS_ADDR_MULTICAST(a) && 	\
    338  1.6.8.1  wrstuden 	 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))
    339  1.6.8.1  wrstuden #define IN6_IS_ADDR_MC_ORGLOCAL(a)	\
    340  1.6.8.1  wrstuden 	(IN6_IS_ADDR_MULTICAST(a) &&	\
    341  1.6.8.1  wrstuden 	 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))
    342  1.6.8.1  wrstuden #define IN6_IS_ADDR_MC_GLOBAL(a)	\
    343  1.6.8.1  wrstuden 	(IN6_IS_ADDR_MULTICAST(a) &&	\
    344  1.6.8.1  wrstuden 	 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL))
    345  1.6.8.1  wrstuden #endif
    346      1.2    itojun 
    347      1.2    itojun /*
    348      1.2    itojun  * Wildcard Socket
    349      1.2    itojun  */
    350  1.6.8.1  wrstuden #if 0	/*pre-RFC2553*/
    351      1.2    itojun #define IN6_IS_ADDR_ANY(a)	IN6_IS_ADDR_UNSPECIFIED(a)
    352  1.6.8.1  wrstuden #endif
    353      1.2    itojun 
    354      1.2    itojun /*
    355      1.2    itojun  * KAME Scope
    356      1.2    itojun  */
    357  1.6.8.1  wrstuden #ifdef _KERNEL	/*nonstandard*/
    358      1.2    itojun #define IN6_IS_SCOPE_LINKLOCAL(a)	\
    359      1.2    itojun 	((IN6_IS_ADDR_LINKLOCAL(a)) ||	\
    360      1.2    itojun 	 (IN6_IS_ADDR_MC_LINKLOCAL(a)))
    361  1.6.8.1  wrstuden #endif
    362      1.2    itojun 
    363      1.2    itojun /*
    364      1.2    itojun  * IP6 route structure
    365      1.2    itojun  */
    366      1.4    kleink #if !defined(_XOPEN_SOURCE)
    367      1.4    kleink struct route_in6 {
    368      1.2    itojun 	struct	rtentry *ro_rt;
    369      1.2    itojun 	struct	sockaddr_in6 ro_dst;
    370      1.2    itojun };
    371      1.4    kleink #endif
    372      1.2    itojun 
    373      1.2    itojun /*
    374      1.2    itojun  * Options for use with [gs]etsockopt at the IPV6 level.
    375      1.2    itojun  * First word of comment is data type; bool is stored in int.
    376      1.2    itojun  */
    377      1.2    itojun #define IPV6_OPTIONS		1  /* buf/ip6_opts; set/get IP6 options */
    378      1.2    itojun /* no hdrincl */
    379      1.2    itojun #define IPV6_SOCKOPT_RESERVED1	3  /* reserved for future use */
    380      1.2    itojun #define IPV6_UNICAST_HOPS	4  /* int; IP6 hops */
    381      1.2    itojun #define IPV6_RECVOPTS		5  /* bool; receive all IP6 opts w/dgram */
    382      1.2    itojun #define IPV6_RECVRETOPTS	6  /* bool; receive IP6 opts for response */
    383      1.2    itojun #define IPV6_RECVDSTADDR	7  /* bool; receive IP6 dst addr w/dgram */
    384      1.2    itojun #define IPV6_RETOPTS		8  /* ip6_opts; set/get IP6 options */
    385      1.2    itojun #define IPV6_MULTICAST_IF	9  /* u_char; set/get IP6 multicast i/f  */
    386      1.2    itojun #define IPV6_MULTICAST_HOPS	10 /* u_char; set/get IP6 multicast hops */
    387      1.2    itojun #define IPV6_MULTICAST_LOOP	11 /* u_char; set/get IP6 multicast loopback */
    388      1.2    itojun #define IPV6_JOIN_GROUP		12 /* ip6_mreq; join a group membership */
    389      1.2    itojun #define IPV6_LEAVE_GROUP	13 /* ip6_mreq; leave a group membership */
    390      1.2    itojun #define IPV6_PORTRANGE		14 /* int; range to choose for unspec port */
    391      1.2    itojun #define ICMP6_FILTER		18 /* icmp6_filter; icmp6 filter */
    392      1.2    itojun #define IPV6_PKTINFO		19 /* bool; send/rcv if, src/dst addr */
    393      1.2    itojun #define IPV6_HOPLIMIT		20 /* bool; hop limit */
    394      1.2    itojun #define IPV6_NEXTHOP		21 /* bool; next hop addr */
    395      1.2    itojun #define IPV6_HOPOPTS		22 /* bool; hop-by-hop option */
    396      1.2    itojun #define IPV6_DSTOPTS		23 /* bool; destination option */
    397      1.2    itojun #define IPV6_RTHDR		24 /* bool; routing header */
    398      1.2    itojun #define IPV6_PKTOPTIONS		25 /* buf/cmsghdr; set/get IPv6 options */
    399      1.2    itojun #define IPV6_CHECKSUM		26 /* int; checksum offset for raw socket */
    400      1.2    itojun #define IPV6_BINDV6ONLY		27 /* bool; only bind INET6 at null bind */
    401      1.2    itojun 
    402      1.2    itojun #if 1 /*IPSEC*/
    403      1.2    itojun #define IPV6_IPSEC_POLICY	28 /* struct; get/set security policy */
    404      1.2    itojun #endif
    405  1.6.8.1  wrstuden #define IPV6_FAITH		29 /* bool; accept FAITH'ed connections */
    406      1.2    itojun 
    407      1.2    itojun #define IPV6_RTHDR_LOOSE     0 /* this hop need not be a neighbor. XXX old spec */
    408      1.2    itojun #define IPV6_RTHDR_STRICT    1 /* this hop must be a neighbor. XXX old spec */
    409      1.2    itojun #define IPV6_RTHDR_TYPE_0    0 /* IPv6 routing header type 0 */
    410      1.2    itojun 
    411      1.2    itojun /*
    412      1.2    itojun  * Defaults and limits for options
    413      1.2    itojun  */
    414      1.2    itojun #define IPV6_DEFAULT_MULTICAST_HOPS 1	/* normally limit m'casts to 1 hop  */
    415      1.2    itojun #define IPV6_DEFAULT_MULTICAST_LOOP 1	/* normally hear sends if a member  */
    416      1.2    itojun 
    417      1.2    itojun /*
    418      1.2    itojun  * Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.
    419      1.2    itojun  */
    420      1.2    itojun struct ipv6_mreq {
    421      1.2    itojun 	struct in6_addr	ipv6mr_multiaddr;
    422      1.2    itojun 	u_int		ipv6mr_interface;
    423      1.2    itojun };
    424      1.2    itojun 
    425      1.2    itojun /*
    426      1.2    itojun  * IPV6_PKTINFO: Packet information(RFC2292 sec 5)
    427      1.2    itojun  */
    428      1.2    itojun struct in6_pktinfo {
    429      1.2    itojun 	struct in6_addr ipi6_addr;	/* src/dst IPv6 address */
    430      1.2    itojun 	u_int ipi6_ifindex;		/* send/recv interface index */
    431      1.2    itojun };
    432      1.2    itojun 
    433      1.2    itojun /*
    434      1.2    itojun  * Argument for IPV6_PORTRANGE:
    435      1.2    itojun  * - which range to search when port is unspecified at bind() or connect()
    436      1.2    itojun  */
    437      1.2    itojun #define	IPV6_PORTRANGE_DEFAULT	0	/* default range */
    438      1.2    itojun #define	IPV6_PORTRANGE_HIGH	1	/* "high" - request firewall bypass */
    439      1.2    itojun #define	IPV6_PORTRANGE_LOW	2	/* "low" - vouchsafe security */
    440      1.2    itojun 
    441      1.4    kleink #if !defined(_XOPEN_SOURCE)
    442      1.2    itojun /*
    443      1.2    itojun  * Definitions for inet6 sysctl operations.
    444      1.2    itojun  *
    445      1.2    itojun  * Third level is protocol number.
    446      1.2    itojun  * Fourth level is desired variable within that protocol.
    447      1.2    itojun  */
    448      1.2    itojun #define IPV6PROTO_MAXID	(IPPROTO_PIM + 1)	/* don't list to IPV6PROTO_MAX */
    449      1.2    itojun 
    450      1.2    itojun #define CTL_IPV6PROTO_NAMES { \
    451      1.2    itojun 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
    452      1.2    itojun 	{ 0, 0 }, \
    453      1.2    itojun 	{ "tcp6", CTLTYPE_NODE }, \
    454      1.2    itojun 	{ 0, 0 }, \
    455      1.2    itojun 	{ 0, 0 }, \
    456      1.2    itojun 	{ 0, 0 }, \
    457      1.2    itojun 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
    458      1.2    itojun 	{ 0, 0 }, \
    459      1.2    itojun 	{ 0, 0 }, \
    460      1.2    itojun 	{ "udp6", CTLTYPE_NODE }, \
    461      1.2    itojun 	{ 0, 0 }, \
    462      1.2    itojun 	{ 0, 0 }, \
    463      1.2    itojun 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
    464      1.2    itojun 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
    465      1.2    itojun 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
    466      1.2    itojun 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
    467      1.2    itojun 	{ 0, 0 }, \
    468      1.2    itojun 	{ "ip6", CTLTYPE_NODE }, \
    469      1.2    itojun 	{ 0, 0 }, \
    470      1.2    itojun 	{ 0, 0 }, \
    471      1.2    itojun 	{ 0, 0 }, \
    472      1.2    itojun 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
    473      1.3    itojun 	{ 0, 0 }, \
    474      1.2    itojun 	{ "ipsec6", CTLTYPE_NODE }, \
    475      1.2    itojun 	{ 0, 0 }, \
    476      1.2    itojun 	{ 0, 0 }, \
    477      1.2    itojun 	{ 0, 0 }, \
    478      1.2    itojun 	{ 0, 0 }, \
    479      1.2    itojun 	{ 0, 0 }, \
    480      1.2    itojun 	{ 0, 0 }, \
    481      1.2    itojun 	{ "icmp6", CTLTYPE_NODE }, \
    482      1.2    itojun 	{ 0, 0 }, \
    483      1.2    itojun 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
    484      1.2    itojun 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
    485      1.2    itojun 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
    486      1.2    itojun 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
    487      1.2    itojun 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
    488      1.2    itojun 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
    489      1.2    itojun 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
    490      1.2    itojun 	{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
    491      1.2    itojun 	{ 0, 0 }, \
    492      1.2    itojun 	{ 0, 0 }, \
    493      1.2    itojun 	{ 0, 0 }, \
    494      1.2    itojun 	{ "pim6", CTLTYPE_NODE }, \
    495      1.2    itojun }
    496      1.2    itojun 
    497      1.2    itojun /*
    498      1.2    itojun  * Names for IP sysctl objects
    499      1.2    itojun  */
    500      1.2    itojun #define IPV6CTL_FORWARDING	1	/* act as router */
    501      1.2    itojun #define IPV6CTL_SENDREDIRECTS	2	/* may send redirects when forwarding*/
    502      1.2    itojun #define IPV6CTL_DEFHLIM		3	/* default Hop-Limit */
    503      1.2    itojun #ifdef notyet
    504      1.2    itojun #define IPV6CTL_DEFMTU		4	/* default MTU */
    505      1.2    itojun #endif
    506      1.2    itojun #define IPV6CTL_FORWSRCRT	5	/* forward source-routed dgrams */
    507      1.2    itojun #define IPV6CTL_STATS		6	/* stats */
    508      1.2    itojun #define IPV6CTL_MRTSTATS	7	/* multicast forwarding stats */
    509      1.2    itojun #define IPV6CTL_MRTPROTO	8	/* multicast routing protocol */
    510      1.2    itojun #define IPV6CTL_MAXFRAGPACKETS	9	/* max packets reassembly queue */
    511      1.2    itojun #define IPV6CTL_SOURCECHECK	10	/* verify source route and intf */
    512      1.2    itojun #define IPV6CTL_SOURCECHECK_LOGINT 11	/* minimume logging interval */
    513      1.2    itojun #define IPV6CTL_ACCEPT_RTADV	12
    514      1.2    itojun #define IPV6CTL_KEEPFAITH	13
    515      1.2    itojun #define IPV6CTL_LOG_INTERVAL	14
    516      1.2    itojun #define IPV6CTL_HDRNESTLIMIT	15
    517      1.2    itojun #define IPV6CTL_DAD_COUNT	16
    518      1.2    itojun #define IPV6CTL_AUTO_FLOWLABEL	17
    519      1.2    itojun #define IPV6CTL_DEFMCASTHLIM	18
    520      1.2    itojun #define IPV6CTL_GIF_HLIM	19	/* default HLIM for gif encap packet */
    521      1.2    itojun #define IPV6CTL_KAME_VERSION	20
    522  1.6.8.1  wrstuden #define IPV6CTL_USE_DEPRECATED	21	/* use deprecated addr (RFC2462 5.5.4) */
    523  1.6.8.1  wrstuden #define IPV6CTL_RR_PRUNE	22	/* walk timer for router renumbering */
    524  1.6.8.1  wrstuden #ifdef MAPPED_ADDR_ENABLED
    525  1.6.8.1  wrstuden #define IPV6CTL_MAPPED_ADDR	23
    526  1.6.8.1  wrstuden #endif /* MAPPED_ADDR_ENABLED */
    527      1.2    itojun /* New entries should be added here from current IPV6CTL_MAXID value. */
    528  1.6.8.1  wrstuden #define IPV6CTL_MAXID		24
    529  1.6.8.1  wrstuden 
    530  1.6.8.1  wrstuden #ifdef MAPPED_ADDR_ENABLED
    531  1.6.8.1  wrstuden #define IPV6CTL_NAMES_MAPPED_ADDR	"mapped_addr"
    532  1.6.8.1  wrstuden #define IPV6CTL_TYPE_MAPPED_ADDR	CTLTYPE_INT
    533  1.6.8.1  wrstuden #define IPV6CTL_VARS_MAPPED_ADDR	&ip6_mapped_addr_on
    534  1.6.8.1  wrstuden #else  /* MAPPED_ADDR_ENABLED */
    535  1.6.8.1  wrstuden #define IPV6CTL_NAMES_MAPPED_ADDR	0
    536  1.6.8.1  wrstuden #define IPV6CTL_TYPE_MAPPED_ADDR	0
    537  1.6.8.1  wrstuden #define IPV6CTL_VARS_MAPPED_ADDR	0
    538  1.6.8.1  wrstuden #endif /* MAPPED_ADDR_ENABLED */
    539      1.2    itojun 
    540      1.2    itojun #define IPV6CTL_NAMES { \
    541      1.2    itojun 	{ 0, 0 }, \
    542      1.2    itojun 	{ "forwarding", CTLTYPE_INT }, \
    543      1.2    itojun 	{ "redirect", CTLTYPE_INT }, \
    544      1.2    itojun 	{ "hlim", CTLTYPE_INT }, \
    545      1.2    itojun 	{ "mtu", CTLTYPE_INT }, \
    546      1.2    itojun 	{ "forwsrcrt", CTLTYPE_INT }, \
    547      1.2    itojun 	{ 0, 0 }, \
    548      1.2    itojun 	{ 0, 0 }, \
    549      1.2    itojun 	{ "mrtproto", CTLTYPE_INT }, \
    550      1.2    itojun 	{ "maxfragpackets", CTLTYPE_INT }, \
    551      1.2    itojun 	{ "sourcecheck", CTLTYPE_INT }, \
    552      1.2    itojun 	{ "sourcecheck_logint", CTLTYPE_INT }, \
    553      1.2    itojun 	{ "accept_rtadv", CTLTYPE_INT }, \
    554      1.2    itojun 	{ "keepfaith", CTLTYPE_INT }, \
    555      1.2    itojun 	{ "log_interval", CTLTYPE_INT }, \
    556      1.2    itojun 	{ "hdrnestlimit", CTLTYPE_INT }, \
    557      1.2    itojun 	{ "dad_count", CTLTYPE_INT }, \
    558      1.2    itojun 	{ "auto_flowlabel", CTLTYPE_INT }, \
    559      1.2    itojun 	{ "defmcasthlim", CTLTYPE_INT }, \
    560      1.2    itojun 	{ "gifhlim", CTLTYPE_INT }, \
    561      1.2    itojun 	{ "kame_version", CTLTYPE_STRING }, \
    562  1.6.8.1  wrstuden 	{ "use_deprecated", CTLTYPE_INT }, \
    563  1.6.8.1  wrstuden 	{ "rr_prune", CTLTYPE_INT }, \
    564  1.6.8.1  wrstuden 	{ IPV6CTL_NAMES_MAPPED_ADDR, IPV6CTL_TYPE_MAPPED_ADDR }, \
    565      1.2    itojun }
    566      1.2    itojun 
    567      1.2    itojun #define IPV6CTL_VARS { \
    568      1.2    itojun 	0, \
    569      1.2    itojun 	&ip6_forwarding, \
    570      1.2    itojun 	&ip6_sendredirects, \
    571      1.2    itojun 	&ip6_defhlim, \
    572      1.2    itojun 	0, \
    573      1.2    itojun 	&ip6_forward_srcrt, \
    574      1.2    itojun 	0, \
    575      1.2    itojun 	0, \
    576      1.2    itojun 	0, \
    577      1.2    itojun 	&ip6_maxfragpackets, \
    578      1.2    itojun 	&ip6_sourcecheck, \
    579      1.2    itojun 	&ip6_sourcecheck_interval, \
    580      1.2    itojun 	&ip6_accept_rtadv, \
    581      1.2    itojun 	&ip6_keepfaith, \
    582      1.2    itojun 	&ip6_log_interval, \
    583      1.2    itojun 	&ip6_hdrnestlimit, \
    584      1.2    itojun 	&ip6_dad_count, \
    585  1.6.8.1  wrstuden 	&ip6_auto_flowlabel, \
    586      1.2    itojun 	&ip6_defmcasthlim, \
    587      1.2    itojun 	&ip6_gif_hlim, \
    588      1.2    itojun 	0, \
    589  1.6.8.1  wrstuden 	&ip6_use_deprecated, \
    590  1.6.8.1  wrstuden 	&ip6_rr_prune, \
    591  1.6.8.1  wrstuden 	IPV6CTL_VARS_MAPPED_ADDR, \
    592      1.2    itojun }
    593      1.4    kleink #endif /* !_XOPEN_SOURCE */
    594      1.2    itojun 
    595      1.2    itojun #ifdef _KERNEL
    596      1.2    itojun struct cmsghdr;
    597      1.2    itojun 
    598      1.2    itojun int	in6_canforward __P((struct in6_addr *, struct in6_addr *));
    599  1.6.8.1  wrstuden int	in6_cksum __P((struct mbuf *, u_int8_t, u_int32_t, u_int32_t));
    600      1.2    itojun int	in6_localaddr __P((struct in6_addr *));
    601      1.2    itojun int	in6_addrscope __P((struct in6_addr *));
    602      1.2    itojun struct	in6_ifaddr *in6_ifawithscope __P((struct ifnet *, struct in6_addr *));
    603      1.2    itojun struct	in6_ifaddr *in6_ifawithifp __P((struct ifnet *, struct in6_addr *));
    604      1.2    itojun extern void in6_if_up __P((struct ifnet *));
    605  1.6.8.1  wrstuden #ifdef MAPPED_ADDR_ENABLED
    606  1.6.8.1  wrstuden struct sockaddr;
    607  1.6.8.1  wrstuden 
    608  1.6.8.1  wrstuden void	in6_sin6_2_sin __P((struct sockaddr_in *sin,
    609  1.6.8.1  wrstuden 			    struct sockaddr_in6 *sin6));
    610  1.6.8.1  wrstuden void	in6_sin_2_v4mapsin6 __P((struct sockaddr_in *sin,
    611  1.6.8.1  wrstuden 				 struct sockaddr_in6 *sin6));
    612  1.6.8.1  wrstuden void	in6_sin6_2_sin_in_sock __P((struct sockaddr *nam));
    613  1.6.8.1  wrstuden void	in6_sin_2_v4mapsin6_in_sock __P((struct sockaddr **nam));
    614  1.6.8.1  wrstuden #endif /* MAPPED_ADDR_ENABLED */
    615      1.2    itojun 
    616      1.2    itojun #define	satosin6(sa)	((struct sockaddr_in6 *)(sa))
    617      1.2    itojun #define	sin6tosa(sin6)	((struct sockaddr *)(sin6))
    618      1.2    itojun #define	ifatoia6(ifa)	((struct in6_ifaddr *)(ifa))
    619      1.2    itojun #endif /* _KERNEL */
    620      1.2    itojun 
    621      1.2    itojun __BEGIN_DECLS
    622      1.2    itojun struct cmsghdr;
    623      1.2    itojun 
    624      1.2    itojun extern int inet6_option_space(int);
    625      1.2    itojun extern int inet6_option_init(void *, struct cmsghdr **, int);
    626      1.2    itojun extern int inet6_option_append(struct cmsghdr *, const u_int8_t *, int, int);
    627      1.2    itojun extern u_int8_t *inet6_option_alloc(struct cmsghdr *, int, int, int);
    628      1.2    itojun extern int inet6_option_next(const struct cmsghdr *, u_int8_t **);
    629      1.2    itojun extern int inet6_option_find(const struct cmsghdr *, u_int8_t **, int);
    630      1.2    itojun 
    631      1.2    itojun extern size_t inet6_rthdr_space __P((int, int));
    632      1.2    itojun extern struct cmsghdr *inet6_rthdr_init __P((void *, int));
    633      1.2    itojun extern int inet6_rthdr_add __P((struct cmsghdr *, const struct in6_addr *,
    634      1.2    itojun 		unsigned int));
    635      1.2    itojun extern int inet6_rthdr_lasthop __P((struct cmsghdr *, unsigned int));
    636      1.2    itojun #if 0 /* not implemented yet */
    637      1.2    itojun extern int inet6_rthdr_reverse __P((const struct cmsghdr *, struct cmsghdr *));
    638      1.2    itojun #endif
    639      1.2    itojun extern int inet6_rthdr_segments __P((const struct cmsghdr *));
    640      1.2    itojun extern struct in6_addr *inet6_rthdr_getaddr __P((struct cmsghdr *, int));
    641      1.2    itojun extern int inet6_rthdr_getflags __P((const struct cmsghdr *, int));
    642      1.2    itojun __END_DECLS
    643      1.2    itojun 
    644      1.2    itojun #endif /* !_NETINET6_IN6_H_ */
    645