xref: /xnu-8792.61.2/bsd/net/if_vlan_var.h (revision 42e220869062b56f8d7d0726fd4c88954f87902c)
1*42e22086SApple OSS Distributions /*
2*42e22086SApple OSS Distributions  * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
3*42e22086SApple OSS Distributions  *
4*42e22086SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*42e22086SApple OSS Distributions  *
6*42e22086SApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*42e22086SApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*42e22086SApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*42e22086SApple OSS Distributions  * compliance with the License. The rights granted to you under the License
10*42e22086SApple OSS Distributions  * may not be used to create, or enable the creation or redistribution of,
11*42e22086SApple OSS Distributions  * unlawful or unlicensed copies of an Apple operating system, or to
12*42e22086SApple OSS Distributions  * circumvent, violate, or enable the circumvention or violation of, any
13*42e22086SApple OSS Distributions  * terms of an Apple operating system software license agreement.
14*42e22086SApple OSS Distributions  *
15*42e22086SApple OSS Distributions  * Please obtain a copy of the License at
16*42e22086SApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*42e22086SApple OSS Distributions  *
18*42e22086SApple OSS Distributions  * The Original Code and all software distributed under the License are
19*42e22086SApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*42e22086SApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*42e22086SApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*42e22086SApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*42e22086SApple OSS Distributions  * Please see the License for the specific language governing rights and
24*42e22086SApple OSS Distributions  * limitations under the License.
25*42e22086SApple OSS Distributions  *
26*42e22086SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*42e22086SApple OSS Distributions  */
28*42e22086SApple OSS Distributions /*
29*42e22086SApple OSS Distributions  * Copyright 1998 Massachusetts Institute of Technology
30*42e22086SApple OSS Distributions  *
31*42e22086SApple OSS Distributions  * Permission to use, copy, modify, and distribute this software and
32*42e22086SApple OSS Distributions  * its documentation for any purpose and without fee is hereby
33*42e22086SApple OSS Distributions  * granted, provided that both the above copyright notice and this
34*42e22086SApple OSS Distributions  * permission notice appear in all copies, that both the above
35*42e22086SApple OSS Distributions  * copyright notice and this permission notice appear in all
36*42e22086SApple OSS Distributions  * supporting documentation, and that the name of M.I.T. not be used
37*42e22086SApple OSS Distributions  * in advertising or publicity pertaining to distribution of the
38*42e22086SApple OSS Distributions  * software without specific, written prior permission.  M.I.T. makes
39*42e22086SApple OSS Distributions  * no representations about the suitability of this software for any
40*42e22086SApple OSS Distributions  * purpose.  It is provided "as is" without express or implied
41*42e22086SApple OSS Distributions  * warranty.
42*42e22086SApple OSS Distributions  *
43*42e22086SApple OSS Distributions  * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS
44*42e22086SApple OSS Distributions  * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
45*42e22086SApple OSS Distributions  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
46*42e22086SApple OSS Distributions  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
47*42e22086SApple OSS Distributions  * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
48*42e22086SApple OSS Distributions  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
49*42e22086SApple OSS Distributions  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
50*42e22086SApple OSS Distributions  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
51*42e22086SApple OSS Distributions  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
52*42e22086SApple OSS Distributions  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
53*42e22086SApple OSS Distributions  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
54*42e22086SApple OSS Distributions  * SUCH DAMAGE.
55*42e22086SApple OSS Distributions  *
56*42e22086SApple OSS Distributions  * $FreeBSD: src/sys/net/if_vlan_var.h,v 1.16 2003/07/08 21:54:20 wpaul Exp $
57*42e22086SApple OSS Distributions  */
58*42e22086SApple OSS Distributions 
59*42e22086SApple OSS Distributions #ifndef _NET_IF_VLAN_VAR_H_
60*42e22086SApple OSS Distributions #define _NET_IF_VLAN_VAR_H_     1
61*42e22086SApple OSS Distributions 
62*42e22086SApple OSS Distributions #define ETHER_VLAN_ENCAP_LEN    4       /* len of 802.1Q VLAN encapsulation */
63*42e22086SApple OSS Distributions struct  ether_vlan_header {
64*42e22086SApple OSS Distributions 	u_char  evl_dhost[ETHER_ADDR_LEN];
65*42e22086SApple OSS Distributions 	u_char  evl_shost[ETHER_ADDR_LEN];
66*42e22086SApple OSS Distributions 	u_int16_t evl_encap_proto;
67*42e22086SApple OSS Distributions 	u_int16_t evl_tag;
68*42e22086SApple OSS Distributions 	u_int16_t evl_proto;
69*42e22086SApple OSS Distributions };
70*42e22086SApple OSS Distributions 
71*42e22086SApple OSS Distributions #define EVL_VLID_MASK   0x0FFF
72*42e22086SApple OSS Distributions #define EVL_VLANOFTAG(tag) ((tag) & EVL_VLID_MASK)
73*42e22086SApple OSS Distributions #define EVL_PRIOFTAG(tag) (((tag) >> 13) & 7)
74*42e22086SApple OSS Distributions 
75*42e22086SApple OSS Distributions #if 0
76*42e22086SApple OSS Distributions /* sysctl(3) tags, for compatibility purposes */
77*42e22086SApple OSS Distributions #define VLANCTL_PROTO   1
78*42e22086SApple OSS Distributions #define VLANCTL_MAX     2
79*42e22086SApple OSS Distributions #endif
80*42e22086SApple OSS Distributions 
81*42e22086SApple OSS Distributions /*
82*42e22086SApple OSS Distributions  * Configuration structure for SIOCSETVLAN and SIOCGETVLAN ioctls.
83*42e22086SApple OSS Distributions  */
84*42e22086SApple OSS Distributions struct  vlanreq {
85*42e22086SApple OSS Distributions 	char    vlr_parent[IFNAMSIZ];
86*42e22086SApple OSS Distributions 	u_short vlr_tag;
87*42e22086SApple OSS Distributions };
88*42e22086SApple OSS Distributions 
89*42e22086SApple OSS Distributions #ifdef KERNEL_PRIVATE
90*42e22086SApple OSS Distributions int vlan_family_init(void);
91*42e22086SApple OSS Distributions #endif /* KERNEL_PRIVATE */
92*42e22086SApple OSS Distributions #endif /* _NET_IF_VLAN_VAR_H_ */
93