drm/tests: hdmi: Fix memory leaks in drm_display_mode_from_cea_vic()
[drm/drm-misc.git] / drivers / staging / rtl8712 / ieee80211.h
blob65ceaca9b51ea725e1947f041179c53080d06460
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
4 * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
6 * Modifications for inclusion into the Linux staging tree are
7 * Copyright(c) 2010 Larry Finger. All rights reserved.
9 * Contact information:
10 * WLAN FAE <wlanfae@realtek.com>
11 * Larry Finger <Larry.Finger@lwfinger.net>
13 ******************************************************************************/
14 #ifndef __IEEE80211_H
15 #define __IEEE80211_H
17 #include <linux/ieee80211.h>
19 #define IEEE_CMD_SET_WPA_PARAM 1
20 #define IEEE_CMD_SET_WPA_IE 2
21 #define IEEE_CMD_SET_ENCRYPTION 3
22 #define IEEE_CMD_MLME 4
24 #define IEEE_PARAM_WPA_ENABLED 1
25 #define IEEE_PARAM_TKIP_COUNTERMEASURES 2
26 #define IEEE_PARAM_DROP_UNENCRYPTED 3
27 #define IEEE_PARAM_PRIVACY_INVOKED 4
28 #define IEEE_PARAM_AUTH_ALGS 5
29 #define IEEE_PARAM_IEEE_802_1X 6
30 #define IEEE_PARAM_WPAX_SELECT 7
32 #define AUTH_ALG_OPEN_SYSTEM 0x1
33 #define AUTH_ALG_SHARED_KEY 0x2
34 #define AUTH_ALG_LEAP 0x00000004
36 #define IEEE_MLME_STA_DEAUTH 1
37 #define IEEE_MLME_STA_DISASSOC 2
39 #define IEEE_CRYPT_ERR_UNKNOWN_ALG 2
40 #define IEEE_CRYPT_ERR_UNKNOWN_ADDR 3
41 #define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED 4
42 #define IEEE_CRYPT_ERR_KEY_SET_FAILED 5
43 #define IEEE_CRYPT_ERR_TX_KEY_SET_FAILED 6
44 #define IEEE_CRYPT_ERR_CARD_CONF_FAILED 7
46 #define IEEE_CRYPT_ALG_NAME_LEN 16
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)
54 #define WPA_SELECTOR_LEN 4
55 #define RSN_HEADER_LEN 4
57 #define RSN_SELECTOR_LEN 4
59 enum 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),
70 struct 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;
99 #define MIN_FRAG_THRESHOLD 256U
100 #define MAX_FRAG_THRESHOLD 2346U
102 /* QoS,QOS */
103 #define NORMAL_ACK 0
105 /* IEEE 802.11 defines */
107 #define P80211_OUI_LEN 3
109 struct 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;
116 #define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
118 #define IEEE80211_CCK_RATE_LEN 4
119 #define IEEE80211_NUM_OFDM_RATESLEN 8
121 #define IEEE80211_CCK_RATE_1MB 0x02
122 #define IEEE80211_CCK_RATE_2MB 0x04
123 #define IEEE80211_CCK_RATE_5MB 0x0B
124 #define IEEE80211_CCK_RATE_11MB 0x16
125 #define IEEE80211_OFDM_RATE_6MB 0x0C
126 #define IEEE80211_OFDM_RATE_9MB 0x12
127 #define IEEE80211_OFDM_RATE_12MB 0x18
128 #define IEEE80211_OFDM_RATE_18MB 0x24
129 #define IEEE80211_OFDM_RATE_24MB 0x30
130 #define IEEE80211_OFDM_RATE_36MB 0x48
131 #define IEEE80211_OFDM_RATE_48MB 0x60
132 #define IEEE80211_OFDM_RATE_54MB 0x6C
133 #define IEEE80211_BASIC_RATE_MASK 0x80
135 #define WEP_KEYS 4
137 /* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
138 * only use 8, and then use extended rates for the remaining supported
139 * rates. Other APs, however, stick all of their supported rates on the
140 * main rates information element...
142 #define MAX_RATES_LENGTH ((u8)12)
143 #define MAX_WPA_IE_LEN 128
145 struct registry_priv;
147 u8 *r8712_set_ie(u8 *pbuf, sint index, uint len, u8 *source, uint *frlen);
148 u8 *r8712_get_ie(u8 *pbuf, sint index, uint *len, sint limit);
149 unsigned char *r8712_get_wpa_ie(unsigned char *pie, uint *rsn_ie_len,
150 int limit);
151 unsigned char *r8712_get_wpa2_ie(unsigned char *pie, uint *rsn_ie_len,
152 int limit);
153 int r8712_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,
154 int *pairwise_cipher);
155 int r8712_parse_wpa2_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,
156 int *pairwise_cipher);
157 int r8712_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len,
158 u8 *wpa_ie, u16 *wpa_len);
159 int r8712_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen);
160 int r8712_generate_ie(struct registry_priv *pregistrypriv);
161 uint r8712_is_cckrates_included(u8 *rate);
162 uint r8712_is_cckratesonly_included(u8 *rate);
164 #endif /* IEEE80211_H */