1335640Shselasky/*-
2335640Shselasky * Copyright (c) 2001 Atsushi Onoe
3335640Shselasky * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
4335640Shselasky * All rights reserved.
5335640Shselasky *
6335640Shselasky * Redistribution and use in source and binary forms, with or without
7335640Shselasky * modification, are permitted provided that the following conditions
8335640Shselasky * are met:
9335640Shselasky * 1. Redistributions of source code must retain the above copyright
10335640Shselasky *    notice, this list of conditions and the following disclaimer.
11335640Shselasky * 2. Redistributions in binary form must reproduce the above copyright
12335640Shselasky *    notice, this list of conditions and the following disclaimer in the
13335640Shselasky *    documentation and/or other materials provided with the distribution.
14335640Shselasky * 3. The name of the author may not be used to endorse or promote products
15335640Shselasky *    derived from this software without specific prior written permission.
16335640Shselasky *
17335640Shselasky * Alternatively, this software may be distributed under the terms of the
18335640Shselasky * GNU General Public License ("GPL") version 2 as published by the Free
19335640Shselasky * Software Foundation.
20335640Shselasky *
21335640Shselasky * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22335640Shselasky * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23335640Shselasky * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24335640Shselasky * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25335640Shselasky * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26335640Shselasky * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27335640Shselasky * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28335640Shselasky * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29335640Shselasky * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30335640Shselasky * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31335640Shselasky *
32335640Shselasky * $FreeBSD: stable/11/contrib/libpcap/ieee80211.h 335640 2018-06-25 15:09:55Z hselasky $
33335640Shselasky */
34335640Shselasky#ifndef _NET80211_IEEE80211_H_
35335640Shselasky#define _NET80211_IEEE80211_H_
36335640Shselasky
37335640Shselasky/*
38335640Shselasky * 802.11 protocol definitions.
39335640Shselasky */
40335640Shselasky
41335640Shselasky#define	IEEE80211_FC0_VERSION_MASK		0x03
42335640Shselasky#define	IEEE80211_FC0_VERSION_SHIFT		0
43335640Shselasky#define	IEEE80211_FC0_VERSION_0			0x00
44335640Shselasky#define	IEEE80211_FC0_TYPE_MASK			0x0c
45335640Shselasky#define	IEEE80211_FC0_TYPE_SHIFT		2
46335640Shselasky#define	IEEE80211_FC0_TYPE_MGT			0x00
47335640Shselasky#define	IEEE80211_FC0_TYPE_CTL			0x04
48335640Shselasky#define	IEEE80211_FC0_TYPE_DATA			0x08
49335640Shselasky
50335640Shselasky#define	IEEE80211_FC0_SUBTYPE_MASK		0xf0
51335640Shselasky#define	IEEE80211_FC0_SUBTYPE_SHIFT		4
52335640Shselasky/* for TYPE_MGT */
53335640Shselasky#define	IEEE80211_FC0_SUBTYPE_ASSOC_REQ		0x00
54335640Shselasky#define	IEEE80211_FC0_SUBTYPE_ASSOC_RESP	0x10
55335640Shselasky#define	IEEE80211_FC0_SUBTYPE_REASSOC_REQ	0x20
56335640Shselasky#define	IEEE80211_FC0_SUBTYPE_REASSOC_RESP	0x30
57335640Shselasky#define	IEEE80211_FC0_SUBTYPE_PROBE_REQ		0x40
58335640Shselasky#define	IEEE80211_FC0_SUBTYPE_PROBE_RESP	0x50
59335640Shselasky#define	IEEE80211_FC0_SUBTYPE_BEACON		0x80
60335640Shselasky#define	IEEE80211_FC0_SUBTYPE_ATIM		0x90
61335640Shselasky#define	IEEE80211_FC0_SUBTYPE_DISASSOC		0xa0
62335640Shselasky#define	IEEE80211_FC0_SUBTYPE_AUTH		0xb0
63335640Shselasky#define	IEEE80211_FC0_SUBTYPE_DEAUTH		0xc0
64335640Shselasky/* for TYPE_CTL */
65335640Shselasky#define	IEEE80211_FC0_SUBTYPE_PS_POLL		0xa0
66335640Shselasky#define	IEEE80211_FC0_SUBTYPE_RTS		0xb0
67335640Shselasky#define	IEEE80211_FC0_SUBTYPE_CTS		0xc0
68335640Shselasky#define	IEEE80211_FC0_SUBTYPE_ACK		0xd0
69335640Shselasky#define	IEEE80211_FC0_SUBTYPE_CF_END		0xe0
70335640Shselasky#define	IEEE80211_FC0_SUBTYPE_CF_END_ACK	0xf0
71335640Shselasky/* for TYPE_DATA (bit combination) */
72335640Shselasky#define	IEEE80211_FC0_SUBTYPE_DATA		0x00
73335640Shselasky#define	IEEE80211_FC0_SUBTYPE_CF_ACK		0x10
74335640Shselasky#define	IEEE80211_FC0_SUBTYPE_CF_POLL		0x20
75335640Shselasky#define	IEEE80211_FC0_SUBTYPE_CF_ACPL		0x30
76335640Shselasky#define	IEEE80211_FC0_SUBTYPE_NODATA		0x40
77335640Shselasky#define	IEEE80211_FC0_SUBTYPE_NODATA_CF_ACK	0x50
78335640Shselasky#define	IEEE80211_FC0_SUBTYPE_NODATA_CF_POLL	0x60
79335640Shselasky#define	IEEE80211_FC0_SUBTYPE_NODATA_CF_ACPL	0x70
80335640Shselasky#define	IEEE80211_FC0_SUBTYPE_QOS		0x80
81335640Shselasky#define	IEEE80211_FC0_SUBTYPE_QOS_NULL		0xc0
82335640Shselasky
83335640Shselasky#define	IEEE80211_FC1_DIR_MASK			0x03
84335640Shselasky#define	IEEE80211_FC1_DIR_NODS			0x00	/* STA->STA */
85335640Shselasky#define	IEEE80211_FC1_DIR_TODS			0x01	/* STA->AP  */
86335640Shselasky#define	IEEE80211_FC1_DIR_FROMDS		0x02	/* AP ->STA */
87335640Shselasky#define	IEEE80211_FC1_DIR_DSTODS		0x03	/* AP ->AP  */
88335640Shselasky
89335640Shselasky#define	IEEE80211_FC1_MORE_FRAG			0x04
90335640Shselasky#define	IEEE80211_FC1_RETRY			0x08
91335640Shselasky#define	IEEE80211_FC1_PWR_MGT			0x10
92335640Shselasky#define	IEEE80211_FC1_MORE_DATA			0x20
93335640Shselasky#define	IEEE80211_FC1_WEP			0x40
94335640Shselasky#define	IEEE80211_FC1_ORDER			0x80
95335640Shselasky
96335640Shselasky#define	IEEE80211_SEQ_FRAG_MASK			0x000f
97335640Shselasky#define	IEEE80211_SEQ_FRAG_SHIFT		0
98335640Shselasky#define	IEEE80211_SEQ_SEQ_MASK			0xfff0
99335640Shselasky#define	IEEE80211_SEQ_SEQ_SHIFT			4
100335640Shselasky
101335640Shselasky#define	IEEE80211_NWID_LEN			32
102335640Shselasky
103335640Shselasky#define	IEEE80211_QOS_TXOP			0x00ff
104335640Shselasky/* bit 8 is reserved */
105335640Shselasky#define	IEEE80211_QOS_ACKPOLICY			0x60
106335640Shselasky#define	IEEE80211_QOS_ACKPOLICY_S		5
107335640Shselasky#define	IEEE80211_QOS_ESOP			0x10
108335640Shselasky#define	IEEE80211_QOS_ESOP_S			4
109335640Shselasky#define	IEEE80211_QOS_TID			0x0f
110335640Shselasky
111335640Shselasky#define IEEE80211_MGT_SUBTYPE_NAMES {			\
112335640Shselasky	"assoc-req",		"assoc-resp",		\
113335640Shselasky	"reassoc-req",		"reassoc-resp",		\
114335640Shselasky	"probe-req",		"probe-resp",		\
115335640Shselasky	"reserved#6",		"reserved#7",		\
116335640Shselasky	"beacon",		"atim",			\
117335640Shselasky	"disassoc",		"auth",			\
118335640Shselasky	"deauth",		"reserved#13",		\
119335640Shselasky	"reserved#14",		"reserved#15"		\
120335640Shselasky}
121335640Shselasky
122335640Shselasky#define IEEE80211_CTL_SUBTYPE_NAMES {			\
123335640Shselasky	"reserved#0",		"reserved#1",		\
124335640Shselasky	"reserved#2",		"reserved#3",		\
125335640Shselasky	"reserved#3",		"reserved#5",		\
126335640Shselasky	"reserved#6",		"reserved#7",		\
127335640Shselasky	"reserved#8",		"reserved#9",		\
128335640Shselasky	"ps-poll",		"rts",			\
129335640Shselasky	"cts",			"ack",			\
130335640Shselasky	"cf-end",		"cf-end-ack"		\
131335640Shselasky}
132335640Shselasky
133335640Shselasky#define IEEE80211_DATA_SUBTYPE_NAMES {			\
134335640Shselasky	"data",			"data-cf-ack",		\
135335640Shselasky	"data-cf-poll",		"data-cf-ack-poll",	\
136335640Shselasky	"null",			"cf-ack",		\
137335640Shselasky	"cf-poll",		"cf-ack-poll",		\
138335640Shselasky	"qos-data",		"qos-data-cf-ack",	\
139335640Shselasky	"qos-data-cf-poll",	"qos-data-cf-ack-poll",	\
140335640Shselasky	"qos",			"reserved#13",		\
141335640Shselasky	"qos-cf-poll",		"qos-cf-ack-poll"	\
142335640Shselasky}
143335640Shselasky
144335640Shselasky#define IEEE80211_TYPE_NAMES	{ "mgt", "ctl", "data", "reserved#4" }
145335640Shselasky
146335640Shselasky#endif /* _NET80211_IEEE80211_H_ */
147