2 * WPA Supplicant - driver_ralink exported functions
3 * Copyright (c) 2003-2005, Jouni Malinen <j@w1.fi>
4 * Copyright (c) 2007, Snowpin Lee <snowpin_lee@ralinktech.com.tw>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * Alternatively, this software may be distributed under the terms of BSD
13 * See README and COPYING for more details.
16 // Ralink defined OIDs
17 #if WIRELESS_EXT <= 11
18 #ifndef SIOCDEVPRIVATE
19 #define SIOCDEVPRIVATE 0x8BE0
21 #define SIOCIWFIRSTPRIV SIOCDEVPRIVATE
24 #define RT_PRIV_IOCTL (SIOCIWFIRSTPRIV + 0x0E)
25 #define RTPRIV_IOCTL_SET (SIOCIWFIRSTPRIV + 0x02)
27 // IEEE 802.11 OIDs & Ralink defined OIDs ******
29 // (RaConfig Set/QueryInform) ==>
30 #define OID_GET_SET_TOGGLE 0x8000
32 #define OID_802_11_ADD_WEP 0x0112
33 #define OID_802_11_REMOVE_WEP 0x0113
34 #define OID_802_11_DISASSOCIATE 0x0114
35 #define OID_802_11_PRIVACY_FILTER 0x0118
36 #define OID_802_11_ASSOCIATION_INFORMATION 0x011E
37 #define OID_802_11_BSSID_LIST_SCAN 0x0508
38 #define OID_802_11_SSID 0x0509
39 #define OID_802_11_BSSID 0x050A
40 #define OID_802_11_WEP_STATUS 0x0510
41 #define OID_802_11_AUTHENTICATION_MODE 0x0511
42 #define OID_802_11_INFRASTRUCTURE_MODE 0x0512
43 #define OID_802_11_TX_POWER_LEVEL 0x0517
44 #define OID_802_11_REMOVE_KEY 0x0519
45 #define OID_802_11_ADD_KEY 0x0520
46 #define OID_802_11_DEAUTHENTICATION 0x0526
47 #define OID_802_11_DROP_UNENCRYPTED 0x0527
48 #define OID_802_11_BSSID_LIST 0x0609
49 #define OID_802_3_CURRENT_ADDRESS 0x060A
50 #define OID_SET_COUNTERMEASURES 0x0616
51 #define OID_802_11_SET_IEEE8021X 0x0617 // For IEEE8021x mode
52 #define OID_802_11_SET_IEEE8021X_REQUIRE_KEY 0x0618 // For DynamicWEP in IEEE802.1x mode
53 #define OID_802_11_PMKID 0x0620
54 #define RT_OID_WPA_SUPPLICANT_SUPPORT 0x0621 // for trigger driver enable/disable wpa_supplicant support
55 #define RT_OID_WE_VERSION_COMPILED 0x0622
56 #define RT_OID_NEW_DRIVER 0x0623
58 #define PACKED __attribute__ ((packed))
60 //wpa_supplicant event flags
61 #define RT_ASSOC_EVENT_FLAG 0x0101
62 #define RT_DISASSOC_EVENT_FLAG 0x0102
63 #define RT_REQIE_EVENT_FLAG 0x0103
64 #define RT_RESPIE_EVENT_FLAG 0x0104
65 #define RT_ASSOCINFO_EVENT_FLAG 0x0105
66 #define RT_PMKIDCAND_FLAG 0x0106
67 #define RT_INTERFACE_DOWN 0x0107
68 #define RT_REPORT_AP_INFO 0x0108
71 // IEEE 802.11 Structures and definitions
73 // new types for Media Specific Indications
82 #define ULONG unsigned long /* 32-bit in 32-bit CPU or 64-bit in 64-bit CPU */
83 #define USHORT unsigned short
84 #define UCHAR unsigned char
91 //#define LARGE_INTEGER s64
98 typedef UCHAR
*PUCHAR
;
99 typedef USHORT
*PUSHORT
;
101 typedef ULONG
*PULONG
;
103 typedef union _LARGE_INTEGER
{
117 #define NDIS_802_11_LENGTH_SSID 32
118 #define NDIS_802_11_LENGTH_RATES 8
119 #define NDIS_802_11_LENGTH_RATES_EX 16
120 #define MAX_LEN_OF_SSID 32
121 #define MAC_ADDR_LEN 6
123 typedef UCHAR NDIS_802_11_MAC_ADDRESS
[6];
125 // mask for authentication/integrity fields
126 #define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS 0x0f
128 #define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01
129 #define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02
130 #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06
131 #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E
133 // Added new types for OFDM 5G and 2.4G
134 typedef enum _NDIS_802_11_NETWORK_TYPE
141 Ndis802_11NetworkTypeMax
// not a real type, defined as an upper bound
142 } NDIS_802_11_NETWORK_TYPE
, *PNDIS_802_11_NETWORK_TYPE
;
145 // Received Signal Strength Indication
147 typedef LONG NDIS_802_11_RSSI
; // in dBm
149 typedef struct _NDIS_802_11_CONFIGURATION_FH
151 ULONG Length
; // Length of structure
152 ULONG HopPattern
; // As defined by 802.11, MSB set
153 ULONG HopSet
; // to one if non-802.11
154 ULONG DwellTime
; // units are Kusec
155 } NDIS_802_11_CONFIGURATION_FH
, *PNDIS_802_11_CONFIGURATION_FH
;
157 typedef struct _NDIS_802_11_CONFIGURATION
159 ULONG Length
; // Length of structure
160 ULONG BeaconPeriod
; // units are Kusec
161 ULONG ATIMWindow
; // units are Kusec
162 ULONG DSConfig
; // Frequency, units are kHz
163 NDIS_802_11_CONFIGURATION_FH FHConfig
;
164 } NDIS_802_11_CONFIGURATION
, *PNDIS_802_11_CONFIGURATION
;
166 typedef ULONG NDIS_802_11_KEY_INDEX
;
167 typedef ULONGLONG NDIS_802_11_KEY_RSC
;
169 // Key mapping keys require a BSSID
170 typedef struct _NDIS_802_11_KEY
172 UINT Length
; // Length of this structure
174 UINT KeyLength
; // length of key in bytes
175 NDIS_802_11_MAC_ADDRESS BSSID
;
176 NDIS_802_11_KEY_RSC KeyRSC
;
177 UCHAR KeyMaterial
[1]; // variable length depending on above field
178 } NDIS_802_11_KEY
, *PNDIS_802_11_KEY
;
180 typedef struct _NDIS_802_11_REMOVE_KEY
182 UINT Length
; // Length of this structure
184 NDIS_802_11_MAC_ADDRESS BSSID
;
185 } NDIS_802_11_REMOVE_KEY
, *PNDIS_802_11_REMOVE_KEY
;
187 typedef struct PACKED _NDIS_802_11_WEP
189 UINT Length
; // Length of this structure
190 UINT KeyIndex
; // 0 is the per-client key, 1-N are the
192 UINT KeyLength
; // length of key in bytes
193 UCHAR KeyMaterial
[1];// variable length depending on above field
194 } NDIS_802_11_WEP
, *PNDIS_802_11_WEP
;
197 typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE
200 Ndis802_11Infrastructure
,
201 Ndis802_11AutoUnknown
,
202 Ndis802_11InfrastructureMax
// Not a real value, defined as upper bound
203 } NDIS_802_11_NETWORK_INFRASTRUCTURE
, *PNDIS_802_11_NETWORK_INFRASTRUCTURE
;
206 typedef UCHAR NDIS_802_11_PMKID_VALUE
[16];
208 typedef struct _BSSID_INFO
210 NDIS_802_11_MAC_ADDRESS BSSID
;
211 NDIS_802_11_PMKID_VALUE PMKID
;
212 } BSSID_INFO
, *PBSSID_INFO
;
214 typedef struct _NDIS_802_11_PMKID
217 ULONG BSSIDInfoCount
;
218 BSSID_INFO BSSIDInfo
[1];
219 } NDIS_802_11_PMKID
, *PNDIS_802_11_PMKID
;
221 //Added new types for PMKID Candidate lists.
222 typedef struct _PMKID_CANDIDATE
{
223 NDIS_802_11_MAC_ADDRESS BSSID
;
225 } PMKID_CANDIDATE
, *PPMKID_CANDIDATE
;
227 typedef struct _NDIS_802_11_PMKID_CANDIDATE_LIST
229 ULONG Version
; // Version of the structure
230 ULONG NumCandidates
; // No. of pmkid candidates
231 PMKID_CANDIDATE CandidateList
[1];
232 } NDIS_802_11_PMKID_CANDIDATE_LIST
, *PNDIS_802_11_PMKID_CANDIDATE_LIST
;
234 //Flags for PMKID Candidate list structure
235 #define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01
237 // Add new authentication modes
238 typedef enum _NDIS_802_11_AUTHENTICATION_MODE
240 Ndis802_11AuthModeOpen
,
241 Ndis802_11AuthModeShared
,
242 Ndis802_11AuthModeAutoSwitch
,
243 Ndis802_11AuthModeWPA
,
244 Ndis802_11AuthModeWPAPSK
,
245 Ndis802_11AuthModeWPANone
,
246 Ndis802_11AuthModeWPA2
,
247 Ndis802_11AuthModeWPA2PSK
,
248 Ndis802_11AuthModeMax
// Not a real mode, defined as upper bound
249 } NDIS_802_11_AUTHENTICATION_MODE
, *PNDIS_802_11_AUTHENTICATION_MODE
;
251 typedef UCHAR NDIS_802_11_RATES
[NDIS_802_11_LENGTH_RATES
]; // Set of 8 data rates
252 typedef UCHAR NDIS_802_11_RATES_EX
[NDIS_802_11_LENGTH_RATES_EX
]; // Set of 16 data rates
254 typedef struct PACKED _NDIS_802_11_SSID
256 INT SsidLength
; // length of SSID field below, in bytes;
258 UCHAR Ssid
[NDIS_802_11_LENGTH_SSID
]; // SSID information field
259 } NDIS_802_11_SSID
, *PNDIS_802_11_SSID
;
262 typedef struct PACKED _NDIS_WLAN_BSSID
264 ULONG Length
; // Length of this structure
265 NDIS_802_11_MAC_ADDRESS MacAddress
; // BSSID
267 NDIS_802_11_SSID Ssid
; // SSID
268 ULONG Privacy
; // WEP encryption requirement
269 NDIS_802_11_RSSI Rssi
; // receive signal
271 NDIS_802_11_NETWORK_TYPE NetworkTypeInUse
;
272 NDIS_802_11_CONFIGURATION Configuration
;
273 NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode
;
274 NDIS_802_11_RATES SupportedRates
;
275 } NDIS_WLAN_BSSID
, *PNDIS_WLAN_BSSID
;
277 typedef struct PACKED _NDIS_802_11_BSSID_LIST
279 UINT NumberOfItems
; // in list below, at least 1
280 NDIS_WLAN_BSSID Bssid
[1];
281 } NDIS_802_11_BSSID_LIST
, *PNDIS_802_11_BSSID_LIST
;
283 // Added Capabilities, IELength and IEs for each BSSID
284 typedef struct PACKED _NDIS_WLAN_BSSID_EX
286 ULONG Length
; // Length of this structure
287 NDIS_802_11_MAC_ADDRESS MacAddress
; // BSSID
289 NDIS_802_11_SSID Ssid
; // SSID
290 UINT Privacy
; // WEP encryption requirement
291 NDIS_802_11_RSSI Rssi
; // receive signal
293 NDIS_802_11_NETWORK_TYPE NetworkTypeInUse
;
294 NDIS_802_11_CONFIGURATION Configuration
;
295 NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode
;
296 NDIS_802_11_RATES_EX SupportedRates
;
299 } NDIS_WLAN_BSSID_EX
, *PNDIS_WLAN_BSSID_EX
;
301 typedef struct PACKED _NDIS_802_11_BSSID_LIST_EX
303 UINT NumberOfItems
; // in list below, at least 1
304 NDIS_WLAN_BSSID_EX Bssid
[1];
305 } NDIS_802_11_BSSID_LIST_EX
, *PNDIS_802_11_BSSID_LIST_EX
;
307 typedef struct PACKED _NDIS_802_11_FIXED_IEs
310 USHORT BeaconInterval
;
312 } NDIS_802_11_FIXED_IEs
, *PNDIS_802_11_FIXED_IEs
;
314 // Added new encryption types
315 // Also aliased typedef to new name
316 typedef enum _NDIS_802_11_WEP_STATUS
318 Ndis802_11WEPEnabled
,
319 Ndis802_11Encryption1Enabled
= Ndis802_11WEPEnabled
,
320 Ndis802_11WEPDisabled
,
321 Ndis802_11EncryptionDisabled
= Ndis802_11WEPDisabled
,
322 Ndis802_11WEPKeyAbsent
,
323 Ndis802_11Encryption1KeyAbsent
= Ndis802_11WEPKeyAbsent
,
324 Ndis802_11WEPNotSupported
,
325 Ndis802_11EncryptionNotSupported
= Ndis802_11WEPNotSupported
,
326 Ndis802_11Encryption2Enabled
,
327 Ndis802_11Encryption2KeyAbsent
,
328 Ndis802_11Encryption3Enabled
,
329 Ndis802_11Encryption3KeyAbsent
330 } NDIS_802_11_WEP_STATUS
, *PNDIS_802_11_WEP_STATUS
,
331 NDIS_802_11_ENCRYPTION_STATUS
, *PNDIS_802_11_ENCRYPTION_STATUS
;
333 typedef enum _NDIS_802_11_RELOAD_DEFAULTS
335 Ndis802_11ReloadWEPKeys
336 } NDIS_802_11_RELOAD_DEFAULTS
, *PNDIS_802_11_RELOAD_DEFAULTS
;
338 #define NDIS_802_11_AI_REQFI_CAPABILITIES 1
339 #define NDIS_802_11_AI_REQFI_LISTENINTERVAL 2
340 #define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS 4
342 #define NDIS_802_11_AI_RESFI_CAPABILITIES 1
343 #define NDIS_802_11_AI_RESFI_STATUSCODE 2
344 #define NDIS_802_11_AI_RESFI_ASSOCIATIONID 4
346 typedef struct _NDIS_802_11_AI_REQFI
349 USHORT ListenInterval
;
350 NDIS_802_11_MAC_ADDRESS CurrentAPAddress
;
351 } NDIS_802_11_AI_REQFI
, *PNDIS_802_11_AI_REQFI
;
353 typedef struct _NDIS_802_11_AI_RESFI
357 USHORT AssociationId
;
358 } NDIS_802_11_AI_RESFI
, *PNDIS_802_11_AI_RESFI
;
360 typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
363 USHORT AvailableRequestFixedIEs
;
364 NDIS_802_11_AI_REQFI RequestFixedIEs
;
365 ULONG RequestIELength
;
366 ULONG OffsetRequestIEs
;
367 USHORT AvailableResponseFixedIEs
;
368 NDIS_802_11_AI_RESFI ResponseFixedIEs
;
369 ULONG ResponseIELength
;
370 ULONG OffsetResponseIEs
;
371 } NDIS_802_11_ASSOCIATION_INFORMATION
, *PNDIS_802_11_ASSOCIATION_INFORMATION
;
373 struct ndis_pmkid_entry
{
374 struct ndis_pmkid_entry
*next
;
379 typedef struct _MLME_DEAUTH_REQ_STRUCT
{
380 UCHAR Addr
[MAC_ADDR_LEN
];
382 } MLME_DEAUTH_REQ_STRUCT
, *PMLME_DEAUTH_REQ_STRUCT
;