]> The Tcpdump Group git mirrors - tcpdump/blob - ieee802_11.h
don't pass on src & dst MAC adresses to the isoclns decoder as MAC adresses
[tcpdump] / ieee802_11.h
1 /* @(#) $Header: /tcpdump/master/tcpdump/ieee802_11.h,v 1.7 2003-02-04 05:53:21 guy Exp $ (LBL) */
2 /*
3 * Copyright (c) 2001
4 * Fortress Technologies
5 * Charlie Lenahan ( clenahan@fortresstech.com )
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that: (1) source code distributions
9 * retain the above copyright notice and this paragraph in its entirety, (2)
10 * distributions including binary code include the above copyright notice and
11 * this paragraph in its entirety in the documentation or other materials
12 * provided with the distribution, and (3) all advertising materials mentioning
13 * features or use of this software display the following acknowledgement:
14 * ``This product includes software developed by the University of California,
15 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
16 * the University nor the names of its contributors may be used to endorse
17 * or promote products derived from this software without specific prior
18 * written permission.
19 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
20 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22 */
23
24 #define IEEE802_11_FC_LEN 2
25
26 #define T_MGMT 0x0 /* management */
27 #define T_CTRL 0x1 /* control */
28 #define T_DATA 0x2 /* data */
29 #define T_RESV 0x3 /* reserved */
30
31 #define ST_ASSOC_REQUEST 0x0
32 #define ST_ASSOC_RESPONSE 0x1
33 #define ST_REASSOC_REQUEST 0x2
34 #define ST_REASSOC_RESPONSE 0x3
35 #define ST_PROBE_REQUEST 0x4
36 #define ST_PROBE_RESPONSE 0x5
37 /* RESERVED 0x6 */
38 /* RESERVED 0x7 */
39 #define ST_BEACON 0x8
40 #define ST_ATIM 0x9
41 #define ST_DISASSOC 0xA
42 #define ST_AUTH 0xB
43 #define ST_DEAUTH 0xC
44 /* RESERVED 0xD */
45 /* RESERVED 0xE */
46 /* RESERVED 0xF */
47
48
49 #define CTRL_PS_POLL 0xA
50 #define CTRL_RTS 0xB
51 #define CTRL_CTS 0xC
52 #define CTRL_ACK 0xD
53 #define CTRL_CF_END 0xE
54 #define CTRL_END_ACK 0xF
55
56 #define DATA_DATA 0x0
57 #define DATA_DATA_CF_ACK 0x1
58 #define DATA_DATA_CF_POLL 0x2
59 #define DATA_DATA_CF_ACK_POLL 0x3
60 #define DATA_NODATA 0x4
61 #define DATA_NODATA_CF_ACK 0x5
62 #define DATA_NODATA_CF_POLL 0x6
63 #define DATA_NODATA_CF_ACK_POLL 0x7
64
65 /*
66 * Bits in the frame control field.
67 */
68 #define FC_VERSION(fc) ((fc) & 0x3)
69 #define FC_TYPE(fc) (((fc) >> 2) & 0x3)
70 #define FC_SUBTYPE(fc) (((fc) >> 4) & 0xF)
71 #define FC_TO_DS(fc) ((fc) & 0x0100)
72 #define FC_FROM_DS(fc) ((fc) & 0x0200)
73 #define FC_MORE_FLAG(fc) ((fc) & 0x0400)
74 #define FC_RETRY(fc) ((fc) & 0x0800)
75 #define FC_POWER_MGMT(fc) ((fc) & 0x1000)
76 #define FC_MORE_DATA(fc) ((fc) & 0x2000)
77 #define FC_WEP(fc) ((fc) & 0x4000)
78 #define FC_ORDER(fc) ((fc) & 0x8000)
79
80 struct mgmt_header_t {
81 u_int16_t fc;
82 u_int16_t duration;
83 u_int8_t da[6];
84 u_int8_t sa[6];
85 u_int8_t bssid[6];
86 u_int16_t seq_ctrl;
87 };
88
89 #define MGMT_HEADER_LEN (2+2+6+6+6+2)
90
91 #define CAPABILITY_ESS(cap) ((cap) & 0x0001)
92 #define CAPABILITY_IBSS(cap) ((cap) & 0x0002)
93 #define CAPABILITY_CFP(cap) ((cap) & 0x0004)
94 #define CAPABILITY_CFP_REQ(cap) ((cap) & 0x0008)
95 #define CAPABILITY_PRIVACY(cap) ((cap) & 0x0010)
96
97 struct ssid_t {
98 u_int8_t element_id;
99 u_int8_t length;
100 u_char ssid[33]; /* 32 + 1 for null */
101 };
102
103 struct rates_t {
104 u_int8_t element_id;
105 u_int8_t length;
106 u_int8_t rate[8];
107 };
108
109 struct challenge_t {
110 u_int8_t element_id;
111 u_int8_t length;
112 u_int8_t text[254]; /* 1-253 + 1 for null */
113 };
114 struct fh_t {
115 u_int8_t element_id;
116 u_int8_t length;
117 u_int16_t dwell_time;
118 u_int8_t hop_set;
119 u_int8_t hop_pattern;
120 u_int8_t hop_index;
121 };
122
123 struct ds_t {
124 u_int8_t element_id;
125 u_int8_t length;
126 u_int8_t channel;
127 };
128
129 struct cf_t {
130 u_int8_t element_id;
131 u_int8_t length;
132 u_int8_t count;
133 u_int8_t period;
134 u_int16_t max_duration;
135 u_int16_t dur_remaing;
136 };
137
138 struct tim_t {
139 u_int8_t element_id;
140 u_int8_t length;
141 u_int8_t count;
142 u_int8_t period;
143 u_int8_t bitmap_control;
144 u_int8_t bitmap[251];
145 };
146
147 #define E_SSID 0
148 #define E_RATES 1
149 #define E_FH 2
150 #define E_DS 3
151 #define E_CF 4
152 #define E_TIM 5
153 #define E_IBSS 6
154 /* reserved 7 */
155 /* reserved 8 */
156 /* reserved 9 */
157 /* reserved 10 */
158 /* reserved 11 */
159 /* reserved 12 */
160 /* reserved 13 */
161 /* reserved 14 */
162 /* reserved 15 */
163 /* reserved 16 */
164
165 #define E_CHALLENGE 16
166 /* reserved 17 */
167 /* reserved 18 */
168 /* reserved 19 */
169 /* reserved 16 */
170 /* reserved 16 */
171
172
173 struct mgmt_body_t {
174 u_int8_t timestamp[8];
175 u_int16_t beacon_interval;
176 u_int16_t listen_interval;
177 u_int16_t status_code;
178 u_int16_t aid;
179 u_char ap[6];
180 u_int16_t reason_code;
181 u_int16_t auth_alg;
182 u_int16_t auth_trans_seq_num;
183 struct challenge_t challenge;
184 u_int16_t capability_info;
185 struct ssid_t ssid;
186 struct rates_t rates;
187 struct ds_t ds;
188 struct cf_t cf;
189 struct fh_t fh;
190 struct tim_t tim;
191 };
192
193 struct ctrl_rts_t {
194 u_int16_t fc;
195 u_int16_t duration;
196 u_int8_t ra[6];
197 u_int8_t ta[6];
198 u_int8_t fcs[4];
199 };
200
201 #define CTRL_RTS_LEN (2+2+6+6+4)
202
203 struct ctrl_cts_t {
204 u_int16_t fc;
205 u_int16_t duration;
206 u_int8_t ra[6];
207 u_int8_t fcs[4];
208 };
209
210 #define CTRL_CTS_LEN (2+2+6+4)
211
212 struct ctrl_ack_t {
213 u_int16_t fc;
214 u_int16_t duration;
215 u_int8_t ra[6];
216 u_int8_t fcs[4];
217 };
218
219 #define CTRL_ACK_LEN (2+2+6+4)
220
221 struct ctrl_ps_poll_t {
222 u_int16_t fc;
223 u_int16_t aid;
224 u_int8_t bssid[6];
225 u_int8_t ta[6];
226 u_int8_t fcs[4];
227 };
228
229 #define CTRL_PS_POLL_LEN (2+2+6+6+4)
230
231 struct ctrl_end_t {
232 u_int16_t fc;
233 u_int16_t duration;
234 u_int8_t ra[6];
235 u_int8_t bssid[6];
236 u_int8_t fcs[4];
237 };
238
239 #define CTRL_END_LEN (2+2+6+6+4)
240
241 struct ctrl_end_ack_t {
242 u_int16_t fc;
243 u_int16_t duration;
244 u_int8_t ra[6];
245 u_int8_t bssid[6];
246 u_int8_t fcs[4];
247 };
248
249 #define CTRL_END_ACK_LEN (2+2+6+6+4)
250
251 #define IV_IV(iv) ((iv) & 0xFFFFFF)
252 #define IV_PAD(iv) (((iv) >> 24) & 0x3F)
253 #define IV_KEYID(iv) (((iv) >> 30) & 0x03)