ieee80211.h revision 335640
1259698Sdim/*-
2259698Sdim * Copyright (c) 2001 Atsushi Onoe
3353358Sdim * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
4353358Sdim * All rights reserved.
5353358Sdim *
6259698Sdim * Redistribution and use in source and binary forms, with or without
7259698Sdim * modification, are permitted provided that the following conditions
8259698Sdim * are met:
9259698Sdim * 1. Redistributions of source code must retain the above copyright
10259698Sdim *    notice, this list of conditions and the following disclaimer.
11259698Sdim * 2. Redistributions in binary form must reproduce the above copyright
12259698Sdim *    notice, this list of conditions and the following disclaimer in the
13259698Sdim *    documentation and/or other materials provided with the distribution.
14259698Sdim * 3. The name of the author may not be used to endorse or promote products
15259698Sdim *    derived from this software without specific prior written permission.
16259698Sdim *
17321369Sdim * Alternatively, this software may be distributed under the terms of the
18321369Sdim * GNU General Public License ("GPL") version 2 as published by the Free
19259698Sdim * Software Foundation.
20259698Sdim *
21259698Sdim * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22341825Sdim * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23259698Sdim * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24259698Sdim * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25259698Sdim * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26259698Sdim * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27259698Sdim * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28259698Sdim * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29259698Sdim * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30259698Sdim * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31259698Sdim *
32259698Sdim * $FreeBSD: stable/11/contrib/libpcap/ieee80211.h 335640 2018-06-25 15:09:55Z hselasky $
33259698Sdim */
34259698Sdim#ifndef _NET80211_IEEE80211_H_
35341825Sdim#define _NET80211_IEEE80211_H_
36259698Sdim
37259698Sdim/*
38259698Sdim * 802.11 protocol definitions.
39259698Sdim */
40276479Sdim
41259698Sdim#define	IEEE80211_FC0_VERSION_MASK		0x03
42341825Sdim#define	IEEE80211_FC0_VERSION_SHIFT		0
43259698Sdim#define	IEEE80211_FC0_VERSION_0			0x00
44259698Sdim#define	IEEE80211_FC0_TYPE_MASK			0x0c
45259698Sdim#define	IEEE80211_FC0_TYPE_SHIFT		2
46259698Sdim#define	IEEE80211_FC0_TYPE_MGT			0x00
47259698Sdim#define	IEEE80211_FC0_TYPE_CTL			0x04
48259698Sdim#define	IEEE80211_FC0_TYPE_DATA			0x08
49288943Sdim
50296417Sdim#define	IEEE80211_FC0_SUBTYPE_MASK		0xf0
51296417Sdim#define	IEEE80211_FC0_SUBTYPE_SHIFT		4
52296417Sdim/* for TYPE_MGT */
53296417Sdim#define	IEEE80211_FC0_SUBTYPE_ASSOC_REQ		0x00
54296417Sdim#define	IEEE80211_FC0_SUBTYPE_ASSOC_RESP	0x10
55314564Sdim#define	IEEE80211_FC0_SUBTYPE_REASSOC_REQ	0x20
56288943Sdim#define	IEEE80211_FC0_SUBTYPE_REASSOC_RESP	0x30
57259698Sdim#define	IEEE80211_FC0_SUBTYPE_PROBE_REQ		0x40
58259698Sdim#define	IEEE80211_FC0_SUBTYPE_PROBE_RESP	0x50
59259698Sdim#define	IEEE80211_FC0_SUBTYPE_BEACON		0x80
60288943Sdim#define	IEEE80211_FC0_SUBTYPE_ATIM		0x90
61259698Sdim#define	IEEE80211_FC0_SUBTYPE_DISASSOC		0xa0
62341825Sdim#define	IEEE80211_FC0_SUBTYPE_AUTH		0xb0
63259698Sdim#define	IEEE80211_FC0_SUBTYPE_DEAUTH		0xc0
64259698Sdim/* for TYPE_CTL */
65259698Sdim#define	IEEE80211_FC0_SUBTYPE_PS_POLL		0xa0
66259698Sdim#define	IEEE80211_FC0_SUBTYPE_RTS		0xb0
67259698Sdim#define	IEEE80211_FC0_SUBTYPE_CTS		0xc0
68259698Sdim#define	IEEE80211_FC0_SUBTYPE_ACK		0xd0
69341825Sdim#define	IEEE80211_FC0_SUBTYPE_CF_END		0xe0
70259698Sdim#define	IEEE80211_FC0_SUBTYPE_CF_END_ACK	0xf0
71259698Sdim/* for TYPE_DATA (bit combination) */
72259698Sdim#define	IEEE80211_FC0_SUBTYPE_DATA		0x00
73259698Sdim#define	IEEE80211_FC0_SUBTYPE_CF_ACK		0x10
74259698Sdim#define	IEEE80211_FC0_SUBTYPE_CF_POLL		0x20
75259698Sdim#define	IEEE80211_FC0_SUBTYPE_CF_ACPL		0x30
76341825Sdim#define	IEEE80211_FC0_SUBTYPE_NODATA		0x40
77341825Sdim#define	IEEE80211_FC0_SUBTYPE_NODATA_CF_ACK	0x50
78341825Sdim#define	IEEE80211_FC0_SUBTYPE_NODATA_CF_POLL	0x60
79341825Sdim#define	IEEE80211_FC0_SUBTYPE_NODATA_CF_ACPL	0x70
80259698Sdim#define	IEEE80211_FC0_SUBTYPE_QOS		0x80
81259698Sdim#define	IEEE80211_FC0_SUBTYPE_QOS_NULL		0xc0
82259698Sdim
83341825Sdim#define	IEEE80211_FC1_DIR_MASK			0x03
84341825Sdim#define	IEEE80211_FC1_DIR_NODS			0x00	/* STA->STA */
85341825Sdim#define	IEEE80211_FC1_DIR_TODS			0x01	/* STA->AP  */
86341825Sdim#define	IEEE80211_FC1_DIR_FROMDS		0x02	/* AP ->STA */
87259698Sdim#define	IEEE80211_FC1_DIR_DSTODS		0x03	/* AP ->AP  */
88259698Sdim
89259698Sdim#define	IEEE80211_FC1_MORE_FRAG			0x04
90259698Sdim#define	IEEE80211_FC1_RETRY			0x08
91259698Sdim#define	IEEE80211_FC1_PWR_MGT			0x10
92259698Sdim#define	IEEE80211_FC1_MORE_DATA			0x20
93259698Sdim#define	IEEE80211_FC1_WEP			0x40
94259698Sdim#define	IEEE80211_FC1_ORDER			0x80
95259698Sdim
96259698Sdim#define	IEEE80211_SEQ_FRAG_MASK			0x000f
97259698Sdim#define	IEEE80211_SEQ_FRAG_SHIFT		0
98259698Sdim#define	IEEE80211_SEQ_SEQ_MASK			0xfff0
99259698Sdim#define	IEEE80211_SEQ_SEQ_SHIFT			4
100259698Sdim
101321369Sdim#define	IEEE80211_NWID_LEN			32
102259698Sdim
103259698Sdim#define	IEEE80211_QOS_TXOP			0x00ff
104/* bit 8 is reserved */
105#define	IEEE80211_QOS_ACKPOLICY			0x60
106#define	IEEE80211_QOS_ACKPOLICY_S		5
107#define	IEEE80211_QOS_ESOP			0x10
108#define	IEEE80211_QOS_ESOP_S			4
109#define	IEEE80211_QOS_TID			0x0f
110
111#define IEEE80211_MGT_SUBTYPE_NAMES {			\
112	"assoc-req",		"assoc-resp",		\
113	"reassoc-req",		"reassoc-resp",		\
114	"probe-req",		"probe-resp",		\
115	"reserved#6",		"reserved#7",		\
116	"beacon",		"atim",			\
117	"disassoc",		"auth",			\
118	"deauth",		"reserved#13",		\
119	"reserved#14",		"reserved#15"		\
120}
121
122#define IEEE80211_CTL_SUBTYPE_NAMES {			\
123	"reserved#0",		"reserved#1",		\
124	"reserved#2",		"reserved#3",		\
125	"reserved#3",		"reserved#5",		\
126	"reserved#6",		"reserved#7",		\
127	"reserved#8",		"reserved#9",		\
128	"ps-poll",		"rts",			\
129	"cts",			"ack",			\
130	"cf-end",		"cf-end-ack"		\
131}
132
133#define IEEE80211_DATA_SUBTYPE_NAMES {			\
134	"data",			"data-cf-ack",		\
135	"data-cf-poll",		"data-cf-ack-poll",	\
136	"null",			"cf-ack",		\
137	"cf-poll",		"cf-ack-poll",		\
138	"qos-data",		"qos-data-cf-ack",	\
139	"qos-data-cf-poll",	"qos-data-cf-ack-poll",	\
140	"qos",			"reserved#13",		\
141	"qos-cf-poll",		"qos-cf-ack-poll"	\
142}
143
144#define IEEE80211_TYPE_NAMES	{ "mgt", "ctl", "data", "reserved#4" }
145
146#endif /* _NET80211_IEEE80211_H_ */
147