1/*-
2 * Copyright (c) 1984, 1985, 1986, 1987, 1993
3 *	The Regents of the University of California.  All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 * 4. Neither the name of the University nor the names of its contributors
14 *    may be used to endorse or promote products derived from this software
15 *    without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28
29 * Copyright (c) 1995, Mike Mitchell
30 *
31 * Redistribution and use in source and binary forms, with or without
32 * modification, are permitted provided that the following conditions
33 * are met:
34 * 1. Redistributions of source code must retain the above copyright
35 *    notice, this list of conditions and the following disclaimer.
36 * 2. Redistributions in binary form must reproduce the above copyright
37 *    notice, this list of conditions and the following disclaimer in the
38 *    documentation and/or other materials provided with the distribution.
39 * 3. All advertising materials mentioning features or use of this software
40 *    must display the following acknowledgement:
41 *	This product includes software developed by the University of
42 *	California, Berkeley and its contributors.
43 * 4. Neither the name of the University nor the names of its contributors
44 *    may be used to endorse or promote products derived from this software
45 *    without specific prior written permission.
46 *
47 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
48 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
50 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
51 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
53 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
56 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
57 * SUCH DAMAGE.
58 *
59 *	@(#)ipx_if.h
60 *
61 * $FreeBSD$
62 */
63
64#ifndef _NETIPX_IPX_IF_H_
65#define	_NETIPX_IPX_IF_H_
66
67/*
68 * Interface address.  One of these structures
69 * is allocated for each interface with an internet address.
70 * The ifaddr structure contains the protocol-independent part
71 * of the structure and is assumed to be first.
72 */
73
74struct ipx_ifaddr {
75	struct	ifaddr ia_ifa;		/* protocol-independent info */
76#define	ia_ifp		ia_ifa.ifa_ifp
77#define	ia_flags	ia_ifa.ifa_flags
78	TAILQ_ENTRY(ipx_ifaddr)	ia_link;	/* list of IPv6 addresses */
79	struct	sockaddr_ipx ia_addr;	/* reserve space for my address */
80	struct	sockaddr_ipx ia_dstaddr;	/* space for my broadcast address */
81#define ia_broadaddr	ia_dstaddr
82	struct	sockaddr_ipx ia_netmask;	/* space for my network mask */
83};
84
85struct	ipx_aliasreq {
86	char	ifra_name[IFNAMSIZ];		/* if name, e.g. "en0" */
87	struct	sockaddr_ipx ifra_addr;
88	struct	sockaddr_ipx ifra_broadaddr;
89#define ifra_dstaddr ifra_broadaddr
90};
91
92/*
93 * List of ipx_ifaddr's.
94 */
95TAILQ_HEAD(ipx_ifaddrhead, ipx_ifaddr);
96
97/*
98 * Given a pointer to an ipx_ifaddr (ifaddr),
99 * return a pointer to the addr as a sockadd_ipx.
100 */
101
102#define	IA_SIPX(ia) (&(((struct ipx_ifaddr *)(ia))->ia_addr))
103
104/* This is not the right place for this but where is? */
105
106#define ETHERTYPE_IPX_8022	0x00e0	/* Ethernet_802.2 */
107#define ETHERTYPE_IPX_8023	0x0000	/* Ethernet_802.3 */
108#define ETHERTYPE_IPX_II	0x8137	/* Ethernet_II */
109#define ETHERTYPE_IPX_SNAP	0x8137	/* Ethernet_SNAP */
110
111#define	ETHERTYPE_IPX		0x8137	/* Only  Ethernet_II Available */
112
113#ifdef	_KERNEL
114extern struct rwlock		 ipx_ifaddr_rw;
115extern struct ipx_ifaddrhead	 ipx_ifaddrhead;
116
117#define	IPX_IFADDR_LOCK_INIT()		rw_init(&ipx_ifaddr_rw, "ipx_ifaddr_rw")
118#define	IPX_IFADDR_LOCK_ASSERT()	rw_assert(&ipx_ifaddr_rw, RA_LOCKED)
119#define	IPX_IFADDR_RLOCK()		rw_rlock(&ipx_ifaddr_rw)
120#define	IPX_IFADDR_RUNLOCK()		rw_runlock(&ipx_ifaddr_rw)
121#define	IPX_IFADDR_WLOCK()		rw_wlock(&ipx_ifaddr_rw)
122#define	IPX_IFADDR_WUNLOCK()		rw_wunlock(&ipx_ifaddr_rw)
123#define	IPX_IFADDR_RLOCK_ASSERT()	rw_assert(&ipx_ifaddr_rw, RA_WLOCKED)
124
125struct ipx_ifaddr	*ipx_iaonnetof(struct ipx_addr *dst);
126#endif
127
128#endif /* !_NETIPX_IPX_IF_H_ */
129