root/drivers/staging/rtl8712/ieee80211.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. ieee80211_is_empty_essid
  2. ieee80211_get_hdrlen

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

/* [<][>][^][v][top][bottom][index][help] */