--- /dev/null
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/\r
+#ifndef __IEEE80211_EXT_H\r
+#define __IEEE80211_EXT_H\r
+\r
+#include <drv_conf.h>\r
+#include <osdep_service.h>\r
+#include <drv_types.h>\r
+\r
+#define WMM_OUI_TYPE 2\r
+#define WMM_OUI_SUBTYPE_INFORMATION_ELEMENT 0\r
+#define WMM_OUI_SUBTYPE_PARAMETER_ELEMENT 1\r
+#define WMM_OUI_SUBTYPE_TSPEC_ELEMENT 2\r
+#define WMM_VERSION 1\r
+\r
+#define WPA_PROTO_WPA BIT(0)\r
+#define WPA_PROTO_RSN BIT(1)\r
+\r
+#define WPA_KEY_MGMT_IEEE8021X BIT(0)\r
+#define WPA_KEY_MGMT_PSK BIT(1)\r
+#define WPA_KEY_MGMT_NONE BIT(2)\r
+#define WPA_KEY_MGMT_IEEE8021X_NO_WPA BIT(3)\r
+#define WPA_KEY_MGMT_WPA_NONE BIT(4)\r
+\r
+\r
+#define WPA_CAPABILITY_PREAUTH BIT(0)\r
+#define WPA_CAPABILITY_MGMT_FRAME_PROTECTION BIT(6)\r
+#define WPA_CAPABILITY_PEERKEY_ENABLED BIT(9)\r
+\r
+\r
+#define PMKID_LEN 16\r
+\r
+\r
+#ifdef PLATFORM_LINUX\r
+struct wpa_ie_hdr {\r
+ u8 elem_id;\r
+ u8 len;\r
+ u8 oui[4]; /* 24-bit OUI followed by 8-bit OUI type */\r
+ u8 version[2]; /* little endian */\r
+}__attribute__ ((packed));\r
+\r
+struct rsn_ie_hdr {\r
+ u8 elem_id; /* WLAN_EID_RSN */\r
+ u8 len;\r
+ u8 version[2]; /* little endian */\r
+}__attribute__ ((packed));\r
+\r
+struct wme_ac_parameter {\r
+#if defined(CONFIG_LITTLE_ENDIAN)\r
+ /* byte 1 */\r
+ u8 aifsn:4,\r
+ acm:1,\r
+ aci:2,\r
+ reserved:1;\r
+\r
+ /* byte 2 */\r
+ u8 eCWmin:4,\r
+ eCWmax:4;\r
+#elif defined(CONFIG_BIG_ENDIAN)\r
+ /* byte 1 */\r
+ u8 reserved:1,\r
+ aci:2,\r
+ acm:1,\r
+ aifsn:4;\r
+\r
+ /* byte 2 */\r
+ u8 eCWmax:4,\r
+ eCWmin:4;\r
+#else\r
+#error "Please fix <endian.h>"\r
+#endif\r
+\r
+ /* bytes 3 & 4 */\r
+ u16 txopLimit;\r
+} __attribute__ ((packed));\r
+\r
+struct wme_parameter_element {\r
+ /* required fields for WME version 1 */\r
+ u8 oui[3];\r
+ u8 oui_type;\r
+ u8 oui_subtype;\r
+ u8 version;\r
+ u8 acInfo;\r
+ u8 reserved;\r
+ struct wme_ac_parameter ac[4];\r
+\r
+} __attribute__ ((packed));\r
+\r
+#endif\r
+\r
+#ifdef PLATFORM_WINDOWS\r
+\r
+#pragma pack(1)\r
+\r
+struct wpa_ie_hdr {\r
+ u8 elem_id;\r
+ u8 len;\r
+ u8 oui[4]; /* 24-bit OUI followed by 8-bit OUI type */\r
+ u8 version[2]; /* little endian */\r
+};\r
+\r
+struct rsn_ie_hdr {\r
+ u8 elem_id; /* WLAN_EID_RSN */\r
+ u8 len;\r
+ u8 version[2]; /* little endian */\r
+};\r
+\r
+#pragma pack()\r
+\r
+#endif\r
+\r
+#define WPA_PUT_LE16(a, val) \\r
+ do { \\r
+ (a)[1] = ((u16) (val)) >> 8; \\r
+ (a)[0] = ((u16) (val)) & 0xff; \\r
+ } while (0)\r
+\r
+#define WPA_PUT_BE32(a, val) \\r
+ do { \\r
+ (a)[0] = (u8) ((((u32) (val)) >> 24) & 0xff); \\r
+ (a)[1] = (u8) ((((u32) (val)) >> 16) & 0xff); \\r
+ (a)[2] = (u8) ((((u32) (val)) >> 8) & 0xff); \\r
+ (a)[3] = (u8) (((u32) (val)) & 0xff); \\r
+ } while (0)\r
+\r
+#define WPA_PUT_LE32(a, val) \\r
+ do { \\r
+ (a)[3] = (u8) ((((u32) (val)) >> 24) & 0xff); \\r
+ (a)[2] = (u8) ((((u32) (val)) >> 16) & 0xff); \\r
+ (a)[1] = (u8) ((((u32) (val)) >> 8) & 0xff); \\r
+ (a)[0] = (u8) (((u32) (val)) & 0xff); \\r
+ } while (0)\r
+\r
+#define RSN_SELECTOR_PUT(a, val) WPA_PUT_BE32((u8 *) (a), (val))\r
+//#define RSN_SELECTOR_PUT(a, val) WPA_PUT_LE32((u8 *) (a), (val))\r
+\r
+\r
+\r
+/* Action category code */\r
+enum ieee80211_category {\r
+ WLAN_CATEGORY_SPECTRUM_MGMT = 0,\r
+ WLAN_CATEGORY_QOS = 1,\r
+ WLAN_CATEGORY_DLS = 2,\r
+ WLAN_CATEGORY_BACK = 3,\r
+ WLAN_CATEGORY_HT = 7,\r
+ WLAN_CATEGORY_WMM = 17,\r
+};\r
+\r
+/* SPECTRUM_MGMT action code */\r
+enum ieee80211_spectrum_mgmt_actioncode {\r
+ WLAN_ACTION_SPCT_MSR_REQ = 0,\r
+ WLAN_ACTION_SPCT_MSR_RPRT = 1,\r
+ WLAN_ACTION_SPCT_TPC_REQ = 2,\r
+ WLAN_ACTION_SPCT_TPC_RPRT = 3,\r
+ WLAN_ACTION_SPCT_CHL_SWITCH = 4,\r
+ WLAN_ACTION_SPCT_EXT_CHL_SWITCH = 5,\r
+};\r
+\r
+/* BACK action code */\r
+enum ieee80211_back_actioncode {\r
+ WLAN_ACTION_ADDBA_REQ = 0,\r
+ WLAN_ACTION_ADDBA_RESP = 1,\r
+ WLAN_ACTION_DELBA = 2,\r
+};\r
+\r
+/* HT features action code */\r
+enum ieee80211_ht_actioncode {\r
+ WLAN_ACTION_NOTIFY_CH_WIDTH = 0,\r
+ WLAN_ACTION_SM_PS = 1,\r
+ WLAN_ACTION_PSPM = 2,\r
+ WLAN_ACTION_PCO_PHASE = 3,\r
+ WLAN_ACTION_MIMO_CSI_MX = 4,\r
+ WLAN_ACTION_MIMO_NONCP_BF = 5,\r
+ WLAN_ACTION_MIMP_CP_BF = 6,\r
+ WLAN_ACTION_ASEL_INDICATES_FB = 7,\r
+ WLAN_ACTION_HI_INFO_EXCHG = 8,\r
+};\r
+\r
+/* BACK (block-ack) parties */\r
+enum ieee80211_back_parties {\r
+ WLAN_BACK_RECIPIENT = 0,\r
+ WLAN_BACK_INITIATOR = 1,\r
+ WLAN_BACK_TIMER = 2,\r
+};\r
+\r
+#ifdef PLATFORM_LINUX\r
+\r
+struct ieee80211_mgmt {\r
+ u16 frame_control;\r
+ u16 duration;\r
+ u8 da[6];\r
+ u8 sa[6];\r
+ u8 bssid[6];\r
+ u16 seq_ctrl;\r
+ union {\r
+ struct {\r
+ u16 auth_alg;\r
+ u16 auth_transaction;\r
+ u16 status_code;\r
+ /* possibly followed by Challenge text */\r
+ u8 variable[0];\r
+ } __attribute__ ((packed)) auth;\r
+ struct {\r
+ u16 reason_code;\r
+ } __attribute__ ((packed)) deauth;\r
+ struct {\r
+ u16 capab_info;\r
+ u16 listen_interval;\r
+ /* followed by SSID and Supported rates */\r
+ u8 variable[0];\r
+ } __attribute__ ((packed)) assoc_req;\r
+ struct {\r
+ u16 capab_info;\r
+ u16 status_code;\r
+ u16 aid;\r
+ /* followed by Supported rates */\r
+ u8 variable[0];\r
+ } __attribute__ ((packed)) assoc_resp, reassoc_resp;\r
+ struct {\r
+ u16 capab_info;\r
+ u16 listen_interval;\r
+ u8 current_ap[6];\r
+ /* followed by SSID and Supported rates */\r
+ u8 variable[0];\r
+ } __attribute__ ((packed)) reassoc_req;\r
+ struct {\r
+ u16 reason_code;\r
+ } __attribute__ ((packed)) disassoc;\r
+ struct {\r
+ __le64 timestamp;\r
+ u16 beacon_int;\r
+ u16 capab_info;\r
+ /* followed by some of SSID, Supported rates,\r
+ * FH Params, DS Params, CF Params, IBSS Params, TIM */\r
+ u8 variable[0];\r
+ } __attribute__ ((packed)) beacon;\r
+ struct {\r
+ /* only variable items: SSID, Supported rates */\r
+ u8 variable[0];\r
+ } __attribute__ ((packed)) probe_req;\r
+ struct {\r
+ __le64 timestamp;\r
+ u16 beacon_int;\r
+ u16 capab_info;\r
+ /* followed by some of SSID, Supported rates,\r
+ * FH Params, DS Params, CF Params, IBSS Params */\r
+ u8 variable[0];\r
+ } __attribute__ ((packed)) probe_resp;\r
+ struct {\r
+ u8 category;\r
+ union {\r
+ struct {\r
+ u8 action_code;\r
+ u8 dialog_token;\r
+ u8 status_code;\r
+ u8 variable[0];\r
+ } __attribute__ ((packed)) wme_action;\r
+#if 0\r
+ struct{\r
+ u8 action_code;\r
+ u8 element_id;\r
+ u8 length;\r
+ struct ieee80211_channel_sw_ie sw_elem;\r
+ } __attribute__ ((packed)) chan_switch;\r
+ struct{\r
+ u8 action_code;\r
+ u8 dialog_token;\r
+ u8 element_id;\r
+ u8 length;\r
+ struct ieee80211_msrment_ie msr_elem;\r
+ } __attribute__ ((packed)) measurement;\r
+#endif\r
+ struct{\r
+ u8 action_code;\r
+ u8 dialog_token;\r
+ u16 capab;\r
+ u16 timeout;\r
+ u16 start_seq_num;\r
+ } __attribute__ ((packed)) addba_req;\r
+ struct{\r
+ u8 action_code;\r
+ u8 dialog_token;\r
+ u16 status;\r
+ u16 capab;\r
+ u16 timeout;\r
+ } __attribute__ ((packed)) addba_resp;\r
+ struct{\r
+ u8 action_code;\r
+ u16 params;\r
+ u16 reason_code;\r
+ } __attribute__ ((packed)) delba;\r
+ struct{\r
+ u8 action_code;\r
+ /* capab_info for open and confirm,\r
+ * reason for close\r
+ */\r
+ u16 aux;\r
+ /* Followed in plink_confirm by status\r
+ * code, AID and supported rates,\r
+ * and directly by supported rates in\r
+ * plink_open and plink_close\r
+ */\r
+ u8 variable[0];\r
+ } __attribute__ ((packed)) plink_action;\r
+ struct{\r
+ u8 action_code;\r
+ u8 variable[0];\r
+ } __attribute__ ((packed)) mesh_action;\r
+ } __attribute__ ((packed)) u;\r
+ } __attribute__ ((packed)) action;\r
+ } __attribute__ ((packed)) u;\r
+}__attribute__ ((packed));\r
+\r
+#endif\r
+\r
+\r
+#ifdef PLATFORM_WINDOWS\r
+\r
+#pragma pack(1)\r
+\r
+struct ieee80211_mgmt {\r
+ u16 frame_control;\r
+ u16 duration;\r
+ u8 da[6];\r
+ u8 sa[6];\r
+ u8 bssid[6];\r
+ u16 seq_ctrl;\r
+ union {\r
+ struct {\r
+ u16 auth_alg;\r
+ u16 auth_transaction;\r
+ u16 status_code;\r
+ /* possibly followed by Challenge text */\r
+ u8 variable[0];\r
+ } auth;\r
+ struct {\r
+ u16 reason_code;\r
+ } deauth;\r
+ struct {\r
+ u16 capab_info;\r
+ u16 listen_interval;\r
+ /* followed by SSID and Supported rates */\r
+ u8 variable[0];\r
+ } assoc_req;\r
+ struct {\r
+ u16 capab_info;\r
+ u16 status_code;\r
+ u16 aid;\r
+ /* followed by Supported rates */\r
+ u8 variable[0];\r
+ } assoc_resp, reassoc_resp;\r
+ struct {\r
+ u16 capab_info;\r
+ u16 listen_interval;\r
+ u8 current_ap[6];\r
+ /* followed by SSID and Supported rates */\r
+ u8 variable[0];\r
+ } reassoc_req;\r
+ struct {\r
+ u16 reason_code;\r
+ } disassoc;\r
+#if 0 \r
+ struct {\r
+ __le64 timestamp;\r
+ u16 beacon_int;\r
+ u16 capab_info;\r
+ /* followed by some of SSID, Supported rates,\r
+ * FH Params, DS Params, CF Params, IBSS Params, TIM */\r
+ u8 variable[0];\r
+ } beacon;\r
+ struct {\r
+ /* only variable items: SSID, Supported rates */\r
+ u8 variable[0];\r
+ } probe_req;\r
+ \r
+ struct {\r
+ __le64 timestamp;\r
+ u16 beacon_int;\r
+ u16 capab_info;\r
+ /* followed by some of SSID, Supported rates,\r
+ * FH Params, DS Params, CF Params, IBSS Params */\r
+ u8 variable[0];\r
+ } probe_resp;\r
+#endif \r
+ struct {\r
+ u8 category;\r
+ union {\r
+ struct {\r
+ u8 action_code;\r
+ u8 dialog_token;\r
+ u8 status_code;\r
+ u8 variable[0];\r
+ } wme_action;\r
+/* \r
+ struct{\r
+ u8 action_code;\r
+ u8 element_id;\r
+ u8 length;\r
+ struct ieee80211_channel_sw_ie sw_elem;\r
+ } chan_switch;\r
+ struct{\r
+ u8 action_code;\r
+ u8 dialog_token;\r
+ u8 element_id;\r
+ u8 length;\r
+ struct ieee80211_msrment_ie msr_elem;\r
+ } measurement;\r
+*/ \r
+ struct{\r
+ u8 action_code;\r
+ u8 dialog_token;\r
+ u16 capab;\r
+ u16 timeout;\r
+ u16 start_seq_num;\r
+ } addba_req;\r
+ struct{\r
+ u8 action_code;\r
+ u8 dialog_token;\r
+ u16 status;\r
+ u16 capab;\r
+ u16 timeout;\r
+ } addba_resp;\r
+ struct{\r
+ u8 action_code;\r
+ u16 params;\r
+ u16 reason_code;\r
+ } delba;\r
+ struct{\r
+ u8 action_code;\r
+ /* capab_info for open and confirm,\r
+ * reason for close\r
+ */\r
+ u16 aux;\r
+ /* Followed in plink_confirm by status\r
+ * code, AID and supported rates,\r
+ * and directly by supported rates in\r
+ * plink_open and plink_close\r
+ */\r
+ u8 variable[0];\r
+ } plink_action;\r
+ struct{\r
+ u8 action_code;\r
+ u8 variable[0];\r
+ } mesh_action;\r
+ } u;\r
+ } action;\r
+ } u;\r
+} ;\r
+\r
+#pragma pack()\r
+\r
+#endif\r
+\r
+/* mgmt header + 1 byte category code */\r
+#define IEEE80211_MIN_ACTION_SIZE FIELD_OFFSET(struct ieee80211_mgmt, u.action.u)\r
+\r
+\r
+\r
+#endif\r
+\r