diff options
Diffstat (limited to 'src/transport/wlan/ieee80211.h')
-rw-r--r-- | src/transport/wlan/ieee80211.h | 532 |
1 files changed, 279 insertions, 253 deletions
diff --git a/src/transport/wlan/ieee80211.h b/src/transport/wlan/ieee80211.h index 8df1d2c29..a952674ca 100644 --- a/src/transport/wlan/ieee80211.h +++ b/src/transport/wlan/ieee80211.h | |||
@@ -38,72 +38,78 @@ | |||
38 | * 802.11 protocol definitions. | 38 | * 802.11 protocol definitions. |
39 | */ | 39 | */ |
40 | 40 | ||
41 | #define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */ | 41 | #define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */ |
42 | /* is 802.11 address multicast/broadcast? */ | 42 | /* is 802.11 address multicast/broadcast? */ |
43 | #define IEEE80211_IS_MULTICAST(_a) (*(_a) & 0x01) | 43 | #define IEEE80211_IS_MULTICAST(_a) (*(_a) & 0x01) |
44 | 44 | ||
45 | /* IEEE 802.11 PLCP header */ | 45 | /* IEEE 802.11 PLCP header */ |
46 | struct ieee80211_plcp_hdr { | 46 | struct ieee80211_plcp_hdr |
47 | u_int16_t i_sfd; | 47 | { |
48 | u_int8_t i_signal; | 48 | u_int16_t i_sfd; |
49 | u_int8_t i_service; | 49 | u_int8_t i_signal; |
50 | u_int16_t i_length; | 50 | u_int8_t i_service; |
51 | u_int16_t i_crc; | 51 | u_int16_t i_length; |
52 | u_int16_t i_crc; | ||
52 | } GNUNET_PACKED; | 53 | } GNUNET_PACKED; |
53 | 54 | ||
54 | #define IEEE80211_PLCP_SFD 0xF3A0 | 55 | #define IEEE80211_PLCP_SFD 0xF3A0 |
55 | #define IEEE80211_PLCP_SERVICE 0x00 | 56 | #define IEEE80211_PLCP_SERVICE 0x00 |
56 | 57 | ||
57 | /* | 58 | /* |
58 | * generic definitions for IEEE 802.11 frames | 59 | * generic definitions for IEEE 802.11 frames |
59 | */ | 60 | */ |
60 | struct ieee80211_frame { | 61 | struct ieee80211_frame |
61 | u_int8_t i_fc[2]; | 62 | { |
62 | u_int8_t i_dur[2]; | 63 | u_int8_t i_fc[2]; |
63 | u_int8_t i_addr1[IEEE80211_ADDR_LEN]; | 64 | u_int8_t i_dur[2]; |
64 | u_int8_t i_addr2[IEEE80211_ADDR_LEN]; | 65 | u_int8_t i_addr1[IEEE80211_ADDR_LEN]; |
65 | u_int8_t i_addr3[IEEE80211_ADDR_LEN]; | 66 | u_int8_t i_addr2[IEEE80211_ADDR_LEN]; |
66 | u_int8_t i_seq[2]; | 67 | u_int8_t i_addr3[IEEE80211_ADDR_LEN]; |
67 | /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ | 68 | u_int8_t i_seq[2]; |
68 | /* see below */ | 69 | /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ |
70 | /* see below */ | ||
69 | } GNUNET_PACKED; | 71 | } GNUNET_PACKED; |
70 | 72 | ||
71 | struct ieee80211_qosframe { | 73 | struct ieee80211_qosframe |
72 | u_int8_t i_fc[2]; | 74 | { |
73 | u_int8_t i_dur[2]; | 75 | u_int8_t i_fc[2]; |
74 | u_int8_t i_addr1[IEEE80211_ADDR_LEN]; | 76 | u_int8_t i_dur[2]; |
75 | u_int8_t i_addr2[IEEE80211_ADDR_LEN]; | 77 | u_int8_t i_addr1[IEEE80211_ADDR_LEN]; |
76 | u_int8_t i_addr3[IEEE80211_ADDR_LEN]; | 78 | u_int8_t i_addr2[IEEE80211_ADDR_LEN]; |
77 | u_int8_t i_seq[2]; | 79 | u_int8_t i_addr3[IEEE80211_ADDR_LEN]; |
78 | u_int8_t i_qos[2]; | 80 | u_int8_t i_seq[2]; |
79 | /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ | 81 | u_int8_t i_qos[2]; |
80 | /* see below */ | 82 | /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ |
83 | /* see below */ | ||
81 | } GNUNET_PACKED; | 84 | } GNUNET_PACKED; |
82 | 85 | ||
83 | struct ieee80211_qoscntl { | 86 | struct ieee80211_qoscntl |
84 | u_int8_t i_qos[2]; | 87 | { |
88 | u_int8_t i_qos[2]; | ||
85 | }; | 89 | }; |
86 | 90 | ||
87 | struct ieee80211_frame_addr4 { | 91 | struct ieee80211_frame_addr4 |
88 | u_int8_t i_fc[2]; | 92 | { |
89 | u_int8_t i_dur[2]; | 93 | u_int8_t i_fc[2]; |
90 | u_int8_t i_addr1[IEEE80211_ADDR_LEN]; | 94 | u_int8_t i_dur[2]; |
91 | u_int8_t i_addr2[IEEE80211_ADDR_LEN]; | 95 | u_int8_t i_addr1[IEEE80211_ADDR_LEN]; |
92 | u_int8_t i_addr3[IEEE80211_ADDR_LEN]; | 96 | u_int8_t i_addr2[IEEE80211_ADDR_LEN]; |
93 | u_int8_t i_seq[2]; | 97 | u_int8_t i_addr3[IEEE80211_ADDR_LEN]; |
94 | u_int8_t i_addr4[IEEE80211_ADDR_LEN]; | 98 | u_int8_t i_seq[2]; |
99 | u_int8_t i_addr4[IEEE80211_ADDR_LEN]; | ||
95 | } GNUNET_PACKED; | 100 | } GNUNET_PACKED; |
96 | 101 | ||
97 | 102 | ||
98 | struct ieee80211_qosframe_addr4 { | 103 | struct ieee80211_qosframe_addr4 |
99 | u_int8_t i_fc[2]; | 104 | { |
100 | u_int8_t i_dur[2]; | 105 | u_int8_t i_fc[2]; |
101 | u_int8_t i_addr1[IEEE80211_ADDR_LEN]; | 106 | u_int8_t i_dur[2]; |
102 | u_int8_t i_addr2[IEEE80211_ADDR_LEN]; | 107 | u_int8_t i_addr1[IEEE80211_ADDR_LEN]; |
103 | u_int8_t i_addr3[IEEE80211_ADDR_LEN]; | 108 | u_int8_t i_addr2[IEEE80211_ADDR_LEN]; |
104 | u_int8_t i_seq[2]; | 109 | u_int8_t i_addr3[IEEE80211_ADDR_LEN]; |
105 | u_int8_t i_addr4[IEEE80211_ADDR_LEN]; | 110 | u_int8_t i_seq[2]; |
106 | u_int8_t i_qos[2]; | 111 | u_int8_t i_addr4[IEEE80211_ADDR_LEN]; |
112 | u_int8_t i_qos[2]; | ||
107 | } GNUNET_PACKED; | 113 | } GNUNET_PACKED; |
108 | 114 | ||
109 | #define IEEE80211_FC0_VERSION_MASK 0x03 | 115 | #define IEEE80211_FC0_VERSION_MASK 0x03 |
@@ -149,10 +155,10 @@ struct ieee80211_qosframe_addr4 { | |||
149 | #define IEEE80211_FC0_SUBTYPE_QOS_NULL 0xc0 | 155 | #define IEEE80211_FC0_SUBTYPE_QOS_NULL 0xc0 |
150 | 156 | ||
151 | #define IEEE80211_FC1_DIR_MASK 0x03 | 157 | #define IEEE80211_FC1_DIR_MASK 0x03 |
152 | #define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */ | 158 | #define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */ |
153 | #define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */ | 159 | #define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */ |
154 | #define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */ | 160 | #define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */ |
155 | #define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */ | 161 | #define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */ |
156 | 162 | ||
157 | #define IEEE80211_FC1_MORE_FRAG 0x04 | 163 | #define IEEE80211_FC1_MORE_FRAG 0x04 |
158 | #define IEEE80211_FC1_RETRY 0x08 | 164 | #define IEEE80211_FC1_RETRY 0x08 |
@@ -185,65 +191,68 @@ struct ieee80211_qosframe_addr4 { | |||
185 | /* | 191 | /* |
186 | * WME/802.11e information element. | 192 | * WME/802.11e information element. |
187 | */ | 193 | */ |
188 | struct ieee80211_wme_info { | 194 | struct ieee80211_wme_info |
189 | u_int8_t wme_id; /* IEEE80211_ELEMID_VENDOR */ | 195 | { |
190 | u_int8_t wme_len; /* length in bytes */ | 196 | u_int8_t wme_id; /* IEEE80211_ELEMID_VENDOR */ |
191 | u_int8_t wme_oui[3]; /* 0x00, 0x50, 0xf2 */ | 197 | u_int8_t wme_len; /* length in bytes */ |
192 | u_int8_t wme_type; /* OUI type */ | 198 | u_int8_t wme_oui[3]; /* 0x00, 0x50, 0xf2 */ |
193 | u_int8_t wme_subtype; /* OUI subtype */ | 199 | u_int8_t wme_type; /* OUI type */ |
194 | u_int8_t wme_version; /* spec revision */ | 200 | u_int8_t wme_subtype; /* OUI subtype */ |
195 | u_int8_t wme_info; /* QoS info */ | 201 | u_int8_t wme_version; /* spec revision */ |
202 | u_int8_t wme_info; /* QoS info */ | ||
196 | } GNUNET_PACKED; | 203 | } GNUNET_PACKED; |
197 | 204 | ||
198 | /* | 205 | /* |
199 | * WME/802.11e Tspec Element | 206 | * WME/802.11e Tspec Element |
200 | */ | 207 | */ |
201 | struct ieee80211_wme_tspec { | 208 | struct ieee80211_wme_tspec |
202 | u_int8_t ts_id; | 209 | { |
203 | u_int8_t ts_len; | 210 | u_int8_t ts_id; |
204 | u_int8_t ts_oui[3]; | 211 | u_int8_t ts_len; |
205 | u_int8_t ts_oui_type; | 212 | u_int8_t ts_oui[3]; |
206 | u_int8_t ts_oui_subtype; | 213 | u_int8_t ts_oui_type; |
207 | u_int8_t ts_version; | 214 | u_int8_t ts_oui_subtype; |
208 | u_int8_t ts_tsinfo[3]; | 215 | u_int8_t ts_version; |
209 | u_int8_t ts_nom_msdu[2]; | 216 | u_int8_t ts_tsinfo[3]; |
210 | u_int8_t ts_max_msdu[2]; | 217 | u_int8_t ts_nom_msdu[2]; |
211 | u_int8_t ts_min_svc[4]; | 218 | u_int8_t ts_max_msdu[2]; |
212 | u_int8_t ts_max_svc[4]; | 219 | u_int8_t ts_min_svc[4]; |
213 | u_int8_t ts_inactv_intv[4]; | 220 | u_int8_t ts_max_svc[4]; |
214 | u_int8_t ts_susp_intv[4]; | 221 | u_int8_t ts_inactv_intv[4]; |
215 | u_int8_t ts_start_svc[4]; | 222 | u_int8_t ts_susp_intv[4]; |
216 | u_int8_t ts_min_rate[4]; | 223 | u_int8_t ts_start_svc[4]; |
217 | u_int8_t ts_mean_rate[4]; | 224 | u_int8_t ts_min_rate[4]; |
218 | u_int8_t ts_max_burst[4]; | 225 | u_int8_t ts_mean_rate[4]; |
219 | u_int8_t ts_min_phy[4]; | 226 | u_int8_t ts_max_burst[4]; |
220 | u_int8_t ts_peak_rate[4]; | 227 | u_int8_t ts_min_phy[4]; |
221 | u_int8_t ts_delay[4]; | 228 | u_int8_t ts_peak_rate[4]; |
222 | u_int8_t ts_surplus[2]; | 229 | u_int8_t ts_delay[4]; |
223 | u_int8_t ts_medium_time[2]; | 230 | u_int8_t ts_surplus[2]; |
231 | u_int8_t ts_medium_time[2]; | ||
224 | } GNUNET_PACKED; | 232 | } GNUNET_PACKED; |
225 | 233 | ||
226 | /* | 234 | /* |
227 | * WME AC parameter field | 235 | * WME AC parameter field |
228 | */ | 236 | */ |
229 | struct ieee80211_wme_acparams { | 237 | struct ieee80211_wme_acparams |
230 | u_int8_t acp_aci_aifsn; | 238 | { |
231 | u_int8_t acp_logcwminmax; | 239 | u_int8_t acp_aci_aifsn; |
232 | u_int16_t acp_txop; | 240 | u_int8_t acp_logcwminmax; |
241 | u_int16_t acp_txop; | ||
233 | } GNUNET_PACKED; | 242 | } GNUNET_PACKED; |
234 | 243 | ||
235 | #define WME_NUM_AC 4 /* 4 AC categories */ | 244 | #define WME_NUM_AC 4 /* 4 AC categories */ |
236 | 245 | ||
237 | #define WME_PARAM_ACI 0x60 /* Mask for ACI field */ | 246 | #define WME_PARAM_ACI 0x60 /* Mask for ACI field */ |
238 | #define WME_PARAM_ACI_S 5 /* Shift for ACI field */ | 247 | #define WME_PARAM_ACI_S 5 /* Shift for ACI field */ |
239 | #define WME_PARAM_ACM 0x10 /* Mask for ACM bit */ | 248 | #define WME_PARAM_ACM 0x10 /* Mask for ACM bit */ |
240 | #define WME_PARAM_ACM_S 4 /* Shift for ACM bit */ | 249 | #define WME_PARAM_ACM_S 4 /* Shift for ACM bit */ |
241 | #define WME_PARAM_AIFSN 0x0f /* Mask for aifsn field */ | 250 | #define WME_PARAM_AIFSN 0x0f /* Mask for aifsn field */ |
242 | #define WME_PARAM_AIFSN_S 0 /* Shift for aifsn field */ | 251 | #define WME_PARAM_AIFSN_S 0 /* Shift for aifsn field */ |
243 | #define WME_PARAM_LOGCWMIN 0x0f /* Mask for CwMin field (in log) */ | 252 | #define WME_PARAM_LOGCWMIN 0x0f /* Mask for CwMin field (in log) */ |
244 | #define WME_PARAM_LOGCWMIN_S 0 /* Shift for CwMin field */ | 253 | #define WME_PARAM_LOGCWMIN_S 0 /* Shift for CwMin field */ |
245 | #define WME_PARAM_LOGCWMAX 0xf0 /* Mask for CwMax field (in log) */ | 254 | #define WME_PARAM_LOGCWMAX 0xf0 /* Mask for CwMax field (in log) */ |
246 | #define WME_PARAM_LOGCWMAX_S 4 /* Shift for CwMax field */ | 255 | #define WME_PARAM_LOGCWMAX_S 4 /* Shift for CwMax field */ |
247 | 256 | ||
248 | #define WME_AC_TO_TID(_ac) ( \ | 257 | #define WME_AC_TO_TID(_ac) ( \ |
249 | ((_ac) == WME_AC_VO) ? 6 : \ | 258 | ((_ac) == WME_AC_VO) ? 6 : \ |
@@ -260,28 +269,31 @@ struct ieee80211_wme_acparams { | |||
260 | /* | 269 | /* |
261 | * WME Parameter Element | 270 | * WME Parameter Element |
262 | */ | 271 | */ |
263 | struct ieee80211_wme_param { | 272 | struct ieee80211_wme_param |
264 | u_int8_t param_id; | 273 | { |
265 | u_int8_t param_len; | 274 | u_int8_t param_id; |
266 | u_int8_t param_oui[3]; | 275 | u_int8_t param_len; |
267 | u_int8_t param_oui_type; | 276 | u_int8_t param_oui[3]; |
268 | u_int8_t param_oui_sybtype; | 277 | u_int8_t param_oui_type; |
269 | u_int8_t param_version; | 278 | u_int8_t param_oui_sybtype; |
270 | u_int8_t param_qosInfo; | 279 | u_int8_t param_version; |
271 | #define WME_QOSINFO_COUNT 0x0f /* Mask for param count field */ | 280 | u_int8_t param_qosInfo; |
272 | u_int8_t param_reserved; | 281 | #define WME_QOSINFO_COUNT 0x0f /* Mask for param count field */ |
273 | struct ieee80211_wme_acparams params_acParams[WME_NUM_AC]; | 282 | u_int8_t param_reserved; |
283 | struct ieee80211_wme_acparams params_acParams[WME_NUM_AC]; | ||
274 | } GNUNET_PACKED; | 284 | } GNUNET_PACKED; |
275 | 285 | ||
276 | /* | 286 | /* |
277 | * Management Notification Frame | 287 | * Management Notification Frame |
278 | */ | 288 | */ |
279 | struct ieee80211_mnf { | 289 | struct ieee80211_mnf |
280 | u_int8_t mnf_category; | 290 | { |
281 | u_int8_t mnf_action; | 291 | u_int8_t mnf_category; |
282 | u_int8_t mnf_dialog; | 292 | u_int8_t mnf_action; |
283 | u_int8_t mnf_status; | 293 | u_int8_t mnf_dialog; |
294 | u_int8_t mnf_status; | ||
284 | } GNUNET_PACKED; | 295 | } GNUNET_PACKED; |
296 | |||
285 | #define MNF_SETUP_REQ 0 | 297 | #define MNF_SETUP_REQ 0 |
286 | #define MNF_SETUP_RESP 1 | 298 | #define MNF_SETUP_RESP 1 |
287 | #define MNF_TEARDOWN 2 | 299 | #define MNF_TEARDOWN 2 |
@@ -289,50 +301,56 @@ struct ieee80211_mnf { | |||
289 | /* | 301 | /* |
290 | * Control frames. | 302 | * Control frames. |
291 | */ | 303 | */ |
292 | struct ieee80211_frame_min { | 304 | struct ieee80211_frame_min |
293 | u_int8_t i_fc[2]; | 305 | { |
294 | u_int8_t i_dur[2]; | 306 | u_int8_t i_fc[2]; |
295 | u_int8_t i_addr1[IEEE80211_ADDR_LEN]; | 307 | u_int8_t i_dur[2]; |
296 | u_int8_t i_addr2[IEEE80211_ADDR_LEN]; | 308 | u_int8_t i_addr1[IEEE80211_ADDR_LEN]; |
297 | /* FCS */ | 309 | u_int8_t i_addr2[IEEE80211_ADDR_LEN]; |
310 | /* FCS */ | ||
298 | } GNUNET_PACKED; | 311 | } GNUNET_PACKED; |
299 | 312 | ||
300 | struct ieee80211_frame_rts { | 313 | struct ieee80211_frame_rts |
301 | u_int8_t i_fc[2]; | 314 | { |
302 | u_int8_t i_dur[2]; | 315 | u_int8_t i_fc[2]; |
303 | u_int8_t i_ra[IEEE80211_ADDR_LEN]; | 316 | u_int8_t i_dur[2]; |
304 | u_int8_t i_ta[IEEE80211_ADDR_LEN]; | 317 | u_int8_t i_ra[IEEE80211_ADDR_LEN]; |
305 | /* FCS */ | 318 | u_int8_t i_ta[IEEE80211_ADDR_LEN]; |
319 | /* FCS */ | ||
306 | } GNUNET_PACKED; | 320 | } GNUNET_PACKED; |
307 | 321 | ||
308 | struct ieee80211_frame_cts { | 322 | struct ieee80211_frame_cts |
309 | u_int8_t i_fc[2]; | 323 | { |
310 | u_int8_t i_dur[2]; | 324 | u_int8_t i_fc[2]; |
311 | u_int8_t i_ra[IEEE80211_ADDR_LEN]; | 325 | u_int8_t i_dur[2]; |
312 | /* FCS */ | 326 | u_int8_t i_ra[IEEE80211_ADDR_LEN]; |
327 | /* FCS */ | ||
313 | } GNUNET_PACKED; | 328 | } GNUNET_PACKED; |
314 | 329 | ||
315 | struct ieee80211_frame_ack { | 330 | struct ieee80211_frame_ack |
316 | u_int8_t i_fc[2]; | 331 | { |
317 | u_int8_t i_dur[2]; | 332 | u_int8_t i_fc[2]; |
318 | u_int8_t i_ra[IEEE80211_ADDR_LEN]; | 333 | u_int8_t i_dur[2]; |
319 | /* FCS */ | 334 | u_int8_t i_ra[IEEE80211_ADDR_LEN]; |
335 | /* FCS */ | ||
320 | } GNUNET_PACKED; | 336 | } GNUNET_PACKED; |
321 | 337 | ||
322 | struct ieee80211_frame_pspoll { | 338 | struct ieee80211_frame_pspoll |
323 | u_int8_t i_fc[2]; | 339 | { |
324 | u_int8_t i_aid[2]; | 340 | u_int8_t i_fc[2]; |
325 | u_int8_t i_bssid[IEEE80211_ADDR_LEN]; | 341 | u_int8_t i_aid[2]; |
326 | u_int8_t i_ta[IEEE80211_ADDR_LEN]; | 342 | u_int8_t i_bssid[IEEE80211_ADDR_LEN]; |
327 | /* FCS */ | 343 | u_int8_t i_ta[IEEE80211_ADDR_LEN]; |
344 | /* FCS */ | ||
328 | } GNUNET_PACKED; | 345 | } GNUNET_PACKED; |
329 | 346 | ||
330 | struct ieee80211_frame_cfend { /* NB: also CF-End+CF-Ack */ | 347 | struct ieee80211_frame_cfend |
331 | u_int8_t i_fc[2]; | 348 | { /* NB: also CF-End+CF-Ack */ |
332 | u_int8_t i_dur[2]; /* should be zero */ | 349 | u_int8_t i_fc[2]; |
333 | u_int8_t i_ra[IEEE80211_ADDR_LEN]; | 350 | u_int8_t i_dur[2]; /* should be zero */ |
334 | u_int8_t i_bssid[IEEE80211_ADDR_LEN]; | 351 | u_int8_t i_ra[IEEE80211_ADDR_LEN]; |
335 | /* FCS */ | 352 | u_int8_t i_bssid[IEEE80211_ADDR_LEN]; |
353 | /* FCS */ | ||
336 | } GNUNET_PACKED; | 354 | } GNUNET_PACKED; |
337 | 355 | ||
338 | /* | 356 | /* |
@@ -372,63 +390,68 @@ typedef u_int8_t *ieee80211_mgt_beacon_t; | |||
372 | /* | 390 | /* |
373 | * 802.11i/WPA information element (maximally sized). | 391 | * 802.11i/WPA information element (maximally sized). |
374 | */ | 392 | */ |
375 | struct ieee80211_ie_wpa { | 393 | struct ieee80211_ie_wpa |
376 | u_int8_t wpa_id; /* IEEE80211_ELEMID_VENDOR */ | 394 | { |
377 | u_int8_t wpa_len; /* length in bytes */ | 395 | u_int8_t wpa_id; /* IEEE80211_ELEMID_VENDOR */ |
378 | u_int8_t wpa_oui[3]; /* 0x00, 0x50, 0xf2 */ | 396 | u_int8_t wpa_len; /* length in bytes */ |
379 | u_int8_t wpa_type; /* OUI type */ | 397 | u_int8_t wpa_oui[3]; /* 0x00, 0x50, 0xf2 */ |
380 | u_int16_t wpa_version; /* spec revision */ | 398 | u_int8_t wpa_type; /* OUI type */ |
381 | u_int32_t wpa_mcipher[1]; /* multicast/group key cipher */ | 399 | u_int16_t wpa_version; /* spec revision */ |
382 | u_int16_t wpa_uciphercnt; /* # pairwise key ciphers */ | 400 | u_int32_t wpa_mcipher[1]; /* multicast/group key cipher */ |
383 | u_int32_t wpa_uciphers[8];/* ciphers */ | 401 | u_int16_t wpa_uciphercnt; /* # pairwise key ciphers */ |
384 | u_int16_t wpa_authselcnt; /* authentication selector cnt*/ | 402 | u_int32_t wpa_uciphers[8]; /* ciphers */ |
385 | u_int32_t wpa_authsels[8];/* selectors */ | 403 | u_int16_t wpa_authselcnt; /* authentication selector cnt */ |
386 | u_int16_t wpa_caps; /* 802.11i capabilities */ | 404 | u_int32_t wpa_authsels[8]; /* selectors */ |
387 | u_int16_t wpa_pmkidcnt; /* 802.11i pmkid count */ | 405 | u_int16_t wpa_caps; /* 802.11i capabilities */ |
388 | u_int16_t wpa_pmkids[8]; /* 802.11i pmkids */ | 406 | u_int16_t wpa_pmkidcnt; /* 802.11i pmkid count */ |
407 | u_int16_t wpa_pmkids[8]; /* 802.11i pmkids */ | ||
389 | } GNUNET_PACKED; | 408 | } GNUNET_PACKED; |
390 | 409 | ||
391 | /* | 410 | /* |
392 | * Management information element payloads. | 411 | * Management information element payloads. |
393 | */ | 412 | */ |
394 | 413 | ||
395 | enum { | 414 | enum |
396 | IEEE80211_ELEMID_SSID = 0, | 415 | { |
397 | IEEE80211_ELEMID_RATES = 1, | 416 | IEEE80211_ELEMID_SSID = 0, |
398 | IEEE80211_ELEMID_FHPARMS = 2, | 417 | IEEE80211_ELEMID_RATES = 1, |
399 | IEEE80211_ELEMID_DSPARMS = 3, | 418 | IEEE80211_ELEMID_FHPARMS = 2, |
400 | IEEE80211_ELEMID_CFPARMS = 4, | 419 | IEEE80211_ELEMID_DSPARMS = 3, |
401 | IEEE80211_ELEMID_TIM = 5, | 420 | IEEE80211_ELEMID_CFPARMS = 4, |
402 | IEEE80211_ELEMID_IBSSPARMS = 6, | 421 | IEEE80211_ELEMID_TIM = 5, |
403 | IEEE80211_ELEMID_COUNTRY = 7, | 422 | IEEE80211_ELEMID_IBSSPARMS = 6, |
404 | IEEE80211_ELEMID_CHALLENGE = 16, | 423 | IEEE80211_ELEMID_COUNTRY = 7, |
405 | /* 17-31 reserved for challenge text extension */ | 424 | IEEE80211_ELEMID_CHALLENGE = 16, |
406 | IEEE80211_ELEMID_ERP = 42, | 425 | /* 17-31 reserved for challenge text extension */ |
407 | IEEE80211_ELEMID_RSN = 48, | 426 | IEEE80211_ELEMID_ERP = 42, |
408 | IEEE80211_ELEMID_XRATES = 50, | 427 | IEEE80211_ELEMID_RSN = 48, |
409 | IEEE80211_ELEMID_TPC = 150, | 428 | IEEE80211_ELEMID_XRATES = 50, |
410 | IEEE80211_ELEMID_CCKM = 156, | 429 | IEEE80211_ELEMID_TPC = 150, |
411 | IEEE80211_ELEMID_VENDOR = 221, /* vendor private */ | 430 | IEEE80211_ELEMID_CCKM = 156, |
431 | IEEE80211_ELEMID_VENDOR = 221, /* vendor private */ | ||
412 | }; | 432 | }; |
413 | 433 | ||
414 | struct ieee80211_tim_ie { | 434 | struct ieee80211_tim_ie |
415 | u_int8_t tim_ie; /* IEEE80211_ELEMID_TIM */ | 435 | { |
416 | u_int8_t tim_len; | 436 | u_int8_t tim_ie; /* IEEE80211_ELEMID_TIM */ |
417 | u_int8_t tim_count; /* DTIM count */ | 437 | u_int8_t tim_len; |
418 | u_int8_t tim_period; /* DTIM period */ | 438 | u_int8_t tim_count; /* DTIM count */ |
419 | u_int8_t tim_bitctl; /* bitmap control */ | 439 | u_int8_t tim_period; /* DTIM period */ |
420 | u_int8_t tim_bitmap[1]; /* variable-length bitmap */ | 440 | u_int8_t tim_bitctl; /* bitmap control */ |
441 | u_int8_t tim_bitmap[1]; /* variable-length bitmap */ | ||
421 | } GNUNET_PACKED; | 442 | } GNUNET_PACKED; |
422 | 443 | ||
423 | struct ieee80211_country_ie { | 444 | struct ieee80211_country_ie |
424 | u_int8_t ie; /* IEEE80211_ELEMID_COUNTRY */ | 445 | { |
425 | u_int8_t len; | 446 | u_int8_t ie; /* IEEE80211_ELEMID_COUNTRY */ |
426 | u_int8_t cc[3]; /* ISO CC+(I)ndoor/(O)utdoor */ | 447 | u_int8_t len; |
427 | struct { | 448 | u_int8_t cc[3]; /* ISO CC+(I)ndoor/(O)utdoor */ |
428 | u_int8_t schan; /* starting channel */ | 449 | struct |
429 | u_int8_t nchan; /* number channels */ | 450 | { |
430 | u_int8_t maxtxpwr; /* tx power cap */ | 451 | u_int8_t schan; /* starting channel */ |
431 | } GNUNET_PACKED band[4]; /* up to 4 sub bands */ | 452 | u_int8_t nchan; /* number channels */ |
453 | u_int8_t maxtxpwr; /* tx power cap */ | ||
454 | } GNUNET_PACKED band[4]; /* up to 4 sub bands */ | ||
432 | } GNUNET_PACKED; | 455 | } GNUNET_PACKED; |
433 | 456 | ||
434 | #define IEEE80211_CHALLENGE_LEN 128 | 457 | #define IEEE80211_CHALLENGE_LEN 128 |
@@ -448,13 +471,13 @@ struct ieee80211_country_ie { | |||
448 | /* bits 3-6 reserved */ | 471 | /* bits 3-6 reserved */ |
449 | #define ATHEROS_CAP_BOOST 0x80 | 472 | #define ATHEROS_CAP_BOOST 0x80 |
450 | 473 | ||
451 | #define ATH_OUI 0x7f0300 /* Atheros OUI */ | 474 | #define ATH_OUI 0x7f0300 /* Atheros OUI */ |
452 | #define ATH_OUI_TYPE 0x01 | 475 | #define ATH_OUI_TYPE 0x01 |
453 | #define ATH_OUI_VERSION 0x01 | 476 | #define ATH_OUI_VERSION 0x01 |
454 | 477 | ||
455 | #define WPA_OUI 0xf25000 | 478 | #define WPA_OUI 0xf25000 |
456 | #define WPA_OUI_TYPE 0x01 | 479 | #define WPA_OUI_TYPE 0x01 |
457 | #define WPA_VERSION 1 /* current supported version */ | 480 | #define WPA_VERSION 1 /* current supported version */ |
458 | 481 | ||
459 | #define WPA_CSE_NULL 0x00 | 482 | #define WPA_CSE_NULL 0x00 |
460 | #define WPA_CSE_WEP40 0x01 | 483 | #define WPA_CSE_WEP40 0x01 |
@@ -467,7 +490,7 @@ struct ieee80211_country_ie { | |||
467 | #define WPA_ASE_8021X_PSK 0x02 | 490 | #define WPA_ASE_8021X_PSK 0x02 |
468 | 491 | ||
469 | #define RSN_OUI 0xac0f00 | 492 | #define RSN_OUI 0xac0f00 |
470 | #define RSN_VERSION 1 /* current supported version */ | 493 | #define RSN_VERSION 1 /* current supported version */ |
471 | 494 | ||
472 | #define RSN_CSE_NULL 0x00 | 495 | #define RSN_CSE_NULL 0x00 |
473 | #define RSN_CSE_WEP40 0x01 | 496 | #define RSN_CSE_WEP40 0x01 |
@@ -489,10 +512,10 @@ struct ieee80211_country_ie { | |||
489 | #define WME_VERSION 1 | 512 | #define WME_VERSION 1 |
490 | 513 | ||
491 | /* WME stream classes */ | 514 | /* WME stream classes */ |
492 | #define WME_AC_BE 0 /* best effort */ | 515 | #define WME_AC_BE 0 /* best effort */ |
493 | #define WME_AC_BK 1 /* background */ | 516 | #define WME_AC_BK 1 /* background */ |
494 | #define WME_AC_VI 2 /* video */ | 517 | #define WME_AC_VI 2 /* video */ |
495 | #define WME_AC_VO 3 /* voice */ | 518 | #define WME_AC_VO 3 /* voice */ |
496 | 519 | ||
497 | /* | 520 | /* |
498 | * AUTH management packets | 521 | * AUTH management packets |
@@ -518,16 +541,18 @@ typedef u_int8_t *ieee80211_mgt_auth_t; | |||
518 | #define IEEE80211_AUTH_ALG_SHARED 0x0001 | 541 | #define IEEE80211_AUTH_ALG_SHARED 0x0001 |
519 | #define IEEE80211_AUTH_ALG_LEAP 0x0080 | 542 | #define IEEE80211_AUTH_ALG_LEAP 0x0080 |
520 | 543 | ||
521 | enum { | 544 | enum |
522 | IEEE80211_AUTH_OPEN_REQUEST = 1, | 545 | { |
523 | IEEE80211_AUTH_OPEN_RESPONSE = 2, | 546 | IEEE80211_AUTH_OPEN_REQUEST = 1, |
547 | IEEE80211_AUTH_OPEN_RESPONSE = 2, | ||
524 | }; | 548 | }; |
525 | 549 | ||
526 | enum { | 550 | enum |
527 | IEEE80211_AUTH_SHARED_REQUEST = 1, | 551 | { |
528 | IEEE80211_AUTH_SHARED_CHALLENGE = 2, | 552 | IEEE80211_AUTH_SHARED_REQUEST = 1, |
529 | IEEE80211_AUTH_SHARED_RESPONSE = 3, | 553 | IEEE80211_AUTH_SHARED_CHALLENGE = 2, |
530 | IEEE80211_AUTH_SHARED_PASS = 4, | 554 | IEEE80211_AUTH_SHARED_RESPONSE = 3, |
555 | IEEE80211_AUTH_SHARED_PASS = 4, | ||
531 | }; | 556 | }; |
532 | 557 | ||
533 | /* | 558 | /* |
@@ -536,47 +561,48 @@ enum { | |||
536 | * Unlisted codes are reserved | 561 | * Unlisted codes are reserved |
537 | */ | 562 | */ |
538 | 563 | ||
539 | enum { | 564 | enum |
540 | IEEE80211_REASON_UNSPECIFIED = 1, | 565 | { |
541 | IEEE80211_REASON_AUTH_EXPIRE = 2, | 566 | IEEE80211_REASON_UNSPECIFIED = 1, |
542 | IEEE80211_REASON_AUTH_LEAVE = 3, | 567 | IEEE80211_REASON_AUTH_EXPIRE = 2, |
543 | IEEE80211_REASON_ASSOC_EXPIRE = 4, | 568 | IEEE80211_REASON_AUTH_LEAVE = 3, |
544 | IEEE80211_REASON_ASSOC_TOOMANY = 5, | 569 | IEEE80211_REASON_ASSOC_EXPIRE = 4, |
545 | IEEE80211_REASON_NOT_AUTHED = 6, | 570 | IEEE80211_REASON_ASSOC_TOOMANY = 5, |
546 | IEEE80211_REASON_NOT_ASSOCED = 7, | 571 | IEEE80211_REASON_NOT_AUTHED = 6, |
547 | IEEE80211_REASON_ASSOC_LEAVE = 8, | 572 | IEEE80211_REASON_NOT_ASSOCED = 7, |
548 | IEEE80211_REASON_ASSOC_NOT_AUTHED = 9, | 573 | IEEE80211_REASON_ASSOC_LEAVE = 8, |
549 | 574 | IEEE80211_REASON_ASSOC_NOT_AUTHED = 9, | |
550 | IEEE80211_REASON_RSN_REQUIRED = 11, | 575 | |
551 | IEEE80211_REASON_RSN_INCONSISTENT = 12, | 576 | IEEE80211_REASON_RSN_REQUIRED = 11, |
552 | IEEE80211_REASON_IE_INVALID = 13, | 577 | IEEE80211_REASON_RSN_INCONSISTENT = 12, |
553 | IEEE80211_REASON_MIC_FAILURE = 14, | 578 | IEEE80211_REASON_IE_INVALID = 13, |
554 | 579 | IEEE80211_REASON_MIC_FAILURE = 14, | |
555 | IEEE80211_STATUS_SUCCESS = 0, | 580 | |
556 | IEEE80211_STATUS_UNSPECIFIED = 1, | 581 | IEEE80211_STATUS_SUCCESS = 0, |
557 | IEEE80211_STATUS_CAPINFO = 10, | 582 | IEEE80211_STATUS_UNSPECIFIED = 1, |
558 | IEEE80211_STATUS_NOT_ASSOCED = 11, | 583 | IEEE80211_STATUS_CAPINFO = 10, |
559 | IEEE80211_STATUS_OTHER = 12, | 584 | IEEE80211_STATUS_NOT_ASSOCED = 11, |
560 | IEEE80211_STATUS_ALG = 13, | 585 | IEEE80211_STATUS_OTHER = 12, |
561 | IEEE80211_STATUS_SEQUENCE = 14, | 586 | IEEE80211_STATUS_ALG = 13, |
562 | IEEE80211_STATUS_CHALLENGE = 15, | 587 | IEEE80211_STATUS_SEQUENCE = 14, |
563 | IEEE80211_STATUS_TIMEOUT = 16, | 588 | IEEE80211_STATUS_CHALLENGE = 15, |
564 | IEEE80211_STATUS_TOOMANY = 17, | 589 | IEEE80211_STATUS_TIMEOUT = 16, |
565 | IEEE80211_STATUS_BASIC_RATE = 18, | 590 | IEEE80211_STATUS_TOOMANY = 17, |
566 | IEEE80211_STATUS_SP_REQUIRED = 19, | 591 | IEEE80211_STATUS_BASIC_RATE = 18, |
567 | IEEE80211_STATUS_PBCC_REQUIRED = 20, | 592 | IEEE80211_STATUS_SP_REQUIRED = 19, |
568 | IEEE80211_STATUS_CA_REQUIRED = 21, | 593 | IEEE80211_STATUS_PBCC_REQUIRED = 20, |
569 | IEEE80211_STATUS_TOO_MANY_STATIONS = 22, | 594 | IEEE80211_STATUS_CA_REQUIRED = 21, |
570 | IEEE80211_STATUS_RATES = 23, | 595 | IEEE80211_STATUS_TOO_MANY_STATIONS = 22, |
571 | IEEE80211_STATUS_SHORTSLOT_REQUIRED = 25, | 596 | IEEE80211_STATUS_RATES = 23, |
572 | IEEE80211_STATUS_DSSSOFDM_REQUIRED = 26, | 597 | IEEE80211_STATUS_SHORTSLOT_REQUIRED = 25, |
598 | IEEE80211_STATUS_DSSSOFDM_REQUIRED = 26, | ||
573 | }; | 599 | }; |
574 | 600 | ||
575 | #define IEEE80211_WEP_KEYLEN 5 /* 40bit */ | 601 | #define IEEE80211_WEP_KEYLEN 5 /* 40bit */ |
576 | #define IEEE80211_WEP_IVLEN 3 /* 24bit */ | 602 | #define IEEE80211_WEP_IVLEN 3 /* 24bit */ |
577 | #define IEEE80211_WEP_KIDLEN 1 /* 1 octet */ | 603 | #define IEEE80211_WEP_KIDLEN 1 /* 1 octet */ |
578 | #define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */ | 604 | #define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */ |
579 | #define IEEE80211_WEP_NKID 4 /* number of key ids */ | 605 | #define IEEE80211_WEP_NKID 4 /* number of key ids */ |
580 | 606 | ||
581 | /* | 607 | /* |
582 | * 802.11i defines an extended IV for use with non-WEP ciphers. | 608 | * 802.11i defines an extended IV for use with non-WEP ciphers. |
@@ -586,8 +612,8 @@ enum { | |||
586 | * CCMP header rather than IV+extended-IV. | 612 | * CCMP header rather than IV+extended-IV. |
587 | */ | 613 | */ |
588 | #define IEEE80211_WEP_EXTIV 0x20 | 614 | #define IEEE80211_WEP_EXTIV 0x20 |
589 | #define IEEE80211_WEP_EXTIVLEN 4 /* extended IV length */ | 615 | #define IEEE80211_WEP_EXTIVLEN 4 /* extended IV length */ |
590 | #define IEEE80211_WEP_MICLEN 8 /* trailing MIC */ | 616 | #define IEEE80211_WEP_MICLEN 8 /* trailing MIC */ |
591 | 617 | ||
592 | #define IEEE80211_CRC_LEN 4 | 618 | #define IEEE80211_CRC_LEN 4 |
593 | 619 | ||
@@ -641,16 +667,16 @@ enum { | |||
641 | * As above, we treat default as implementation-dependent so | 667 | * As above, we treat default as implementation-dependent so |
642 | * define it elsewhere. | 668 | * define it elsewhere. |
643 | */ | 669 | */ |
644 | #define IEEE80211_BINTVAL_MAX 1000 /* max beacon interval (TU's) */ | 670 | #define IEEE80211_BINTVAL_MAX 1000 /* max beacon interval (TU's) */ |
645 | #define IEEE80211_BINTVAL_MIN 25 /* min beacon interval (TU's) */ | 671 | #define IEEE80211_BINTVAL_MIN 25 /* min beacon interval (TU's) */ |
646 | 672 | ||
647 | /* | 673 | /* |
648 | * DTIM period (beacons). Min+max are not really defined | 674 | * DTIM period (beacons). Min+max are not really defined |
649 | * by the protocol but we want them publicly visible so | 675 | * by the protocol but we want them publicly visible so |
650 | * define them here. | 676 | * define them here. |
651 | */ | 677 | */ |
652 | #define IEEE80211_DTIM_MAX 15 /* max DTIM period */ | 678 | #define IEEE80211_DTIM_MAX 15 /* max DTIM period */ |
653 | #define IEEE80211_DTIM_MIN 1 /* min DTIM period */ | 679 | #define IEEE80211_DTIM_MIN 1 /* min DTIM period */ |
654 | 680 | ||
655 | /* | 681 | /* |
656 | * Beacon miss threshold (beacons). As for DTIM, we define | 682 | * Beacon miss threshold (beacons). As for DTIM, we define |