Add linux-next specific files for 20110831
[linux-2.6/next.git] / drivers / staging / rtl8712 / ieee80211.h
blobd62c6ac09550969fe37ba9da94d75e594b6567e8
1 #ifndef __IEEE80211_H
2 #define __IEEE80211_H
4 #include "osdep_service.h"
5 #include "drv_types.h"
6 #include "wifi.h"
7 #include <linux/compiler.h>
8 #include <linux/wireless.h>
10 #define MGMT_QUEUE_NUM 5
11 #define ETH_ALEN 6
12 #define IEEE_CMD_SET_WPA_PARAM 1
13 #define IEEE_CMD_SET_WPA_IE 2
14 #define IEEE_CMD_SET_ENCRYPTION 3
15 #define IEEE_CMD_MLME 4
17 #define IEEE_PARAM_WPA_ENABLED 1
18 #define IEEE_PARAM_TKIP_COUNTERMEASURES 2
19 #define IEEE_PARAM_DROP_UNENCRYPTED 3
20 #define IEEE_PARAM_PRIVACY_INVOKED 4
21 #define IEEE_PARAM_AUTH_ALGS 5
22 #define IEEE_PARAM_IEEE_802_1X 6
23 #define IEEE_PARAM_WPAX_SELECT 7
25 #define AUTH_ALG_OPEN_SYSTEM 0x1
26 #define AUTH_ALG_SHARED_KEY 0x2
27 #define AUTH_ALG_LEAP 0x00000004
29 #define IEEE_MLME_STA_DEAUTH 1
30 #define IEEE_MLME_STA_DISASSOC 2
32 #define IEEE_CRYPT_ERR_UNKNOWN_ALG 2
33 #define IEEE_CRYPT_ERR_UNKNOWN_ADDR 3
34 #define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED 4
35 #define IEEE_CRYPT_ERR_KEY_SET_FAILED 5
36 #define IEEE_CRYPT_ERR_TX_KEY_SET_FAILED 6
37 #define IEEE_CRYPT_ERR_CARD_CONF_FAILED 7
40 #define IEEE_CRYPT_ALG_NAME_LEN 16
42 #define WPA_CIPHER_NONE BIT(0)
43 #define WPA_CIPHER_WEP40 BIT(1)
44 #define WPA_CIPHER_WEP104 BIT(2)
45 #define WPA_CIPHER_TKIP BIT(3)
46 #define WPA_CIPHER_CCMP BIT(4)
50 #define WPA_SELECTOR_LEN 4
51 #define RSN_HEADER_LEN 4
53 #define RSN_SELECTOR_LEN 4
55 enum NETWORK_TYPE {
56 WIRELESS_INVALID = 0,
57 WIRELESS_11B = 1,
58 WIRELESS_11G = 2,
59 WIRELESS_11BG = (WIRELESS_11B | WIRELESS_11G),
60 WIRELESS_11A = 4,
61 WIRELESS_11N = 8,
62 WIRELESS_11GN = (WIRELESS_11G | WIRELESS_11N),
63 WIRELESS_11BGN = (WIRELESS_11B | WIRELESS_11G | WIRELESS_11N),
67 struct ieee_param {
68 u32 cmd;
69 u8 sta_addr[ETH_ALEN];
70 union {
71 struct {
72 u8 name;
73 u32 value;
74 } wpa_param;
75 struct {
76 u32 len;
77 u8 reserved[32];
78 u8 data[0];
79 } wpa_ie;
80 struct {
81 int command;
82 int reason_code;
83 } mlme;
84 struct {
85 u8 alg[IEEE_CRYPT_ALG_NAME_LEN];
86 u8 set_tx;
87 u32 err;
88 u8 idx;
89 u8 seq[8]; /* sequence counter (set: RX, get: TX) */
90 u16 key_len;
91 u8 key[0];
92 } crypt;
93 } u;
96 #define IEEE80211_DATA_LEN 2304
97 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
98 6.2.1.1.2.
100 The figure in section 7.1.2 suggests a body size of up to 2312
101 bytes is allowed, which is a bit confusing, I suspect this
102 represents the 2304 bytes of real data, plus a possible 8 bytes of
103 WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
105 #define IEEE80211_HLEN 30
106 #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
108 /* this is stolen from ipw2200 driver */
109 #define IEEE_IBSS_MAC_HASH_SIZE 31
111 struct ieee_ibss_seq {
112 u8 mac[ETH_ALEN];
113 u16 seq_num;
114 u16 frag_num;
115 unsigned int packet_time;
116 struct list_head list;
119 struct ieee80211_hdr {
120 u16 frame_ctl;
121 u16 duration_id;
122 u8 addr1[ETH_ALEN];
123 u8 addr2[ETH_ALEN];
124 u8 addr3[ETH_ALEN];
125 u16 seq_ctl;
126 u8 addr4[ETH_ALEN];
127 } __packed;
129 struct ieee80211_hdr_3addr {
130 u16 frame_ctl;
131 u16 duration_id;
132 u8 addr1[ETH_ALEN];
133 u8 addr2[ETH_ALEN];
134 u8 addr3[ETH_ALEN];
135 u16 seq_ctl;
136 } __packed;
139 struct ieee80211_hdr_qos {
140 u16 frame_ctl;
141 u16 duration_id;
142 u8 addr1[ETH_ALEN];
143 u8 addr2[ETH_ALEN];
144 u8 addr3[ETH_ALEN];
145 u16 seq_ctl;
146 u8 addr4[ETH_ALEN];
147 u16 qc;
148 } __packed;
150 struct ieee80211_hdr_3addr_qos {
151 u16 frame_ctl;
152 u16 duration_id;
153 u8 addr1[ETH_ALEN];
154 u8 addr2[ETH_ALEN];
155 u8 addr3[ETH_ALEN];
156 u16 seq_ctl;
157 u16 qc;
158 } __packed;
160 struct eapol {
161 u8 snap[6];
162 u16 ethertype;
163 u8 version;
164 u8 type;
165 u16 length;
166 } __packed;
169 enum eap_type {
170 EAP_PACKET = 0,
171 EAPOL_START,
172 EAPOL_LOGOFF,
173 EAPOL_KEY,
174 EAPOL_ENCAP_ASF_ALERT
177 #define IEEE80211_3ADDR_LEN 24
178 #define IEEE80211_4ADDR_LEN 30
179 #define IEEE80211_FCS_LEN 4
181 #define MIN_FRAG_THRESHOLD 256U
182 #define MAX_FRAG_THRESHOLD 2346U
184 /* Frame control field constants */
185 #define IEEE80211_FCTL_VERS 0x0002
186 #define IEEE80211_FCTL_FTYPE 0x000c
187 #define IEEE80211_FCTL_STYPE 0x00f0
188 #define IEEE80211_FCTL_TODS 0x0100
189 #define IEEE80211_FCTL_FROMDS 0x0200
190 #define IEEE80211_FCTL_MOREFRAGS 0x0400
191 #define IEEE80211_FCTL_RETRY 0x0800
192 #define IEEE80211_FCTL_PM 0x1000
193 #define IEEE80211_FCTL_MOREDATA 0x2000
194 #define IEEE80211_FCTL_WEP 0x4000
195 #define IEEE80211_FCTL_ORDER 0x8000
197 #define IEEE80211_FTYPE_MGMT 0x0000
198 #define IEEE80211_FTYPE_CTL 0x0004
199 #define IEEE80211_FTYPE_DATA 0x0008
201 /* management */
202 #define IEEE80211_STYPE_ASSOC_REQ 0x0000
203 #define IEEE80211_STYPE_ASSOC_RESP 0x0010
204 #define IEEE80211_STYPE_REASSOC_REQ 0x0020
205 #define IEEE80211_STYPE_REASSOC_RESP 0x0030
206 #define IEEE80211_STYPE_PROBE_REQ 0x0040
207 #define IEEE80211_STYPE_PROBE_RESP 0x0050
208 #define IEEE80211_STYPE_BEACON 0x0080
209 #define IEEE80211_STYPE_ATIM 0x0090
210 #define IEEE80211_STYPE_DISASSOC 0x00A0
211 #define IEEE80211_STYPE_AUTH 0x00B0
212 #define IEEE80211_STYPE_DEAUTH 0x00C0
214 /* control */
215 #define IEEE80211_STYPE_PSPOLL 0x00A0
216 #define IEEE80211_STYPE_RTS 0x00B0
217 #define IEEE80211_STYPE_CTS 0x00C0
218 #define IEEE80211_STYPE_ACK 0x00D0
219 #define IEEE80211_STYPE_CFEND 0x00E0
220 #define IEEE80211_STYPE_CFENDACK 0x00F0
222 /* data */
223 #define IEEE80211_STYPE_DATA 0x0000
224 #define IEEE80211_STYPE_DATA_CFACK 0x0010
225 #define IEEE80211_STYPE_DATA_CFPOLL 0x0020
226 #define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030
227 #define IEEE80211_STYPE_NULLFUNC 0x0040
228 #define IEEE80211_STYPE_CFACK 0x0050
229 #define IEEE80211_STYPE_CFPOLL 0x0060
230 #define IEEE80211_STYPE_CFACKPOLL 0x0070
231 #define IEEE80211_QOS_DATAGRP 0x0080
232 #define IEEE80211_QoS_DATAGRP IEEE80211_QOS_DATAGRP
234 #define IEEE80211_SCTL_FRAG 0x000F
235 #define IEEE80211_SCTL_SEQ 0xFFF0
237 /* QoS,QOS */
238 #define NORMAL_ACK 0
239 #define NO_ACK 1
240 #define NON_EXPLICIT_ACK 2
241 #define BLOCK_ACK 3
243 #ifndef ETH_P_PAE
244 #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
245 #endif /* ETH_P_PAE */
247 #define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */
249 #define ETH_P_ECONET 0x0018
251 #ifndef ETH_P_80211_RAW
252 #define ETH_P_80211_RAW (ETH_P_ECONET + 1)
253 #endif
255 /* IEEE 802.11 defines */
257 #define P80211_OUI_LEN 3
259 struct ieee80211_snap_hdr {
260 u8 dsap; /* always 0xAA */
261 u8 ssap; /* always 0xAA */
262 u8 ctrl; /* always 0x03 */
263 u8 oui[P80211_OUI_LEN]; /* organizational universal id */
264 } __packed;
266 #define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
268 #define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE)
269 #define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE)
271 #define WLAN_QC_GET_TID(qc) ((qc) & 0x0f)
273 #define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG)
274 #define WLAN_GET_SEQ_SEQ(seq) ((seq) & IEEE80211_SCTL_SEQ)
276 /* Authentication algorithms */
277 #define WLAN_AUTH_OPEN 0
278 #define WLAN_AUTH_SHARED_KEY 1
280 #define WLAN_AUTH_CHALLENGE_LEN 128
282 #define WLAN_CAPABILITY_BSS (1<<0)
283 #define WLAN_CAPABILITY_IBSS (1<<1)
284 #define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
285 #define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
286 #define WLAN_CAPABILITY_PRIVACY (1<<4)
287 #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
288 #define WLAN_CAPABILITY_PBCC (1<<6)
289 #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
290 #define WLAN_CAPABILITY_SHORT_SLOT (1<<10)
292 /* Status codes */
293 #define WLAN_STATUS_SUCCESS 0
294 #define WLAN_STATUS_UNSPECIFIED_FAILURE 1
295 #define WLAN_STATUS_CAPS_UNSUPPORTED 10
296 #define WLAN_STATUS_REASSOC_NO_ASSOC 11
297 #define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12
298 #define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13
299 #define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14
300 #define WLAN_STATUS_CHALLENGE_FAIL 15
301 #define WLAN_STATUS_AUTH_TIMEOUT 16
302 #define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17
303 #define WLAN_STATUS_ASSOC_DENIED_RATES 18
304 /* 802.11b */
305 #define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19
306 #define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20
307 #define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21
309 /* Reason codes */
310 #define WLAN_REASON_UNSPECIFIED 1
311 #define WLAN_REASON_PREV_AUTH_NOT_VALID 2
312 #define WLAN_REASON_DEAUTH_LEAVING 3
313 #define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4
314 #define WLAN_REASON_DISASSOC_AP_BUSY 5
315 #define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6
316 #define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7
317 #define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8
318 #define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9
321 /* Information Element IDs */
322 #define WLAN_EID_SSID 0
323 #define WLAN_EID_SUPP_RATES 1
324 #define WLAN_EID_FH_PARAMS 2
325 #define WLAN_EID_DS_PARAMS 3
326 #define WLAN_EID_CF_PARAMS 4
327 #define WLAN_EID_TIM 5
328 #define WLAN_EID_IBSS_PARAMS 6
329 #define WLAN_EID_CHALLENGE 16
330 #define WLAN_EID_RSN 48
331 #define WLAN_EID_GENERIC 221
333 #define IEEE80211_MGMT_HDR_LEN 24
334 #define IEEE80211_DATA_HDR3_LEN 24
335 #define IEEE80211_DATA_HDR4_LEN 30
338 #define IEEE80211_STATMASK_SIGNAL (1<<0)
339 #define IEEE80211_STATMASK_RSSI (1<<1)
340 #define IEEE80211_STATMASK_NOISE (1<<2)
341 #define IEEE80211_STATMASK_RATE (1<<3)
342 #define IEEE80211_STATMASK_WEMASK 0x7
345 #define IEEE80211_CCK_MODULATION (1<<0)
346 #define IEEE80211_OFDM_MODULATION (1<<1)
348 #define IEEE80211_24GHZ_BAND (1<<0)
349 #define IEEE80211_52GHZ_BAND (1<<1)
351 #define IEEE80211_CCK_RATE_LEN 4
352 #define IEEE80211_NUM_OFDM_RATESLEN 8
355 #define IEEE80211_CCK_RATE_1MB 0x02
356 #define IEEE80211_CCK_RATE_2MB 0x04
357 #define IEEE80211_CCK_RATE_5MB 0x0B
358 #define IEEE80211_CCK_RATE_11MB 0x16
359 #define IEEE80211_OFDM_RATE_LEN 8
360 #define IEEE80211_OFDM_RATE_6MB 0x0C
361 #define IEEE80211_OFDM_RATE_9MB 0x12
362 #define IEEE80211_OFDM_RATE_12MB 0x18
363 #define IEEE80211_OFDM_RATE_18MB 0x24
364 #define IEEE80211_OFDM_RATE_24MB 0x30
365 #define IEEE80211_OFDM_RATE_36MB 0x48
366 #define IEEE80211_OFDM_RATE_48MB 0x60
367 #define IEEE80211_OFDM_RATE_54MB 0x6C
368 #define IEEE80211_BASIC_RATE_MASK 0x80
370 #define IEEE80211_CCK_RATE_1MB_MASK (1<<0)
371 #define IEEE80211_CCK_RATE_2MB_MASK (1<<1)
372 #define IEEE80211_CCK_RATE_5MB_MASK (1<<2)
373 #define IEEE80211_CCK_RATE_11MB_MASK (1<<3)
374 #define IEEE80211_OFDM_RATE_6MB_MASK (1<<4)
375 #define IEEE80211_OFDM_RATE_9MB_MASK (1<<5)
376 #define IEEE80211_OFDM_RATE_12MB_MASK (1<<6)
377 #define IEEE80211_OFDM_RATE_18MB_MASK (1<<7)
378 #define IEEE80211_OFDM_RATE_24MB_MASK (1<<8)
379 #define IEEE80211_OFDM_RATE_36MB_MASK (1<<9)
380 #define IEEE80211_OFDM_RATE_48MB_MASK (1<<10)
381 #define IEEE80211_OFDM_RATE_54MB_MASK (1<<11)
383 #define IEEE80211_CCK_RATES_MASK 0x0000000F
384 #define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \
385 IEEE80211_CCK_RATE_2MB_MASK)
386 #define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \
387 IEEE80211_CCK_RATE_5MB_MASK | \
388 IEEE80211_CCK_RATE_11MB_MASK)
390 #define IEEE80211_OFDM_RATES_MASK 0x00000FF0
391 #define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \
392 IEEE80211_OFDM_RATE_12MB_MASK | \
393 IEEE80211_OFDM_RATE_24MB_MASK)
394 #define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \
395 IEEE80211_OFDM_RATE_9MB_MASK | \
396 IEEE80211_OFDM_RATE_18MB_MASK | \
397 IEEE80211_OFDM_RATE_36MB_MASK | \
398 IEEE80211_OFDM_RATE_48MB_MASK | \
399 IEEE80211_OFDM_RATE_54MB_MASK)
400 #define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \
401 IEEE80211_CCK_DEFAULT_RATES_MASK)
403 #define IEEE80211_NUM_OFDM_RATES 8
404 #define IEEE80211_NUM_CCK_RATES 4
405 #define IEEE80211_OFDM_SHIFT_MASK_A 4
410 /* NOTE: This data is for statistical purposes; not all hardware provides this
411 * information for frames received. Not setting these will not cause
412 * any adverse affects. */
413 struct ieee80211_rx_stats {
414 s8 rssi;
415 u8 signal;
416 u8 noise;
417 u8 received_channel;
418 u16 rate; /* in 100 kbps */
419 u8 mask;
420 u8 freq;
421 u16 len;
424 /* IEEE 802.11 requires that STA supports concurrent reception of at least
425 * three fragmented frames. This define can be increased to support more
426 * concurrent frames, but it should be noted that each entry can consume about
427 * 2 kB of RAM and increasing cache size will slow down frame reassembly. */
428 #define IEEE80211_FRAG_CACHE_LEN 4
430 struct ieee80211_frag_entry {
431 u32 first_frag_time;
432 uint seq;
433 uint last_frag;
434 uint qos; /*jackson*/
435 uint tid; /*jackson*/
436 struct sk_buff *skb;
437 u8 src_addr[ETH_ALEN];
438 u8 dst_addr[ETH_ALEN];
441 struct ieee80211_stats {
442 uint tx_unicast_frames;
443 uint tx_multicast_frames;
444 uint tx_fragments;
445 uint tx_unicast_octets;
446 uint tx_multicast_octets;
447 uint tx_deferred_transmissions;
448 uint tx_single_retry_frames;
449 uint tx_multiple_retry_frames;
450 uint tx_retry_limit_exceeded;
451 uint tx_discards;
452 uint rx_unicast_frames;
453 uint rx_multicast_frames;
454 uint rx_fragments;
455 uint rx_unicast_octets;
456 uint rx_multicast_octets;
457 uint rx_fcs_errors;
458 uint rx_discards_no_buffer;
459 uint tx_discards_wrong_sa;
460 uint rx_discards_undecryptable;
461 uint rx_message_in_msg_fragments;
462 uint rx_message_in_bad_msg_fragments;
465 struct ieee80211_softmac_stats {
466 uint rx_ass_ok;
467 uint rx_ass_err;
468 uint rx_probe_rq;
469 uint tx_probe_rs;
470 uint tx_beacons;
471 uint rx_auth_rq;
472 uint rx_auth_rs_ok;
473 uint rx_auth_rs_err;
474 uint tx_auth_rq;
475 uint no_auth_rs;
476 uint no_ass_rs;
477 uint tx_ass_rq;
478 uint rx_ass_rq;
479 uint tx_probe_rq;
480 uint reassoc;
481 uint swtxstop;
482 uint swtxawake;
485 #define SEC_KEY_1 (1<<0)
486 #define SEC_KEY_2 (1<<1)
487 #define SEC_KEY_3 (1<<2)
488 #define SEC_KEY_4 (1<<3)
489 #define SEC_ACTIVE_KEY (1<<4)
490 #define SEC_AUTH_MODE (1<<5)
491 #define SEC_UNICAST_GROUP (1<<6)
492 #define SEC_LEVEL (1<<7)
493 #define SEC_ENABLED (1<<8)
495 #define SEC_LEVEL_0 0 /* None */
496 #define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */
497 #define SEC_LEVEL_2 2 /* Level 1 + TKIP */
498 #define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */
499 #define SEC_LEVEL_3 4 /* Level 2 + CCMP */
501 #define WEP_KEYS 4
502 #define WEP_KEY_LEN 13
504 struct ieee80211_security {
505 u16 active_key:2,
506 enabled:1,
507 auth_mode:2,
508 auth_algo:4,
509 unicast_uses_group:1;
510 u8 key_sizes[WEP_KEYS];
511 u8 keys[WEP_KEYS][WEP_KEY_LEN];
512 u8 level;
513 u16 flags;
514 } __packed;
518 802.11 data frame from AP
520 ,-------------------------------------------------------------------.
521 Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
522 |------|------|---------|---------|---------|------|---------|------|
523 Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs |
524 | | tion | (BSSID) | | | ence | data | |
525 `-------------------------------------------------------------------'
527 Total: 28-2340 bytes
531 struct ieee80211_header_data {
532 u16 frame_ctl;
533 u16 duration_id;
534 u8 addr1[6];
535 u8 addr2[6];
536 u8 addr3[6];
537 u16 seq_ctrl;
540 #define BEACON_PROBE_SSID_ID_POSITION 12
542 /* Management Frame Information Element Types */
543 #define MFIE_TYPE_SSID 0
544 #define MFIE_TYPE_RATES 1
545 #define MFIE_TYPE_FH_SET 2
546 #define MFIE_TYPE_DS_SET 3
547 #define MFIE_TYPE_CF_SET 4
548 #define MFIE_TYPE_TIM 5
549 #define MFIE_TYPE_IBSS_SET 6
550 #define MFIE_TYPE_CHALLENGE 16
551 #define MFIE_TYPE_ERP 42
552 #define MFIE_TYPE_RSN 48
553 #define MFIE_TYPE_RATES_EX 50
554 #define MFIE_TYPE_GENERIC 221
556 struct ieee80211_info_element_hdr {
557 u8 id;
558 u8 len;
559 } __packed;
561 struct ieee80211_info_element {
562 u8 id;
563 u8 len;
564 u8 data[0];
565 } __packed;
568 * These are the data types that can make up management packets
570 u16 auth_algorithm;
571 u16 auth_sequence;
572 u16 beacon_interval;
573 u16 capability;
574 u8 current_ap[ETH_ALEN];
575 u16 listen_interval;
576 struct {
577 u16 association_id:14, reserved:2;
578 } __packed;
579 u32 time_stamp[2];
580 u16 reason;
581 u16 status;
584 #define IEEE80211_DEFAULT_TX_ESSID "Penguin"
585 #define IEEE80211_DEFAULT_BASIC_RATE 10
587 struct ieee80211_authentication {
588 struct ieee80211_header_data header;
589 u16 algorithm;
590 u16 transaction;
591 u16 status;
592 } __packed;
594 struct ieee80211_probe_response {
595 struct ieee80211_header_data header;
596 u32 time_stamp[2];
597 u16 beacon_interval;
598 u16 capability;
599 struct ieee80211_info_element info_element;
600 } __packed;
602 struct ieee80211_probe_request {
603 struct ieee80211_header_data header;
604 } __packed;
606 struct ieee80211_assoc_request_frame {
607 struct ieee80211_hdr_3addr header;
608 u16 capability;
609 u16 listen_interval;
610 struct ieee80211_info_element_hdr info_element;
611 } __packed;
613 struct ieee80211_assoc_response_frame {
614 struct ieee80211_hdr_3addr header;
615 u16 capability;
616 u16 status;
617 u16 aid;
618 } __packed;
620 struct ieee80211_txb {
621 u8 nr_frags;
622 u8 encrypted;
623 u16 reserved;
624 u16 frag_size;
625 u16 payload_size;
626 struct sk_buff *fragments[0];
629 /* SWEEP TABLE ENTRIES NUMBER*/
630 #define MAX_SWEEP_TAB_ENTRIES 42
631 #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7
632 /* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
633 * only use 8, and then use extended rates for the remaining supported
634 * rates. Other APs, however, stick all of their supported rates on the
635 * main rates information element... */
636 #define MAX_RATES_LENGTH ((u8)12)
637 #define MAX_RATES_EX_LENGTH ((u8)16)
638 #define MAX_NETWORK_COUNT 128
639 #define MAX_CHANNEL_NUMBER 161
640 #define IEEE80211_SOFTMAC_SCAN_TIME 400
641 /*(HZ / 2)*/
642 #define IEEE80211_SOFTMAC_ASSOC_RETRY_TIME (HZ * 2)
644 #define CRC_LENGTH 4U
646 #define MAX_WPA_IE_LEN 128
647 #define MAX_WPS_IE_LEN 512
649 #define NETWORK_EMPTY_ESSID (1<<0)
650 #define NETWORK_HAS_OFDM (1<<1)
651 #define NETWORK_HAS_CCK (1<<2)
653 #define IEEE80211_DTIM_MBCAST 4
654 #define IEEE80211_DTIM_UCAST 2
655 #define IEEE80211_DTIM_VALID 1
656 #define IEEE80211_DTIM_INVALID 0
658 #define IEEE80211_PS_DISABLED 0
659 #define IEEE80211_PS_UNICAST IEEE80211_DTIM_UCAST
660 #define IEEE80211_PS_MBCAST IEEE80211_DTIM_MBCAST
661 #define IW_ESSID_MAX_SIZE 32
663 * join_res:
664 * -1: authentication fail
665 * -2: association fail
666 * > 0: TID
669 enum ieee80211_state {
670 /* the card is not linked at all */
671 IEEE80211_NOLINK = 0,
672 /* IEEE80211_ASSOCIATING* are for BSS client mode
673 * the driver shall not perform RX filtering unless
674 * the state is LINKED.
675 * The driver shall just check for the state LINKED and
676 * defaults to NOLINK for ALL the other states (including
677 * LINKED_SCANNING)
679 /* the association procedure will start (wq scheduling)*/
680 IEEE80211_ASSOCIATING,
681 IEEE80211_ASSOCIATING_RETRY,
682 /* the association procedure is sending AUTH request*/
683 IEEE80211_ASSOCIATING_AUTHENTICATING,
684 /* the association procedure has successfully authentcated
685 * and is sending association request
687 IEEE80211_ASSOCIATING_AUTHENTICATED,
688 /* the link is ok. the card associated to a BSS or linked
689 * to a ibss cell or acting as an AP and creating the bss
691 IEEE80211_LINKED,
692 /* same as LINKED, but the driver shall apply RX filter
693 * rules as we are in NO_LINK mode. As the card is still
694 * logically linked, but it is doing a syncro site survey
695 * then it will be back to LINKED state.
697 IEEE80211_LINKED_SCANNING,
700 #define DEFAULT_MAX_SCAN_AGE (15 * HZ)
701 #define DEFAULT_FTS 2346
703 #define CFG_IEEE80211_RESERVE_FCS (1<<0)
704 #define CFG_IEEE80211_COMPUTE_FCS (1<<1)
706 #define MAXTID 16
708 #define IEEE_A (1<<0)
709 #define IEEE_B (1<<1)
710 #define IEEE_G (1<<2)
711 #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G)
713 extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
715 /* Single white space is for Linksys APs */
716 if (essid_len == 1 && essid[0] == ' ')
717 return 1;
718 /* Otherwise, if the entire essid is 0, we assume it is hidden */
719 while (essid_len) {
720 essid_len--;
721 if (essid[essid_len] != '\0')
722 return 0;
724 return 1;
727 extern inline int ieee80211_get_hdrlen(u16 fc)
729 int hdrlen = 24;
731 switch (WLAN_FC_GET_TYPE(fc)) {
732 case IEEE80211_FTYPE_DATA:
733 if (fc & IEEE80211_QOS_DATAGRP)
734 hdrlen += 2;
735 if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS))
736 hdrlen += 6; /* Addr4 */
737 break;
738 case IEEE80211_FTYPE_CTL:
739 switch (WLAN_FC_GET_STYPE(fc)) {
740 case IEEE80211_STYPE_CTS:
741 case IEEE80211_STYPE_ACK:
742 hdrlen = 10;
743 break;
744 default:
745 hdrlen = 16;
746 break;
748 break;
750 return hdrlen;
753 struct registry_priv;
755 u8 *r8712_set_ie(u8 *pbuf, sint index, uint len, u8 *source, uint *frlen);
756 u8 *r8712_get_ie(u8*pbuf, sint index, sint *len, sint limit);
757 unsigned char *r8712_get_wpa_ie(unsigned char *pie, int *rsn_ie_len, int limit);
758 unsigned char *r8712_get_wpa2_ie(unsigned char *pie, int *rsn_ie_len,
759 int limit);
760 int r8712_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,
761 int *pairwise_cipher);
762 int r8712_parse_wpa2_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,
763 int *pairwise_cipher);
764 int r8712_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len,
765 u8 *wpa_ie, u16 *wpa_len);
766 int r8712_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen);
767 int r8712_generate_ie(struct registry_priv *pregistrypriv,
768 struct _adapter *padapter);
769 uint r8712_is_cckrates_included(u8 *rate);
770 uint r8712_is_cckratesonly_included(u8 *rate);
772 #endif /* IEEE80211_H */