1139823Simp/*-
211819Sjulian * Copyright (c) 1984, 1985, 1986, 1987, 1993
311819Sjulian *	The Regents of the University of California.  All rights reserved.
411819Sjulian *
511819Sjulian * Redistribution and use in source and binary forms, with or without
611819Sjulian * modification, are permitted provided that the following conditions
711819Sjulian * are met:
811819Sjulian * 1. Redistributions of source code must retain the above copyright
911819Sjulian *    notice, this list of conditions and the following disclaimer.
1011819Sjulian * 2. Redistributions in binary form must reproduce the above copyright
1111819Sjulian *    notice, this list of conditions and the following disclaimer in the
1211819Sjulian *    documentation and/or other materials provided with the distribution.
13165899Srwatson * 4. Neither the name of the University nor the names of its contributors
14165899Srwatson *    may be used to endorse or promote products derived from this software
15165899Srwatson *    without specific prior written permission.
16165899Srwatson *
17165899Srwatson * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18165899Srwatson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19165899Srwatson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20165899Srwatson * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21165899Srwatson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22165899Srwatson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23165899Srwatson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24165899Srwatson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25165899Srwatson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26165899Srwatson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27165899Srwatson * SUCH DAMAGE.
28165899Srwatson
29165899Srwatson * Copyright (c) 1995, Mike Mitchell
30165899Srwatson *
31165899Srwatson * Redistribution and use in source and binary forms, with or without
32165899Srwatson * modification, are permitted provided that the following conditions
33165899Srwatson * are met:
34165899Srwatson * 1. Redistributions of source code must retain the above copyright
35165899Srwatson *    notice, this list of conditions and the following disclaimer.
36165899Srwatson * 2. Redistributions in binary form must reproduce the above copyright
37165899Srwatson *    notice, this list of conditions and the following disclaimer in the
38165899Srwatson *    documentation and/or other materials provided with the distribution.
3911819Sjulian * 3. All advertising materials mentioning features or use of this software
4011819Sjulian *    must display the following acknowledgement:
4111819Sjulian *	This product includes software developed by the University of
4211819Sjulian *	California, Berkeley and its contributors.
4311819Sjulian * 4. Neither the name of the University nor the names of its contributors
4411819Sjulian *    may be used to endorse or promote products derived from this software
4511819Sjulian *    without specific prior written permission.
4611819Sjulian *
4711819Sjulian * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
4811819Sjulian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4911819Sjulian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
5011819Sjulian * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
5111819Sjulian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5211819Sjulian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
5311819Sjulian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
5411819Sjulian * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
5511819Sjulian * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
5611819Sjulian * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
5711819Sjulian * SUCH DAMAGE.
58139584Srwatson *
5912057Sjulian *	@(#)ipx_if.h
6012057Sjulian *
6150477Speter * $FreeBSD$
6211819Sjulian */
6311819Sjulian
6411819Sjulian#ifndef _NETIPX_IPX_IF_H_
6512470Sbde#define	_NETIPX_IPX_IF_H_
6611819Sjulian
6711819Sjulian/*
6811819Sjulian * Interface address.  One of these structures
6911819Sjulian * is allocated for each interface with an internet address.
7011819Sjulian * The ifaddr structure contains the protocol-independent part
7111819Sjulian * of the structure and is assumed to be first.
7211819Sjulian */
7311819Sjulian
7411819Sjulianstruct ipx_ifaddr {
7511819Sjulian	struct	ifaddr ia_ifa;		/* protocol-independent info */
7611819Sjulian#define	ia_ifp		ia_ifa.ifa_ifp
7711819Sjulian#define	ia_flags	ia_ifa.ifa_flags
78194905Srwatson	TAILQ_ENTRY(ipx_ifaddr)	ia_link;	/* list of IPv6 addresses */
7911819Sjulian	struct	sockaddr_ipx ia_addr;	/* reserve space for my address */
8011819Sjulian	struct	sockaddr_ipx ia_dstaddr;	/* space for my broadcast address */
8111819Sjulian#define ia_broadaddr	ia_dstaddr
8211819Sjulian	struct	sockaddr_ipx ia_netmask;	/* space for my network mask */
8311819Sjulian};
8411819Sjulian
8511819Sjulianstruct	ipx_aliasreq {
8611819Sjulian	char	ifra_name[IFNAMSIZ];		/* if name, e.g. "en0" */
8711819Sjulian	struct	sockaddr_ipx ifra_addr;
8811819Sjulian	struct	sockaddr_ipx ifra_broadaddr;
8911819Sjulian#define ifra_dstaddr ifra_broadaddr
9011819Sjulian};
91194905Srwatson
9211819Sjulian/*
93194905Srwatson * List of ipx_ifaddr's.
94194905Srwatson */
95194905SrwatsonTAILQ_HEAD(ipx_ifaddrhead, ipx_ifaddr);
96194905Srwatson
97194905Srwatson/*
9811819Sjulian * Given a pointer to an ipx_ifaddr (ifaddr),
9911819Sjulian * return a pointer to the addr as a sockadd_ipx.
10011819Sjulian */
10111819Sjulian
10211819Sjulian#define	IA_SIPX(ia) (&(((struct ipx_ifaddr *)(ia))->ia_addr))
10311819Sjulian
10411819Sjulian/* This is not the right place for this but where is? */
10511819Sjulian
10611991Sjulian#define ETHERTYPE_IPX_8022	0x00e0	/* Ethernet_802.2 */
10711991Sjulian#define ETHERTYPE_IPX_8023	0x0000	/* Ethernet_802.3 */
10811991Sjulian#define ETHERTYPE_IPX_II	0x8137	/* Ethernet_II */
10911991Sjulian#define ETHERTYPE_IPX_SNAP	0x8137	/* Ethernet_SNAP */
11011991Sjulian
11111991Sjulian#define	ETHERTYPE_IPX		0x8137	/* Only  Ethernet_II Available */
11211991Sjulian
11355205Speter#ifdef	_KERNEL
114194608Srwatsonextern struct rwlock		 ipx_ifaddr_rw;
115194905Srwatsonextern struct ipx_ifaddrhead	 ipx_ifaddrhead;
11611947Sjulian
117194608Srwatson#define	IPX_IFADDR_LOCK_INIT()		rw_init(&ipx_ifaddr_rw, "ipx_ifaddr_rw")
118194608Srwatson#define	IPX_IFADDR_LOCK_ASSERT()	rw_assert(&ipx_ifaddr_rw, RA_LOCKED)
119194608Srwatson#define	IPX_IFADDR_RLOCK()		rw_rlock(&ipx_ifaddr_rw)
120194608Srwatson#define	IPX_IFADDR_RUNLOCK()		rw_runlock(&ipx_ifaddr_rw)
121194608Srwatson#define	IPX_IFADDR_WLOCK()		rw_wlock(&ipx_ifaddr_rw)
122194608Srwatson#define	IPX_IFADDR_WUNLOCK()		rw_wunlock(&ipx_ifaddr_rw)
123194608Srwatson#define	IPX_IFADDR_RLOCK_ASSERT()	rw_assert(&ipx_ifaddr_rw, RA_WLOCKED)
124194608Srwatson
125169463Srwatsonstruct ipx_ifaddr	*ipx_iaonnetof(struct ipx_addr *dst);
12655205Speter#endif
12711819Sjulian
12826965Sjhay#endif /* !_NETIPX_IPX_IF_H_ */
129