List.mui: Update entries count prior to range change
[AROS.git] / workbench / network / WirelessManager / src / drivers / driver_ralink.h
blobd13df28de45647b08deaab1fde727765aca513fc
1 /*
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
11 * license.
13 * See README and COPYING for more details.
16 // Ralink defined OIDs
17 #if WIRELESS_EXT <= 11
18 #ifndef SIOCDEVPRIVATE
19 #define SIOCDEVPRIVATE 0x8BE0
20 #endif
21 #define SIOCIWFIRSTPRIV SIOCDEVPRIVATE
22 #endif
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
57 #define RT_OID_WPS_PROBE_REQ_IE 0x0625
59 #define PACKED __attribute__ ((packed))
61 //wpa_supplicant event flags
62 #define RT_ASSOC_EVENT_FLAG 0x0101
63 #define RT_DISASSOC_EVENT_FLAG 0x0102
64 #define RT_REQIE_EVENT_FLAG 0x0103
65 #define RT_RESPIE_EVENT_FLAG 0x0104
66 #define RT_ASSOCINFO_EVENT_FLAG 0x0105
67 #define RT_PMKIDCAND_FLAG 0x0106
68 #define RT_INTERFACE_DOWN 0x0107
69 #define RT_INTERFACE_UP 0x0108
72 // IEEE 802.11 Structures and definitions
74 // new types for Media Specific Indications
76 #ifndef ULONG
77 #define CHAR char
78 #define INT int
79 #define SHORT int
80 #define UINT u32
81 #undef ULONG
82 //#define ULONG u32
83 #define ULONG unsigned long /* 32-bit in 32-bit CPU or 64-bit in 64-bit CPU */
84 #define USHORT unsigned short
85 #define UCHAR unsigned char
87 #define uint32 u32
88 #define uint8 u8
91 #define BOOLEAN u8
92 //#define LARGE_INTEGER s64
93 #define VOID void
94 #define LONG long
95 #define LONGLONG s64
96 #define ULONGLONG u64
97 typedef VOID *PVOID;
98 typedef CHAR *PCHAR;
99 typedef UCHAR *PUCHAR;
100 typedef USHORT *PUSHORT;
101 typedef LONG *PLONG;
102 typedef ULONG *PULONG;
104 typedef union _LARGE_INTEGER {
105 struct {
106 ULONG LowPart;
107 LONG HighPart;
108 }vv;
109 struct {
110 ULONG LowPart;
111 LONG HighPart;
112 } u;
113 s64 QuadPart;
114 } LARGE_INTEGER;
116 #endif
118 #define NDIS_802_11_LENGTH_SSID 32
119 #define NDIS_802_11_LENGTH_RATES 8
120 #define NDIS_802_11_LENGTH_RATES_EX 16
121 #define MAX_LEN_OF_SSID 32
122 #define MAC_ADDR_LEN 6
124 typedef UCHAR NDIS_802_11_MAC_ADDRESS[6];
126 // mask for authentication/integrity fields
127 #define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS 0x0f
129 #define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01
130 #define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02
131 #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06
132 #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E
134 // Added new types for OFDM 5G and 2.4G
135 typedef enum _NDIS_802_11_NETWORK_TYPE
137 Ndis802_11FH,
138 Ndis802_11DS,
139 Ndis802_11OFDM5,
140 Ndis802_11OFDM24,
141 Ndis802_11Automode,
142 Ndis802_11NetworkTypeMax // not a real type, defined as an upper bound
143 } NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE;
146 // Received Signal Strength Indication
148 typedef LONG NDIS_802_11_RSSI; // in dBm
150 typedef struct _NDIS_802_11_CONFIGURATION_FH
152 ULONG Length; // Length of structure
153 ULONG HopPattern; // As defined by 802.11, MSB set
154 ULONG HopSet; // to one if non-802.11
155 ULONG DwellTime; // units are Kusec
156 } NDIS_802_11_CONFIGURATION_FH, *PNDIS_802_11_CONFIGURATION_FH;
158 typedef struct _NDIS_802_11_CONFIGURATION
160 ULONG Length; // Length of structure
161 ULONG BeaconPeriod; // units are Kusec
162 ULONG ATIMWindow; // units are Kusec
163 ULONG DSConfig; // Frequency, units are kHz
164 NDIS_802_11_CONFIGURATION_FH FHConfig;
165 } NDIS_802_11_CONFIGURATION, *PNDIS_802_11_CONFIGURATION;
167 typedef ULONG NDIS_802_11_KEY_INDEX;
168 typedef ULONGLONG NDIS_802_11_KEY_RSC;
170 // Key mapping keys require a BSSID
171 typedef struct _NDIS_802_11_KEY
173 UINT Length; // Length of this structure
174 UINT KeyIndex;
175 UINT KeyLength; // length of key in bytes
176 NDIS_802_11_MAC_ADDRESS BSSID;
177 NDIS_802_11_KEY_RSC KeyRSC;
178 UCHAR KeyMaterial[1]; // variable length depending on above field
179 } NDIS_802_11_KEY, *PNDIS_802_11_KEY;
181 typedef struct _NDIS_802_11_REMOVE_KEY
183 UINT Length; // Length of this structure
184 UINT KeyIndex;
185 NDIS_802_11_MAC_ADDRESS BSSID;
186 } NDIS_802_11_REMOVE_KEY, *PNDIS_802_11_REMOVE_KEY;
188 typedef struct PACKED _NDIS_802_11_WEP
190 UINT Length; // Length of this structure
191 UINT KeyIndex; // 0 is the per-client key, 1-N are the
192 // global keys
193 UINT KeyLength; // length of key in bytes
194 UCHAR KeyMaterial[1];// variable length depending on above field
195 } NDIS_802_11_WEP, *PNDIS_802_11_WEP;
198 typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE
200 Ndis802_11IBSS,
201 Ndis802_11Infrastructure,
202 Ndis802_11AutoUnknown,
203 Ndis802_11InfrastructureMax // Not a real value, defined as upper bound
204 } NDIS_802_11_NETWORK_INFRASTRUCTURE, *PNDIS_802_11_NETWORK_INFRASTRUCTURE;
206 // PMKID Structures
207 typedef UCHAR NDIS_802_11_PMKID_VALUE[16];
209 typedef struct _BSSID_INFO
211 NDIS_802_11_MAC_ADDRESS BSSID;
212 NDIS_802_11_PMKID_VALUE PMKID;
213 } BSSID_INFO, *PBSSID_INFO;
215 typedef struct _NDIS_802_11_PMKID
217 ULONG Length;
218 ULONG BSSIDInfoCount;
219 BSSID_INFO BSSIDInfo[1];
220 } NDIS_802_11_PMKID, *PNDIS_802_11_PMKID;
222 //Added new types for PMKID Candidate lists.
223 typedef struct _PMKID_CANDIDATE {
224 NDIS_802_11_MAC_ADDRESS BSSID;
225 ULONG Flags;
226 } PMKID_CANDIDATE, *PPMKID_CANDIDATE;
228 typedef struct _NDIS_802_11_PMKID_CANDIDATE_LIST
230 ULONG Version; // Version of the structure
231 ULONG NumCandidates; // No. of pmkid candidates
232 PMKID_CANDIDATE CandidateList[1];
233 } NDIS_802_11_PMKID_CANDIDATE_LIST, *PNDIS_802_11_PMKID_CANDIDATE_LIST;
235 //Flags for PMKID Candidate list structure
236 #define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01
238 // Add new authentication modes
239 typedef enum _NDIS_802_11_AUTHENTICATION_MODE
241 Ndis802_11AuthModeOpen,
242 Ndis802_11AuthModeShared,
243 Ndis802_11AuthModeAutoSwitch,
244 Ndis802_11AuthModeWPA,
245 Ndis802_11AuthModeWPAPSK,
246 Ndis802_11AuthModeWPANone,
247 Ndis802_11AuthModeWPA2,
248 Ndis802_11AuthModeWPA2PSK,
249 Ndis802_11AuthModeMax // Not a real mode, defined as upper bound
250 } NDIS_802_11_AUTHENTICATION_MODE, *PNDIS_802_11_AUTHENTICATION_MODE;
252 typedef UCHAR NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES]; // Set of 8 data rates
253 typedef UCHAR NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX]; // Set of 16 data rates
255 typedef struct PACKED _NDIS_802_11_SSID
257 INT SsidLength; // length of SSID field below, in bytes;
258 // this can be zero.
259 UCHAR Ssid[NDIS_802_11_LENGTH_SSID]; // SSID information field
260 } NDIS_802_11_SSID, *PNDIS_802_11_SSID;
263 typedef struct PACKED _NDIS_WLAN_BSSID
265 ULONG Length; // Length of this structure
266 NDIS_802_11_MAC_ADDRESS MacAddress; // BSSID
267 UCHAR Reserved[2];
268 NDIS_802_11_SSID Ssid; // SSID
269 ULONG Privacy; // WEP encryption requirement
270 NDIS_802_11_RSSI Rssi; // receive signal
271 // strength in dBm
272 NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
273 NDIS_802_11_CONFIGURATION Configuration;
274 NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode;
275 NDIS_802_11_RATES SupportedRates;
276 } NDIS_WLAN_BSSID, *PNDIS_WLAN_BSSID;
278 typedef struct PACKED _NDIS_802_11_BSSID_LIST
280 UINT NumberOfItems; // in list below, at least 1
281 NDIS_WLAN_BSSID Bssid[1];
282 } NDIS_802_11_BSSID_LIST, *PNDIS_802_11_BSSID_LIST;
284 // Added Capabilities, IELength and IEs for each BSSID
285 typedef struct PACKED _NDIS_WLAN_BSSID_EX
287 ULONG Length; // Length of this structure
288 NDIS_802_11_MAC_ADDRESS MacAddress; // BSSID
289 UCHAR Reserved[2];
290 NDIS_802_11_SSID Ssid; // SSID
291 UINT Privacy; // WEP encryption requirement
292 NDIS_802_11_RSSI Rssi; // receive signal
293 // strength in dBm
294 NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
295 NDIS_802_11_CONFIGURATION Configuration;
296 NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode;
297 NDIS_802_11_RATES_EX SupportedRates;
298 ULONG IELength;
299 UCHAR IEs[1];
300 } NDIS_WLAN_BSSID_EX, *PNDIS_WLAN_BSSID_EX;
302 typedef struct PACKED _NDIS_802_11_BSSID_LIST_EX
304 UINT NumberOfItems; // in list below, at least 1
305 NDIS_WLAN_BSSID_EX Bssid[1];
306 } NDIS_802_11_BSSID_LIST_EX, *PNDIS_802_11_BSSID_LIST_EX;
308 typedef struct PACKED _NDIS_802_11_FIXED_IEs
310 UCHAR Timestamp[8];
311 USHORT BeaconInterval;
312 USHORT Capabilities;
313 } NDIS_802_11_FIXED_IEs, *PNDIS_802_11_FIXED_IEs;
315 // Added new encryption types
316 // Also aliased typedef to new name
317 typedef enum _NDIS_802_11_WEP_STATUS
319 Ndis802_11WEPEnabled,
320 Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
321 Ndis802_11WEPDisabled,
322 Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
323 Ndis802_11WEPKeyAbsent,
324 Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
325 Ndis802_11WEPNotSupported,
326 Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
327 Ndis802_11Encryption2Enabled,
328 Ndis802_11Encryption2KeyAbsent,
329 Ndis802_11Encryption3Enabled,
330 Ndis802_11Encryption3KeyAbsent
331 } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
332 NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
334 typedef enum _NDIS_802_11_RELOAD_DEFAULTS
336 Ndis802_11ReloadWEPKeys
337 } NDIS_802_11_RELOAD_DEFAULTS, *PNDIS_802_11_RELOAD_DEFAULTS;
339 #define NDIS_802_11_AI_REQFI_CAPABILITIES 1
340 #define NDIS_802_11_AI_REQFI_LISTENINTERVAL 2
341 #define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS 4
343 #define NDIS_802_11_AI_RESFI_CAPABILITIES 1
344 #define NDIS_802_11_AI_RESFI_STATUSCODE 2
345 #define NDIS_802_11_AI_RESFI_ASSOCIATIONID 4
347 typedef struct _NDIS_802_11_AI_REQFI
349 USHORT Capabilities;
350 USHORT ListenInterval;
351 NDIS_802_11_MAC_ADDRESS CurrentAPAddress;
352 } NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI;
354 typedef struct _NDIS_802_11_AI_RESFI
356 USHORT Capabilities;
357 USHORT StatusCode;
358 USHORT AssociationId;
359 } NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI;
361 typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
363 ULONG Length;
364 USHORT AvailableRequestFixedIEs;
365 NDIS_802_11_AI_REQFI RequestFixedIEs;
366 ULONG RequestIELength;
367 ULONG OffsetRequestIEs;
368 USHORT AvailableResponseFixedIEs;
369 NDIS_802_11_AI_RESFI ResponseFixedIEs;
370 ULONG ResponseIELength;
371 ULONG OffsetResponseIEs;
372 } NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION;
374 struct ndis_pmkid_entry {
375 struct ndis_pmkid_entry *next;
376 u8 bssid[ETH_ALEN];
377 u8 pmkid[16];
380 typedef struct _MLME_DEAUTH_REQ_STRUCT {
381 UCHAR Addr[MAC_ADDR_LEN];
382 USHORT Reason;
383 } MLME_DEAUTH_REQ_STRUCT, *PMLME_DEAUTH_REQ_STRUCT;