166 lines · c
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 are7 * 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_H15#define __IEEE80211_H16 17#include <linux/ieee80211.h>18 19#define IEEE_CMD_SET_WPA_PARAM 120#define IEEE_CMD_SET_WPA_IE 221#define IEEE_CMD_SET_ENCRYPTION 322#define IEEE_CMD_MLME 423 24#define IEEE_PARAM_WPA_ENABLED 125#define IEEE_PARAM_TKIP_COUNTERMEASURES 226#define IEEE_PARAM_DROP_UNENCRYPTED 327#define IEEE_PARAM_PRIVACY_INVOKED 428#define IEEE_PARAM_AUTH_ALGS 529#define IEEE_PARAM_IEEE_802_1X 630#define IEEE_PARAM_WPAX_SELECT 731 32#define AUTH_ALG_OPEN_SYSTEM 0x133#define AUTH_ALG_SHARED_KEY 0x234#define AUTH_ALG_LEAP 0x0000000435 36#define IEEE_MLME_STA_DEAUTH 137#define IEEE_MLME_STA_DISASSOC 238 39#define IEEE_CRYPT_ERR_UNKNOWN_ALG 240#define IEEE_CRYPT_ERR_UNKNOWN_ADDR 341#define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED 442#define IEEE_CRYPT_ERR_KEY_SET_FAILED 543#define IEEE_CRYPT_ERR_TX_KEY_SET_FAILED 644#define IEEE_CRYPT_ERR_CARD_CONF_FAILED 745 46#define IEEE_CRYPT_ALG_NAME_LEN 1647 48#define WPA_CIPHER_NONE BIT(0)49#define WPA_CIPHER_WEP40 BIT(1)50#define WPA_CIPHER_WEP104 BIT(2)51#define WPA_CIPHER_TKIP BIT(3)52#define WPA_CIPHER_CCMP BIT(4)53 54#define WPA_SELECTOR_LEN 455#define RSN_HEADER_LEN 456 57#define RSN_SELECTOR_LEN 458 59enum NETWORK_TYPE {60 WIRELESS_INVALID = 0,61 WIRELESS_11B = 1,62 WIRELESS_11G = 2,63 WIRELESS_11BG = (WIRELESS_11B | WIRELESS_11G),64 WIRELESS_11A = 4,65 WIRELESS_11N = 8,66 WIRELESS_11GN = (WIRELESS_11G | WIRELESS_11N),67 WIRELESS_11BGN = (WIRELESS_11B | WIRELESS_11G | WIRELESS_11N),68};69 70struct ieee_param {71 u32 cmd;72 u8 sta_addr[ETH_ALEN];73 union {74 struct {75 u8 name;76 u32 value;77 } wpa_param;78 struct {79 u32 len;80 u8 reserved[32];81 u8 data[];82 } wpa_ie;83 struct {84 int command;85 int reason_code;86 } mlme;87 struct {88 u8 alg[IEEE_CRYPT_ALG_NAME_LEN];89 u8 set_tx;90 u32 err;91 u8 idx;92 u8 seq[8]; /* sequence counter (set: RX, get: TX) */93 u16 key_len;94 u8 key[];95 } crypt;96 } u;97};98 99#define MIN_FRAG_THRESHOLD 256U100#define MAX_FRAG_THRESHOLD 2346U101 102/* QoS,QOS */103#define NORMAL_ACK 0104 105/* IEEE 802.11 defines */106 107#define P80211_OUI_LEN 3108 109struct ieee80211_snap_hdr {110 u8 dsap; /* always 0xAA */111 u8 ssap; /* always 0xAA */112 u8 ctrl; /* always 0x03 */113 u8 oui[P80211_OUI_LEN]; /* organizational universal id */114} __packed;115 116#define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)117 118#define IEEE80211_CCK_RATE_LEN 4119#define IEEE80211_NUM_OFDM_RATESLEN 8120 121#define IEEE80211_CCK_RATE_1MB 0x02122#define IEEE80211_CCK_RATE_2MB 0x04123#define IEEE80211_CCK_RATE_5MB 0x0B124#define IEEE80211_CCK_RATE_11MB 0x16125#define IEEE80211_OFDM_RATE_6MB 0x0C126#define IEEE80211_OFDM_RATE_9MB 0x12127#define IEEE80211_OFDM_RATE_12MB 0x18128#define IEEE80211_OFDM_RATE_18MB 0x24129#define IEEE80211_OFDM_RATE_24MB 0x30130#define IEEE80211_OFDM_RATE_36MB 0x48131#define IEEE80211_OFDM_RATE_48MB 0x60132#define IEEE80211_OFDM_RATE_54MB 0x6C133#define IEEE80211_BASIC_RATE_MASK 0x80134 135#define WEP_KEYS 4136 137/* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs138 * only use 8, and then use extended rates for the remaining supported139 * rates. Other APs, however, stick all of their supported rates on the140 * main rates information element...141 */142#define MAX_RATES_LENGTH ((u8)12)143#define MAX_WPA_IE_LEN 128144 145struct registry_priv;146 147u8 *r8712_set_ie(u8 *pbuf, sint index, uint len, u8 *source, uint *frlen);148u8 *r8712_get_ie(u8 *pbuf, sint index, uint *len, sint limit);149unsigned char *r8712_get_wpa_ie(unsigned char *pie, uint *rsn_ie_len,150 int limit);151unsigned char *r8712_get_wpa2_ie(unsigned char *pie, uint *rsn_ie_len,152 int limit);153int r8712_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,154 int *pairwise_cipher);155int r8712_parse_wpa2_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,156 int *pairwise_cipher);157int r8712_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len,158 u8 *wpa_ie, u16 *wpa_len);159int r8712_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen);160int r8712_generate_ie(struct registry_priv *pregistrypriv);161uint r8712_is_cckrates_included(u8 *rate);162uint r8712_is_cckratesonly_included(u8 *rate);163 164#endif /* IEEE80211_H */165 166