2 *************************************************************************
4 * 5F., No.36, Taiyuan St., Jhubei City,
8 * (c) Copyright 2002-2007, Ralink Technology, Inc.
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
25 *************************************************************************
34 -------- ---------- ----------------------------------------------
35 Name Date Modification logs
44 // IEEE 802.11 Structures and definitions
46 #define MAX_TX_POWER_LEVEL 100 /* mW */
47 #define MAX_RSSI_TRIGGER -10 /* dBm */
48 #define MIN_RSSI_TRIGGER -200 /* dBm */
49 #define MAX_FRAG_THRESHOLD 2346 /* byte count */
50 #define MIN_FRAG_THRESHOLD 256 /* byte count */
51 #define MAX_RTS_THRESHOLD 2347 /* byte count */
53 // new types for Media Specific Indications
54 // Extension channel offset
56 #define EXTCHA_ABOVE 0x1
57 #define EXTCHA_BELOW 0x3
60 #define BAND_WIDTH_20 0
61 #define BAND_WIDTH_40 1
62 #define BAND_WIDTH_BOTH 2
63 #define BAND_WIDTH_10 3 // 802.11j has 10MHz. This definition is for internal usage. doesn't fill in the IE or other field.
65 #define GAP_INTERVAL_400 1 // only support in HT mode
66 #define GAP_INTERVAL_800 0
67 #define GAP_INTERVAL_BOTH 2
69 #define NdisMediaStateConnected 1
70 #define NdisMediaStateDisconnected 0
72 #define NDIS_802_11_LENGTH_SSID 32
73 #define NDIS_802_11_LENGTH_RATES 8
74 #define NDIS_802_11_LENGTH_RATES_EX 16
75 #define MAC_ADDR_LENGTH 6
76 #define MAX_NUM_OF_CHS 49 // 14 channels @2.4G + 12@UNII + 4 @MMAC + 11 @HiperLAN2 + 7 @Japan + 1 as NULL terminationc
77 #define MAX_NUMBER_OF_EVENT 10 // entry # in EVENT table
78 #define MAX_NUMBER_OF_MAC 32 // if MAX_MBSSID_NUM is 8, this value can't be larger than 211
79 #define MAX_NUMBER_OF_ACL 64
80 #define MAX_LENGTH_OF_SUPPORT_RATES 12 // 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54
81 #define MAX_NUMBER_OF_DLS_ENTRY 4
83 #define OID_GEN_MACHINE_NAME 0x0001021A
85 #define RT_QUERY_SIGNAL_CONTEXT 0x0402
86 #define RT_SET_IAPP_PID 0x0404
87 #define RT_SET_APD_PID 0x0405
88 #define RT_SET_DEL_MAC_ENTRY 0x0406
93 #define OID_GET_SET_TOGGLE 0x8000
95 #define OID_802_11_NETWORK_TYPES_SUPPORTED 0x0103
96 #define OID_802_11_NETWORK_TYPE_IN_USE 0x0104
97 #define OID_802_11_RSSI_TRIGGER 0x0107
98 #define RT_OID_802_11_RSSI 0x0108 //rt2860 only , kathy
99 #define RT_OID_802_11_RSSI_1 0x0109 //rt2860 only , kathy
100 #define RT_OID_802_11_RSSI_2 0x010A //rt2860 only , kathy
101 #define OID_802_11_NUMBER_OF_ANTENNAS 0x010B
102 #define OID_802_11_RX_ANTENNA_SELECTED 0x010C
103 #define OID_802_11_TX_ANTENNA_SELECTED 0x010D
104 #define OID_802_11_SUPPORTED_RATES 0x010E
105 #define OID_802_11_ADD_WEP 0x0112
106 #define OID_802_11_REMOVE_WEP 0x0113
107 #define OID_802_11_DISASSOCIATE 0x0114
108 #define OID_802_11_PRIVACY_FILTER 0x0118
109 #define OID_802_11_ASSOCIATION_INFORMATION 0x011E
110 #define OID_802_11_TEST 0x011F
111 #define RT_OID_802_11_COUNTRY_REGION 0x0507
112 #define OID_802_11_BSSID_LIST_SCAN 0x0508
113 #define OID_802_11_SSID 0x0509
114 #define OID_802_11_BSSID 0x050A
115 #define RT_OID_802_11_RADIO 0x050B
116 #define RT_OID_802_11_PHY_MODE 0x050C
117 #define RT_OID_802_11_STA_CONFIG 0x050D
118 #define OID_802_11_DESIRED_RATES 0x050E
119 #define RT_OID_802_11_PREAMBLE 0x050F
120 #define OID_802_11_WEP_STATUS 0x0510
121 #define OID_802_11_AUTHENTICATION_MODE 0x0511
122 #define OID_802_11_INFRASTRUCTURE_MODE 0x0512
123 #define RT_OID_802_11_RESET_COUNTERS 0x0513
124 #define OID_802_11_RTS_THRESHOLD 0x0514
125 #define OID_802_11_FRAGMENTATION_THRESHOLD 0x0515
126 #define OID_802_11_POWER_MODE 0x0516
127 #define OID_802_11_TX_POWER_LEVEL 0x0517
128 #define RT_OID_802_11_ADD_WPA 0x0518
129 #define OID_802_11_REMOVE_KEY 0x0519
130 #define OID_802_11_ADD_KEY 0x0520
131 #define OID_802_11_CONFIGURATION 0x0521
132 #define OID_802_11_TX_PACKET_BURST 0x0522
133 #define RT_OID_802_11_QUERY_NOISE_LEVEL 0x0523
134 #define RT_OID_802_11_EXTRA_INFO 0x0524
136 #define RT_OID_802_11_HARDWARE_REGISTER 0x0525
138 #define OID_802_11_ENCRYPTION_STATUS OID_802_11_WEP_STATUS
139 #define OID_802_11_DEAUTHENTICATION 0x0526
140 #define OID_802_11_DROP_UNENCRYPTED 0x0527
141 #define OID_802_11_MIC_FAILURE_REPORT_FRAME 0x0528
143 // For 802.1x daemin using to require current driver configuration
144 #define OID_802_11_RADIUS_QUERY_SETTING 0x0540
146 #define RT_OID_DEVICE_NAME 0x0607
147 #define RT_OID_VERSION_INFO 0x0608
148 #define OID_802_11_BSSID_LIST 0x0609
149 #define OID_802_3_CURRENT_ADDRESS 0x060A
150 #define OID_GEN_MEDIA_CONNECT_STATUS 0x060B
151 #define RT_OID_802_11_QUERY_LINK_STATUS 0x060C
152 #define OID_802_11_RSSI 0x060D
153 #define OID_802_11_STATISTICS 0x060E
154 #define OID_GEN_RCV_OK 0x060F
155 #define OID_GEN_RCV_NO_BUFFER 0x0610
156 #define RT_OID_802_11_QUERY_EEPROM_VERSION 0x0611
157 #define RT_OID_802_11_QUERY_FIRMWARE_VERSION 0x0612
158 #define RT_OID_802_11_QUERY_LAST_RX_RATE 0x0613
159 #define RT_OID_802_11_TX_POWER_LEVEL_1 0x0614
160 #define RT_OID_802_11_QUERY_PIDVID 0x0615
162 #define OID_SET_COUNTERMEASURES 0x0616
163 #define OID_802_11_SET_IEEE8021X 0x0617
164 #define OID_802_11_SET_IEEE8021X_REQUIRE_KEY 0x0618
165 #define OID_802_11_PMKID 0x0620
166 #define RT_OID_WPA_SUPPLICANT_SUPPORT 0x0621
167 #define RT_OID_WE_VERSION_COMPILED 0x0622
168 #define RT_OID_NEW_DRIVER 0x0623
172 #define RT_OID_802_11_SNR_0 0x0630
173 #define RT_OID_802_11_SNR_1 0x0631
174 #define RT_OID_802_11_QUERY_LAST_TX_RATE 0x0632
175 #define RT_OID_802_11_QUERY_HT_PHYMODE 0x0633
176 #define RT_OID_802_11_SET_HT_PHYMODE 0x0634
177 #define OID_802_11_RELOAD_DEFAULTS 0x0635
178 #define RT_OID_802_11_QUERY_APSD_SETTING 0x0636
179 #define RT_OID_802_11_SET_APSD_SETTING 0x0637
180 #define RT_OID_802_11_QUERY_APSD_PSM 0x0638
181 #define RT_OID_802_11_SET_APSD_PSM 0x0639
182 #define RT_OID_802_11_QUERY_DLS 0x063A
183 #define RT_OID_802_11_SET_DLS 0x063B
184 #define RT_OID_802_11_QUERY_DLS_PARAM 0x063C
185 #define RT_OID_802_11_SET_DLS_PARAM 0x063D
186 #define RT_OID_802_11_QUERY_WMM 0x063E
187 #define RT_OID_802_11_SET_WMM 0x063F
188 #define RT_OID_802_11_QUERY_IMME_BA_CAP 0x0640
189 #define RT_OID_802_11_SET_IMME_BA_CAP 0x0641
190 #define RT_OID_802_11_QUERY_BATABLE 0x0642
191 #define RT_OID_802_11_ADD_IMME_BA 0x0643
192 #define RT_OID_802_11_TEAR_IMME_BA 0x0644
193 #define RT_OID_DRIVER_DEVICE_NAME 0x0645
194 #define RT_OID_802_11_QUERY_DAT_HT_PHYMODE 0x0646
195 #define RT_OID_QUERY_MULTIPLE_CARD_SUPPORT 0x0647
197 // Ralink defined OIDs
198 // Dennis Lee move to platform specific
200 #define RT_OID_802_11_BSSID (OID_GET_SET_TOGGLE | OID_802_11_BSSID)
201 #define RT_OID_802_11_SSID (OID_GET_SET_TOGGLE | OID_802_11_SSID)
202 #define RT_OID_802_11_INFRASTRUCTURE_MODE (OID_GET_SET_TOGGLE | OID_802_11_INFRASTRUCTURE_MODE)
203 #define RT_OID_802_11_ADD_WEP (OID_GET_SET_TOGGLE | OID_802_11_ADD_WEP)
204 #define RT_OID_802_11_ADD_KEY (OID_GET_SET_TOGGLE | OID_802_11_ADD_KEY)
205 #define RT_OID_802_11_REMOVE_WEP (OID_GET_SET_TOGGLE | OID_802_11_REMOVE_WEP)
206 #define RT_OID_802_11_REMOVE_KEY (OID_GET_SET_TOGGLE | OID_802_11_REMOVE_KEY)
207 #define RT_OID_802_11_DISASSOCIATE (OID_GET_SET_TOGGLE | OID_802_11_DISASSOCIATE)
208 #define RT_OID_802_11_AUTHENTICATION_MODE (OID_GET_SET_TOGGLE | OID_802_11_AUTHENTICATION_MODE)
209 #define RT_OID_802_11_PRIVACY_FILTER (OID_GET_SET_TOGGLE | OID_802_11_PRIVACY_FILTER)
210 #define RT_OID_802_11_BSSID_LIST_SCAN (OID_GET_SET_TOGGLE | OID_802_11_BSSID_LIST_SCAN)
211 #define RT_OID_802_11_WEP_STATUS (OID_GET_SET_TOGGLE | OID_802_11_WEP_STATUS)
212 #define RT_OID_802_11_RELOAD_DEFAULTS (OID_GET_SET_TOGGLE | OID_802_11_RELOAD_DEFAULTS)
213 #define RT_OID_802_11_NETWORK_TYPE_IN_USE (OID_GET_SET_TOGGLE | OID_802_11_NETWORK_TYPE_IN_USE)
214 #define RT_OID_802_11_TX_POWER_LEVEL (OID_GET_SET_TOGGLE | OID_802_11_TX_POWER_LEVEL)
215 #define RT_OID_802_11_RSSI_TRIGGER (OID_GET_SET_TOGGLE | OID_802_11_RSSI_TRIGGER)
216 #define RT_OID_802_11_FRAGMENTATION_THRESHOLD (OID_GET_SET_TOGGLE | OID_802_11_FRAGMENTATION_THRESHOLD)
217 #define RT_OID_802_11_RTS_THRESHOLD (OID_GET_SET_TOGGLE | OID_802_11_RTS_THRESHOLD)
218 #define RT_OID_802_11_RX_ANTENNA_SELECTED (OID_GET_SET_TOGGLE | OID_802_11_RX_ANTENNA_SELECTED)
219 #define RT_OID_802_11_TX_ANTENNA_SELECTED (OID_GET_SET_TOGGLE | OID_802_11_TX_ANTENNA_SELECTED)
220 #define RT_OID_802_11_SUPPORTED_RATES (OID_GET_SET_TOGGLE | OID_802_11_SUPPORTED_RATES)
221 #define RT_OID_802_11_DESIRED_RATES (OID_GET_SET_TOGGLE | OID_802_11_DESIRED_RATES)
222 #define RT_OID_802_11_CONFIGURATION (OID_GET_SET_TOGGLE | OID_802_11_CONFIGURATION)
223 #define RT_OID_802_11_POWER_MODE (OID_GET_SET_TOGGLE | OID_802_11_POWER_MODE)
225 typedef enum _NDIS_802_11_STATUS_TYPE
227 Ndis802_11StatusType_Authentication,
228 Ndis802_11StatusType_MediaStreamMode,
229 Ndis802_11StatusType_PMKID_CandidateList,
230 Ndis802_11StatusTypeMax // not a real type, defined as an upper bound
231 } NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE;
233 typedef UCHAR NDIS_802_11_MAC_ADDRESS[6];
235 typedef struct _NDIS_802_11_STATUS_INDICATION
237 NDIS_802_11_STATUS_TYPE StatusType;
238 } NDIS_802_11_STATUS_INDICATION, *PNDIS_802_11_STATUS_INDICATION;
240 // mask for authentication/integrity fields
241 #define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS 0x0f
243 #define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01
244 #define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02
245 #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06
246 #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E
248 typedef struct _NDIS_802_11_AUTHENTICATION_REQUEST
250 ULONG Length; // Length of structure
251 NDIS_802_11_MAC_ADDRESS Bssid;
253 } NDIS_802_11_AUTHENTICATION_REQUEST, *PNDIS_802_11_AUTHENTICATION_REQUEST;
255 //Added new types for PMKID Candidate lists.
256 typedef struct _PMKID_CANDIDATE {
257 NDIS_802_11_MAC_ADDRESS BSSID;
259 } PMKID_CANDIDATE, *PPMKID_CANDIDATE;
261 typedef struct _NDIS_802_11_PMKID_CANDIDATE_LIST
263 ULONG Version; // Version of the structure
264 ULONG NumCandidates; // No. of pmkid candidates
265 PMKID_CANDIDATE CandidateList[1];
266 } NDIS_802_11_PMKID_CANDIDATE_LIST, *PNDIS_802_11_PMKID_CANDIDATE_LIST;
268 //Flags for PMKID Candidate list structure
269 #define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01
271 // Added new types for OFDM 5G and 2.4G
272 typedef enum _NDIS_802_11_NETWORK_TYPE
281 Ndis802_11NetworkTypeMax // not a real type, defined as an upper bound
282 } NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE;
284 typedef struct _NDIS_802_11_NETWORK_TYPE_LIST
286 UINT NumberOfItems; // in list below, at least 1
287 NDIS_802_11_NETWORK_TYPE NetworkType [1];
288 } NDIS_802_11_NETWORK_TYPE_LIST, *PNDIS_802_11_NETWORK_TYPE_LIST;
290 typedef enum _NDIS_802_11_POWER_MODE
292 Ndis802_11PowerModeCAM,
293 Ndis802_11PowerModeMAX_PSP,
294 Ndis802_11PowerModeFast_PSP,
295 Ndis802_11PowerModeLegacy_PSP,
296 Ndis802_11PowerModeMax // not a real mode, defined as an upper bound
297 } NDIS_802_11_POWER_MODE, *PNDIS_802_11_POWER_MODE;
299 typedef ULONG NDIS_802_11_TX_POWER_LEVEL; // in milliwatts
302 // Received Signal Strength Indication
304 typedef LONG NDIS_802_11_RSSI; // in dBm
306 typedef struct _NDIS_802_11_CONFIGURATION_FH
308 ULONG Length; // Length of structure
309 ULONG HopPattern; // As defined by 802.11, MSB set
310 ULONG HopSet; // to one if non-802.11
311 ULONG DwellTime; // units are Kusec
312 } NDIS_802_11_CONFIGURATION_FH, *PNDIS_802_11_CONFIGURATION_FH;
314 typedef struct _NDIS_802_11_CONFIGURATION
316 ULONG Length; // Length of structure
317 ULONG BeaconPeriod; // units are Kusec
318 ULONG ATIMWindow; // units are Kusec
319 ULONG DSConfig; // Frequency, units are kHz
320 NDIS_802_11_CONFIGURATION_FH FHConfig;
321 } NDIS_802_11_CONFIGURATION, *PNDIS_802_11_CONFIGURATION;
323 typedef struct _NDIS_802_11_STATISTICS
325 ULONG Length; // Length of structure
326 LARGE_INTEGER TransmittedFragmentCount;
327 LARGE_INTEGER MulticastTransmittedFrameCount;
328 LARGE_INTEGER FailedCount;
329 LARGE_INTEGER RetryCount;
330 LARGE_INTEGER MultipleRetryCount;
331 LARGE_INTEGER RTSSuccessCount;
332 LARGE_INTEGER RTSFailureCount;
333 LARGE_INTEGER ACKFailureCount;
334 LARGE_INTEGER FrameDuplicateCount;
335 LARGE_INTEGER ReceivedFragmentCount;
336 LARGE_INTEGER MulticastReceivedFrameCount;
337 LARGE_INTEGER FCSErrorCount;
338 LARGE_INTEGER TKIPLocalMICFailures;
339 LARGE_INTEGER TKIPRemoteMICErrors;
340 LARGE_INTEGER TKIPICVErrors;
341 LARGE_INTEGER TKIPCounterMeasuresInvoked;
342 LARGE_INTEGER TKIPReplays;
343 LARGE_INTEGER CCMPFormatErrors;
344 LARGE_INTEGER CCMPReplays;
345 LARGE_INTEGER CCMPDecryptErrors;
346 LARGE_INTEGER FourWayHandshakeFailures;
347 } NDIS_802_11_STATISTICS, *PNDIS_802_11_STATISTICS;
349 typedef ULONG NDIS_802_11_KEY_INDEX;
350 typedef ULONGLONG NDIS_802_11_KEY_RSC;
352 #define MAX_RADIUS_SRV_NUM 2 // 802.1x failover number
354 typedef struct PACKED _RADIUS_SRV_INFO {
357 UCHAR radius_key[64];
358 UCHAR radius_key_len;
359 } RADIUS_SRV_INFO, *PRADIUS_SRV_INFO;
361 typedef struct PACKED _RADIUS_KEY_INFO
363 UCHAR radius_srv_num;
364 RADIUS_SRV_INFO radius_srv_info[MAX_RADIUS_SRV_NUM];
365 UCHAR ieee8021xWEP; // dynamic WEP
367 UCHAR key_length; // length of key in bytes
368 UCHAR key_material[13];
369 } RADIUS_KEY_INFO, *PRADIUS_KEY_INFO;
371 // It's used by 802.1x daemon to require relative configuration
372 typedef struct PACKED _RADIUS_CONF
374 UINT32 Length; // Length of this structure
375 UCHAR mbss_num; // indicate multiple BSS number
377 UINT32 retry_interval;
378 UINT32 session_timeout_interval;
379 UCHAR EAPifname[IFNAMSIZ];
381 UCHAR PreAuthifname[IFNAMSIZ];
382 UCHAR PreAuthifname_len;
383 RADIUS_KEY_INFO RadiusInfo[8/*MAX_MBSSID_NUM*/];
384 } RADIUS_CONF, *PRADIUS_CONF;
386 // Key mapping keys require a BSSID
387 typedef struct _NDIS_802_11_KEY
389 UINT Length; // Length of this structure
391 UINT KeyLength; // length of key in bytes
392 NDIS_802_11_MAC_ADDRESS BSSID;
393 NDIS_802_11_KEY_RSC KeyRSC;
394 UCHAR KeyMaterial[1]; // variable length depending on above field
395 } NDIS_802_11_KEY, *PNDIS_802_11_KEY;
397 typedef struct _NDIS_802_11_REMOVE_KEY
399 UINT Length; // Length of this structure
401 NDIS_802_11_MAC_ADDRESS BSSID;
402 } NDIS_802_11_REMOVE_KEY, *PNDIS_802_11_REMOVE_KEY;
404 typedef struct _NDIS_802_11_WEP
406 UINT Length; // Length of this structure
407 UINT KeyIndex; // 0 is the per-client key, 1-N are the
409 UINT KeyLength; // length of key in bytes
410 UCHAR KeyMaterial[1];// variable length depending on above field
411 } NDIS_802_11_WEP, *PNDIS_802_11_WEP;
414 typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE
417 Ndis802_11Infrastructure,
418 Ndis802_11AutoUnknown,
420 Ndis802_11InfrastructureMax // Not a real value, defined as upper bound
421 } NDIS_802_11_NETWORK_INFRASTRUCTURE, *PNDIS_802_11_NETWORK_INFRASTRUCTURE;
423 // Add new authentication modes
424 typedef enum _NDIS_802_11_AUTHENTICATION_MODE
426 Ndis802_11AuthModeOpen,
427 Ndis802_11AuthModeShared,
428 Ndis802_11AuthModeAutoSwitch,
429 Ndis802_11AuthModeWPA,
430 Ndis802_11AuthModeWPAPSK,
431 Ndis802_11AuthModeWPANone,
432 Ndis802_11AuthModeWPA2,
433 Ndis802_11AuthModeWPA2PSK,
434 Ndis802_11AuthModeWPA1WPA2,
435 Ndis802_11AuthModeWPA1PSKWPA2PSK,
436 Ndis802_11AuthModeMax // Not a real mode, defined as upper bound
437 } NDIS_802_11_AUTHENTICATION_MODE, *PNDIS_802_11_AUTHENTICATION_MODE;
439 typedef UCHAR NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES]; // Set of 8 data rates
440 typedef UCHAR NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX]; // Set of 16 data rates
442 typedef struct PACKED _NDIS_802_11_SSID
444 UINT SsidLength; // length of SSID field below, in bytes;
446 UCHAR Ssid[NDIS_802_11_LENGTH_SSID]; // SSID information field
447 } NDIS_802_11_SSID, *PNDIS_802_11_SSID;
450 typedef struct PACKED _NDIS_WLAN_BSSID
452 ULONG Length; // Length of this structure
453 NDIS_802_11_MAC_ADDRESS MacAddress; // BSSID
455 NDIS_802_11_SSID Ssid; // SSID
456 ULONG Privacy; // WEP encryption requirement
457 NDIS_802_11_RSSI Rssi; // receive signal strength in dBm
458 NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
459 NDIS_802_11_CONFIGURATION Configuration;
460 NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode;
461 NDIS_802_11_RATES SupportedRates;
462 } NDIS_WLAN_BSSID, *PNDIS_WLAN_BSSID;
464 typedef struct PACKED _NDIS_802_11_BSSID_LIST
466 UINT NumberOfItems; // in list below, at least 1
467 NDIS_WLAN_BSSID Bssid[1];
468 } NDIS_802_11_BSSID_LIST, *PNDIS_802_11_BSSID_LIST;
470 // Added Capabilities, IELength and IEs for each BSSID
471 typedef struct PACKED _NDIS_WLAN_BSSID_EX
473 ULONG Length; // Length of this structure
474 NDIS_802_11_MAC_ADDRESS MacAddress; // BSSID
476 NDIS_802_11_SSID Ssid; // SSID
477 UINT Privacy; // WEP encryption requirement
478 NDIS_802_11_RSSI Rssi; // receive signal
480 NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
481 NDIS_802_11_CONFIGURATION Configuration;
482 NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode;
483 NDIS_802_11_RATES_EX SupportedRates;
486 } NDIS_WLAN_BSSID_EX, *PNDIS_WLAN_BSSID_EX;
488 typedef struct PACKED _NDIS_802_11_BSSID_LIST_EX
490 UINT NumberOfItems; // in list below, at least 1
491 NDIS_WLAN_BSSID_EX Bssid[1];
492 } NDIS_802_11_BSSID_LIST_EX, *PNDIS_802_11_BSSID_LIST_EX;
494 typedef struct PACKED _NDIS_802_11_FIXED_IEs
497 USHORT BeaconInterval;
499 } NDIS_802_11_FIXED_IEs, *PNDIS_802_11_FIXED_IEs;
501 typedef struct _NDIS_802_11_VARIABLE_IEs
504 UCHAR Length; // Number of bytes in data field
506 } NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs;
508 typedef ULONG NDIS_802_11_FRAGMENTATION_THRESHOLD;
510 typedef ULONG NDIS_802_11_RTS_THRESHOLD;
512 typedef ULONG NDIS_802_11_ANTENNA;
514 typedef enum _NDIS_802_11_PRIVACY_FILTER
516 Ndis802_11PrivFilterAcceptAll,
517 Ndis802_11PrivFilter8021xWEP
518 } NDIS_802_11_PRIVACY_FILTER, *PNDIS_802_11_PRIVACY_FILTER;
520 // Added new encryption types
521 // Also aliased typedef to new name
522 typedef enum _NDIS_802_11_WEP_STATUS
524 Ndis802_11WEPEnabled,
525 Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
526 Ndis802_11WEPDisabled,
527 Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
528 Ndis802_11WEPKeyAbsent,
529 Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
530 Ndis802_11WEPNotSupported,
531 Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
532 Ndis802_11Encryption2Enabled,
533 Ndis802_11Encryption2KeyAbsent,
534 Ndis802_11Encryption3Enabled,
535 Ndis802_11Encryption3KeyAbsent,
536 Ndis802_11Encryption4Enabled, // TKIP or AES mix
537 Ndis802_11Encryption4KeyAbsent,
539 Ndis802_11GroupWEP40Enabled,
540 Ndis802_11GroupWEP104Enabled,
542 } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
543 NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
545 typedef enum _NDIS_802_11_RELOAD_DEFAULTS
547 Ndis802_11ReloadWEPKeys
548 } NDIS_802_11_RELOAD_DEFAULTS, *PNDIS_802_11_RELOAD_DEFAULTS;
550 #define NDIS_802_11_AI_REQFI_CAPABILITIES 1
551 #define NDIS_802_11_AI_REQFI_LISTENINTERVAL 2
552 #define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS 4
554 #define NDIS_802_11_AI_RESFI_CAPABILITIES 1
555 #define NDIS_802_11_AI_RESFI_STATUSCODE 2
556 #define NDIS_802_11_AI_RESFI_ASSOCIATIONID 4
558 typedef struct _NDIS_802_11_AI_REQFI
561 USHORT ListenInterval;
562 NDIS_802_11_MAC_ADDRESS CurrentAPAddress;
563 } NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI;
565 typedef struct _NDIS_802_11_AI_RESFI
569 USHORT AssociationId;
570 } NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI;
572 typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
575 USHORT AvailableRequestFixedIEs;
576 NDIS_802_11_AI_REQFI RequestFixedIEs;
577 ULONG RequestIELength;
578 ULONG OffsetRequestIEs;
579 USHORT AvailableResponseFixedIEs;
580 NDIS_802_11_AI_RESFI ResponseFixedIEs;
581 ULONG ResponseIELength;
582 ULONG OffsetResponseIEs;
583 } NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION;
585 typedef struct _NDIS_802_11_AUTHENTICATION_EVENT
587 NDIS_802_11_STATUS_INDICATION Status;
588 NDIS_802_11_AUTHENTICATION_REQUEST Request[1];
589 } NDIS_802_11_AUTHENTICATION_EVENT, *PNDIS_802_11_AUTHENTICATION_EVENT;
591 // 802.11 Media stream constraints, associated with OID_802_11_MEDIA_STREAM_MODE
592 typedef enum _NDIS_802_11_MEDIA_STREAM_MODE
594 Ndis802_11MediaStreamOff,
595 Ndis802_11MediaStreamOn,
596 } NDIS_802_11_MEDIA_STREAM_MODE, *PNDIS_802_11_MEDIA_STREAM_MODE;
599 typedef UCHAR NDIS_802_11_PMKID_VALUE[16];
601 typedef struct _BSSID_INFO
603 NDIS_802_11_MAC_ADDRESS BSSID;
604 NDIS_802_11_PMKID_VALUE PMKID;
605 } BSSID_INFO, *PBSSID_INFO;
607 typedef struct _NDIS_802_11_PMKID
611 BSSID_INFO BSSIDInfo[1];
612 } NDIS_802_11_PMKID, *PNDIS_802_11_PMKID;
614 typedef struct _NDIS_802_11_AUTHENTICATION_ENCRYPTION
616 NDIS_802_11_AUTHENTICATION_MODE AuthModeSupported;
617 NDIS_802_11_ENCRYPTION_STATUS EncryptStatusSupported;
618 } NDIS_802_11_AUTHENTICATION_ENCRYPTION, *PNDIS_802_11_AUTHENTICATION_ENCRYPTION;
620 typedef struct _NDIS_802_11_CAPABILITY
625 ULONG NoOfAuthEncryptPairsSupported;
626 NDIS_802_11_AUTHENTICATION_ENCRYPTION AuthenticationEncryptionSupported[1];
627 } NDIS_802_11_CAPABILITY, *PNDIS_802_11_CAPABILITY;
629 #if WIRELESS_EXT <= 11
630 #ifndef SIOCDEVPRIVATE
631 #define SIOCDEVPRIVATE 0x8BE0
633 #define SIOCIWFIRSTPRIV SIOCDEVPRIVATE
637 #define RT_PRIV_IOCTL_EXT (SIOCIWFIRSTPRIV + 0x01) // Sync. with AP for wsc upnp daemon
639 #define RTPRIV_IOCTL_SET (SIOCIWFIRSTPRIV + 0x02)
642 #define RTPRIV_IOCTL_BBP (SIOCIWFIRSTPRIV + 0x03)
643 #define RTPRIV_IOCTL_MAC (SIOCIWFIRSTPRIV + 0x05)
645 #define RTPRIV_IOCTL_RF (SIOCIWFIRSTPRIV + 0x13)
647 #define RTPRIV_IOCTL_E2P (SIOCIWFIRSTPRIV + 0x07)
650 #define RTPRIV_IOCTL_STATISTICS (SIOCIWFIRSTPRIV + 0x09)
651 #define RTPRIV_IOCTL_ADD_PMKID_CACHE (SIOCIWFIRSTPRIV + 0x0A)
652 #define RTPRIV_IOCTL_RADIUS_DATA (SIOCIWFIRSTPRIV + 0x0C)
653 #define RTPRIV_IOCTL_GSITESURVEY (SIOCIWFIRSTPRIV + 0x0D)
654 #define RT_PRIV_IOCTL (SIOCIWFIRSTPRIV + 0x0E) // Sync. with RT61 (for wpa_supplicant)
655 #define RTPRIV_IOCTL_GET_MAC_TABLE (SIOCIWFIRSTPRIV + 0x0F)
657 #define RTPRIV_IOCTL_SHOW (SIOCIWFIRSTPRIV + 0x11)
659 SHOW_CONN_STATUS = 4,
660 SHOW_DRVIER_VERION = 5,
664 SHOW_RXBULK_INFO = 8,
665 SHOW_TXBULK_INFO = 9,
670 #if !defined(RT2860) && !defined(RT30xx)
671 SHOW_ADHOC_ENTRY_INFO = 21,
675 #define OID_802_11_BUILD_CHANNEL_EX 0x0714
676 #define OID_802_11_GET_CH_LIST 0x0715
677 #define OID_802_11_GET_COUNTRY_CODE 0x0716
678 #define OID_802_11_GET_CHANNEL_GEOGRAPHY 0x0717
681 #define RT_OID_WSC_SET_PASSPHRASE 0x0740 // passphrase for wpa(2)-psk
682 #define RT_OID_WSC_DRIVER_AUTO_CONNECT 0x0741
683 #define RT_OID_WSC_QUERY_DEFAULT_PROFILE 0x0742
684 #define RT_OID_WSC_SET_CONN_BY_PROFILE_INDEX 0x0743
685 #define RT_OID_WSC_SET_ACTION 0x0744
686 #define RT_OID_WSC_SET_SSID 0x0745
687 #define RT_OID_WSC_SET_PIN_CODE 0x0746
688 #define RT_OID_WSC_SET_MODE 0x0747 // PIN or PBC
689 #define RT_OID_WSC_SET_CONF_MODE 0x0748 // Enrollee or Registrar
690 #define RT_OID_WSC_SET_PROFILE 0x0749
692 #define RT_OID_802_11_WSC_QUERY_PROFILE 0x0750
693 // for consistency with RT61
694 #define RT_OID_WSC_QUERY_STATUS 0x0751
695 #define RT_OID_WSC_PIN_CODE 0x0752
696 #define RT_OID_WSC_UUID 0x0753
697 #define RT_OID_WSC_SET_SELECTED_REGISTRAR 0x0754
698 #define RT_OID_WSC_EAPMSG 0x0755
699 #define RT_OID_WSC_MANUFACTURER 0x0756
700 #define RT_OID_WSC_MODEL_NAME 0x0757
701 #define RT_OID_WSC_MODEL_NO 0x0758
702 #define RT_OID_WSC_SERIAL_NO 0x0759
703 #define RT_OID_WSC_MAC_ADDRESS 0x0760
707 // for consistency with RT61
708 #define RT_OID_GET_PHY_MODE 0x761
709 #endif // LLTD_SUPPORT //
711 #if defined(RT2860) || defined(RT30xx)
712 // New for MeetingHouse Api support
713 #define OID_MH_802_1X_SUPPORTED 0xFFEDC100
716 // MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition!!!
717 typedef union _HTTRANSMIT_SETTING {
720 USHORT BW:1; //channel bandwidth 20MHz or 40 MHz
722 USHORT STBC:2; //SPACE
725 USHORT MODE:2; // Use definition MODE_xxx.
728 } HTTRANSMIT_SETTING, *PHTTRANSMIT_SETTING;
730 typedef enum _RT_802_11_PREAMBLE {
731 Rt802_11PreambleLong,
732 Rt802_11PreambleShort,
734 } RT_802_11_PREAMBLE, *PRT_802_11_PREAMBLE;
736 // Only for STA, need to sync with AP
737 typedef enum _RT_802_11_PHY_MODE {
743 PHY_11ABGN_MIXED, // both band 5
744 PHY_11N_2_4G, // 11n-only with 2.4G band 6
745 PHY_11GN_MIXED, // 2.4G band 7
746 PHY_11AN_MIXED, // 5G band 8
747 PHY_11BGN_MIXED, // if check 802.11b. 9
748 PHY_11AGN_MIXED, // if check 802.11b. 10
749 PHY_11N_5G, // 11n-only with 5G band 11
750 } RT_802_11_PHY_MODE;
752 // put all proprietery for-query objects here to reduce # of Query_OID
753 typedef struct _RT_802_11_LINK_STATUS {
754 ULONG CurrTxRate; // in units of 0.5Mbps
755 ULONG ChannelQuality; // 0..100 %
756 ULONG TxByteCount; // both ok and fail
757 ULONG RxByteCount; // both ok and fail
758 ULONG CentralChannel; // 40MHz central channel number
759 } RT_802_11_LINK_STATUS, *PRT_802_11_LINK_STATUS;
761 typedef struct _RT_802_11_EVENT_LOG {
762 LARGE_INTEGER SystemTime; // timestammp via NdisGetCurrentSystemTime()
763 UCHAR Addr[MAC_ADDR_LENGTH];
764 USHORT Event; // EVENT_xxx
765 } RT_802_11_EVENT_LOG, *PRT_802_11_EVENT_LOG;
767 typedef struct _RT_802_11_EVENT_TABLE {
769 ULONG Rsv; // to align Log[] at LARGE_INEGER boundary
770 RT_802_11_EVENT_LOG Log[MAX_NUMBER_OF_EVENT];
771 } RT_802_11_EVENT_TABLE, PRT_802_11_EVENT_TABLE;
773 // MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition!!!
774 typedef union _MACHTTRANSMIT_SETTING {
777 USHORT BW:1; //channel bandwidth 20MHz or 40 MHz
779 USHORT STBC:2; //SPACE
781 USHORT MODE:2; // Use definition MODE_xxx.
784 } MACHTTRANSMIT_SETTING, *PMACHTTRANSMIT_SETTING;
786 typedef struct _RT_802_11_MAC_ENTRY {
787 UCHAR Addr[MAC_ADDR_LENGTH];
789 UCHAR Psm; // 0:PWR_ACTIVE, 1:PWR_SAVE
790 UCHAR MimoPs; // 0:MMPS_STATIC, 1:MMPS_DYNAMIC, 3:MMPS_Enabled
794 UINT32 ConnectedTime;
795 MACHTTRANSMIT_SETTING TxRate;
796 } RT_802_11_MAC_ENTRY, *PRT_802_11_MAC_ENTRY;
798 typedef struct _RT_802_11_MAC_TABLE {
800 RT_802_11_MAC_ENTRY Entry[MAX_NUMBER_OF_MAC];
801 } RT_802_11_MAC_TABLE, *PRT_802_11_MAC_TABLE;
803 // structure for query/set hardware register - MAC, BBP, RF register
804 typedef struct _RT_802_11_HARDWARE_REGISTER {
805 ULONG HardwareType; // 0:MAC, 1:BBP, 2:RF register, 3:EEPROM
806 ULONG Offset; // Q/S register offset addr
807 ULONG Data; // R/W data buffer
808 } RT_802_11_HARDWARE_REGISTER, *PRT_802_11_HARDWARE_REGISTER;
810 typedef struct _RT_802_11_AP_CONFIG {
811 ULONG EnableTxBurst; // 0-disable, 1-enable
812 ULONG EnableTurboRate; // 0-disable, 1-enable 72/100mbps turbo rate
813 ULONG IsolateInterStaTraffic; // 0-disable, 1-enable isolation
814 ULONG HideSsid; // 0-disable, 1-enable hiding
815 ULONG UseBGProtection; // 0-AUTO, 1-always ON, 2-always OFF
816 ULONG UseShortSlotTime; // 0-no use, 1-use 9-us short slot time
817 ULONG Rsv1; // must be 0
818 ULONG SystemErrorBitmap; // ignore upon SET, return system error upon QUERY
819 } RT_802_11_AP_CONFIG, *PRT_802_11_AP_CONFIG;
821 // structure to query/set STA_CONFIG
822 typedef struct _RT_802_11_STA_CONFIG {
823 ULONG EnableTxBurst; // 0-disable, 1-enable
824 ULONG EnableTurboRate; // 0-disable, 1-enable 72/100mbps turbo rate
825 ULONG UseBGProtection; // 0-AUTO, 1-always ON, 2-always OFF
826 ULONG UseShortSlotTime; // 0-no use, 1-use 9-us short slot time when applicable
827 ULONG AdhocMode; // 0-11b rates only (WIFI spec), 1 - b/g mixed, 2 - g only
828 ULONG HwRadioStatus; // 0-OFF, 1-ON, default is 1, Read-Only
829 ULONG Rsv1; // must be 0
830 ULONG SystemErrorBitmap; // ignore upon SET, return system error upon QUERY
831 } RT_802_11_STA_CONFIG, *PRT_802_11_STA_CONFIG;
834 // For OID Query or Set about BA structure
836 typedef struct _OID_BACAP_STRUC {
839 UCHAR Policy; // 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use. other value invalid
840 UCHAR MpduDensity; // 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use. other value invalid
841 UCHAR AmsduEnable; //Enable AMSDU transmisstion
842 UCHAR AmsduSize; // 0:3839, 1:7935 bytes. UINT MSDUSizeToBytes[] = { 3839, 7935};
843 UCHAR MMPSmode; // MIMO power save more, 0:static, 1:dynamic, 2:rsv, 3:mimo enable
844 BOOLEAN AutoBA; // Auto BA will automatically
845 } OID_BACAP_STRUC, *POID_BACAP_STRUC;
847 typedef struct _RT_802_11_ACL_ENTRY {
848 UCHAR Addr[MAC_ADDR_LENGTH];
850 } RT_802_11_ACL_ENTRY, *PRT_802_11_ACL_ENTRY;
852 typedef struct PACKED _RT_802_11_ACL {
853 ULONG Policy; // 0-disable, 1-positive list, 2-negative list
855 RT_802_11_ACL_ENTRY Entry[MAX_NUMBER_OF_ACL];
856 } RT_802_11_ACL, *PRT_802_11_ACL;
858 typedef struct _RT_802_11_WDS {
860 NDIS_802_11_MAC_ADDRESS Entry[24/*MAX_NUM_OF_WDS_LINK*/];
862 UCHAR KeyMaterial[32];
863 } RT_802_11_WDS, *PRT_802_11_WDS;
865 typedef struct _RT_802_11_TX_RATES_ {
867 UCHAR SupRate[MAX_LENGTH_OF_SUPPORT_RATES];
869 UCHAR ExtRate[MAX_LENGTH_OF_SUPPORT_RATES];
870 } RT_802_11_TX_RATES, *PRT_802_11_TX_RATES;
873 // Definition of extra information code
874 #define GENERAL_LINK_UP 0x0 // Link is Up
875 #define GENERAL_LINK_DOWN 0x1 // Link is Down
876 #define HW_RADIO_OFF 0x2 // Hardware radio off
877 #define SW_RADIO_OFF 0x3 // Software radio off
878 #define AUTH_FAIL 0x4 // Open authentication fail
879 #define AUTH_FAIL_KEYS 0x5 // Shared authentication fail
880 #define ASSOC_FAIL 0x6 // Association failed
881 #define EAP_MIC_FAILURE 0x7 // Deauthencation because MIC failure
882 #define EAP_4WAY_TIMEOUT 0x8 // Deauthencation on 4-way handshake timeout
883 #define EAP_GROUP_KEY_TIMEOUT 0x9 // Deauthencation on group key handshake timeout
884 #define EAP_SUCCESS 0xa // EAP succeed
885 #define DETECT_RADAR_SIGNAL 0xb // Radar signal occur in current channel
886 #define EXTRA_INFO_MAX 0xb // Indicate Last OID
888 #define EXTRA_INFO_CLEAR 0xffffffff
890 // This is OID setting structure. So only GF or MM as Mode. This is valid when our wirelss mode has 802.11n in use.
892 RT_802_11_PHY_MODE PhyMode; //
894 UCHAR HtMode; //HTMODE_GF or HTMODE_MM
895 UCHAR ExtOffset; //extension channel above or below
901 } OID_SET_HT_PHYMODE, *POID_SET_HT_PHYMODE;
904 typedef struct _RT_LLTD_ASSOICATION_ENTRY {
905 UCHAR Addr[ETH_LENGTH_OF_ADDRESS];
906 unsigned short MOR; // maximum operational rate
908 } RT_LLTD_ASSOICATION_ENTRY, *PRT_LLTD_ASSOICATION_ENTRY;
910 typedef struct _RT_LLTD_ASSOICATION_TABLE {
912 RT_LLTD_ASSOICATION_ENTRY Entry[MAX_NUMBER_OF_MAC];
913 } RT_LLTD_ASSOICATION_TABLE, *PRT_LLTD_ASSOICATION_TABLE;
914 #endif // LLTD_SUPPORT //
916 #define MAX_CUSTOM_LEN 128
918 typedef enum _RT_802_11_D_CLIENT_MODE
923 } RT_802_11_D_CLIENT_MODE, *PRT_802_11_D_CLIENT_MODE;
925 typedef struct _RT_CHANNEL_LIST_INFO
927 UCHAR ChannelList[MAX_NUM_OF_CHS]; // list all supported channels for site survey
928 UCHAR ChannelListNum; // number of channel in ChannelList[]
929 } RT_CHANNEL_LIST_INFO, *PRT_CHANNEL_LIST_INFO;
932 // WSC configured credential
933 typedef struct _WSC_CREDENTIAL
935 NDIS_802_11_SSID SSID; // mandatory
936 USHORT AuthType; // mandatory, 1: open, 2: wpa-psk, 4: shared, 8:wpa, 0x10: wpa2, 0x20: wpa2-psk
937 USHORT EncrType; // mandatory, 1: none, 2: wep, 4: tkip, 8: aes
938 UCHAR Key[64]; // mandatory, Maximum 64 byte
940 UCHAR MacAddr[6]; // mandatory, AP MAC address
941 UCHAR KeyIndex; // optional, default is 1
942 UCHAR Rsvd[3]; // Make alignment
943 } WSC_CREDENTIAL, *PWSC_CREDENTIAL;
945 // WSC configured profiles
946 typedef struct _WSC_PROFILE
949 WSC_CREDENTIAL Profile[8]; // Support up to 8 profiles
950 } WSC_PROFILE, *PWSC_PROFILE;