1 /******************************************************************************
3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 ******************************************************************************/
20 #ifndef __IEEE80211_EXT_H
21 #define __IEEE80211_EXT_H
24 #include <osdep_service.h>
25 #include <drv_types.h>
27 #define WMM_OUI_TYPE 2
28 #define WMM_OUI_SUBTYPE_INFORMATION_ELEMENT 0
29 #define WMM_OUI_SUBTYPE_PARAMETER_ELEMENT 1
30 #define WMM_OUI_SUBTYPE_TSPEC_ELEMENT 2
33 #define WPA_PROTO_WPA BIT(0)
34 #define WPA_PROTO_RSN BIT(1)
36 #define WPA_KEY_MGMT_IEEE8021X BIT(0)
37 #define WPA_KEY_MGMT_PSK BIT(1)
38 #define WPA_KEY_MGMT_NONE BIT(2)
39 #define WPA_KEY_MGMT_IEEE8021X_NO_WPA BIT(3)
40 #define WPA_KEY_MGMT_WPA_NONE BIT(4)
43 #define WPA_CAPABILITY_PREAUTH BIT(0)
44 #define WPA_CAPABILITY_MGMT_FRAME_PROTECTION BIT(6)
45 #define WPA_CAPABILITY_PEERKEY_ENABLED BIT(9)
55 u8 oui[4]; /* 24-bit OUI followed by 8-bit OUI type */
56 u8 version[2]; /* little endian */
57 }__attribute__ ((packed));
60 u8 elem_id; /* WLAN_EID_RSN */
62 u8 version[2]; /* little endian */
63 }__attribute__ ((packed));
65 struct wme_ac_parameter {
66 #if defined(CONFIG_LITTLE_ENDIAN)
76 #elif defined(CONFIG_BIG_ENDIAN)
87 #error "Please fix <endian.h>"
92 } __attribute__ ((packed));
94 struct wme_parameter_element {
95 /* required fields for WME version 1 */
102 struct wme_ac_parameter ac[4];
104 } __attribute__ ((packed));
108 #ifdef PLATFORM_WINDOWS
115 u8 oui[4]; /* 24-bit OUI followed by 8-bit OUI type */
116 u8 version[2]; /* little endian */
120 u8 elem_id; /* WLAN_EID_RSN */
122 u8 version[2]; /* little endian */
129 #define WPA_PUT_LE16(a, val) \
131 (a)[1] = ((u16) (val)) >> 8; \
132 (a)[0] = ((u16) (val)) & 0xff; \
135 #define WPA_PUT_BE32(a, val) \
137 (a)[0] = (u8) ((((u32) (val)) >> 24) & 0xff); \
138 (a)[1] = (u8) ((((u32) (val)) >> 16) & 0xff); \
139 (a)[2] = (u8) ((((u32) (val)) >> 8) & 0xff); \
140 (a)[3] = (u8) (((u32) (val)) & 0xff); \
143 #define WPA_PUT_LE32(a, val) \
145 (a)[3] = (u8) ((((u32) (val)) >> 24) & 0xff); \
146 (a)[2] = (u8) ((((u32) (val)) >> 16) & 0xff); \
147 (a)[1] = (u8) ((((u32) (val)) >> 8) & 0xff); \
148 (a)[0] = (u8) (((u32) (val)) & 0xff); \
151 #define RSN_SELECTOR_PUT(a, val) WPA_PUT_BE32((u8 *) (a), (val))
152 //#define RSN_SELECTOR_PUT(a, val) WPA_PUT_LE32((u8 *) (a), (val))
156 /* Action category code */
157 enum ieee80211_category {
158 WLAN_CATEGORY_SPECTRUM_MGMT = 0,
159 WLAN_CATEGORY_QOS = 1,
160 WLAN_CATEGORY_DLS = 2,
161 WLAN_CATEGORY_BACK = 3,
162 WLAN_CATEGORY_HT = 7,
163 WLAN_CATEGORY_WMM = 17,
166 /* SPECTRUM_MGMT action code */
167 enum ieee80211_spectrum_mgmt_actioncode {
168 WLAN_ACTION_SPCT_MSR_REQ = 0,
169 WLAN_ACTION_SPCT_MSR_RPRT = 1,
170 WLAN_ACTION_SPCT_TPC_REQ = 2,
171 WLAN_ACTION_SPCT_TPC_RPRT = 3,
172 WLAN_ACTION_SPCT_CHL_SWITCH = 4,
173 WLAN_ACTION_SPCT_EXT_CHL_SWITCH = 5,
176 /* BACK action code */
177 enum ieee80211_back_actioncode {
178 WLAN_ACTION_ADDBA_REQ = 0,
179 WLAN_ACTION_ADDBA_RESP = 1,
180 WLAN_ACTION_DELBA = 2,
183 /* HT features action code */
184 enum ieee80211_ht_actioncode {
185 WLAN_ACTION_NOTIFY_CH_WIDTH = 0,
186 WLAN_ACTION_SM_PS = 1,
187 WLAN_ACTION_PSPM = 2,
188 WLAN_ACTION_PCO_PHASE = 3,
189 WLAN_ACTION_MIMO_CSI_MX = 4,
190 WLAN_ACTION_MIMO_NONCP_BF = 5,
191 WLAN_ACTION_MIMP_CP_BF = 6,
192 WLAN_ACTION_ASEL_INDICATES_FB = 7,
193 WLAN_ACTION_HI_INFO_EXCHG = 8,
196 /* BACK (block-ack) parties */
197 enum ieee80211_back_parties {
198 WLAN_BACK_RECIPIENT = 0,
199 WLAN_BACK_INITIATOR = 1,
203 #ifdef PLATFORM_LINUX
205 struct ieee80211_mgmt {
215 u16 auth_transaction;
217 /* possibly followed by Challenge text */
219 } __attribute__ ((packed)) auth;
222 } __attribute__ ((packed)) deauth;
226 /* followed by SSID and Supported rates */
228 } __attribute__ ((packed)) assoc_req;
233 /* followed by Supported rates */
235 } __attribute__ ((packed)) assoc_resp, reassoc_resp;
240 /* followed by SSID and Supported rates */
242 } __attribute__ ((packed)) reassoc_req;
245 } __attribute__ ((packed)) disassoc;
250 /* followed by some of SSID, Supported rates,
251 * FH Params, DS Params, CF Params, IBSS Params, TIM */
253 } __attribute__ ((packed)) beacon;
255 /* only variable items: SSID, Supported rates */
257 } __attribute__ ((packed)) probe_req;
262 /* followed by some of SSID, Supported rates,
263 * FH Params, DS Params, CF Params, IBSS Params */
265 } __attribute__ ((packed)) probe_resp;
274 } __attribute__ ((packed)) wme_action;
280 struct ieee80211_channel_sw_ie sw_elem;
281 } __attribute__ ((packed)) chan_switch;
287 struct ieee80211_msrment_ie msr_elem;
288 } __attribute__ ((packed)) measurement;
296 } __attribute__ ((packed)) addba_req;
303 } __attribute__ ((packed)) addba_resp;
308 } __attribute__ ((packed)) delba;
311 /* capab_info for open and confirm,
315 /* Followed in plink_confirm by status
316 * code, AID and supported rates,
317 * and directly by supported rates in
318 * plink_open and plink_close
321 } __attribute__ ((packed)) plink_action;
325 } __attribute__ ((packed)) mesh_action;
326 } __attribute__ ((packed)) u;
327 } __attribute__ ((packed)) action;
328 } __attribute__ ((packed)) u;
329 }__attribute__ ((packed));
334 #ifdef PLATFORM_WINDOWS
338 struct ieee80211_mgmt {
348 u16 auth_transaction;
350 /* possibly followed by Challenge text */
359 /* followed by SSID and Supported rates */
366 /* followed by Supported rates */
368 } assoc_resp, reassoc_resp;
373 /* followed by SSID and Supported rates */
384 /* followed by some of SSID, Supported rates,
385 * FH Params, DS Params, CF Params, IBSS Params, TIM */
389 /* only variable items: SSID, Supported rates */
397 /* followed by some of SSID, Supported rates,
398 * FH Params, DS Params, CF Params, IBSS Params */
416 struct ieee80211_channel_sw_ie sw_elem;
423 struct ieee80211_msrment_ie msr_elem;
447 /* capab_info for open and confirm,
451 /* Followed in plink_confirm by status
452 * code, AID and supported rates,
453 * and directly by supported rates in
454 * plink_open and plink_close
471 /* mgmt header + 1 byte category code */
472 #define IEEE80211_MIN_ACTION_SIZE FIELD_OFFSET(struct ieee80211_mgmt, u.action.u)