OSDN Git Service

Remove more non Linux gibberish
[android-x86/external-modules-rtl8723au.git] / include / ieee80211_ext.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
4  *
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.
8  *
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
12  * more details.
13  *
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
17  *
18  *
19  ******************************************************************************/
20 #ifndef __IEEE80211_EXT_H
21 #define __IEEE80211_EXT_H
22
23 #include <drv_conf.h>
24 #include <osdep_service.h>
25 #include <drv_types.h>
26
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
31 #define WMM_VERSION 1
32
33 #define WPA_PROTO_WPA BIT(0)
34 #define WPA_PROTO_RSN BIT(1)
35
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)
41
42
43 #define WPA_CAPABILITY_PREAUTH BIT(0)
44 #define WPA_CAPABILITY_MGMT_FRAME_PROTECTION BIT(6)
45 #define WPA_CAPABILITY_PEERKEY_ENABLED BIT(9)
46
47
48 #define PMKID_LEN 16
49
50
51 struct wpa_ie_hdr {
52         u8 elem_id;
53         u8 len;
54         u8 oui[4]; /* 24-bit OUI followed by 8-bit OUI type */
55         u8 version[2]; /* little endian */
56 }__attribute__ ((packed));
57
58 struct rsn_ie_hdr {
59         u8 elem_id; /* WLAN_EID_RSN */
60         u8 len;
61         u8 version[2]; /* little endian */
62 }__attribute__ ((packed));
63
64 struct wme_ac_parameter {
65 #if defined(__LITTLE_ENDIAN)
66         /* byte 1 */
67         u8      aifsn:4,
68                 acm:1,
69                 aci:2,
70                 reserved:1;
71
72         /* byte 2 */
73         u8      eCWmin:4,
74                 eCWmax:4;
75 #elif defined(__BIG_ENDIAN)
76         /* byte 1 */
77         u8      reserved:1,
78                 aci:2,
79                 acm:1,
80                 aifsn:4;
81
82         /* byte 2 */
83         u8      eCWmax:4,
84                 eCWmin:4;
85 #else
86 #error  "Please fix <endian.h>"
87 #endif
88
89         /* bytes 3 & 4 */
90         u16 txopLimit;
91 } __attribute__ ((packed));
92
93 struct wme_parameter_element {
94         /* required fields for WME version 1 */
95         u8 oui[3];
96         u8 oui_type;
97         u8 oui_subtype;
98         u8 version;
99         u8 acInfo;
100         u8 reserved;
101         struct wme_ac_parameter ac[4];
102
103 } __attribute__ ((packed));
104
105
106 #define WPA_PUT_LE16(a, val)                    \
107         do {                                    \
108                 (a)[1] = ((u16) (val)) >> 8;    \
109                 (a)[0] = ((u16) (val)) & 0xff;  \
110         } while (0)
111
112 #define WPA_PUT_BE32(a, val)                                    \
113         do {                                                    \
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);           \
118         } while (0)
119
120 #define WPA_PUT_LE32(a, val)                                    \
121         do {                                                    \
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);           \
126         } while (0)
127
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))
130
131
132
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,
141 };
142
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,
151 };
152
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,
158 };
159
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,
171 };
172
173 /* BACK (block-ack) parties */
174 enum ieee80211_back_parties {
175         WLAN_BACK_RECIPIENT = 0,
176         WLAN_BACK_INITIATOR = 1,
177         WLAN_BACK_TIMER = 2,
178 };
179
180
181 struct ieee80211_mgmt {
182         u16 frame_control;
183         u16 duration;
184         u8 da[6];
185         u8 sa[6];
186         u8 bssid[6];
187         u16 seq_ctrl;
188         union {
189                 struct {
190                         u16 auth_alg;
191                         u16 auth_transaction;
192                         u16 status_code;
193                         /* possibly followed by Challenge text */
194                         u8 variable[0];
195                 }  __attribute__ ((packed)) auth;
196                 struct {
197                         u16 reason_code;
198                 }  __attribute__ ((packed)) deauth;
199                 struct {
200                         u16 capab_info;
201                         u16 listen_interval;
202                         /* followed by SSID and Supported rates */
203                         u8 variable[0];
204                 }  __attribute__ ((packed)) assoc_req;
205                 struct {
206                         u16 capab_info;
207                         u16 status_code;
208                         u16 aid;
209                         /* followed by Supported rates */
210                         u8 variable[0];
211                 }  __attribute__ ((packed)) assoc_resp, reassoc_resp;
212                 struct {
213                         u16 capab_info;
214                         u16 listen_interval;
215                         u8 current_ap[6];
216                         /* followed by SSID and Supported rates */
217                         u8 variable[0];
218                 }  __attribute__ ((packed)) reassoc_req;
219                 struct {
220                         u16 reason_code;
221                 }  __attribute__ ((packed)) disassoc;
222                 struct {
223                         __le64 timestamp;
224                         u16 beacon_int;
225                         u16 capab_info;
226                         /* followed by some of SSID, Supported rates,
227                          * FH Params, DS Params, CF Params, IBSS Params, TIM */
228                         u8 variable[0];
229                 }  __attribute__ ((packed)) beacon;
230                 struct {
231                         /* only variable items: SSID, Supported rates */
232                         u8 variable[0];
233                 }  __attribute__ ((packed)) probe_req;
234                 struct {
235                         __le64 timestamp;
236                         u16 beacon_int;
237                         u16 capab_info;
238                         /* followed by some of SSID, Supported rates,
239                          * FH Params, DS Params, CF Params, IBSS Params */
240                         u8 variable[0];
241                 }  __attribute__ ((packed)) probe_resp;
242                 struct {
243                         u8 category;
244                         union {
245                                 struct {
246                                         u8 action_code;
247                                         u8 dialog_token;
248                                         u8 status_code;
249                                         u8 variable[0];
250                                 }  __attribute__ ((packed)) wme_action;
251 #if 0
252                                 struct{
253                                         u8 action_code;
254                                         u8 element_id;
255                                         u8 length;
256                                         struct ieee80211_channel_sw_ie sw_elem;
257                                 }  __attribute__ ((packed)) chan_switch;
258                                 struct{
259                                         u8 action_code;
260                                         u8 dialog_token;
261                                         u8 element_id;
262                                         u8 length;
263                                         struct ieee80211_msrment_ie msr_elem;
264                                 }  __attribute__ ((packed)) measurement;
265 #endif
266                                 struct{
267                                         u8 action_code;
268                                         u8 dialog_token;
269                                         u16 capab;
270                                         u16 timeout;
271                                         u16 start_seq_num;
272                                 }  __attribute__ ((packed)) addba_req;
273                                 struct{
274                                         u8 action_code;
275                                         u8 dialog_token;
276                                         u16 status;
277                                         u16 capab;
278                                         u16 timeout;
279                                 }  __attribute__ ((packed)) addba_resp;
280                                 struct{
281                                         u8 action_code;
282                                         u16 params;
283                                         u16 reason_code;
284                                 }  __attribute__ ((packed)) delba;
285                                 struct{
286                                         u8 action_code;
287                                         /* capab_info for open and confirm,
288                                          * reason for close
289                                          */
290                                         u16 aux;
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
295                                          */
296                                         u8 variable[0];
297                                 }  __attribute__ ((packed)) plink_action;
298                                 struct{
299                                         u8 action_code;
300                                         u8 variable[0];
301                                 }  __attribute__ ((packed)) mesh_action;
302                         } __attribute__ ((packed)) u;
303                 }  __attribute__ ((packed)) action;
304         } __attribute__ ((packed)) u;
305 }__attribute__ ((packed));
306
307 /* mgmt header + 1 byte category code */
308 #define IEEE80211_MIN_ACTION_SIZE FIELD_OFFSET(struct ieee80211_mgmt, u.action.u)
309
310
311
312 #endif