added 2.6.29.6 aldebaran kernel
[nao-ulib.git] / kernel / 2.6.29.6-aldebaran-rt / drivers / staging / rtl8187se / ieee80211.h
blob58336080ad507b0a21eee4970794ea432290897c
1 /*
2 * Merged with mainline ieee80211.h in Aug 2004. Original ieee802_11
3 * remains copyright by the original authors
5 * Portions of the merged code are based on Host AP (software wireless
6 * LAN access point) driver for Intersil Prism2/2.5/3.
8 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
9 * <jkmaline@cc.hut.fi>
10 * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi>
12 * Adaption to a generic IEEE 802.11 stack by James Ketrenos
13 * <jketreno@linux.intel.com>
14 * Copyright (c) 2004, Intel Corporation
16 * Modified for Realtek's wi-fi cards by Andrea Merello
17 * <andreamrl@tiscali.it>
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License version 2 as
21 * published by the Free Software Foundation. See README and COPYING for
22 * more details.
24 #ifndef IEEE80211_H
25 #define IEEE80211_H
26 #include <linux/if_ether.h> /* ETH_ALEN */
27 #include <linux/kernel.h> /* ARRAY_SIZE */
28 #include <linux/version.h>
29 #include <linux/jiffies.h>
30 #include <linux/timer.h>
31 #include <linux/sched.h>
33 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13))
34 #include <linux/wireless.h>
35 #endif
38 #ifndef bool
39 #define bool int
40 #endif
42 #ifndef true
43 #define true 1
44 #endif
46 #ifndef false
47 #define false 0
48 #endif
50 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
51 #ifndef bool
52 typedef enum{false = 0, true} bool;
53 #endif
54 #endif
55 //#ifdef JOHN_HWSEC
56 #define KEY_TYPE_NA 0x0
57 #define KEY_TYPE_WEP40 0x1
58 #define KEY_TYPE_TKIP 0x2
59 #define KEY_TYPE_CCMP 0x4
60 #define KEY_TYPE_WEP104 0x5
61 //#endif
64 #define aSifsTime 10
66 #define MGMT_QUEUE_NUM 5
69 #define IEEE_CMD_SET_WPA_PARAM 1
70 #define IEEE_CMD_SET_WPA_IE 2
71 #define IEEE_CMD_SET_ENCRYPTION 3
72 #define IEEE_CMD_MLME 4
74 #define IEEE_PARAM_WPA_ENABLED 1
75 #define IEEE_PARAM_TKIP_COUNTERMEASURES 2
76 #define IEEE_PARAM_DROP_UNENCRYPTED 3
77 #define IEEE_PARAM_PRIVACY_INVOKED 4
78 #define IEEE_PARAM_AUTH_ALGS 5
79 #define IEEE_PARAM_IEEE_802_1X 6
80 //It should consistent with the driver_XXX.c
81 // David, 2006.9.26
82 #define IEEE_PARAM_WPAX_SELECT 7
83 //Added for notify the encryption type selection
84 // David, 2006.9.26
85 #define IEEE_PROTO_WPA 1
86 #define IEEE_PROTO_RSN 2
87 //Added for notify the encryption type selection
88 // David, 2006.9.26
89 #define IEEE_WPAX_USEGROUP 0
90 #define IEEE_WPAX_WEP40 1
91 #define IEEE_WPAX_TKIP 2
92 #define IEEE_WPAX_WRAP 3
93 #define IEEE_WPAX_CCMP 4
94 #define IEEE_WPAX_WEP104 5
96 #define IEEE_KEY_MGMT_IEEE8021X 1
97 #define IEEE_KEY_MGMT_PSK 2
101 #define IEEE_MLME_STA_DEAUTH 1
102 #define IEEE_MLME_STA_DISASSOC 2
105 #define IEEE_CRYPT_ERR_UNKNOWN_ALG 2
106 #define IEEE_CRYPT_ERR_UNKNOWN_ADDR 3
107 #define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED 4
108 #define IEEE_CRYPT_ERR_KEY_SET_FAILED 5
109 #define IEEE_CRYPT_ERR_TX_KEY_SET_FAILED 6
110 #define IEEE_CRYPT_ERR_CARD_CONF_FAILED 7
113 #define IEEE_CRYPT_ALG_NAME_LEN 16
115 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10))
116 #define ieee80211_wx_get_scan ieee80211_wx_get_scan_rtl
117 #define ieee80211_wx_set_encode ieee80211_wx_set_encode_rtl
118 #define ieee80211_wx_get_encode ieee80211_wx_get_encode_rtl
119 ////////////////////////////////
120 // added for kernel conflict under FC5
121 #define ieee80211_wx_get_name ieee80211_wx_get_name_rtl
122 #define free_ieee80211 free_ieee80211_rtl
123 #define alloc_ieee80211 alloc_ieee80211_rtl
124 ///////////////////////////////
125 #endif
126 //error in ubuntu2.6.22,so add these
127 #define ieee80211_wake_queue ieee80211_wake_queue_rtl
128 #define ieee80211_stop_queue ieee80211_stop_queue_rtl
130 #define ieee80211_rx ieee80211_rx_rtl
132 #define ieee80211_register_crypto_ops ieee80211_register_crypto_ops_rtl
133 #define ieee80211_unregister_crypto_ops ieee80211_unregister_crypto_ops_rtl
134 #define ieee80211_get_crypto_ops ieee80211_get_crypto_ops_rtl
135 #define ieee80211_crypt_deinit_entries ieee80211_crypt_deinit_entries_rtl
136 #define ieee80211_crypt_deinit_handler ieee80211_crypt_deinit_handler_rtl
137 #define ieee80211_crypt_delayed_deinit ieee80211_crypt_delayed_deinit_rtl
139 #define ieee80211_txb_free ieee80211_txb_free_rtl
140 #define ieee80211_wx_get_essid ieee80211_wx_get_essid_rtl
141 #define ieee80211_wx_set_essid ieee80211_wx_set_essid_rtl
142 #define ieee80211_wx_set_rate ieee80211_wx_set_rate_rtl
143 #define ieee80211_wx_get_rate ieee80211_wx_get_rate_rtl
144 #define ieee80211_wx_set_wap ieee80211_wx_set_wap_rtl
145 #define ieee80211_wx_get_wap ieee80211_wx_get_wap_rtl
146 #define ieee80211_wx_set_mode ieee80211_wx_set_mode_rtl
147 #define ieee80211_wx_get_mode ieee80211_wx_get_mode_rtl
148 #define ieee80211_wx_set_scan ieee80211_wx_set_scan_rtl
149 #define ieee80211_wx_get_freq ieee80211_wx_get_freq_rtl
150 #define ieee80211_wx_set_freq ieee80211_wx_set_freq_rtl
151 #define ieee80211_wx_set_rawtx ieee80211_wx_set_rawtx_rtl
152 #define ieee80211_wx_set_power ieee80211_wx_set_power_rtl
153 #define ieee80211_wx_get_power ieee80211_wx_get_power_rtl
154 #define ieee80211_wlan_frequencies ieee80211_wlan_frequencies_rtl
155 #define ieee80211_softmac_stop_protocol ieee80211_softmac_stop_protocol_rtl
156 #define ieee80211_softmac_start_protocol ieee80211_softmac_start_protocol_rtl
157 #define ieee80211_start_protocol ieee80211_start_protocol_rtl
158 #define ieee80211_stop_protocol ieee80211_stop_protocol_rtl
159 #define ieee80211_rx_mgt ieee80211_rx_mgt_rtl
161 #define ieee80211_wx_set_auth ieee80211_wx_set_auth_rtl
162 //by amy for ps
163 #define notify_wx_assoc_event notify_wx_assoc_event_rtl
164 #define ieee80211_stop_send_beacons ieee80211_stop_send_beacons_rtl
165 #define ieee80211_disassociate ieee80211_disassociate_rtl
166 #define ieee80211_start_scan ieee80211_start_scan_rtl
167 //by amy for ps
168 typedef struct ieee_param {
169 u32 cmd;
170 u8 sta_addr[ETH_ALEN];
171 union {
172 struct {
173 u8 name;
174 u32 value;
175 } wpa_param;
176 struct {
177 u32 len;
178 u8 reserved[32];
179 u8 data[0];
180 } wpa_ie;
181 struct{
182 int command;
183 int reason_code;
184 } mlme;
185 struct {
186 u8 alg[IEEE_CRYPT_ALG_NAME_LEN];
187 u8 set_tx;
188 u32 err;
189 u8 idx;
190 u8 seq[8]; /* sequence counter (set: RX, get: TX) */
191 u16 key_len;
192 u8 key[0];
193 } crypt;
195 } u;
196 }ieee_param;
199 #if WIRELESS_EXT < 17
200 #define IW_QUAL_QUAL_INVALID 0x10
201 #define IW_QUAL_LEVEL_INVALID 0x20
202 #define IW_QUAL_NOISE_INVALID 0x40
203 #define IW_QUAL_QUAL_UPDATED 0x1
204 #define IW_QUAL_LEVEL_UPDATED 0x2
205 #define IW_QUAL_NOISE_UPDATED 0x4
206 #endif
208 // linux under 2.6.9 release may not support it, so modify it for common use
209 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
210 #define MSECS(t) (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ)
211 static inline unsigned long msleep_interruptible_rtl(unsigned int msecs)
213 unsigned long timeout = MSECS(msecs) + 1;
215 while (timeout) {
216 set_current_state(TASK_UNINTERRUPTIBLE);
217 timeout = schedule_timeout(timeout);
219 return timeout;
221 #else
222 #define MSECS(t) msecs_to_jiffies(t)
223 #define msleep_interruptible_rtl msleep_interruptible
224 #endif
226 #define IEEE80211_DATA_LEN 2304
227 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
228 6.2.1.1.2.
230 The figure in section 7.1.2 suggests a body size of up to 2312
231 bytes is allowed, which is a bit confusing, I suspect this
232 represents the 2304 bytes of real data, plus a possible 8 bytes of
233 WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
236 #define IEEE80211_HLEN 30
237 #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
239 /* this is stolen and modified from the madwifi driver*/
240 #define IEEE80211_FC0_TYPE_MASK 0x0c
241 #define IEEE80211_FC0_TYPE_DATA 0x08
242 #define IEEE80211_FC0_SUBTYPE_MASK 0xB0
243 #define IEEE80211_FC0_SUBTYPE_QOS 0x80
245 #define IEEE80211_QOS_HAS_SEQ(fc) \
246 (((fc) & (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) == \
247 (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS))
249 /* this is stolen from ipw2200 driver */
250 #define IEEE_IBSS_MAC_HASH_SIZE 31
251 struct ieee_ibss_seq {
252 u8 mac[ETH_ALEN];
253 u16 seq_num[17];
254 u16 frag_num[17];
255 unsigned long packet_time[17];
256 struct list_head list;
259 struct ieee80211_hdr {
260 u16 frame_ctl;
261 u16 duration_id;
262 u8 addr1[ETH_ALEN];
263 u8 addr2[ETH_ALEN];
264 u8 addr3[ETH_ALEN];
265 u16 seq_ctl;
266 u8 addr4[ETH_ALEN];
267 } __attribute__ ((packed));
269 struct ieee80211_hdr_QOS {
270 u16 frame_ctl;
271 u16 duration_id;
272 u8 addr1[ETH_ALEN];
273 u8 addr2[ETH_ALEN];
274 u8 addr3[ETH_ALEN];
275 u16 seq_ctl;
276 u8 addr4[ETH_ALEN];
277 u16 QOS_ctl;
278 } __attribute__ ((packed));
280 struct ieee80211_hdr_3addr {
281 u16 frame_ctl;
282 u16 duration_id;
283 u8 addr1[ETH_ALEN];
284 u8 addr2[ETH_ALEN];
285 u8 addr3[ETH_ALEN];
286 u16 seq_ctl;
287 } __attribute__ ((packed));
289 struct ieee80211_hdr_3addr_QOS {
290 u16 frame_ctl;
291 u16 duration_id;
292 u8 addr1[ETH_ALEN];
293 u8 addr2[ETH_ALEN];
294 u8 addr3[ETH_ALEN];
295 u16 seq_ctl;
296 u16 QOS_ctl;
297 } __attribute__ ((packed));
299 enum eap_type {
300 EAP_PACKET = 0,
301 EAPOL_START,
302 EAPOL_LOGOFF,
303 EAPOL_KEY,
304 EAPOL_ENCAP_ASF_ALERT
307 static const char *eap_types[] = {
308 [EAP_PACKET] = "EAP-Packet",
309 [EAPOL_START] = "EAPOL-Start",
310 [EAPOL_LOGOFF] = "EAPOL-Logoff",
311 [EAPOL_KEY] = "EAPOL-Key",
312 [EAPOL_ENCAP_ASF_ALERT] = "EAPOL-Encap-ASF-Alert"
315 static inline const char *eap_get_type(int type)
317 return (type >= ARRAY_SIZE(eap_types)) ? "Unknown" : eap_types[type];
320 struct eapol {
321 u8 snap[6];
322 u16 ethertype;
323 u8 version;
324 u8 type;
325 u16 length;
326 } __attribute__ ((packed));
328 #define IEEE80211_3ADDR_LEN 24
329 #define IEEE80211_4ADDR_LEN 30
330 #define IEEE80211_FCS_LEN 4
332 #define MIN_FRAG_THRESHOLD 256U
333 #define MAX_FRAG_THRESHOLD 2346U
335 /* Frame control field constants */
336 #define IEEE80211_FCTL_VERS 0x0002
337 #define IEEE80211_FCTL_FTYPE 0x000c
338 #define IEEE80211_FCTL_STYPE 0x00f0
339 #define IEEE80211_FCTL_TODS 0x0100
340 #define IEEE80211_FCTL_FROMDS 0x0200
341 #define IEEE80211_FCTL_DSTODS 0x0300 //added by david
342 #define IEEE80211_FCTL_MOREFRAGS 0x0400
343 #define IEEE80211_FCTL_RETRY 0x0800
344 #define IEEE80211_FCTL_PM 0x1000
345 #define IEEE80211_FCTL_MOREDATA 0x2000
346 #define IEEE80211_FCTL_WEP 0x4000
347 #define IEEE80211_FCTL_ORDER 0x8000
349 #define IEEE80211_FTYPE_MGMT 0x0000
350 #define IEEE80211_FTYPE_CTL 0x0004
351 #define IEEE80211_FTYPE_DATA 0x0008
353 /* management */
354 #define IEEE80211_STYPE_ASSOC_REQ 0x0000
355 #define IEEE80211_STYPE_ASSOC_RESP 0x0010
356 #define IEEE80211_STYPE_REASSOC_REQ 0x0020
357 #define IEEE80211_STYPE_REASSOC_RESP 0x0030
358 #define IEEE80211_STYPE_PROBE_REQ 0x0040
359 #define IEEE80211_STYPE_PROBE_RESP 0x0050
360 #define IEEE80211_STYPE_BEACON 0x0080
361 #define IEEE80211_STYPE_ATIM 0x0090
362 #define IEEE80211_STYPE_DISASSOC 0x00A0
363 #define IEEE80211_STYPE_AUTH 0x00B0
364 #define IEEE80211_STYPE_DEAUTH 0x00C0
365 #define IEEE80211_STYPE_MANAGE_ACT 0x00D0
367 /* control */
368 #define IEEE80211_STYPE_PSPOLL 0x00A0
369 #define IEEE80211_STYPE_RTS 0x00B0
370 #define IEEE80211_STYPE_CTS 0x00C0
371 #define IEEE80211_STYPE_ACK 0x00D0
372 #define IEEE80211_STYPE_CFEND 0x00E0
373 #define IEEE80211_STYPE_CFENDACK 0x00F0
375 /* data */
376 #define IEEE80211_STYPE_DATA 0x0000
377 #define IEEE80211_STYPE_DATA_CFACK 0x0010
378 #define IEEE80211_STYPE_DATA_CFPOLL 0x0020
379 #define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030
380 #define IEEE80211_STYPE_NULLFUNC 0x0040
381 #define IEEE80211_STYPE_CFACK 0x0050
382 #define IEEE80211_STYPE_CFPOLL 0x0060
383 #define IEEE80211_STYPE_CFACKPOLL 0x0070
384 #define IEEE80211_STYPE_QOS_DATA 0x0080 //added for WMM 2006/8/2
385 #define IEEE80211_STYPE_QOS_NULL 0x00C0
388 #define IEEE80211_SCTL_FRAG 0x000F
389 #define IEEE80211_SCTL_SEQ 0xFFF0
392 /* debug macros */
394 #ifdef CONFIG_IEEE80211_DEBUG
395 extern u32 ieee80211_debug_level;
396 #define IEEE80211_DEBUG(level, fmt, args...) \
397 do { if (ieee80211_debug_level & (level)) \
398 printk(KERN_DEBUG "ieee80211: %c %s " fmt, \
399 in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0)
400 #else
401 #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0)
402 #endif /* CONFIG_IEEE80211_DEBUG */
405 * To use the debug system;
407 * If you are defining a new debug classification, simply add it to the #define
408 * list here in the form of:
410 * #define IEEE80211_DL_xxxx VALUE
412 * shifting value to the left one bit from the previous entry. xxxx should be
413 * the name of the classification (for example, WEP)
415 * You then need to either add a IEEE80211_xxxx_DEBUG() macro definition for your
416 * classification, or use IEEE80211_DEBUG(IEEE80211_DL_xxxx, ...) whenever you want
417 * to send output to that classification.
419 * To add your debug level to the list of levels seen when you perform
421 * % cat /proc/net/ipw/debug_level
423 * you simply need to add your entry to the ipw_debug_levels array.
425 * If you do not see debug_level in /proc/net/ipw then you do not have
426 * CONFIG_IEEE80211_DEBUG defined in your kernel configuration
430 #define IEEE80211_DL_INFO (1<<0)
431 #define IEEE80211_DL_WX (1<<1)
432 #define IEEE80211_DL_SCAN (1<<2)
433 #define IEEE80211_DL_STATE (1<<3)
434 #define IEEE80211_DL_MGMT (1<<4)
435 #define IEEE80211_DL_FRAG (1<<5)
436 #define IEEE80211_DL_EAP (1<<6)
437 #define IEEE80211_DL_DROP (1<<7)
439 #define IEEE80211_DL_TX (1<<8)
440 #define IEEE80211_DL_RX (1<<9)
442 #define IEEE80211_ERROR(f, a...) printk(KERN_ERR "ieee80211: " f, ## a)
443 #define IEEE80211_WARNING(f, a...) printk(KERN_WARNING "ieee80211: " f, ## a)
444 #define IEEE80211_DEBUG_INFO(f, a...) IEEE80211_DEBUG(IEEE80211_DL_INFO, f, ## a)
446 #define IEEE80211_DEBUG_WX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_WX, f, ## a)
447 #define IEEE80211_DEBUG_SCAN(f, a...) IEEE80211_DEBUG(IEEE80211_DL_SCAN, f, ## a)
448 //#define IEEE_DEBUG_SCAN IEEE80211_WARNING
449 #define IEEE80211_DEBUG_STATE(f, a...) IEEE80211_DEBUG(IEEE80211_DL_STATE, f, ## a)
450 #define IEEE80211_DEBUG_MGMT(f, a...) IEEE80211_DEBUG(IEEE80211_DL_MGMT, f, ## a)
451 #define IEEE80211_DEBUG_FRAG(f, a...) IEEE80211_DEBUG(IEEE80211_DL_FRAG, f, ## a)
452 #define IEEE80211_DEBUG_EAP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_EAP, f, ## a)
453 #define IEEE80211_DEBUG_DROP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a)
454 #define IEEE80211_DEBUG_TX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a)
455 #define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a)
456 #include <linux/netdevice.h>
457 #include <linux/wireless.h>
458 #include <linux/if_arp.h> /* ARPHRD_ETHER */
460 #ifndef WIRELESS_SPY
461 #define WIRELESS_SPY // enable iwspy support
462 #endif
463 #include <net/iw_handler.h> // new driver API
465 #ifndef ETH_P_PAE
466 #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
467 #endif /* ETH_P_PAE */
469 #define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */
471 #ifndef ETH_P_80211_RAW
472 #define ETH_P_80211_RAW (ETH_P_ECONET + 1)
473 #endif
475 /* IEEE 802.11 defines */
477 #define P80211_OUI_LEN 3
479 struct ieee80211_snap_hdr {
481 u8 dsap; /* always 0xAA */
482 u8 ssap; /* always 0xAA */
483 u8 ctrl; /* always 0x03 */
484 u8 oui[P80211_OUI_LEN]; /* organizational universal id */
486 } __attribute__ ((packed));
488 #define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
490 #define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE)
491 #define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE)
493 #define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG)
494 #define WLAN_GET_SEQ_SEQ(seq) ((seq) & IEEE80211_SCTL_SEQ)
496 /* Authentication algorithms */
497 #define WLAN_AUTH_OPEN 0
498 #define WLAN_AUTH_SHARED_KEY 1
500 #define WLAN_AUTH_CHALLENGE_LEN 128
502 #define WLAN_CAPABILITY_BSS (1<<0)
503 #define WLAN_CAPABILITY_IBSS (1<<1)
504 #define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
505 #define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
506 #define WLAN_CAPABILITY_PRIVACY (1<<4)
507 #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
508 #define WLAN_CAPABILITY_PBCC (1<<6)
509 #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
510 #define WLAN_CAPABILITY_SHORT_SLOT (1<<10)
512 /* Status codes */
513 #define WLAN_STATUS_SUCCESS 0
514 #define WLAN_STATUS_UNSPECIFIED_FAILURE 1
515 #define WLAN_STATUS_CAPS_UNSUPPORTED 10
516 #define WLAN_STATUS_REASSOC_NO_ASSOC 11
517 #define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12
518 #define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13
519 #define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14
520 #define WLAN_STATUS_CHALLENGE_FAIL 15
521 #define WLAN_STATUS_AUTH_TIMEOUT 16
522 #define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17
523 #define WLAN_STATUS_ASSOC_DENIED_RATES 18
524 /* 802.11b */
525 #define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19
526 #define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20
527 #define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21
529 /* Reason codes */
530 #define WLAN_REASON_UNSPECIFIED 1
531 #define WLAN_REASON_PREV_AUTH_NOT_VALID 2
532 #define WLAN_REASON_DEAUTH_LEAVING 3
533 #define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4
534 #define WLAN_REASON_DISASSOC_AP_BUSY 5
535 #define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6
536 #define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7
537 #define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8
538 #define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9
541 /* Information Element IDs */
542 #define WLAN_EID_SSID 0
543 #define WLAN_EID_SUPP_RATES 1
544 #define WLAN_EID_FH_PARAMS 2
545 #define WLAN_EID_DS_PARAMS 3
546 #define WLAN_EID_CF_PARAMS 4
547 #define WLAN_EID_TIM 5
548 #define WLAN_EID_IBSS_PARAMS 6
549 #define WLAN_EID_CHALLENGE 16
550 #define WLAN_EID_RSN 48
551 #define WLAN_EID_GENERIC 221
553 #define IEEE80211_MGMT_HDR_LEN 24
554 #define IEEE80211_DATA_HDR3_LEN 24
555 #define IEEE80211_DATA_HDR4_LEN 30
558 #define IEEE80211_STATMASK_SIGNAL (1<<0)
559 #define IEEE80211_STATMASK_RSSI (1<<1)
560 #define IEEE80211_STATMASK_NOISE (1<<2)
561 #define IEEE80211_STATMASK_RATE (1<<3)
562 #define IEEE80211_STATMASK_WEMASK 0x7
565 #define IEEE80211_CCK_MODULATION (1<<0)
566 #define IEEE80211_OFDM_MODULATION (1<<1)
568 #define IEEE80211_24GHZ_BAND (1<<0)
569 #define IEEE80211_52GHZ_BAND (1<<1)
571 #define IEEE80211_CCK_RATE_LEN 4
572 #define IEEE80211_CCK_RATE_1MB 0x02
573 #define IEEE80211_CCK_RATE_2MB 0x04
574 #define IEEE80211_CCK_RATE_5MB 0x0B
575 #define IEEE80211_CCK_RATE_11MB 0x16
576 #define IEEE80211_OFDM_RATE_LEN 8
577 #define IEEE80211_OFDM_RATE_6MB 0x0C
578 #define IEEE80211_OFDM_RATE_9MB 0x12
579 #define IEEE80211_OFDM_RATE_12MB 0x18
580 #define IEEE80211_OFDM_RATE_18MB 0x24
581 #define IEEE80211_OFDM_RATE_24MB 0x30
582 #define IEEE80211_OFDM_RATE_36MB 0x48
583 #define IEEE80211_OFDM_RATE_48MB 0x60
584 #define IEEE80211_OFDM_RATE_54MB 0x6C
585 #define IEEE80211_BASIC_RATE_MASK 0x80
587 #define IEEE80211_CCK_RATE_1MB_MASK (1<<0)
588 #define IEEE80211_CCK_RATE_2MB_MASK (1<<1)
589 #define IEEE80211_CCK_RATE_5MB_MASK (1<<2)
590 #define IEEE80211_CCK_RATE_11MB_MASK (1<<3)
591 #define IEEE80211_OFDM_RATE_6MB_MASK (1<<4)
592 #define IEEE80211_OFDM_RATE_9MB_MASK (1<<5)
593 #define IEEE80211_OFDM_RATE_12MB_MASK (1<<6)
594 #define IEEE80211_OFDM_RATE_18MB_MASK (1<<7)
595 #define IEEE80211_OFDM_RATE_24MB_MASK (1<<8)
596 #define IEEE80211_OFDM_RATE_36MB_MASK (1<<9)
597 #define IEEE80211_OFDM_RATE_48MB_MASK (1<<10)
598 #define IEEE80211_OFDM_RATE_54MB_MASK (1<<11)
600 #define IEEE80211_CCK_RATES_MASK 0x0000000F
601 #define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \
602 IEEE80211_CCK_RATE_2MB_MASK)
603 #define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \
604 IEEE80211_CCK_RATE_5MB_MASK | \
605 IEEE80211_CCK_RATE_11MB_MASK)
607 #define IEEE80211_OFDM_RATES_MASK 0x00000FF0
608 #define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \
609 IEEE80211_OFDM_RATE_12MB_MASK | \
610 IEEE80211_OFDM_RATE_24MB_MASK)
611 #define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \
612 IEEE80211_OFDM_RATE_9MB_MASK | \
613 IEEE80211_OFDM_RATE_18MB_MASK | \
614 IEEE80211_OFDM_RATE_36MB_MASK | \
615 IEEE80211_OFDM_RATE_48MB_MASK | \
616 IEEE80211_OFDM_RATE_54MB_MASK)
617 #define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \
618 IEEE80211_CCK_DEFAULT_RATES_MASK)
620 #define IEEE80211_NUM_OFDM_RATES 8
621 #define IEEE80211_NUM_CCK_RATES 4
622 #define IEEE80211_OFDM_SHIFT_MASK_A 4
627 /* NOTE: This data is for statistical purposes; not all hardware provides this
628 * information for frames received. Not setting these will not cause
629 * any adverse affects. */
630 struct ieee80211_rx_stats {
631 u32 mac_time[2];
632 u8 signalstrength;
633 s8 rssi;
634 u8 signal;
635 u8 noise;
636 u16 rate; /* in 100 kbps */
637 u8 received_channel;
638 u8 control;
639 u8 mask;
640 u8 freq;
641 u16 len;
642 u8 nic_type;
645 /* IEEE 802.11 requires that STA supports concurrent reception of at least
646 * three fragmented frames. This define can be increased to support more
647 * concurrent frames, but it should be noted that each entry can consume about
648 * 2 kB of RAM and increasing cache size will slow down frame reassembly. */
649 #define IEEE80211_FRAG_CACHE_LEN 4
651 struct ieee80211_frag_entry {
652 unsigned long first_frag_time;
653 unsigned int seq;
654 unsigned int last_frag;
655 struct sk_buff *skb;
656 u8 src_addr[ETH_ALEN];
657 u8 dst_addr[ETH_ALEN];
660 struct ieee80211_stats {
661 unsigned int tx_unicast_frames;
662 unsigned int tx_multicast_frames;
663 unsigned int tx_fragments;
664 unsigned int tx_unicast_octets;
665 unsigned int tx_multicast_octets;
666 unsigned int tx_deferred_transmissions;
667 unsigned int tx_single_retry_frames;
668 unsigned int tx_multiple_retry_frames;
669 unsigned int tx_retry_limit_exceeded;
670 unsigned int tx_discards;
671 unsigned int rx_unicast_frames;
672 unsigned int rx_multicast_frames;
673 unsigned int rx_fragments;
674 unsigned int rx_unicast_octets;
675 unsigned int rx_multicast_octets;
676 unsigned int rx_fcs_errors;
677 unsigned int rx_discards_no_buffer;
678 unsigned int tx_discards_wrong_sa;
679 unsigned int rx_discards_undecryptable;
680 unsigned int rx_message_in_msg_fragments;
681 unsigned int rx_message_in_bad_msg_fragments;
684 struct ieee80211_softmac_stats{
685 unsigned int rx_ass_ok;
686 unsigned int rx_ass_err;
687 unsigned int rx_probe_rq;
688 unsigned int tx_probe_rs;
689 unsigned int tx_beacons;
690 unsigned int rx_auth_rq;
691 unsigned int rx_auth_rs_ok;
692 unsigned int rx_auth_rs_err;
693 unsigned int tx_auth_rq;
694 unsigned int no_auth_rs;
695 unsigned int no_ass_rs;
696 unsigned int tx_ass_rq;
697 unsigned int rx_ass_rq;
698 unsigned int tx_probe_rq;
699 unsigned int reassoc;
700 unsigned int swtxstop;
701 unsigned int swtxawake;
704 struct ieee80211_device;
706 #include "ieee80211_crypt.h"
708 #define SEC_KEY_1 (1<<0)
709 #define SEC_KEY_2 (1<<1)
710 #define SEC_KEY_3 (1<<2)
711 #define SEC_KEY_4 (1<<3)
712 #define SEC_ACTIVE_KEY (1<<4)
713 #define SEC_AUTH_MODE (1<<5)
714 #define SEC_UNICAST_GROUP (1<<6)
715 #define SEC_LEVEL (1<<7)
716 #define SEC_ENABLED (1<<8)
718 #define SEC_LEVEL_0 0 /* None */
719 #define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */
720 #define SEC_LEVEL_2 2 /* Level 1 + TKIP */
721 #define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */
722 #define SEC_LEVEL_3 4 /* Level 2 + CCMP */
724 #define WEP_KEYS 4
725 #define WEP_KEY_LEN 13
727 #define WEP_KEY_LEN_MODIF 32
729 struct ieee80211_security {
730 u16 active_key:2,
731 enabled:1,
732 auth_mode:2,
733 auth_algo:4,
734 unicast_uses_group:1;
735 u8 key_sizes[WEP_KEYS];
736 u8 keys[WEP_KEYS][WEP_KEY_LEN_MODIF];
737 u8 level;
738 u16 flags;
739 } __attribute__ ((packed));
744 802.11 data frame from AP
746 ,-------------------------------------------------------------------.
747 Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
748 |------|------|---------|---------|---------|------|---------|------|
749 Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs |
750 | | tion | (BSSID) | | | ence | data | |
751 `-------------------------------------------------------------------'
753 Total: 28-2340 bytes
757 struct ieee80211_header_data {
758 u16 frame_ctl;
759 u16 duration_id;
760 u8 addr1[6];
761 u8 addr2[6];
762 u8 addr3[6];
763 u16 seq_ctrl;
766 #define BEACON_PROBE_SSID_ID_POSITION 12
768 /* Management Frame Information Element Types */
769 #define MFIE_TYPE_SSID 0
770 #define MFIE_TYPE_RATES 1
771 #define MFIE_TYPE_FH_SET 2
772 #define MFIE_TYPE_DS_SET 3
773 #define MFIE_TYPE_CF_SET 4
774 #define MFIE_TYPE_TIM 5
775 #define MFIE_TYPE_IBSS_SET 6
776 #define MFIE_TYPE_COUNTRY 7 //+YJ,080625
777 #define MFIE_TYPE_CHALLENGE 16
778 #define MFIE_TYPE_ERP 42
779 #define MFIE_TYPE_RSN 48
780 #define MFIE_TYPE_RATES_EX 50
781 #define MFIE_TYPE_GENERIC 221
783 #ifdef ENABLE_DOT11D
784 typedef enum
786 COUNTRY_CODE_FCC = 0,
787 COUNTRY_CODE_IC = 1,
788 COUNTRY_CODE_ETSI = 2,
789 COUNTRY_CODE_SPAIN = 3,
790 COUNTRY_CODE_FRANCE = 4,
791 COUNTRY_CODE_MKK = 5,
792 COUNTRY_CODE_MKK1 = 6,
793 COUNTRY_CODE_ISRAEL = 7,
794 COUNTRY_CODE_TELEC = 8,
795 COUNTRY_CODE_GLOBAL_DOMAIN = 9,
796 COUNTRY_CODE_WORLD_WIDE_13_INDEX = 10
797 }country_code_type_t;
798 #endif
800 struct ieee80211_info_element_hdr {
801 u8 id;
802 u8 len;
803 } __attribute__ ((packed));
805 struct ieee80211_info_element {
806 u8 id;
807 u8 len;
808 u8 data[0];
809 } __attribute__ ((packed));
812 * These are the data types that can make up management packets
814 u16 auth_algorithm;
815 u16 auth_sequence;
816 u16 beacon_interval;
817 u16 capability;
818 u8 current_ap[ETH_ALEN];
819 u16 listen_interval;
820 struct {
821 u16 association_id:14, reserved:2;
822 } __attribute__ ((packed));
823 u32 time_stamp[2];
824 u16 reason;
825 u16 status;
828 #define IEEE80211_DEFAULT_TX_ESSID "Penguin"
829 #define IEEE80211_DEFAULT_BASIC_RATE 10
831 struct ieee80211_authentication {
832 struct ieee80211_header_data header;
833 u16 algorithm;
834 u16 transaction;
835 u16 status;
836 //struct ieee80211_info_element_hdr info_element;
837 } __attribute__ ((packed));
840 struct ieee80211_probe_response {
841 struct ieee80211_header_data header;
842 u32 time_stamp[2];
843 u16 beacon_interval;
844 u16 capability;
845 struct ieee80211_info_element info_element;
846 } __attribute__ ((packed));
848 struct ieee80211_probe_request {
849 struct ieee80211_header_data header;
850 /*struct ieee80211_info_element info_element;*/
851 } __attribute__ ((packed));
853 struct ieee80211_assoc_request_frame {
854 struct ieee80211_hdr_3addr header;
855 u16 capability;
856 u16 listen_interval;
857 //u8 current_ap[ETH_ALEN];
858 struct ieee80211_info_element_hdr info_element;
859 } __attribute__ ((packed));
861 struct ieee80211_assoc_response_frame {
862 struct ieee80211_hdr_3addr header;
863 u16 capability;
864 u16 status;
865 u16 aid;
866 struct ieee80211_info_element info_element; /* supported rates */
867 } __attribute__ ((packed));
869 struct ieee80211_disassoc_frame{
870 struct ieee80211_hdr_3addr header;
871 u16 reasoncode;
872 }__attribute__ ((packed));
874 struct ieee80211_txb {
875 u8 nr_frags;
876 u8 encrypted;
877 u16 reserved;
878 u16 frag_size;
879 u16 payload_size;
880 struct sk_buff *fragments[0];
883 struct ieee80211_wmm_ac_param {
884 u8 ac_aci_acm_aifsn;
885 u8 ac_ecwmin_ecwmax;
886 u16 ac_txop_limit;
889 struct ieee80211_wmm_ts_info {
890 u8 ac_dir_tid;
891 u8 ac_up_psb;
892 u8 reserved;
893 } __attribute__ ((packed));
895 struct ieee80211_wmm_tspec_elem {
896 struct ieee80211_wmm_ts_info ts_info;
897 u16 norm_msdu_size;
898 u16 max_msdu_size;
899 u32 min_serv_inter;
900 u32 max_serv_inter;
901 u32 inact_inter;
902 u32 suspen_inter;
903 u32 serv_start_time;
904 u32 min_data_rate;
905 u32 mean_data_rate;
906 u32 peak_data_rate;
907 u32 max_burst_size;
908 u32 delay_bound;
909 u32 min_phy_rate;
910 u16 surp_band_allow;
911 u16 medium_time;
912 }__attribute__((packed));
914 enum {WMM_all_frame, WMM_two_frame, WMM_four_frame, WMM_six_frame};
915 #define MAX_SP_Len (WMM_all_frame << 4)
916 #define IEEE80211_QOS_TID 0x0f
917 #define QOS_CTL_NOTCONTAIN_ACK (0x01 << 5)
919 /* SWEEP TABLE ENTRIES NUMBER*/
920 #define MAX_SWEEP_TAB_ENTRIES 42
921 #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7
922 /* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
923 * only use 8, and then use extended rates for the remaining supported
924 * rates. Other APs, however, stick all of their supported rates on the
925 * main rates information element... */
926 #define MAX_RATES_LENGTH ((u8)12)
927 #define MAX_RATES_EX_LENGTH ((u8)16)
928 #define MAX_NETWORK_COUNT 128
929 //#define MAX_CHANNEL_NUMBER 161
930 #define MAX_CHANNEL_NUMBER 165 //YJ,modified,080625
931 #define MAX_IE_LEN 0xFF //+YJ,080625
933 typedef struct _CHANNEL_LIST{
934 u8 Channel[MAX_CHANNEL_NUMBER + 1];
935 u8 Len;
936 }CHANNEL_LIST, *PCHANNEL_LIST;
938 #define IEEE80211_SOFTMAC_SCAN_TIME 100//400
939 //(HZ / 2)
940 //by amy for ps
941 #define IEEE80211_WATCH_DOG_TIME 2000
942 //by amy for ps
943 //by amy for antenna
944 #define ANTENNA_DIVERSITY_TIMER_PERIOD 1000 // 1000 m
945 //by amy for antenna
946 #define IEEE80211_SOFTMAC_ASSOC_RETRY_TIME (HZ * 2)
948 #define CRC_LENGTH 4U
950 #define MAX_WPA_IE_LEN 64
952 #define NETWORK_EMPTY_ESSID (1<<0)
953 #define NETWORK_HAS_OFDM (1<<1)
954 #define NETWORK_HAS_CCK (1<<2)
956 #define IEEE80211_DTIM_MBCAST 4
957 #define IEEE80211_DTIM_UCAST 2
958 #define IEEE80211_DTIM_VALID 1
959 #define IEEE80211_DTIM_INVALID 0
961 #define IEEE80211_PS_DISABLED 0
962 #define IEEE80211_PS_UNICAST IEEE80211_DTIM_UCAST
963 #define IEEE80211_PS_MBCAST IEEE80211_DTIM_MBCAST
964 #define IEEE80211_PS_ENABLE IEEE80211_DTIM_VALID
965 //added by David for QoS 2006/6/30
966 //#define WMM_Hang_8187
967 #ifdef WMM_Hang_8187
968 #undef WMM_Hang_8187
969 #endif
971 #define WME_AC_BE 0x00
972 #define WME_AC_BK 0x01
973 #define WME_AC_VI 0x02
974 #define WME_AC_VO 0x03
975 #define WME_ACI_MASK 0x03
976 #define WME_AIFSN_MASK 0x03
977 #define WME_AC_PRAM_LEN 16
979 //UP Mapping to AC, using in MgntQuery_SequenceNumber() and maybe for DSCP
980 //#define UP2AC(up) ((up<3) ? ((up==0)?1:0) : (up>>1))
981 #define UP2AC(up) ( \
982 ((up) < 1) ? WME_AC_BE : \
983 ((up) < 3) ? WME_AC_BK : \
984 ((up) < 4) ? WME_AC_BE : \
985 ((up) < 6) ? WME_AC_VI : \
986 WME_AC_VO)
987 //AC Mapping to UP, using in Tx part for selecting the corresponding TX queue
988 #define AC2UP(_ac) ( \
989 ((_ac) == WME_AC_VO) ? 6 : \
990 ((_ac) == WME_AC_VI) ? 5 : \
991 ((_ac) == WME_AC_BK) ? 1 : \
994 #define ETHER_ADDR_LEN 6 /* length of an Ethernet address */
995 struct ether_header {
996 u8 ether_dhost[ETHER_ADDR_LEN];
997 u8 ether_shost[ETHER_ADDR_LEN];
998 u16 ether_type;
999 } __attribute__((packed));
1001 #ifndef ETHERTYPE_PAE
1002 #define ETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */
1003 #endif
1004 #ifndef ETHERTYPE_IP
1005 #define ETHERTYPE_IP 0x0800 /* IP protocol */
1006 #endif
1008 struct ieee80211_network {
1009 /* These entries are used to identify a unique network */
1010 u8 bssid[ETH_ALEN];
1011 u8 channel;
1012 /* Ensure null-terminated for any debug msgs */
1013 u8 ssid[IW_ESSID_MAX_SIZE + 1];
1014 u8 ssid_len;
1016 /* These are network statistics */
1017 struct ieee80211_rx_stats stats;
1018 u16 capability;
1019 u8 rates[MAX_RATES_LENGTH];
1020 u8 rates_len;
1021 u8 rates_ex[MAX_RATES_EX_LENGTH];
1022 u8 rates_ex_len;
1023 unsigned long last_scanned;
1024 u8 mode;
1025 u8 flags;
1026 u32 last_associate;
1027 u32 time_stamp[2];
1028 u16 beacon_interval;
1029 u16 listen_interval;
1030 u16 atim_window;
1031 u8 wpa_ie[MAX_WPA_IE_LEN];
1032 size_t wpa_ie_len;
1033 u8 rsn_ie[MAX_WPA_IE_LEN];
1034 size_t rsn_ie_len;
1035 u8 dtim_period;
1036 u8 dtim_data;
1037 u32 last_dtim_sta_time[2];
1038 struct list_head list;
1039 //appeded for QoS
1040 u8 wmm_info;
1041 struct ieee80211_wmm_ac_param wmm_param[4];
1042 u8 QoS_Enable;
1043 u8 SignalStrength;
1044 //by amy 080312
1045 u8 HighestOperaRate;
1046 //by amy 080312
1047 #ifdef THOMAS_TURBO
1048 u8 Turbo_Enable;//enable turbo mode, added by thomas
1049 #endif
1050 #ifdef ENABLE_DOT11D
1051 u16 CountryIeLen;
1052 u8 CountryIeBuf[MAX_IE_LEN];
1053 #endif
1056 enum ieee80211_state {
1058 /* the card is not linked at all */
1059 IEEE80211_NOLINK = 0,
1061 /* IEEE80211_ASSOCIATING* are for BSS client mode
1062 * the driver shall not perform RX filtering unless
1063 * the state is LINKED.
1064 * The driver shall just check for the state LINKED and
1065 * defaults to NOLINK for ALL the other states (including
1066 * LINKED_SCANNING)
1069 /* the association procedure will start (wq scheduling)*/
1070 IEEE80211_ASSOCIATING,
1071 IEEE80211_ASSOCIATING_RETRY,
1073 /* the association procedure is sending AUTH request*/
1074 IEEE80211_ASSOCIATING_AUTHENTICATING,
1076 /* the association procedure has successfully authentcated
1077 * and is sending association request
1079 IEEE80211_ASSOCIATING_AUTHENTICATED,
1081 /* the link is ok. the card associated to a BSS or linked
1082 * to a ibss cell or acting as an AP and creating the bss
1084 IEEE80211_LINKED,
1086 /* same as LINKED, but the driver shall apply RX filter
1087 * rules as we are in NO_LINK mode. As the card is still
1088 * logically linked, but it is doing a syncro site survey
1089 * then it will be back to LINKED state.
1091 IEEE80211_LINKED_SCANNING,
1095 #define DEFAULT_MAX_SCAN_AGE (15 * HZ)
1096 #define DEFAULT_FTS 2346
1097 #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
1098 #define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5]
1101 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
1102 extern inline int is_multicast_ether_addr(const u8 *addr)
1104 return ((addr[0] != 0xff) && (0x01 & addr[0]));
1106 #endif
1108 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
1109 extern inline int is_broadcast_ether_addr(const u8 *addr)
1111 return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
1112 (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
1114 #endif
1116 #define CFG_IEEE80211_RESERVE_FCS (1<<0)
1117 #define CFG_IEEE80211_COMPUTE_FCS (1<<1)
1119 typedef struct tx_pending_t{
1120 int frag;
1121 struct ieee80211_txb *txb;
1122 }tx_pending_t;
1125 struct ieee80211_device {
1126 struct net_device *dev;
1128 /* Bookkeeping structures */
1129 struct net_device_stats stats;
1130 struct ieee80211_stats ieee_stats;
1131 struct ieee80211_softmac_stats softmac_stats;
1133 /* Probe / Beacon management */
1134 struct list_head network_free_list;
1135 struct list_head network_list;
1136 struct ieee80211_network *networks;
1137 int scans;
1138 int scan_age;
1140 int iw_mode; /* operating mode (IW_MODE_*) */
1142 spinlock_t lock;
1143 spinlock_t wpax_suitlist_lock;
1145 int tx_headroom; /* Set to size of any additional room needed at front
1146 * of allocated Tx SKBs */
1147 u32 config;
1149 /* WEP and other encryption related settings at the device level */
1150 int open_wep; /* Set to 1 to allow unencrypted frames */
1152 int reset_on_keychange; /* Set to 1 if the HW needs to be reset on
1153 * WEP key changes */
1155 /* If the host performs {en,de}cryption, then set to 1 */
1156 int host_encrypt;
1157 int host_decrypt;
1158 int ieee802_1x; /* is IEEE 802.1X used */
1160 /* WPA data */
1161 int wpa_enabled;
1162 int drop_unencrypted;
1163 int tkip_countermeasures;
1164 int privacy_invoked;
1165 size_t wpa_ie_len;
1166 u8 *wpa_ie;
1168 u8 ap_mac_addr[6];
1169 u16 pairwise_key_type;
1170 u16 broadcast_key_type;
1172 struct list_head crypt_deinit_list;
1173 struct ieee80211_crypt_data *crypt[WEP_KEYS];
1174 int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */
1175 struct timer_list crypt_deinit_timer;
1177 int bcrx_sta_key; /* use individual keys to override default keys even
1178 * with RX of broad/multicast frames */
1180 /* Fragmentation structures */
1181 // each streaming contain a entry
1182 struct ieee80211_frag_entry frag_cache[17][IEEE80211_FRAG_CACHE_LEN];
1183 unsigned int frag_next_idx[17];
1184 u16 fts; /* Fragmentation Threshold */
1186 /* This stores infos for the current network.
1187 * Either the network we are associated in INFRASTRUCTURE
1188 * or the network that we are creating in MASTER mode.
1189 * ad-hoc is a mixture ;-).
1190 * Note that in infrastructure mode, even when not associated,
1191 * fields bssid and essid may be valid (if wpa_set and essid_set
1192 * are true) as thy carry the value set by the user via iwconfig
1194 struct ieee80211_network current_network;
1197 enum ieee80211_state state;
1199 int short_slot;
1200 int mode; /* A, B, G */
1201 int modulation; /* CCK, OFDM */
1202 int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
1203 int abg_true; /* ABG flag */
1205 /* used for forcing the ibss workqueue to terminate
1206 * without wait for the syncro scan to terminate
1208 short sync_scan_hurryup;
1210 #ifdef ENABLE_DOT11D
1211 void * pDot11dInfo;
1212 bool bGlobalDomain;
1214 // For Liteon Ch12~13 passive scan
1215 u8 MinPassiveChnlNum;
1216 u8 IbssStartChnl;
1217 #else
1218 /* map of allowed channels. 0 is dummy */
1219 // FIXME: remeber to default to a basic channel plan depending of the PHY type
1220 int channel_map[MAX_CHANNEL_NUMBER+1];
1221 #endif
1223 int rate; /* current rate */
1224 int basic_rate;
1225 //FIXME: pleace callback, see if redundant with softmac_features
1226 short active_scan;
1228 /* this contains flags for selectively enable softmac support */
1229 u16 softmac_features;
1231 /* if the sequence control field is not filled by HW */
1232 u16 seq_ctrl[5];
1234 /* association procedure transaction sequence number */
1235 u16 associate_seq;
1237 /* AID for RTXed association responses */
1238 u16 assoc_id;
1240 /* power save mode related*/
1241 short ps;
1242 short sta_sleep;
1243 int ps_timeout;
1244 struct tasklet_struct ps_task;
1245 u32 ps_th;
1246 u32 ps_tl;
1248 short raw_tx;
1249 /* used if IEEE_SOFTMAC_TX_QUEUE is set */
1250 short queue_stop;
1251 short scanning;
1252 short proto_started;
1254 struct semaphore wx_sem;
1255 struct semaphore scan_sem;
1257 spinlock_t mgmt_tx_lock;
1258 spinlock_t beacon_lock;
1260 short beacon_txing;
1262 short wap_set;
1263 short ssid_set;
1265 u8 wpax_type_set; //{added by David, 2006.9.28}
1266 u32 wpax_type_notify; //{added by David, 2006.9.26}
1268 /* QoS related flag */
1269 char init_wmmparam_flag;
1271 /* for discarding duplicated packets in IBSS */
1272 struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
1274 /* for discarding duplicated packets in BSS */
1275 u16 last_rxseq_num[17]; /* rx seq previous per-tid */
1276 u16 last_rxfrag_num[17];/* tx frag previous per-tid */
1277 unsigned long last_packet_time[17];
1279 /* for PS mode */
1280 unsigned long last_rx_ps_time;
1282 /* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
1283 struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
1284 int mgmt_queue_head;
1285 int mgmt_queue_tail;
1288 /* used if IEEE_SOFTMAC_TX_QUEUE is set */
1289 struct tx_pending_t tx_pending;
1291 /* used if IEEE_SOFTMAC_ASSOCIATE is set */
1292 struct timer_list associate_timer;
1294 /* used if IEEE_SOFTMAC_BEACONS is set */
1295 struct timer_list beacon_timer;
1297 struct work_struct associate_complete_wq;
1298 // struct work_struct associate_retry_wq;
1299 struct work_struct associate_procedure_wq;
1300 // struct work_struct softmac_scan_wq;
1301 struct work_struct wx_sync_scan_wq;
1302 struct work_struct wmm_param_update_wq;
1303 struct work_struct ps_request_tx_ack_wq;//for ps
1304 // struct work_struct hw_wakeup_wq;
1305 // struct work_struct hw_sleep_wq;
1306 // struct work_struct watch_dog_wq;
1307 bool bInactivePs;
1308 bool actscanning;
1309 bool beinretry;
1310 u16 ListenInterval;
1311 unsigned long NumRxDataInPeriod; //YJ,add,080828
1312 unsigned long NumRxBcnInPeriod; //YJ,add,080828
1313 unsigned long NumRxOkTotal;
1314 unsigned long NumRxUnicast;//YJ,add,080828,for keep alive
1315 bool bHwRadioOff;
1316 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1317 struct delayed_work softmac_scan_wq;
1318 struct delayed_work associate_retry_wq;
1319 struct delayed_work hw_wakeup_wq;
1320 struct delayed_work hw_sleep_wq;//+by amy 080324
1321 struct delayed_work watch_dog_wq;
1322 struct delayed_work sw_antenna_wq;
1323 struct delayed_work start_ibss_wq;
1324 //by amy for rate adaptive 080312
1325 struct delayed_work rate_adapter_wq;
1326 //by amy for rate adaptive
1327 struct delayed_work hw_dig_wq;
1328 struct delayed_work tx_pw_wq;
1330 //Added for RF power on power off by lizhaoming 080512
1331 struct delayed_work GPIOChangeRFWorkItem;
1332 #else
1334 struct work_struct start_ibss_wq;
1335 struct work_struct softmac_scan_wq;
1336 struct work_struct associate_retry_wq;
1337 struct work_struct hw_wakeup_wq;
1338 struct work_struct hw_sleep_wq;
1339 struct work_struct watch_dog_wq;
1340 struct work_struct sw_antenna_wq;
1341 //by amy for rate adaptive 080312
1342 struct work_struct rate_adapter_wq;
1343 //by amy for rate adaptive
1344 struct work_struct hw_dig_wq;
1345 struct work_struct tx_pw_wq;
1347 //Added for RF power on power off by lizhaoming 080512
1348 struct work_struct GPIOChangeRFWorkItem;
1349 #endif
1350 struct workqueue_struct *wq;
1352 /* Callback functions */
1353 void (*set_security)(struct net_device *dev,
1354 struct ieee80211_security *sec);
1356 /* Used to TX data frame by using txb structs.
1357 * this is not used if in the softmac_features
1358 * is set the flag IEEE_SOFTMAC_TX_QUEUE
1360 int (*hard_start_xmit)(struct ieee80211_txb *txb,
1361 struct net_device *dev);
1363 int (*reset_port)(struct net_device *dev);
1365 /* Softmac-generated frames (mamagement) are TXed via this
1366 * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
1367 * not set. As some cards may have different HW queues that
1368 * one might want to use for data and management frames
1369 * the option to have two callbacks might be useful.
1370 * This fucntion can't sleep.
1372 int (*softmac_hard_start_xmit)(struct sk_buff *skb,
1373 struct net_device *dev);
1375 /* used instead of hard_start_xmit (not softmac_hard_start_xmit)
1376 * if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
1377 * frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
1378 * then also management frames are sent via this callback.
1379 * This function can't sleep.
1381 void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
1382 struct net_device *dev,int rate);
1384 /* stops the HW queue for DATA frames. Useful to avoid
1385 * waste time to TX data frame when we are reassociating
1386 * This function can sleep.
1388 void (*data_hard_stop)(struct net_device *dev);
1390 /* OK this is complementar to data_poll_hard_stop */
1391 void (*data_hard_resume)(struct net_device *dev);
1393 /* ask to the driver to retune the radio .
1394 * This function can sleep. the driver should ensure
1395 * the radio has been swithced before return.
1397 void (*set_chan)(struct net_device *dev,short ch);
1399 /* These are not used if the ieee stack takes care of
1400 * scanning (IEEE_SOFTMAC_SCAN feature set).
1401 * In this case only the set_chan is used.
1403 * The syncro version is similar to the start_scan but
1404 * does not return until all channels has been scanned.
1405 * this is called in user context and should sleep,
1406 * it is called in a work_queue when swithcing to ad-hoc mode
1407 * or in behalf of iwlist scan when the card is associated
1408 * and root user ask for a scan.
1409 * the fucntion stop_scan should stop both the syncro and
1410 * background scanning and can sleep.
1411 * The fucntion start_scan should initiate the background
1412 * scanning and can't sleep.
1414 void (*scan_syncro)(struct net_device *dev);
1415 void (*start_scan)(struct net_device *dev);
1416 void (*stop_scan)(struct net_device *dev);
1418 /* indicate the driver that the link state is changed
1419 * for example it may indicate the card is associated now.
1420 * Driver might be interested in this to apply RX filter
1421 * rules or simply light the LINK led
1423 void (*link_change)(struct net_device *dev);
1425 /* these two function indicates to the HW when to start
1426 * and stop to send beacons. This is used when the
1427 * IEEE_SOFTMAC_BEACONS is not set. For now the
1428 * stop_send_bacons is NOT guaranteed to be called only
1429 * after start_send_beacons.
1431 void (*start_send_beacons) (struct net_device *dev);
1432 void (*stop_send_beacons) (struct net_device *dev);
1434 /* power save mode related */
1435 void (*sta_wake_up) (struct net_device *dev);
1436 void (*ps_request_tx_ack) (struct net_device *dev);
1437 void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl);
1438 short (*ps_is_queue_empty) (struct net_device *dev);
1440 /* QoS related */
1441 //void (*wmm_param_update) (struct net_device *dev, u8 *ac_param);
1442 //void (*wmm_param_update) (struct ieee80211_device *ieee);
1444 /* This must be the last item so that it points to the data
1445 * allocated beyond this structure by alloc_ieee80211 */
1446 u8 priv[0];
1449 #define IEEE_A (1<<0)
1450 #define IEEE_B (1<<1)
1451 #define IEEE_G (1<<2)
1452 #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G)
1454 /* Generate a 802.11 header */
1456 /* Uses the channel change callback directly
1457 * instead of [start/stop] scan callbacks
1459 #define IEEE_SOFTMAC_SCAN (1<<2)
1461 /* Perform authentication and association handshake */
1462 #define IEEE_SOFTMAC_ASSOCIATE (1<<3)
1464 /* Generate probe requests */
1465 #define IEEE_SOFTMAC_PROBERQ (1<<4)
1467 /* Generate respones to probe requests */
1468 #define IEEE_SOFTMAC_PROBERS (1<<5)
1470 /* The ieee802.11 stack will manages the netif queue
1471 * wake/stop for the driver, taking care of 802.11
1472 * fragmentation. See softmac.c for details. */
1473 #define IEEE_SOFTMAC_TX_QUEUE (1<<7)
1475 /* Uses only the softmac_data_hard_start_xmit
1476 * even for TX management frames.
1478 #define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
1480 /* Generate beacons. The stack will enqueue beacons
1481 * to the card
1483 #define IEEE_SOFTMAC_BEACONS (1<<6)
1487 static inline void *ieee80211_priv(struct net_device *dev)
1489 return ((struct ieee80211_device *)netdev_priv(dev))->priv;
1492 extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
1494 /* Single white space is for Linksys APs */
1495 if (essid_len == 1 && essid[0] == ' ')
1496 return 1;
1498 /* Otherwise, if the entire essid is 0, we assume it is hidden */
1499 while (essid_len) {
1500 essid_len--;
1501 if (essid[essid_len] != '\0')
1502 return 0;
1505 return 1;
1508 extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
1511 * It is possible for both access points and our device to support
1512 * combinations of modes, so as long as there is one valid combination
1513 * of ap/device supported modes, then return success
1516 if ((mode & IEEE_A) &&
1517 (ieee->modulation & IEEE80211_OFDM_MODULATION) &&
1518 (ieee->freq_band & IEEE80211_52GHZ_BAND))
1519 return 1;
1521 if ((mode & IEEE_G) &&
1522 (ieee->modulation & IEEE80211_OFDM_MODULATION) &&
1523 (ieee->freq_band & IEEE80211_24GHZ_BAND))
1524 return 1;
1526 if ((mode & IEEE_B) &&
1527 (ieee->modulation & IEEE80211_CCK_MODULATION) &&
1528 (ieee->freq_band & IEEE80211_24GHZ_BAND))
1529 return 1;
1531 return 0;
1534 extern inline int ieee80211_get_hdrlen(u16 fc)
1536 int hdrlen = 24;
1538 switch (WLAN_FC_GET_TYPE(fc)) {
1539 case IEEE80211_FTYPE_DATA:
1540 if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS))
1541 hdrlen = 30; /* Addr4 */
1542 if(IEEE80211_QOS_HAS_SEQ(fc))
1543 hdrlen += 2; /* QOS ctrl*/
1544 break;
1545 case IEEE80211_FTYPE_CTL:
1546 switch (WLAN_FC_GET_STYPE(fc)) {
1547 case IEEE80211_STYPE_CTS:
1548 case IEEE80211_STYPE_ACK:
1549 hdrlen = 10;
1550 break;
1551 default:
1552 hdrlen = 16;
1553 break;
1555 break;
1558 return hdrlen;
1563 /* ieee80211.c */
1564 extern void free_ieee80211(struct net_device *dev);
1565 extern struct net_device *alloc_ieee80211(int sizeof_priv);
1567 extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
1569 /* ieee80211_tx.c */
1571 extern int ieee80211_encrypt_fragment(
1572 struct ieee80211_device *ieee,
1573 struct sk_buff *frag,
1574 int hdr_len);
1576 extern int ieee80211_xmit(struct sk_buff *skb,
1577 struct net_device *dev);
1578 extern void ieee80211_txb_free(struct ieee80211_txb *);
1581 /* ieee80211_rx.c */
1582 extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
1583 struct ieee80211_rx_stats *rx_stats);
1584 extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
1585 struct ieee80211_hdr *header,
1586 struct ieee80211_rx_stats *stats);
1588 /* ieee80211_wx.c */
1589 extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
1590 struct iw_request_info *info,
1591 union iwreq_data *wrqu, char *key);
1592 extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
1593 struct iw_request_info *info,
1594 union iwreq_data *wrqu, char *key);
1595 extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
1596 struct iw_request_info *info,
1597 union iwreq_data *wrqu, char *key);
1598 extern int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
1599 struct iw_request_info *info,
1600 union iwreq_data* wrqu, char *extra);
1601 int ieee80211_wx_set_auth(struct ieee80211_device *ieee,
1602 struct iw_request_info *info,
1603 struct iw_param *data, char *extra);
1604 int ieee80211_wx_set_mlme(struct ieee80211_device *ieee,
1605 struct iw_request_info *info,
1606 union iwreq_data *wrqu, char *extra);
1608 int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len);
1609 /* ieee80211_softmac.c */
1610 extern short ieee80211_is_54g(struct ieee80211_network net);
1611 extern short ieee80211_is_shortslot(struct ieee80211_network net);
1612 extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
1613 struct ieee80211_rx_stats *rx_stats, u16 type,
1614 u16 stype);
1615 extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
1617 extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
1618 extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
1619 extern void ieee80211_start_bss(struct ieee80211_device *ieee);
1620 extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
1621 extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
1622 extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
1623 extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
1624 extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
1625 extern void ieee80211_disassociate(struct ieee80211_device *ieee);
1626 extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
1627 extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
1628 extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
1629 extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
1630 extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
1631 extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
1632 extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
1633 extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
1634 extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
1635 extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
1636 extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
1637 extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
1638 extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
1639 extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
1640 extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
1641 extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
1642 extern void SendDisassociation(struct ieee80211_device *ieee,u8* asSta,u8 asRsn);
1643 extern void ieee80211_start_scan(struct ieee80211_device *ieee);
1645 //Add for RF power on power off by lizhaoming 080512
1646 extern void SendDisassociation(struct ieee80211_device *ieee,
1647 u8* asSta,
1648 u8 asRsn);
1650 /* ieee80211_crypt_ccmp&tkip&wep.c */
1651 extern void ieee80211_tkip_null(void);
1652 extern void ieee80211_wep_null(void);
1653 extern void ieee80211_ccmp_null(void);
1654 /* ieee80211_softmac_wx.c */
1656 extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
1657 struct iw_request_info *info,
1658 union iwreq_data *wrqu, char *ext);
1660 extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
1661 struct iw_request_info *info,
1662 union iwreq_data *awrq,
1663 char *extra);
1665 extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
1667 extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
1668 struct iw_request_info *info,
1669 union iwreq_data *wrqu, char *extra);
1671 extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
1672 struct iw_request_info *info,
1673 union iwreq_data *wrqu, char *extra);
1675 extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
1676 union iwreq_data *wrqu, char *b);
1678 extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
1679 union iwreq_data *wrqu, char *b);
1681 extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
1682 struct iw_request_info *a,
1683 union iwreq_data *wrqu, char *extra);
1685 extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
1686 union iwreq_data *wrqu, char *b);
1688 extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
1689 union iwreq_data *wrqu, char *b);
1691 extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
1692 union iwreq_data *wrqu, char *b);
1693 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
1694 extern void ieee80211_wx_sync_scan_wq(struct work_struct *work);
1695 #else
1696 extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
1697 #endif
1698 //extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
1700 extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
1701 struct iw_request_info *info,
1702 union iwreq_data *wrqu, char *extra);
1704 extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
1705 struct iw_request_info *info,
1706 union iwreq_data *wrqu, char *extra);
1708 extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
1709 struct iw_request_info *info,
1710 union iwreq_data *wrqu, char *extra);
1712 extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
1713 struct iw_request_info *info,
1714 union iwreq_data *wrqu, char *extra);
1716 extern void ieee80211_softmac_ips_scan_syncro(struct ieee80211_device *ieee);
1718 extern void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr);
1720 extern const long ieee80211_wlan_frequencies[];
1722 extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
1724 ieee->scans++;
1727 extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
1729 return ieee->scans;
1732 static inline const char *escape_essid(const char *essid, u8 essid_len) {
1733 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
1734 const char *s = essid;
1735 char *d = escaped;
1737 if (ieee80211_is_empty_essid(essid, essid_len)) {
1738 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
1739 return escaped;
1742 essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE);
1743 while (essid_len--) {
1744 if (*s == '\0') {
1745 *d++ = '\\';
1746 *d++ = '0';
1747 s++;
1748 } else {
1749 *d++ = *s++;
1752 *d = '\0';
1753 return escaped;
1755 #endif /* IEEE80211_H */