epoc32/include/stdapis/netinet6/in6_var.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
     1.1 --- a/epoc32/include/stdapis/netinet6/in6_var.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/stdapis/netinet6/in6_var.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,628 @@
     1.4 -in6_var.h
     1.5 +/*	$FreeBSD: src/sys/netinet6/in6_var.h,v 1.21.2.1 2005/08/24 15:18:38 rwatson Exp $	*/
     1.6 +/*	$KAME: in6_var.h,v 1.56 2001/03/29 05:34:31 itojun Exp $	*/
     1.7 +
     1.8 +/*-
     1.9 + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
    1.10 + * All rights reserved.
    1.11 +* © Portions copyright (c) 2007 Symbian Software Ltd. All rights reserved.
    1.12 + * Redistribution and use in source and binary forms, with or without
    1.13 + * modification, are permitted provided that the following conditions
    1.14 + * are met:
    1.15 + * 1. Redistributions of source code must retain the above copyright
    1.16 + *    notice, this list of conditions and the following disclaimer.
    1.17 + * 2. Redistributions in binary form must reproduce the above copyright
    1.18 + *    notice, this list of conditions and the following disclaimer in the
    1.19 + *    documentation and/or other materials provided with the distribution.
    1.20 + * 3. Neither the name of the project nor the names of its contributors
    1.21 + *    may be used to endorse or promote products derived from this software
    1.22 + *    without specific prior written permission.
    1.23 + *
    1.24 + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
    1.25 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1.26 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    1.27 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
    1.28 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    1.29 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    1.30 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    1.31 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    1.32 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    1.33 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.34 + * SUCH DAMAGE.
    1.35 + */
    1.36 +
    1.37 +/*-
    1.38 + * Copyright (c) 1985, 1986, 1993
    1.39 + *	The Regents of the University of California.  All rights reserved.
    1.40 + *
    1.41 + * Redistribution and use in source and binary forms, with or without
    1.42 + * modification, are permitted provided that the following conditions
    1.43 + * are met:
    1.44 + * 1. Redistributions of source code must retain the above copyright
    1.45 + *    notice, this list of conditions and the following disclaimer.
    1.46 + * 2. Redistributions in binary form must reproduce the above copyright
    1.47 + *    notice, this list of conditions and the following disclaimer in the
    1.48 + *    documentation and/or other materials provided with the distribution.
    1.49 + * 4. Neither the name of the University nor the names of its contributors
    1.50 + *    may be used to endorse or promote products derived from this software
    1.51 + *    without specific prior written permission.
    1.52 + *
    1.53 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    1.54 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1.55 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    1.56 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    1.57 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    1.58 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    1.59 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    1.60 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    1.61 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    1.62 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.63 + * SUCH DAMAGE.
    1.64 + *
    1.65 + *	@(#)in_var.h	8.1 (Berkeley) 6/10/93
    1.66 + */
    1.67 +
    1.68 +#ifndef _NETINET6_IN6_VAR_H_
    1.69 +#define _NETINET6_IN6_VAR_H_
    1.70 +
    1.71 +/*
    1.72 + * Interface address, Internet version.  One of these structures
    1.73 + * is allocated for each interface with an Internet address.
    1.74 + * The ifaddr structure contains the protocol-independent part
    1.75 + * of the structure and is assumed to be first.
    1.76 + */
    1.77 +
    1.78 +/*
    1.79 + * pltime/vltime are just for future reference (required to implements 2
    1.80 + * hour rule for hosts).  they should never be modified by nd6_timeout or
    1.81 + * anywhere else.
    1.82 + *	userland -> kernel: accept pltime/vltime
    1.83 + *	kernel -> userland: throw up everything
    1.84 + *	in kernel: modify preferred/expire only
    1.85 + */
    1.86 +struct in6_addrlifetime {
    1.87 +	time_t ia6t_expire;	/* valid lifetime expiration time */
    1.88 +	time_t ia6t_preferred;	/* preferred lifetime expiration time */
    1.89 +	u_int32_t ia6t_vltime;	/* valid lifetime */
    1.90 +	u_int32_t ia6t_pltime;	/* prefix lifetime */
    1.91 +};
    1.92 +
    1.93 +struct nd_ifinfo;
    1.94 +struct scope6_id;
    1.95 +struct in6_ifextra {
    1.96 +	struct in6_ifstat *in6_ifstat;
    1.97 +	struct icmp6_ifstat *icmp6_ifstat;
    1.98 +	struct nd_ifinfo *nd_ifinfo;
    1.99 +	struct scope6_id *scope6_id;
   1.100 +};
   1.101 +
   1.102 +#ifndef __SYMBIAN32__
   1.103 +/*
   1.104 + * XXX: removing dependency on ifaddr for getaddrinfo()
   1.105 + */
   1.106 +struct	in6_ifaddr {
   1.107 +	struct	ifaddr ia_ifa;		/* protocol-independent info */
   1.108 +#define	ia_ifp		ia_ifa.ifa_ifp
   1.109 +#define ia_flags	ia_ifa.ifa_flags
   1.110 +	struct	sockaddr_in6 ia_addr;	/* interface address */
   1.111 +	struct	sockaddr_in6 ia_net;	/* network number of interface */
   1.112 +	struct	sockaddr_in6 ia_dstaddr; /* space for destination addr */
   1.113 +	struct	sockaddr_in6 ia_prefixmask; /* prefix mask */
   1.114 +	u_int32_t ia_plen;		/* prefix length */
   1.115 +	struct	in6_ifaddr *ia_next;	/* next in6 list of IP6 addresses */
   1.116 +	int	ia6_flags;
   1.117 +
   1.118 +	struct in6_addrlifetime ia6_lifetime;
   1.119 +	struct ifprefix *ia6_ifpr; /* back pointer to ifprefix */
   1.120 +
   1.121 +	/* back pointer to the ND prefix (for autoconfigured addresses only) */
   1.122 +	struct nd_prefix *ia6_ndpr;
   1.123 +};
   1.124 +#endif //__SYMBIAN32__
   1.125 +/* control structure to manage address selection policy */
   1.126 +struct in6_addrpolicy {
   1.127 +	struct sockaddr_in6 addr; /* prefix address */
   1.128 +	struct sockaddr_in6 addrmask; /* prefix mask */
   1.129 +	int preced;		/* precedence */
   1.130 +	int label;		/* matching label */
   1.131 +	u_quad_t use;		/* statistics */
   1.132 +};
   1.133 +
   1.134 +/*
   1.135 + * IPv6 interface statistics, as defined in RFC2465 Ipv6IfStatsEntry (p12).
   1.136 + */
   1.137 +struct in6_ifstat {
   1.138 +	u_quad_t ifs6_in_receive;	/* # of total input datagram */
   1.139 +	u_quad_t ifs6_in_hdrerr;	/* # of datagrams with invalid hdr */
   1.140 +	u_quad_t ifs6_in_toobig;	/* # of datagrams exceeded MTU */
   1.141 +	u_quad_t ifs6_in_noroute;	/* # of datagrams with no route */
   1.142 +	u_quad_t ifs6_in_addrerr;	/* # of datagrams with invalid dst */
   1.143 +	u_quad_t ifs6_in_protounknown;	/* # of datagrams with unknown proto */
   1.144 +					/* NOTE: increment on final dst if */
   1.145 +	u_quad_t ifs6_in_truncated;	/* # of truncated datagrams */
   1.146 +	u_quad_t ifs6_in_discard;	/* # of discarded datagrams */
   1.147 +					/* NOTE: fragment timeout is not here */
   1.148 +	u_quad_t ifs6_in_deliver;	/* # of datagrams delivered to ULP */
   1.149 +					/* NOTE: increment on final dst if */
   1.150 +	u_quad_t ifs6_out_forward;	/* # of datagrams forwarded */
   1.151 +					/* NOTE: increment on outgoing if */
   1.152 +	u_quad_t ifs6_out_request;	/* # of outgoing datagrams from ULP */
   1.153 +					/* NOTE: does not include forwrads */
   1.154 +	u_quad_t ifs6_out_discard;	/* # of discarded datagrams */
   1.155 +	u_quad_t ifs6_out_fragok;	/* # of datagrams fragmented */
   1.156 +	u_quad_t ifs6_out_fragfail;	/* # of datagrams failed on fragment */
   1.157 +	u_quad_t ifs6_out_fragcreat;	/* # of fragment datagrams */
   1.158 +					/* NOTE: this is # after fragment */
   1.159 +	u_quad_t ifs6_reass_reqd;	/* # of incoming fragmented packets */
   1.160 +					/* NOTE: increment on final dst if */
   1.161 +	u_quad_t ifs6_reass_ok;		/* # of reassembled packets */
   1.162 +					/* NOTE: this is # after reass */
   1.163 +					/* NOTE: increment on final dst if */
   1.164 +	u_quad_t ifs6_reass_fail;	/* # of reass failures */
   1.165 +					/* NOTE: may not be packet count */
   1.166 +					/* NOTE: increment on final dst if */
   1.167 +	u_quad_t ifs6_in_mcast;		/* # of inbound multicast datagrams */
   1.168 +	u_quad_t ifs6_out_mcast;	/* # of outbound multicast datagrams */
   1.169 +};
   1.170 +
   1.171 +/*
   1.172 + * ICMPv6 interface statistics, as defined in RFC2466 Ipv6IfIcmpEntry.
   1.173 + * XXX: I'm not sure if this file is the right place for this structure...
   1.174 + */
   1.175 +struct icmp6_ifstat {
   1.176 +	/*
   1.177 +	 * Input statistics
   1.178 +	 */
   1.179 +	/* ipv6IfIcmpInMsgs, total # of input messages */
   1.180 +	u_quad_t ifs6_in_msg;
   1.181 +	/* ipv6IfIcmpInErrors, # of input error messages */
   1.182 +	u_quad_t ifs6_in_error;
   1.183 +	/* ipv6IfIcmpInDestUnreachs, # of input dest unreach errors */
   1.184 +	u_quad_t ifs6_in_dstunreach;
   1.185 +	/* ipv6IfIcmpInAdminProhibs, # of input administratively prohibited errs */
   1.186 +	u_quad_t ifs6_in_adminprohib;
   1.187 +	/* ipv6IfIcmpInTimeExcds, # of input time exceeded errors */
   1.188 +	u_quad_t ifs6_in_timeexceed;
   1.189 +	/* ipv6IfIcmpInParmProblems, # of input parameter problem errors */
   1.190 +	u_quad_t ifs6_in_paramprob;
   1.191 +	/* ipv6IfIcmpInPktTooBigs, # of input packet too big errors */
   1.192 +	u_quad_t ifs6_in_pkttoobig;
   1.193 +	/* ipv6IfIcmpInEchos, # of input echo requests */
   1.194 +	u_quad_t ifs6_in_echo;
   1.195 +	/* ipv6IfIcmpInEchoReplies, # of input echo replies */
   1.196 +	u_quad_t ifs6_in_echoreply;
   1.197 +	/* ipv6IfIcmpInRouterSolicits, # of input router solicitations */
   1.198 +	u_quad_t ifs6_in_routersolicit;
   1.199 +	/* ipv6IfIcmpInRouterAdvertisements, # of input router advertisements */
   1.200 +	u_quad_t ifs6_in_routeradvert;
   1.201 +	/* ipv6IfIcmpInNeighborSolicits, # of input neighbor solicitations */
   1.202 +	u_quad_t ifs6_in_neighborsolicit;
   1.203 +	/* ipv6IfIcmpInNeighborAdvertisements, # of input neighbor advertisements */
   1.204 +	u_quad_t ifs6_in_neighboradvert;
   1.205 +	/* ipv6IfIcmpInRedirects, # of input redirects */
   1.206 +	u_quad_t ifs6_in_redirect;
   1.207 +	/* ipv6IfIcmpInGroupMembQueries, # of input MLD queries */
   1.208 +	u_quad_t ifs6_in_mldquery;
   1.209 +	/* ipv6IfIcmpInGroupMembResponses, # of input MLD reports */
   1.210 +	u_quad_t ifs6_in_mldreport;
   1.211 +	/* ipv6IfIcmpInGroupMembReductions, # of input MLD done */
   1.212 +	u_quad_t ifs6_in_mlddone;
   1.213 +
   1.214 +	/*
   1.215 +	 * Output statistics. We should solve unresolved routing problem...
   1.216 +	 */
   1.217 +	/* ipv6IfIcmpOutMsgs, total # of output messages */
   1.218 +	u_quad_t ifs6_out_msg;
   1.219 +	/* ipv6IfIcmpOutErrors, # of output error messages */
   1.220 +	u_quad_t ifs6_out_error;
   1.221 +	/* ipv6IfIcmpOutDestUnreachs, # of output dest unreach errors */
   1.222 +	u_quad_t ifs6_out_dstunreach;
   1.223 +	/* ipv6IfIcmpOutAdminProhibs, # of output administratively prohibited errs */
   1.224 +	u_quad_t ifs6_out_adminprohib;
   1.225 +	/* ipv6IfIcmpOutTimeExcds, # of output time exceeded errors */
   1.226 +	u_quad_t ifs6_out_timeexceed;
   1.227 +	/* ipv6IfIcmpOutParmProblems, # of output parameter problem errors */
   1.228 +	u_quad_t ifs6_out_paramprob;
   1.229 +	/* ipv6IfIcmpOutPktTooBigs, # of output packet too big errors */
   1.230 +	u_quad_t ifs6_out_pkttoobig;
   1.231 +	/* ipv6IfIcmpOutEchos, # of output echo requests */
   1.232 +	u_quad_t ifs6_out_echo;
   1.233 +	/* ipv6IfIcmpOutEchoReplies, # of output echo replies */
   1.234 +	u_quad_t ifs6_out_echoreply;
   1.235 +	/* ipv6IfIcmpOutRouterSolicits, # of output router solicitations */
   1.236 +	u_quad_t ifs6_out_routersolicit;
   1.237 +	/* ipv6IfIcmpOutRouterAdvertisements, # of output router advertisements */
   1.238 +	u_quad_t ifs6_out_routeradvert;
   1.239 +	/* ipv6IfIcmpOutNeighborSolicits, # of output neighbor solicitations */
   1.240 +	u_quad_t ifs6_out_neighborsolicit;
   1.241 +	/* ipv6IfIcmpOutNeighborAdvertisements, # of output neighbor advertisements */
   1.242 +	u_quad_t ifs6_out_neighboradvert;
   1.243 +	/* ipv6IfIcmpOutRedirects, # of output redirects */
   1.244 +	u_quad_t ifs6_out_redirect;
   1.245 +	/* ipv6IfIcmpOutGroupMembQueries, # of output MLD queries */
   1.246 +	u_quad_t ifs6_out_mldquery;
   1.247 +	/* ipv6IfIcmpOutGroupMembResponses, # of output MLD reports */
   1.248 +	u_quad_t ifs6_out_mldreport;
   1.249 +	/* ipv6IfIcmpOutGroupMembReductions, # of output MLD done */
   1.250 +	u_quad_t ifs6_out_mlddone;
   1.251 +};
   1.252 +
   1.253 +struct	in6_ifreq {
   1.254 +	char	ifr_name[IFNAMSIZ];
   1.255 +	union {
   1.256 +		struct	sockaddr_in6 ifru_addr;
   1.257 +		struct	sockaddr_in6 ifru_dstaddr;
   1.258 +		int	ifru_flags;
   1.259 +		int	ifru_flags6;
   1.260 +		int	ifru_metric;
   1.261 +		caddr_t	ifru_data;
   1.262 +		struct in6_addrlifetime ifru_lifetime;
   1.263 +		struct in6_ifstat ifru_stat;
   1.264 +		struct icmp6_ifstat ifru_icmp6stat;
   1.265 +		u_int32_t ifru_scope_id[16];
   1.266 +	} ifr_ifru;
   1.267 +};
   1.268 +
   1.269 +struct	in6_aliasreq {
   1.270 +	char	ifra_name[IFNAMSIZ];
   1.271 +	struct	sockaddr_in6 ifra_addr;
   1.272 +	struct	sockaddr_in6 ifra_dstaddr;
   1.273 +	struct	sockaddr_in6 ifra_prefixmask;
   1.274 +	int	ifra_flags;
   1.275 +	struct in6_addrlifetime ifra_lifetime;
   1.276 +};
   1.277 +
   1.278 +/* prefix type macro */
   1.279 +#define IN6_PREFIX_ND	1
   1.280 +#define IN6_PREFIX_RR	2
   1.281 +
   1.282 +/*
   1.283 + * prefix related flags passed between kernel(NDP related part) and
   1.284 + * user land command(ifconfig) and daemon(rtadvd).
   1.285 + */
   1.286 +struct in6_prflags {
   1.287 +	struct prf_ra {
   1.288 +		u_char onlink : 1;
   1.289 +		u_char autonomous : 1;
   1.290 +		u_char reserved : 6;
   1.291 +	} prf_ra;
   1.292 +	u_char prf_reserved1;
   1.293 +	u_short prf_reserved2;
   1.294 +	/* want to put this on 4byte offset */
   1.295 +	struct prf_rr {
   1.296 +		u_char decrvalid : 1;
   1.297 +		u_char decrprefd : 1;
   1.298 +		u_char reserved : 6;
   1.299 +	} prf_rr;
   1.300 +	u_char prf_reserved3;
   1.301 +	u_short prf_reserved4;
   1.302 +};
   1.303 +
   1.304 +struct  in6_prefixreq {
   1.305 +	char	ipr_name[IFNAMSIZ];
   1.306 +	u_char	ipr_origin;
   1.307 +	u_char	ipr_plen;
   1.308 +	u_int32_t ipr_vltime;
   1.309 +	u_int32_t ipr_pltime;
   1.310 +	struct in6_prflags ipr_flags;
   1.311 +	struct	sockaddr_in6 ipr_prefix;
   1.312 +};
   1.313 +
   1.314 +#define PR_ORIG_RA	0
   1.315 +#define PR_ORIG_RR	1
   1.316 +#define PR_ORIG_STATIC	2
   1.317 +#define PR_ORIG_KERNEL	3
   1.318 +
   1.319 +#define ipr_raf_onlink		ipr_flags.prf_ra.onlink
   1.320 +#define ipr_raf_auto		ipr_flags.prf_ra.autonomous
   1.321 +
   1.322 +#define ipr_statef_onlink	ipr_flags.prf_state.onlink
   1.323 +
   1.324 +#define ipr_rrf_decrvalid	ipr_flags.prf_rr.decrvalid
   1.325 +#define ipr_rrf_decrprefd	ipr_flags.prf_rr.decrprefd
   1.326 +
   1.327 +struct	in6_rrenumreq {
   1.328 +	char	irr_name[IFNAMSIZ];
   1.329 +	u_char	irr_origin;
   1.330 +	u_char	irr_m_len;	/* match len for matchprefix */
   1.331 +	u_char	irr_m_minlen;	/* minlen for matching prefix */
   1.332 +	u_char	irr_m_maxlen;	/* maxlen for matching prefix */
   1.333 +	u_char	irr_u_uselen;	/* uselen for adding prefix */
   1.334 +	u_char	irr_u_keeplen;	/* keeplen from matching prefix */
   1.335 +	struct irr_raflagmask {
   1.336 +		u_char onlink : 1;
   1.337 +		u_char autonomous : 1;
   1.338 +		u_char reserved : 6;
   1.339 +	} irr_raflagmask;
   1.340 +	u_int32_t irr_vltime;
   1.341 +	u_int32_t irr_pltime;
   1.342 +	struct in6_prflags irr_flags;
   1.343 +	struct	sockaddr_in6 irr_matchprefix;
   1.344 +	struct	sockaddr_in6 irr_useprefix;
   1.345 +};
   1.346 +
   1.347 +#define irr_raf_mask_onlink	irr_raflagmask.onlink
   1.348 +#define irr_raf_mask_auto	irr_raflagmask.autonomous
   1.349 +#define irr_raf_mask_reserved	irr_raflagmask.reserved
   1.350 +
   1.351 +#define irr_raf_onlink		irr_flags.prf_ra.onlink
   1.352 +#define irr_raf_auto		irr_flags.prf_ra.autonomous
   1.353 +
   1.354 +#define irr_statef_onlink	irr_flags.prf_state.onlink
   1.355 +
   1.356 +#define irr_rrf			irr_flags.prf_rr
   1.357 +#define irr_rrf_decrvalid	irr_flags.prf_rr.decrvalid
   1.358 +#define irr_rrf_decrprefd	irr_flags.prf_rr.decrprefd
   1.359 +
   1.360 +/*
   1.361 + * Given a pointer to an in6_ifaddr (ifaddr),
   1.362 + * return a pointer to the addr as a sockaddr_in6
   1.363 + */
   1.364 +#define IA6_IN6(ia)	(&((ia)->ia_addr.sin6_addr))
   1.365 +#define IA6_DSTIN6(ia)	(&((ia)->ia_dstaddr.sin6_addr))
   1.366 +#define IA6_MASKIN6(ia)	(&((ia)->ia_prefixmask.sin6_addr))
   1.367 +#define IA6_SIN6(ia)	(&((ia)->ia_addr))
   1.368 +#define IA6_DSTSIN6(ia)	(&((ia)->ia_dstaddr))
   1.369 +#define IFA_IN6(x)	(&((struct sockaddr_in6 *)((x)->ifa_addr))->sin6_addr)
   1.370 +#define IFA_DSTIN6(x)	(&((struct sockaddr_in6 *)((x)->ifa_dstaddr))->sin6_addr)
   1.371 +
   1.372 +#define IFPR_IN6(x)	(&((struct sockaddr_in6 *)((x)->ifpr_prefix))->sin6_addr)
   1.373 +
   1.374 +#ifdef _KERNEL
   1.375 +#define IN6_ARE_MASKED_ADDR_EQUAL(d, a, m)	(	\
   1.376 +	(((d)->s6_addr32[0] ^ (a)->s6_addr32[0]) & (m)->s6_addr32[0]) == 0 && \
   1.377 +	(((d)->s6_addr32[1] ^ (a)->s6_addr32[1]) & (m)->s6_addr32[1]) == 0 && \
   1.378 +	(((d)->s6_addr32[2] ^ (a)->s6_addr32[2]) & (m)->s6_addr32[2]) == 0 && \
   1.379 +	(((d)->s6_addr32[3] ^ (a)->s6_addr32[3]) & (m)->s6_addr32[3]) == 0 )
   1.380 +#endif
   1.381 +
   1.382 +#define SIOCSIFADDR_IN6		 _IOW('i', 12, struct in6_ifreq)
   1.383 +#define SIOCGIFADDR_IN6		_IOWR('i', 33, struct in6_ifreq)
   1.384 +
   1.385 +#ifdef _KERNEL
   1.386 +/*
   1.387 + * SIOCSxxx ioctls should be unused (see comments in in6.c), but
   1.388 + * we do not shift numbers for binary compatibility.
   1.389 + */
   1.390 +#define SIOCSIFDSTADDR_IN6	 _IOW('i', 14, struct in6_ifreq)
   1.391 +#define SIOCSIFNETMASK_IN6	 _IOW('i', 22, struct in6_ifreq)
   1.392 +#endif
   1.393 +
   1.394 +#define SIOCGIFDSTADDR_IN6	_IOWR('i', 34, struct in6_ifreq)
   1.395 +#define SIOCGIFNETMASK_IN6	_IOWR('i', 37, struct in6_ifreq)
   1.396 +
   1.397 +#define SIOCDIFADDR_IN6		 _IOW('i', 25, struct in6_ifreq)
   1.398 +#define SIOCAIFADDR_IN6		 _IOW('i', 26, struct in6_aliasreq)
   1.399 +
   1.400 +#define SIOCSIFPHYADDR_IN6       _IOW('i', 70, struct in6_aliasreq)
   1.401 +#define	SIOCGIFPSRCADDR_IN6	_IOWR('i', 71, struct in6_ifreq)
   1.402 +#define	SIOCGIFPDSTADDR_IN6	_IOWR('i', 72, struct in6_ifreq)
   1.403 +
   1.404 +#define SIOCGIFAFLAG_IN6	_IOWR('i', 73, struct in6_ifreq)
   1.405 +
   1.406 +#define SIOCGDRLST_IN6		_IOWR('i', 74, struct in6_drlist)
   1.407 +#ifdef _KERNEL
   1.408 +/* XXX: SIOCGPRLST_IN6 is exposed in KAME but in6_oprlist is not. */
   1.409 +#define SIOCGPRLST_IN6		_IOWR('i', 75, struct in6_oprlist)
   1.410 +#endif
   1.411 +#ifdef _KERNEL
   1.412 +#define OSIOCGIFINFO_IN6	_IOWR('i', 76, struct in6_ondireq)
   1.413 +#endif
   1.414 +#define SIOCGIFINFO_IN6		_IOWR('i', 108, struct in6_ndireq)
   1.415 +#define SIOCSNDFLUSH_IN6	_IOWR('i', 77, struct in6_ifreq)
   1.416 +#define SIOCGNBRINFO_IN6	_IOWR('i', 78, struct in6_nbrinfo)
   1.417 +#define SIOCSPFXFLUSH_IN6	_IOWR('i', 79, struct in6_ifreq)
   1.418 +#define SIOCSRTRFLUSH_IN6	_IOWR('i', 80, struct in6_ifreq)
   1.419 +
   1.420 +#define SIOCGIFALIFETIME_IN6	_IOWR('i', 81, struct in6_ifreq)
   1.421 +#define SIOCSIFALIFETIME_IN6	_IOWR('i', 82, struct in6_ifreq)
   1.422 +#define SIOCGIFSTAT_IN6		_IOWR('i', 83, struct in6_ifreq)
   1.423 +#define SIOCGIFSTAT_ICMP6	_IOWR('i', 84, struct in6_ifreq)
   1.424 +
   1.425 +#define SIOCSDEFIFACE_IN6	_IOWR('i', 85, struct in6_ndifreq)
   1.426 +#define SIOCGDEFIFACE_IN6	_IOWR('i', 86, struct in6_ndifreq)
   1.427 +
   1.428 +#define SIOCSIFINFO_FLAGS	_IOWR('i', 87, struct in6_ndireq) /* XXX */
   1.429 +
   1.430 +#define SIOCSSCOPE6		_IOW('i', 88, struct in6_ifreq)
   1.431 +#define SIOCGSCOPE6		_IOWR('i', 89, struct in6_ifreq)
   1.432 +#define SIOCGSCOPE6DEF		_IOWR('i', 90, struct in6_ifreq)
   1.433 +
   1.434 +#define SIOCSIFPREFIX_IN6	_IOW('i', 100, struct in6_prefixreq) /* set */
   1.435 +#define SIOCGIFPREFIX_IN6	_IOWR('i', 101, struct in6_prefixreq) /* get */
   1.436 +#define SIOCDIFPREFIX_IN6	_IOW('i', 102, struct in6_prefixreq) /* del */
   1.437 +#define SIOCAIFPREFIX_IN6	_IOW('i', 103, struct in6_rrenumreq) /* add */
   1.438 +#define SIOCCIFPREFIX_IN6	_IOW('i', 104, \
   1.439 +				     struct in6_rrenumreq) /* change */
   1.440 +#define SIOCSGIFPREFIX_IN6	_IOW('i', 105, \
   1.441 +				     struct in6_rrenumreq) /* set global */
   1.442 +
   1.443 +#define SIOCGETSGCNT_IN6	_IOWR('u', 106, \
   1.444 +				      struct sioc_sg_req6) /* get s,g pkt cnt */
   1.445 +#define SIOCGETMIFCNT_IN6	_IOWR('u', 107, \
   1.446 +				      struct sioc_mif_req6) /* get pkt cnt per if */
   1.447 +
   1.448 +#define SIOCAADDRCTL_POLICY	_IOW('u', 108, struct in6_addrpolicy)
   1.449 +#define SIOCDADDRCTL_POLICY	_IOW('u', 109, struct in6_addrpolicy)
   1.450 +
   1.451 +#define IN6_IFF_ANYCAST		0x01	/* anycast address */
   1.452 +#define IN6_IFF_TENTATIVE	0x02	/* tentative address */
   1.453 +#define IN6_IFF_DUPLICATED	0x04	/* DAD detected duplicate */
   1.454 +#define IN6_IFF_DETACHED	0x08	/* may be detached from the link */
   1.455 +#define IN6_IFF_DEPRECATED	0x10	/* deprecated address */
   1.456 +#define IN6_IFF_NODAD		0x20	/* don't perform DAD on this address
   1.457 +					 * (used only at first SIOC* call)
   1.458 +					 */
   1.459 +#define IN6_IFF_AUTOCONF	0x40	/* autoconfigurable address. */
   1.460 +#define IN6_IFF_TEMPORARY	0x80	/* temporary (anonymous) address. */
   1.461 +#define IN6_IFF_NOPFX		0x8000	/* skip kernel prefix management.
   1.462 +					 * XXX: this should be temporary.
   1.463 +					 */
   1.464 +
   1.465 +/* do not input/output */
   1.466 +#define IN6_IFF_NOTREADY (IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED)
   1.467 +
   1.468 +#ifdef _KERNEL
   1.469 +#define IN6_ARE_SCOPE_CMP(a,b) ((a)-(b))
   1.470 +#define IN6_ARE_SCOPE_EQUAL(a,b) ((a)==(b))
   1.471 +#endif
   1.472 +
   1.473 +#ifdef _KERNEL
   1.474 +extern struct in6_ifaddr *in6_ifaddr;
   1.475 +
   1.476 +extern struct icmp6stat icmp6stat;
   1.477 +#define in6_ifstat_inc(ifp, tag) \
   1.478 +do {								\
   1.479 +	if (ifp)						\
   1.480 +		((struct in6_ifextra *)((ifp)->if_afdata[AF_INET6]))->in6_ifstat->tag++; \
   1.481 +} while (/*CONSTCOND*/ 0)
   1.482 +
   1.483 +extern struct in6_addr zeroin6_addr;
   1.484 +extern u_char inet6ctlerrmap[];
   1.485 +extern unsigned long in6_maxmtu;
   1.486 +#ifdef MALLOC_DECLARE
   1.487 +MALLOC_DECLARE(M_IPMADDR);
   1.488 +#endif /* MALLOC_DECLARE */
   1.489 +
   1.490 +/*
   1.491 + * Macro for finding the internet address structure (in6_ifaddr) corresponding
   1.492 + * to a given interface (ifnet structure).
   1.493 + */
   1.494 +
   1.495 +#define IFP_TO_IA6(ifp, ia)				\
   1.496 +/* struct ifnet *ifp; */				\
   1.497 +/* struct in6_ifaddr *ia; */				\
   1.498 +do {									\
   1.499 +	struct ifaddr *ifa;						\
   1.500 +	for (ifa = (ifp)->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next) {	\
   1.501 +		if (!ifa->ifa_addr)					\
   1.502 +			continue;					\
   1.503 +		if (ifa->ifa_addr->sa_family == AF_INET6)		\
   1.504 +			break;						\
   1.505 +	}								\
   1.506 +	(ia) = (struct in6_ifaddr *)ifa;				\
   1.507 +} while (/*CONSTCOND*/ 0)
   1.508 +
   1.509 +#endif /* _KERNEL */
   1.510 +
   1.511 +/*
   1.512 + * Multi-cast membership entry.  One for each group/ifp that a PCB
   1.513 + * belongs to.
   1.514 + */
   1.515 +struct in6_multi_mship {
   1.516 +	struct	in6_multi *i6mm_maddr;	/* Multicast address pointer */
   1.517 +	LIST_ENTRY(in6_multi_mship) i6mm_chain;  /* multicast options chain */
   1.518 +};
   1.519 +
   1.520 +struct	in6_multi {
   1.521 +	LIST_ENTRY(in6_multi) in6m_entry; /* list glue */
   1.522 +	struct	in6_addr in6m_addr;	/* IP6 multicast address */
   1.523 +	struct	ifnet *in6m_ifp;	/* back pointer to ifnet */
   1.524 +	struct	ifmultiaddr *in6m_ifma;	/* back pointer to ifmultiaddr */
   1.525 +	u_int	in6m_refcount;		/* # membership claims by sockets */
   1.526 +	u_int	in6m_state;		/* state of the membership */
   1.527 +	u_int	in6m_timer;		/* MLD6 listener report timer */
   1.528 +};
   1.529 +
   1.530 +#ifdef _KERNEL
   1.531 +extern LIST_HEAD(in6_multihead, in6_multi) in6_multihead;
   1.532 +
   1.533 +/*
   1.534 + * Structure used by macros below to remember position when stepping through
   1.535 + * all of the in6_multi records.
   1.536 + */
   1.537 +struct	in6_multistep {
   1.538 +	struct	in6_ifaddr *i_ia;
   1.539 +	struct	in6_multi *i_in6m;
   1.540 +};
   1.541 +
   1.542 +/*
   1.543 + * Macros for looking up the in6_multi record for a given IP6 multicast
   1.544 + * address on a given interface. If no matching record is found, "in6m"
   1.545 + * returns NLL.
   1.546 + */
   1.547 +
   1.548 +#define IN6_LOOKUP_MULTI(addr, ifp, in6m)			\
   1.549 +/* struct in6_addr addr; */					\
   1.550 +/* struct ifnet *ifp; */					\
   1.551 +/* struct in6_multi *in6m; */					\
   1.552 +do { \
   1.553 +	struct ifmultiaddr *ifma; \
   1.554 +	IF_ADDR_LOCK(ifp); \
   1.555 +	TAILQ_FOREACH(ifma, &(ifp)->if_multiaddrs, ifma_link) { \
   1.556 +		if (ifma->ifma_addr->sa_family == AF_INET6 \
   1.557 +		    && IN6_ARE_ADDR_EQUAL(&((struct sockaddr_in6 *)ifma->ifma_addr)->sin6_addr, \
   1.558 +					  &(addr))) \
   1.559 +			break; \
   1.560 +	} \
   1.561 +	(in6m) = (struct in6_multi *)(ifma ? ifma->ifma_protospec : 0); \
   1.562 +	IF_ADDR_UNLOCK(ifp); \
   1.563 +} while(0)
   1.564 +
   1.565 +/*
   1.566 + * Macro to step through all of the in6_multi records, one at a time.
   1.567 + * The current position is remembered in "step", which the caller must
   1.568 + * provide.  IN6_FIRST_MULTI(), below, must be called to initialize "step"
   1.569 + * and get the first record.  Both macros return a NULL "in6m" when there
   1.570 + * are no remaining records.
   1.571 + */
   1.572 +#define IN6_NEXT_MULTI(step, in6m)					\
   1.573 +/* struct in6_multistep step; */					\
   1.574 +/* struct in6_multi *in6m; */						\
   1.575 +do { \
   1.576 +	if (((in6m) = (step).i_in6m) != NULL) \
   1.577 +		(step).i_in6m = (step).i_in6m->in6m_entry.le_next; \
   1.578 +} while(0)
   1.579 +
   1.580 +#define IN6_FIRST_MULTI(step, in6m)		\
   1.581 +/* struct in6_multistep step; */		\
   1.582 +/* struct in6_multi *in6m */			\
   1.583 +do { \
   1.584 +	(step).i_in6m = in6_multihead.lh_first; \
   1.585 +		IN6_NEXT_MULTI((step), (in6m)); \
   1.586 +} while(0)
   1.587 +
   1.588 +struct	in6_multi *in6_addmulti __P((struct in6_addr *, struct ifnet *,
   1.589 +	int *));
   1.590 +void	in6_delmulti __P((struct in6_multi *));
   1.591 +struct in6_multi_mship *in6_joingroup(struct ifnet *, struct in6_addr *, int *);
   1.592 +int	in6_leavegroup(struct in6_multi_mship *);
   1.593 +int	in6_mask2len __P((struct in6_addr *, u_char *));
   1.594 +int	in6_control __P((struct socket *, u_long, caddr_t, struct ifnet *,
   1.595 +	struct thread *));
   1.596 +int	in6_update_ifa __P((struct ifnet *, struct in6_aliasreq *,
   1.597 +	struct in6_ifaddr *));
   1.598 +void	in6_purgeaddr __P((struct ifaddr *));
   1.599 +int	in6if_do_dad __P((struct ifnet *));
   1.600 +void	in6_purgeif __P((struct ifnet *));
   1.601 +void	in6_savemkludge __P((struct in6_ifaddr *));
   1.602 +void	*in6_domifattach __P((struct ifnet *));
   1.603 +void	in6_domifdetach __P((struct ifnet *, void *));
   1.604 +void	in6_setmaxmtu   __P((void));
   1.605 +void	in6_restoremkludge __P((struct in6_ifaddr *, struct ifnet *));
   1.606 +void	in6_purgemkludge __P((struct ifnet *));
   1.607 +struct in6_ifaddr *in6ifa_ifpforlinklocal __P((struct ifnet *, int));
   1.608 +struct in6_ifaddr *in6ifa_ifpwithaddr __P((struct ifnet *, struct in6_addr *));
   1.609 +char	*ip6_sprintf __P((const struct in6_addr *));
   1.610 +int	in6_addr2zoneid __P((struct ifnet *, struct in6_addr *, u_int32_t *));
   1.611 +int	in6_matchlen __P((struct in6_addr *, struct in6_addr *));
   1.612 +int	in6_are_prefix_equal __P((struct in6_addr *, struct in6_addr *, int));
   1.613 +void	in6_prefixlen2mask __P((struct in6_addr *, int));
   1.614 +int	in6_prefix_ioctl __P((struct socket *, u_long, caddr_t,
   1.615 +	struct ifnet *));
   1.616 +int	in6_prefix_add_ifid __P((int, struct in6_ifaddr *));
   1.617 +void	in6_prefix_remove_ifid __P((int, struct in6_ifaddr *));
   1.618 +void	in6_purgeprefix __P((struct ifnet *));
   1.619 +void	in6_ifremloop(struct ifaddr *);
   1.620 +void	in6_ifaddloop(struct ifaddr *);
   1.621 +
   1.622 +int	in6_is_addr_deprecated __P((struct sockaddr_in6 *));
   1.623 +struct inpcb;
   1.624 +int in6_embedscope __P((struct in6_addr *, const struct sockaddr_in6 *,
   1.625 +	struct inpcb *, struct ifnet **));
   1.626 +int in6_recoverscope __P((struct sockaddr_in6 *, const struct in6_addr *,
   1.627 +	struct ifnet *));
   1.628 +void in6_clearscope __P((struct in6_addr *));
   1.629 +int in6_src_ioctl __P((u_long, caddr_t));
   1.630 +#endif /* _KERNEL */
   1.631 +
   1.632 +#endif /* _NETINET6_IN6_VAR_H_ */