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)
54 u8 oui[4]; /* 24-bit OUI followed by 8-bit OUI type */
55 u8 version[2]; /* little endian */
56 }__attribute__ ((packed));
59 u8 elem_id; /* WLAN_EID_RSN */
61 u8 version[2]; /* little endian */
62 }__attribute__ ((packed));
64 struct wme_ac_parameter {
65 #if defined(__LITTLE_ENDIAN)
75 #elif defined(__BIG_ENDIAN)
86 #error "Please fix <endian.h>"
91 } __attribute__ ((packed));
93 struct wme_parameter_element {
94 /* required fields for WME version 1 */
101 struct wme_ac_parameter ac[4];
103 } __attribute__ ((packed));
106 #define WPA_PUT_LE16(a, val) \
108 (a)[1] = ((u16) (val)) >> 8; \
109 (a)[0] = ((u16) (val)) & 0xff; \
112 #define WPA_PUT_BE32(a, val) \
114 (a)[0] = (u8) ((((u32) (val)) >> 24) & 0xff); \
115 (a)[1] = (u8) ((((u32) (val)) >> 16) & 0xff); \
116 (a)[2] = (u8) ((((u32) (val)) >> 8) & 0xff); \
117 (a)[3] = (u8) (((u32) (val)) & 0xff); \
120 #define WPA_PUT_LE32(a, val) \
122 (a)[3] = (u8) ((((u32) (val)) >> 24) & 0xff); \
123 (a)[2] = (u8) ((((u32) (val)) >> 16) & 0xff); \
124 (a)[1] = (u8) ((((u32) (val)) >> 8) & 0xff); \
125 (a)[0] = (u8) (((u32) (val)) & 0xff); \
128 #define RSN_SELECTOR_PUT(a, val) WPA_PUT_BE32((u8 *) (a), (val))
129 //#define RSN_SELECTOR_PUT(a, val) WPA_PUT_LE32((u8 *) (a), (val))
133 /* Action category code */
134 enum ieee80211_category {
135 WLAN_CATEGORY_SPECTRUM_MGMT = 0,
136 WLAN_CATEGORY_QOS = 1,
137 WLAN_CATEGORY_DLS = 2,
138 WLAN_CATEGORY_BACK = 3,
139 WLAN_CATEGORY_HT = 7,
140 WLAN_CATEGORY_WMM = 17,
143 /* SPECTRUM_MGMT action code */
144 enum ieee80211_spectrum_mgmt_actioncode {
145 WLAN_ACTION_SPCT_MSR_REQ = 0,
146 WLAN_ACTION_SPCT_MSR_RPRT = 1,
147 WLAN_ACTION_SPCT_TPC_REQ = 2,
148 WLAN_ACTION_SPCT_TPC_RPRT = 3,
149 WLAN_ACTION_SPCT_CHL_SWITCH = 4,
150 WLAN_ACTION_SPCT_EXT_CHL_SWITCH = 5,
153 /* BACK action code */
154 enum ieee80211_back_actioncode {
155 WLAN_ACTION_ADDBA_REQ = 0,
156 WLAN_ACTION_ADDBA_RESP = 1,
157 WLAN_ACTION_DELBA = 2,
160 /* HT features action code */
161 enum ieee80211_ht_actioncode {
162 WLAN_ACTION_NOTIFY_CH_WIDTH = 0,
163 WLAN_ACTION_SM_PS = 1,
164 WLAN_ACTION_PSPM = 2,
165 WLAN_ACTION_PCO_PHASE = 3,
166 WLAN_ACTION_MIMO_CSI_MX = 4,
167 WLAN_ACTION_MIMO_NONCP_BF = 5,
168 WLAN_ACTION_MIMP_CP_BF = 6,
169 WLAN_ACTION_ASEL_INDICATES_FB = 7,
170 WLAN_ACTION_HI_INFO_EXCHG = 8,
173 /* BACK (block-ack) parties */
174 enum ieee80211_back_parties {
175 WLAN_BACK_RECIPIENT = 0,
176 WLAN_BACK_INITIATOR = 1,
181 struct ieee80211_mgmt {
191 u16 auth_transaction;
193 /* possibly followed by Challenge text */
195 } __attribute__ ((packed)) auth;
198 } __attribute__ ((packed)) deauth;
202 /* followed by SSID and Supported rates */
204 } __attribute__ ((packed)) assoc_req;
209 /* followed by Supported rates */
211 } __attribute__ ((packed)) assoc_resp, reassoc_resp;
216 /* followed by SSID and Supported rates */
218 } __attribute__ ((packed)) reassoc_req;
221 } __attribute__ ((packed)) disassoc;
226 /* followed by some of SSID, Supported rates,
227 * FH Params, DS Params, CF Params, IBSS Params, TIM */
229 } __attribute__ ((packed)) beacon;
231 /* only variable items: SSID, Supported rates */
233 } __attribute__ ((packed)) probe_req;
238 /* followed by some of SSID, Supported rates,
239 * FH Params, DS Params, CF Params, IBSS Params */
241 } __attribute__ ((packed)) probe_resp;
250 } __attribute__ ((packed)) wme_action;
256 struct ieee80211_channel_sw_ie sw_elem;
257 } __attribute__ ((packed)) chan_switch;
263 struct ieee80211_msrment_ie msr_elem;
264 } __attribute__ ((packed)) measurement;
272 } __attribute__ ((packed)) addba_req;
279 } __attribute__ ((packed)) addba_resp;
284 } __attribute__ ((packed)) delba;
287 /* capab_info for open and confirm,
291 /* Followed in plink_confirm by status
292 * code, AID and supported rates,
293 * and directly by supported rates in
294 * plink_open and plink_close
297 } __attribute__ ((packed)) plink_action;
301 } __attribute__ ((packed)) mesh_action;
302 } __attribute__ ((packed)) u;
303 } __attribute__ ((packed)) action;
304 } __attribute__ ((packed)) u;
305 }__attribute__ ((packed));
307 /* mgmt header + 1 byte category code */
308 #define IEEE80211_MIN_ACTION_SIZE FIELD_OFFSET(struct ieee80211_mgmt, u.action.u)