]> git.saurik.com Git - apple/xnu.git/blame - bsd/net/if_vlan_var.h
xnu-344.21.73.tar.gz
[apple/xnu.git] / bsd / net / if_vlan_var.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
d7e50217 6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
1c79356b 7 *
d7e50217
A
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1c79356b
A
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
d7e50217
A
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
1c79356b
A
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25/*
26 * Copyright 1998 Massachusetts Institute of Technology
27 *
28 * Permission to use, copy, modify, and distribute this software and
29 * its documentation for any purpose and without fee is hereby
30 * granted, provided that both the above copyright notice and this
31 * permission notice appear in all copies, that both the above
32 * copyright notice and this permission notice appear in all
33 * supporting documentation, and that the name of M.I.T. not be used
34 * in advertising or publicity pertaining to distribution of the
35 * software without specific, written prior permission. M.I.T. makes
36 * no representations about the suitability of this software for any
37 * purpose. It is provided "as is" without express or implied
38 * warranty.
39 *
40 * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
41 * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
42 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
43 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
44 * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
47 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
48 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
49 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
50 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 */
54
55#ifndef _NET_IF_VLAN_VAR_H_
56#define _NET_IF_VLAN_VAR_H_ 1
9bccf70c 57#include <sys/appleapiopts.h>
1c79356b 58
9bccf70c 59#ifdef __APPLE_API_PRIVATE
1c79356b
A
60#ifdef KERNEL
61struct ifvlan {
62 struct arpcom ifv_ac; /* make this an interface */
63 struct ifnet *ifv_p; /* parent inteface of this vlan */
64 struct ifv_linkmib {
65 int ifvm_parent;
66 u_int16_t ifvm_proto; /* encapsulation ethertype */
67 u_int16_t ifvm_tag; /* tag to apply on packets leaving if */
68 } ifv_mib;
69};
70#define ifv_if ifv_ac.ac_if
71#define ifv_tag ifv_mib.ifvm_tag
72#endif /* KERNEL */
73
74struct ether_vlan_header {
75 u_char evl_dhost[ETHER_ADDR_LEN];
76 u_char evl_shost[ETHER_ADDR_LEN];
77 u_int16_t evl_encap_proto;
78 u_int16_t evl_tag;
79 u_int16_t evl_proto;
80};
81
82#define EVL_VLANOFTAG(tag) ((tag) & 4095)
83#define EVL_PRIOFTAG(tag) (((tag) >> 13) & 7)
84#define EVL_ENCAPLEN 4 /* length in octets of encapsulation */
85
86/* When these sorts of interfaces get their own identifier... */
87#define IFT_8021_VLAN IFT_PROPVIRTUAL
88
89/* sysctl(3) tags, for compatibility purposes */
90#define VLANCTL_PROTO 1
91#define VLANCTL_MAX 2
92
93/*
94 * Configuration structure for SIOCSETVLAN and SIOCGETVLAN ioctls.
95 */
96struct vlanreq {
97 char vlr_parent[IFNAMSIZ];
98 u_short vlr_tag;
99};
100#define SIOCSETVLAN SIOCSIFGENERIC
101#define SIOCGETVLAN SIOCGIFGENERIC
102
103#ifdef KERNEL
104/* shared with if_ethersubr.c: */
105extern u_int vlan_proto;
106extern int vlan_input(struct ether_header *eh, struct mbuf *m);
107#endif
108
9bccf70c 109#endif /* __APPLE_API_PRIVATE */
1c79356b 110#endif /* _NET_IF_VLAN_VAR_H_ */