12b54eeaimp/*-
24736ccfpfg * SPDX-License-Identifier: BSD-3-Clause
34736ccfpfg *
45f4e854itojun * Copyright (C) 2000 WIDE Project.
550ba589shin * All rights reserved.
65f396e4ume *
750ba589shin * Redistribution and use in source and binary forms, with or without
850ba589shin * modification, are permitted provided that the following conditions
950ba589shin * are met:
1050ba589shin * 1. Redistributions of source code must retain the above copyright
1150ba589shin *    notice, this list of conditions and the following disclaimer.
1250ba589shin * 2. Redistributions in binary form must reproduce the above copyright
1350ba589shin *    notice, this list of conditions and the following disclaimer in the
1450ba589shin *    documentation and/or other materials provided with the distribution.
1550ba589shin * 3. Neither the name of the project nor the names of its contributors
1650ba589shin *    may be used to endorse or promote products derived from this software
1750ba589shin *    without specific prior written permission.
185f396e4ume *
1950ba589shin * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
2050ba589shin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2150ba589shin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2250ba589shin * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
2350ba589shin * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2450ba589shin * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2550ba589shin * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2650ba589shin * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2750ba589shin * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2850ba589shin * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2950ba589shin * SUCH DAMAGE.
300d684d9obrien *
310d684d9obrien *	$KAME: scope6_var.h,v 1.4 2000/05/18 15:03:27 jinmei Exp $
320d684d9obrien * $FreeBSD$
3350ba589shin */
3450ba589shin
355f4e854itojun#ifndef _NETINET6_SCOPE6_VAR_H_
365f4e854itojun#define _NETINET6_SCOPE6_VAR_H_
3750ba589shin
385f4e854itojun#ifdef _KERNEL
39377b89chrs#include <net/vnet.h>
40377b89chrs
413c66398ae#define	IPV6_ADDR_SCOPES_COUNT	16
42babf2c3umestruct scope6_id {
43babf2c3ume	/*
44babf2c3ume	 * 16 is correspondent to 4bit multicast scope field.
45babf2c3ume	 * i.e. from node-local to global with some reserved/unassigned types.
46babf2c3ume	 */
473c66398ae	uint32_t s6id_list[IPV6_ADDR_SCOPES_COUNT];
48babf2c3ume};
49babf2c3ume
50377b89chrsVNET_DECLARE(int, deembed_scopeid);
51377b89chrs#define V_deembed_scopeid       VNET(deembed_scopeid)
52377b89chrs
533948ce7delphijvoid	scope6_init(void);
543948ce7delphijstruct scope6_id *scope6_ifattach(struct ifnet *);
553948ce7delphijvoid	scope6_ifdetach(struct scope6_id *);
5672d1944markjint	scope6_ioctl(u_long cmd, caddr_t data, struct ifnet *);
573948ce7delphijvoid	scope6_setdefault(struct ifnet *);
583948ce7delphijint	scope6_get_default(struct scope6_id *);
593948ce7delphiju_int32_t scope6_addr2default(struct in6_addr *);
603948ce7delphijint	sa6_embedscope(struct sockaddr_in6 *, int);
613948ce7delphijint	sa6_recoverscope(struct sockaddr_in6 *);
623c66398aeint	sa6_checkzone(struct sockaddr_in6 *);
63253f06caeint	sa6_checkzone_ifp(struct ifnet *, struct sockaddr_in6 *);
643948ce7delphijint	in6_setscope(struct in6_addr *, struct ifnet *, u_int32_t *);
653948ce7delphijint	in6_clearscope(struct in6_addr *);
668066b88aeuint16_t in6_getscope(const struct in6_addr *);
673c66398aeuint32_t in6_getscopezone(const struct ifnet *, int);
68ca13483melifarovoid	in6_splitscope(const struct in6_addr *, struct in6_addr *, uint32_t *);
693c66398aestruct ifnet* in6_getlinkifnet(uint32_t);
705f4e854itojun#endif /* _KERNEL */
7150ba589shin
725f4e854itojun#endif /* _NETINET6_SCOPE6_VAR_H_ */
73