xref: /netbsd/sys/net/if_vlanvar.h (revision bf9ec67e)
1 /*	$NetBSD: if_vlanvar.h,v 1.4 2000/10/03 23:50:52 thorpej Exp $	*/
2 
3 /*-
4  * Copyright (c) 2000 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Andrew Doran.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *	This product includes software developed by the NetBSD
21  *	Foundation, Inc. and its contributors.
22  * 4. Neither the name of The NetBSD Foundation nor the names of its
23  *    contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 /*
40  * Copyright 1998 Massachusetts Institute of Technology
41  *
42  * Permission to use, copy, modify, and distribute this software and
43  * its documentation for any purpose and without fee is hereby
44  * granted, provided that both the above copyright notice and this
45  * permission notice appear in all copies, that both the above
46  * copyright notice and this permission notice appear in all
47  * supporting documentation, and that the name of M.I.T. not be used
48  * in advertising or publicity pertaining to distribution of the
49  * software without specific, written prior permission.  M.I.T. makes
50  * no representations about the suitability of this software for any
51  * purpose.  It is provided "as is" without express or implied
52  * warranty.
53  *
54  * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS
55  * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
56  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
57  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
58  * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
59  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
60  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
61  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
62  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
63  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
64  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
65  * SUCH DAMAGE.
66  *
67  * from FreeBSD: if_vlan_var.h,v 1.3 1999/08/28 00:48:24 peter Exp
68  */
69 
70 #ifndef _NET_IF_VLANVAR_H_
71 #define	_NET_IF_VLANVAR_H_
72 
73 struct ether_vlan_header {
74 	u_int8_t	evl_dhost[ETHER_ADDR_LEN];
75 	u_int8_t	evl_shost[ETHER_ADDR_LEN];
76 	u_int16_t	evl_encap_proto;
77 	u_int16_t	evl_tag;
78 	u_int16_t	evl_proto;
79 } __attribute__((__packed__));
80 
81 #define	EVL_VLANOFTAG(tag)	((tag) & 4095)
82 #define	EVL_PRIOFTAG(tag)	(((tag) >> 13) & 7)
83 
84 /* Configuration structure for SIOCSETVLAN and SIOCGETVLAN ioctls. */
85 struct vlanreq {
86 	char	vlr_parent[IFNAMSIZ];
87 	u_short	vlr_tag;
88 };
89 
90 #define	SIOCSETVLAN	SIOCSIFGENERIC
91 #define	SIOCGETVLAN	SIOCGIFGENERIC
92 
93 #ifdef _KERNEL
94 void	vlan_input(struct ifnet *, struct mbuf *);
95 void	vlan_ifdetach(struct ifnet *);
96 #endif	/* _KERNEL */
97 
98 #endif	/* !_NET_IF_VLANVAR_H_ */
99