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