123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773 |
- #ifndef __IEEE80211_H
- #define __IEEE80211_H
- #include "osdep_service.h"
- #include "drv_types.h"
- #include "wifi.h"
- #include <linux/wireless.h>
- #define MGMT_QUEUE_NUM 5
- #define ETH_ALEN 6
- #define IEEE_CMD_SET_WPA_PARAM 1
- #define IEEE_CMD_SET_WPA_IE 2
- #define IEEE_CMD_SET_ENCRYPTION 3
- #define IEEE_CMD_MLME 4
- #define IEEE_PARAM_WPA_ENABLED 1
- #define IEEE_PARAM_TKIP_COUNTERMEASURES 2
- #define IEEE_PARAM_DROP_UNENCRYPTED 3
- #define IEEE_PARAM_PRIVACY_INVOKED 4
- #define IEEE_PARAM_AUTH_ALGS 5
- #define IEEE_PARAM_IEEE_802_1X 6
- #define IEEE_PARAM_WPAX_SELECT 7
- #define AUTH_ALG_OPEN_SYSTEM 0x1
- #define AUTH_ALG_SHARED_KEY 0x2
- #define AUTH_ALG_LEAP 0x00000004
- #define IEEE_MLME_STA_DEAUTH 1
- #define IEEE_MLME_STA_DISASSOC 2
- #define IEEE_CRYPT_ERR_UNKNOWN_ALG 2
- #define IEEE_CRYPT_ERR_UNKNOWN_ADDR 3
- #define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED 4
- #define IEEE_CRYPT_ERR_KEY_SET_FAILED 5
- #define IEEE_CRYPT_ERR_TX_KEY_SET_FAILED 6
- #define IEEE_CRYPT_ERR_CARD_CONF_FAILED 7
- #define IEEE_CRYPT_ALG_NAME_LEN 16
- #define WPA_CIPHER_NONE BIT(0)
- #define WPA_CIPHER_WEP40 BIT(1)
- #define WPA_CIPHER_WEP104 BIT(2)
- #define WPA_CIPHER_TKIP BIT(3)
- #define WPA_CIPHER_CCMP BIT(4)
- #define WPA_SELECTOR_LEN 4
- #define RSN_HEADER_LEN 4
- #define RSN_SELECTOR_LEN 4
- enum NETWORK_TYPE {
- WIRELESS_INVALID = 0,
- WIRELESS_11B = 1,
- WIRELESS_11G = 2,
- WIRELESS_11BG = (WIRELESS_11B | WIRELESS_11G),
- WIRELESS_11A = 4,
- WIRELESS_11N = 8,
- WIRELESS_11GN = (WIRELESS_11G | WIRELESS_11N),
- WIRELESS_11BGN = (WIRELESS_11B | WIRELESS_11G | WIRELESS_11N),
- };
- struct ieee_param {
- u32 cmd;
- u8 sta_addr[ETH_ALEN];
- union {
- struct {
- u8 name;
- u32 value;
- } wpa_param;
- struct {
- u32 len;
- u8 reserved[32];
- u8 data[0];
- } wpa_ie;
- struct {
- int command;
- int reason_code;
- } mlme;
- struct {
- u8 alg[IEEE_CRYPT_ALG_NAME_LEN];
- u8 set_tx;
- u32 err;
- u8 idx;
- u8 seq[8]; /* sequence counter (set: RX, get: TX) */
- u16 key_len;
- u8 key[0];
- } crypt;
- } u;
- };
- #define IEEE80211_DATA_LEN 2304
- /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
- 6.2.1.1.2.
- The figure in section 7.1.2 suggests a body size of up to 2312
- bytes is allowed, which is a bit confusing, I suspect this
- represents the 2304 bytes of real data, plus a possible 8 bytes of
- WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
- #define IEEE80211_HLEN 30
- #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
- /* this is stolen from ipw2200 driver */
- #define IEEE_IBSS_MAC_HASH_SIZE 31
- struct ieee_ibss_seq {
- u8 mac[ETH_ALEN];
- u16 seq_num;
- u16 frag_num;
- unsigned int packet_time;
- struct list_head list;
- };
- struct ieee80211_hdr {
- u16 frame_ctl;
- u16 duration_id;
- u8 addr1[ETH_ALEN];
- u8 addr2[ETH_ALEN];
- u8 addr3[ETH_ALEN];
- u16 seq_ctl;
- u8 addr4[ETH_ALEN];
- } __attribute__ ((packed));
- struct ieee80211_hdr_3addr {
- u16 frame_ctl;
- u16 duration_id;
- u8 addr1[ETH_ALEN];
- u8 addr2[ETH_ALEN];
- u8 addr3[ETH_ALEN];
- u16 seq_ctl;
- } __attribute__ ((packed));
- struct ieee80211_hdr_qos {
- u16 frame_ctl;
- u16 duration_id;
- u8 addr1[ETH_ALEN];
- u8 addr2[ETH_ALEN];
- u8 addr3[ETH_ALEN];
- u16 seq_ctl;
- u8 addr4[ETH_ALEN];
- u16 qc;
- } __attribute__ ((packed));
- struct ieee80211_hdr_3addr_qos {
- u16 frame_ctl;
- u16 duration_id;
- u8 addr1[ETH_ALEN];
- u8 addr2[ETH_ALEN];
- u8 addr3[ETH_ALEN];
- u16 seq_ctl;
- u16 qc;
- } __attribute__ ((packed));
- struct eapol {
- u8 snap[6];
- u16 ethertype;
- u8 version;
- u8 type;
- u16 length;
- } __attribute__ ((packed));
- enum eap_type {
- EAP_PACKET = 0,
- EAPOL_START,
- EAPOL_LOGOFF,
- EAPOL_KEY,
- EAPOL_ENCAP_ASF_ALERT
- };
- #define IEEE80211_3ADDR_LEN 24
- #define IEEE80211_4ADDR_LEN 30
- #define IEEE80211_FCS_LEN 4
- #define MIN_FRAG_THRESHOLD 256U
- #define MAX_FRAG_THRESHOLD 2346U
- /* Frame control field constants */
- #define IEEE80211_FCTL_VERS 0x0002
- #define IEEE80211_FCTL_FTYPE 0x000c
- #define IEEE80211_FCTL_STYPE 0x00f0
- #define IEEE80211_FCTL_TODS 0x0100
- #define IEEE80211_FCTL_FROMDS 0x0200
- #define IEEE80211_FCTL_MOREFRAGS 0x0400
- #define IEEE80211_FCTL_RETRY 0x0800
- #define IEEE80211_FCTL_PM 0x1000
- #define IEEE80211_FCTL_MOREDATA 0x2000
- #define IEEE80211_FCTL_WEP 0x4000
- #define IEEE80211_FCTL_ORDER 0x8000
- #define IEEE80211_FTYPE_MGMT 0x0000
- #define IEEE80211_FTYPE_CTL 0x0004
- #define IEEE80211_FTYPE_DATA 0x0008
- /* management */
- #define IEEE80211_STYPE_ASSOC_REQ 0x0000
- #define IEEE80211_STYPE_ASSOC_RESP 0x0010
- #define IEEE80211_STYPE_REASSOC_REQ 0x0020
- #define IEEE80211_STYPE_REASSOC_RESP 0x0030
- #define IEEE80211_STYPE_PROBE_REQ 0x0040
- #define IEEE80211_STYPE_PROBE_RESP 0x0050
- #define IEEE80211_STYPE_BEACON 0x0080
- #define IEEE80211_STYPE_ATIM 0x0090
- #define IEEE80211_STYPE_DISASSOC 0x00A0
- #define IEEE80211_STYPE_AUTH 0x00B0
- #define IEEE80211_STYPE_DEAUTH 0x00C0
- /* control */
- #define IEEE80211_STYPE_PSPOLL 0x00A0
- #define IEEE80211_STYPE_RTS 0x00B0
- #define IEEE80211_STYPE_CTS 0x00C0
- #define IEEE80211_STYPE_ACK 0x00D0
- #define IEEE80211_STYPE_CFEND 0x00E0
- #define IEEE80211_STYPE_CFENDACK 0x00F0
- /* data */
- #define IEEE80211_STYPE_DATA 0x0000
- #define IEEE80211_STYPE_DATA_CFACK 0x0010
- #define IEEE80211_STYPE_DATA_CFPOLL 0x0020
- #define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030
- #define IEEE80211_STYPE_NULLFUNC 0x0040
- #define IEEE80211_STYPE_CFACK 0x0050
- #define IEEE80211_STYPE_CFPOLL 0x0060
- #define IEEE80211_STYPE_CFACKPOLL 0x0070
- #define IEEE80211_QOS_DATAGRP 0x0080
- #define IEEE80211_QoS_DATAGRP IEEE80211_QOS_DATAGRP
- #define IEEE80211_SCTL_FRAG 0x000F
- #define IEEE80211_SCTL_SEQ 0xFFF0
- /* QoS,QOS */
- #define NORMAL_ACK 0
- #define NO_ACK 1
- #define NON_EXPLICIT_ACK 2
- #define BLOCK_ACK 3
- #ifndef ETH_P_PAE
- #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
- #endif /* ETH_P_PAE */
- #define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */
- #define ETH_P_ECONET 0x0018
- #ifndef ETH_P_80211_RAW
- #define ETH_P_80211_RAW (ETH_P_ECONET + 1)
- #endif
- /* IEEE 802.11 defines */
- #define P80211_OUI_LEN 3
- struct ieee80211_snap_hdr {
- u8 dsap; /* always 0xAA */
- u8 ssap; /* always 0xAA */
- u8 ctrl; /* always 0x03 */
- u8 oui[P80211_OUI_LEN]; /* organizational universal id */
- } __attribute__ ((packed));
- #define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
- #define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE)
- #define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE)
- #define WLAN_QC_GET_TID(qc) ((qc) & 0x0f)
- #define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG)
- #define WLAN_GET_SEQ_SEQ(seq) ((seq) & IEEE80211_SCTL_SEQ)
- /* Authentication algorithms */
- #define WLAN_AUTH_OPEN 0
- #define WLAN_AUTH_SHARED_KEY 1
- #define WLAN_AUTH_CHALLENGE_LEN 128
- #define WLAN_CAPABILITY_BSS (1<<0)
- #define WLAN_CAPABILITY_IBSS (1<<1)
- #define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
- #define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
- #define WLAN_CAPABILITY_PRIVACY (1<<4)
- #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
- #define WLAN_CAPABILITY_PBCC (1<<6)
- #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
- #define WLAN_CAPABILITY_SHORT_SLOT (1<<10)
- /* Status codes */
- #define WLAN_STATUS_SUCCESS 0
- #define WLAN_STATUS_UNSPECIFIED_FAILURE 1
- #define WLAN_STATUS_CAPS_UNSUPPORTED 10
- #define WLAN_STATUS_REASSOC_NO_ASSOC 11
- #define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12
- #define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13
- #define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14
- #define WLAN_STATUS_CHALLENGE_FAIL 15
- #define WLAN_STATUS_AUTH_TIMEOUT 16
- #define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17
- #define WLAN_STATUS_ASSOC_DENIED_RATES 18
- /* 802.11b */
- #define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19
- #define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20
- #define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21
- /* Reason codes */
- #define WLAN_REASON_UNSPECIFIED 1
- #define WLAN_REASON_PREV_AUTH_NOT_VALID 2
- #define WLAN_REASON_DEAUTH_LEAVING 3
- #define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4
- #define WLAN_REASON_DISASSOC_AP_BUSY 5
- #define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6
- #define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7
- #define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8
- #define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9
- /* Information Element IDs */
- #define WLAN_EID_SSID 0
- #define WLAN_EID_SUPP_RATES 1
- #define WLAN_EID_FH_PARAMS 2
- #define WLAN_EID_DS_PARAMS 3
- #define WLAN_EID_CF_PARAMS 4
- #define WLAN_EID_TIM 5
- #define WLAN_EID_IBSS_PARAMS 6
- #define WLAN_EID_CHALLENGE 16
- #define WLAN_EID_RSN 48
- #define WLAN_EID_GENERIC 221
- #define IEEE80211_MGMT_HDR_LEN 24
- #define IEEE80211_DATA_HDR3_LEN 24
- #define IEEE80211_DATA_HDR4_LEN 30
- #define IEEE80211_STATMASK_SIGNAL (1<<0)
- #define IEEE80211_STATMASK_RSSI (1<<1)
- #define IEEE80211_STATMASK_NOISE (1<<2)
- #define IEEE80211_STATMASK_RATE (1<<3)
- #define IEEE80211_STATMASK_WEMASK 0x7
- #define IEEE80211_CCK_MODULATION (1<<0)
- #define IEEE80211_OFDM_MODULATION (1<<1)
- #define IEEE80211_24GHZ_BAND (1<<0)
- #define IEEE80211_52GHZ_BAND (1<<1)
- #define IEEE80211_CCK_RATE_LEN 4
- #define IEEE80211_NUM_OFDM_RATESLEN 8
- #define IEEE80211_CCK_RATE_1MB 0x02
- #define IEEE80211_CCK_RATE_2MB 0x04
- #define IEEE80211_CCK_RATE_5MB 0x0B
- #define IEEE80211_CCK_RATE_11MB 0x16
- #define IEEE80211_OFDM_RATE_LEN 8
- #define IEEE80211_OFDM_RATE_6MB 0x0C
- #define IEEE80211_OFDM_RATE_9MB 0x12
- #define IEEE80211_OFDM_RATE_12MB 0x18
- #define IEEE80211_OFDM_RATE_18MB 0x24
- #define IEEE80211_OFDM_RATE_24MB 0x30
- #define IEEE80211_OFDM_RATE_36MB 0x48
- #define IEEE80211_OFDM_RATE_48MB 0x60
- #define IEEE80211_OFDM_RATE_54MB 0x6C
- #define IEEE80211_BASIC_RATE_MASK 0x80
- #define IEEE80211_CCK_RATE_1MB_MASK (1<<0)
- #define IEEE80211_CCK_RATE_2MB_MASK (1<<1)
- #define IEEE80211_CCK_RATE_5MB_MASK (1<<2)
- #define IEEE80211_CCK_RATE_11MB_MASK (1<<3)
- #define IEEE80211_OFDM_RATE_6MB_MASK (1<<4)
- #define IEEE80211_OFDM_RATE_9MB_MASK (1<<5)
- #define IEEE80211_OFDM_RATE_12MB_MASK (1<<6)
- #define IEEE80211_OFDM_RATE_18MB_MASK (1<<7)
- #define IEEE80211_OFDM_RATE_24MB_MASK (1<<8)
- #define IEEE80211_OFDM_RATE_36MB_MASK (1<<9)
- #define IEEE80211_OFDM_RATE_48MB_MASK (1<<10)
- #define IEEE80211_OFDM_RATE_54MB_MASK (1<<11)
- #define IEEE80211_CCK_RATES_MASK 0x0000000F
- #define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \
- IEEE80211_CCK_RATE_2MB_MASK)
- #define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \
- IEEE80211_CCK_RATE_5MB_MASK | \
- IEEE80211_CCK_RATE_11MB_MASK)
- #define IEEE80211_OFDM_RATES_MASK 0x00000FF0
- #define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \
- IEEE80211_OFDM_RATE_12MB_MASK | \
- IEEE80211_OFDM_RATE_24MB_MASK)
- #define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \
- IEEE80211_OFDM_RATE_9MB_MASK | \
- IEEE80211_OFDM_RATE_18MB_MASK | \
- IEEE80211_OFDM_RATE_36MB_MASK | \
- IEEE80211_OFDM_RATE_48MB_MASK | \
- IEEE80211_OFDM_RATE_54MB_MASK)
- #define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \
- IEEE80211_CCK_DEFAULT_RATES_MASK)
- #define IEEE80211_NUM_OFDM_RATES 8
- #define IEEE80211_NUM_CCK_RATES 4
- #define IEEE80211_OFDM_SHIFT_MASK_A 4
- /* NOTE: This data is for statistical purposes; not all hardware provides this
- * information for frames received. Not setting these will not cause
- * any adverse affects. */
- struct ieee80211_rx_stats {
- s8 rssi;
- u8 signal;
- u8 noise;
- u8 received_channel;
- u16 rate; /* in 100 kbps */
- u8 mask;
- u8 freq;
- u16 len;
- };
- /* IEEE 802.11 requires that STA supports concurrent reception of at least
- * three fragmented frames. This define can be increased to support more
- * concurrent frames, but it should be noted that each entry can consume about
- * 2 kB of RAM and increasing cache size will slow down frame reassembly. */
- #define IEEE80211_FRAG_CACHE_LEN 4
- struct ieee80211_frag_entry {
- u32 first_frag_time;
- uint seq;
- uint last_frag;
- uint qos; /*jackson*/
- uint tid; /*jackson*/
- struct sk_buff *skb;
- u8 src_addr[ETH_ALEN];
- u8 dst_addr[ETH_ALEN];
- };
- struct ieee80211_stats {
- uint tx_unicast_frames;
- uint tx_multicast_frames;
- uint tx_fragments;
- uint tx_unicast_octets;
- uint tx_multicast_octets;
- uint tx_deferred_transmissions;
- uint tx_single_retry_frames;
- uint tx_multiple_retry_frames;
- uint tx_retry_limit_exceeded;
- uint tx_discards;
- uint rx_unicast_frames;
- uint rx_multicast_frames;
- uint rx_fragments;
- uint rx_unicast_octets;
- uint rx_multicast_octets;
- uint rx_fcs_errors;
- uint rx_discards_no_buffer;
- uint tx_discards_wrong_sa;
- uint rx_discards_undecryptable;
- uint rx_message_in_msg_fragments;
- uint rx_message_in_bad_msg_fragments;
- };
- struct ieee80211_softmac_stats {
- uint rx_ass_ok;
- uint rx_ass_err;
- uint rx_probe_rq;
- uint tx_probe_rs;
- uint tx_beacons;
- uint rx_auth_rq;
- uint rx_auth_rs_ok;
- uint rx_auth_rs_err;
- uint tx_auth_rq;
- uint no_auth_rs;
- uint no_ass_rs;
- uint tx_ass_rq;
- uint rx_ass_rq;
- uint tx_probe_rq;
- uint reassoc;
- uint swtxstop;
- uint swtxawake;
- };
- #define SEC_KEY_1 (1<<0)
- #define SEC_KEY_2 (1<<1)
- #define SEC_KEY_3 (1<<2)
- #define SEC_KEY_4 (1<<3)
- #define SEC_ACTIVE_KEY (1<<4)
- #define SEC_AUTH_MODE (1<<5)
- #define SEC_UNICAST_GROUP (1<<6)
- #define SEC_LEVEL (1<<7)
- #define SEC_ENABLED (1<<8)
- #define SEC_LEVEL_0 0 /* None */
- #define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */
- #define SEC_LEVEL_2 2 /* Level 1 + TKIP */
- #define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */
- #define SEC_LEVEL_3 4 /* Level 2 + CCMP */
- #define WEP_KEYS 4
- #define WEP_KEY_LEN 13
- struct ieee80211_security {
- u16 active_key:2,
- enabled:1,
- auth_mode:2,
- auth_algo:4,
- unicast_uses_group:1;
- u8 key_sizes[WEP_KEYS];
- u8 keys[WEP_KEYS][WEP_KEY_LEN];
- u8 level;
- u16 flags;
- } __attribute__ ((packed));
- /*
- 802.11 data frame from AP
- ,-------------------------------------------------------------------.
- Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
- |------|------|---------|---------|---------|------|---------|------|
- Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs |
- | | tion | (BSSID) | | | ence | data | |
- `-------------------------------------------------------------------'
- Total: 28-2340 bytes
- */
- struct ieee80211_header_data {
- u16 frame_ctl;
- u16 duration_id;
- u8 addr1[6];
- u8 addr2[6];
- u8 addr3[6];
- u16 seq_ctrl;
- };
- #define BEACON_PROBE_SSID_ID_POSITION 12
- /* Management Frame Information Element Types */
- #define MFIE_TYPE_SSID 0
- #define MFIE_TYPE_RATES 1
- #define MFIE_TYPE_FH_SET 2
- #define MFIE_TYPE_DS_SET 3
- #define MFIE_TYPE_CF_SET 4
- #define MFIE_TYPE_TIM 5
- #define MFIE_TYPE_IBSS_SET 6
- #define MFIE_TYPE_CHALLENGE 16
- #define MFIE_TYPE_ERP 42
- #define MFIE_TYPE_RSN 48
- #define MFIE_TYPE_RATES_EX 50
- #define MFIE_TYPE_GENERIC 221
- struct ieee80211_info_element_hdr {
- u8 id;
- u8 len;
- } __attribute__ ((packed));
- struct ieee80211_info_element {
- u8 id;
- u8 len;
- u8 data[0];
- } __attribute__ ((packed));
- /*
- * These are the data types that can make up management packets
- *
- u16 auth_algorithm;
- u16 auth_sequence;
- u16 beacon_interval;
- u16 capability;
- u8 current_ap[ETH_ALEN];
- u16 listen_interval;
- struct {
- u16 association_id:14, reserved:2;
- } __attribute__ ((packed));
- u32 time_stamp[2];
- u16 reason;
- u16 status;
- */
- #define IEEE80211_DEFAULT_TX_ESSID "Penguin"
- #define IEEE80211_DEFAULT_BASIC_RATE 10
- struct ieee80211_authentication {
- struct ieee80211_header_data header;
- u16 algorithm;
- u16 transaction;
- u16 status;
- } __attribute__ ((packed));
- struct ieee80211_probe_response {
- struct ieee80211_header_data header;
- u32 time_stamp[2];
- u16 beacon_interval;
- u16 capability;
- struct ieee80211_info_element info_element;
- } __attribute__ ((packed));
- struct ieee80211_probe_request {
- struct ieee80211_header_data header;
- } __attribute__ ((packed));
- struct ieee80211_assoc_request_frame {
- struct ieee80211_hdr_3addr header;
- u16 capability;
- u16 listen_interval;
- struct ieee80211_info_element_hdr info_element;
- } __attribute__ ((packed));
- struct ieee80211_assoc_response_frame {
- struct ieee80211_hdr_3addr header;
- u16 capability;
- u16 status;
- u16 aid;
- } __attribute__ ((packed));
- struct ieee80211_txb {
- u8 nr_frags;
- u8 encrypted;
- u16 reserved;
- u16 frag_size;
- u16 payload_size;
- struct sk_buff *fragments[0];
- };
- /* SWEEP TABLE ENTRIES NUMBER*/
- #define MAX_SWEEP_TAB_ENTRIES 42
- #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7
- /* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
- * only use 8, and then use extended rates for the remaining supported
- * rates. Other APs, however, stick all of their supported rates on the
- * main rates information element... */
- #define MAX_RATES_LENGTH ((u8)12)
- #define MAX_RATES_EX_LENGTH ((u8)16)
- #define MAX_NETWORK_COUNT 128
- #define MAX_CHANNEL_NUMBER 161
- #define IEEE80211_SOFTMAC_SCAN_TIME 400
- /*(HZ / 2)*/
- #define IEEE80211_SOFTMAC_ASSOC_RETRY_TIME (HZ * 2)
- #define CRC_LENGTH 4U
- #define MAX_WPA_IE_LEN 128
- #define MAX_WPS_IE_LEN 512
- #define NETWORK_EMPTY_ESSID (1<<0)
- #define NETWORK_HAS_OFDM (1<<1)
- #define NETWORK_HAS_CCK (1<<2)
- #define IEEE80211_DTIM_MBCAST 4
- #define IEEE80211_DTIM_UCAST 2
- #define IEEE80211_DTIM_VALID 1
- #define IEEE80211_DTIM_INVALID 0
- #define IEEE80211_PS_DISABLED 0
- #define IEEE80211_PS_UNICAST IEEE80211_DTIM_UCAST
- #define IEEE80211_PS_MBCAST IEEE80211_DTIM_MBCAST
- #define IW_ESSID_MAX_SIZE 32
- /*
- * join_res:
- * -1: authentication fail
- * -2: association fail
- * > 0: TID
- */
- enum ieee80211_state {
- /* the card is not linked at all */
- IEEE80211_NOLINK = 0,
- /* IEEE80211_ASSOCIATING* are for BSS client mode
- * the driver shall not perform RX filtering unless
- * the state is LINKED.
- * The driver shall just check for the state LINKED and
- * defaults to NOLINK for ALL the other states (including
- * LINKED_SCANNING)
- */
- /* the association procedure will start (wq scheduling)*/
- IEEE80211_ASSOCIATING,
- IEEE80211_ASSOCIATING_RETRY,
- /* the association procedure is sending AUTH request*/
- IEEE80211_ASSOCIATING_AUTHENTICATING,
- /* the association procedure has successfully authentcated
- * and is sending association request
- */
- IEEE80211_ASSOCIATING_AUTHENTICATED,
- /* the link is ok. the card associated to a BSS or linked
- * to a ibss cell or acting as an AP and creating the bss
- */
- IEEE80211_LINKED,
- /* same as LINKED, but the driver shall apply RX filter
- * rules as we are in NO_LINK mode. As the card is still
- * logically linked, but it is doing a syncro site survey
- * then it will be back to LINKED state.
- */
- IEEE80211_LINKED_SCANNING,
- };
- #define DEFAULT_MAX_SCAN_AGE (15 * HZ)
- #define DEFAULT_FTS 2346
- #define CFG_IEEE80211_RESERVE_FCS (1<<0)
- #define CFG_IEEE80211_COMPUTE_FCS (1<<1)
- #define MAXTID 16
- #define IEEE_A (1<<0)
- #define IEEE_B (1<<1)
- #define IEEE_G (1<<2)
- #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G)
- extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
- {
- /* Single white space is for Linksys APs */
- if (essid_len == 1 && essid[0] == ' ')
- return 1;
- /* Otherwise, if the entire essid is 0, we assume it is hidden */
- while (essid_len) {
- essid_len--;
- if (essid[essid_len] != '\0')
- return 0;
- }
- return 1;
- }
- extern inline int ieee80211_get_hdrlen(u16 fc)
- {
- int hdrlen = 24;
- switch (WLAN_FC_GET_TYPE(fc)) {
- case IEEE80211_FTYPE_DATA:
- if (fc & IEEE80211_QOS_DATAGRP)
- hdrlen += 2;
- if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS))
- hdrlen += 6; /* Addr4 */
- break;
- case IEEE80211_FTYPE_CTL:
- switch (WLAN_FC_GET_STYPE(fc)) {
- case IEEE80211_STYPE_CTS:
- case IEEE80211_STYPE_ACK:
- hdrlen = 10;
- break;
- default:
- hdrlen = 16;
- break;
- }
- break;
- }
- return hdrlen;
- }
- struct registry_priv;
- u8 *r8712_set_ie(u8 *pbuf, sint index, uint len, u8 *source, uint *frlen);
- u8 *r8712_get_ie(u8*pbuf, sint index, sint *len, sint limit);
- unsigned char *r8712_get_wpa_ie(unsigned char *pie, int *rsn_ie_len, int limit);
- unsigned char *r8712_get_wpa2_ie(unsigned char *pie, int *rsn_ie_len,
- int limit);
- int r8712_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,
- int *pairwise_cipher);
- int r8712_parse_wpa2_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,
- int *pairwise_cipher);
- int r8712_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len,
- u8 *wpa_ie, u16 *wpa_len);
- int r8712_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen);
- int r8712_generate_ie(struct registry_priv *pregistrypriv,
- struct _adapter *padapter);
- uint r8712_is_cckrates_included(u8 *rate);
- uint r8712_is_cckratesonly_included(u8 *rate);
- #endif /* IEEE80211_H */
|