4 #include <sys/socket.h>
5 #include <linux/types.h>
6 #include <linux/wireless.h>
8 #define CONFIGURATION_UI_VERSION "1.2.1.0"
9 #define CONFIGURATION_UI_DATE "2004-08-12"
10 #define NIC_DEVICE_NAME "RT2500STA"
12 #define RT2500_SYSTEM_PATH "/etc/Wireless/RT2500STA/"
13 #define RT2500_SYSTEM_DATA "RT2500STA.dat" //for driver init
14 #define RT2500_UI_PROFILE "RT2500STA.ui" //for UI saving Profile.
15 #define RT2500_UI_TYPE 0x18140201
17 #if WIRELESS_EXT <= 11
18 #ifndef SIOCDEVPRIVATE
19 #define SIOCDEVPRIVATE 0x8BE0
21 #define SIOCIWFIRSTPRIV SIOCDEVPRIVATE
24 #define RT_PRIV_IOCTL SIOCIWFIRSTPRIV + 0x01
25 #define RTPRIV_IOCTL_SET SIOCIWFIRSTPRIV + 0x02
30 // Ralink defined OIDs
31 #define OID_GET_SET_TOGGLE 0x8000
33 #define OID_802_11_BSSID 0x0101
34 #define OID_802_11_SSID 0x0102
35 #define OID_802_11_NETWORK_TYPES_SUPPORTED 0x0103
36 #define OID_802_11_NETWORK_TYPE_IN_USE 0x0104
37 #define OID_802_11_TX_POWER_LEVEL 0x0105
38 #define OID_802_11_RSSI 0x0106
39 #define OID_802_11_RSSI_TRIGGER 0x0107
40 #define OID_802_11_INFRASTRUCTURE_MODE 0x0108
41 #define OID_802_11_FRAGMENTATION_THRESHOLD 0x0109
42 #define OID_802_11_RTS_THRESHOLD 0x010A
43 #define OID_802_11_NUMBER_OF_ANTENNAS 0x010B
44 #define OID_802_11_RX_ANTENNA_SELECTED 0x010C
45 #define OID_802_11_TX_ANTENNA_SELECTED 0x010D
46 #define OID_802_11_SUPPORTED_RATES 0x010E
47 #define OID_802_11_DESIRED_RATES 0x010F
48 #define OID_802_11_CONFIGURATION 0x0110
49 #define OID_802_11_STATISTICS 0x0111
50 #define OID_802_11_ADD_WEP 0x0112
51 #define OID_802_11_REMOVE_WEP 0x0113
52 #define OID_802_11_DISASSOCIATE 0x0114
53 #define OID_802_11_POWER_MODE 0x0115
54 #define OID_802_11_BSSID_LIST 0x0116
55 #define OID_802_11_AUTHENTICATION_MODE 0x0117
56 #define OID_802_11_PRIVACY_FILTER 0x0118
57 #define OID_802_11_BSSID_LIST_SCAN 0x0119
58 #define OID_802_11_WEP_STATUS 0x011A
59 // Renamed to reflect better the extended set of encryption status
60 #define OID_802_11_ENCRYPTION_STATUS OID_802_11_WEP_STATUS
61 #define OID_802_11_RELOAD_DEFAULTS 0x011B
62 // Added to allow key mapping and default keys
63 #define OID_802_11_ADD_KEY 0x011C
64 #define OID_802_11_REMOVE_KEY 0x011D
65 #define OID_802_11_ASSOCIATION_INFORMATION 0x011E
66 #define OID_802_11_TEST 0x011F
68 #define OID_802_3_CURRENT_ADDRESS 0x0120
69 #define OID_GEN_RCV_OK 0x0121
70 #define OID_GEN_RCV_NO_BUFFER 0x0122
71 #define OID_GEN_MEDIA_CONNECT_STATUS 0x0123
73 #define RT_OID_DEVICE_NAME 0x0200
74 #define RT_OID_802_11_PREAMBLE 0x0201
75 #define RT_OID_802_11_LINK_STATUS 0x0202
76 #define RT_OID_802_11_RESET_COUNTERS 0x0203
77 #define RT_OID_802_11_AC_CAM 0x0204
79 #define RT_OID_802_11_HARDWARE_REGISTER 0x0205
81 #define RT_OID_802_11_RACONFIG 0x0206
82 #define RT_OID_802_11_COUNTRY_REGION 0x0207
83 #define RT_OID_802_11_RADIO 0x0208
84 #define RT_OID_802_11_RX_AGC_VGC_TUNING 0x0209
85 #define RT_OID_802_11_EVENT_TABLE 0x0210
86 #define RT_OID_802_11_MAC_TABLE 0x0211
87 #define RT_OID_802_11_PHY_MODE 0x0212
88 #define RT_OID_802_11_TX_PACKET_BURST 0x0213
89 #define RT_OID_802_11_TURBO_MODE 0x0214
90 #define RT_OID_802_11_AP_CONFIG 0x0215
91 #define RT_OID_802_11_ACL 0x0216
92 #define RT_OID_802_11_STA_CONFIG 0x0217
93 #define RT_OID_VERSION_INFO 0x0218
95 #define RT_OID_802_11_WDS 0x0219
96 #define RT_OID_802_11_RADIUS_DATA 0x0220
97 #define RT_OID_802_11_WPA_REKEY 0x0221
99 #define RT_OID_802_11_ADD_WPA 0x0222
102 typedef unsigned char UCHAR
;
103 typedef unsigned short USHORT
;
104 typedef unsigned long ULONG
;
105 typedef unsigned int UINT
;
107 typedef unsigned char* PUCHAR
;
108 typedef unsigned short* PUSHORT
;
111 typedef unsigned long DWORD
;
112 typedef unsigned short WORD
;
114 typedef __u64 ULONGLONG
;
115 typedef ULONGLONG LARGE_INTEGER
;
117 #define REGSTR_COUNTRYREGION_MINIMUM 0 //minimum
118 #define REGSTR_COUNTRYREGION_FCC 0 // FCC, CH1-11
119 #define REGSTR_COUNTRYREGION_IC 1 // IC (Canada), CH1-11
120 #define REGSTR_COUNTRYREGION_ETSI 2 // ETSI, CH1-13
121 #define REGSTR_COUNTRYREGION_SPAIN 3 // SPAIN, CH10-11
122 #define REGSTR_COUNTRYREGION_FRANCE 4 // FRANCE, CH10-13
123 #define REGSTR_COUNTRYREGION_MKK 5 // MKK, CH14
124 #define REGSTR_COUNTRYREGION_MKK1 6 // MKK1(TELEC), CH1-14
125 #define REGSTR_COUNTRYREGION_ISRAEL 7 // ISRAEL, CH3-9
126 #define REGSTR_COUNTRYREGION_MAXIMUM 7 // maximum
128 typedef struct _PAIR_CHANNEL_FREQ_ENTRY
132 } PAIR_CHANNEL_FREQ_ENTRY
, *PPAIR_CHANNEL_FREQ_ENTRY
;
135 // IEEE 802.11 Structures and definitions
137 // new types for Media Specific Indications
139 #define NDIS_802_11_LENGTH_SSID 32
140 #define NDIS_802_11_LENGTH_RATES 8
141 #define NDIS_802_11_LENGTH_RATES_EX 16
143 #define ETH_LENGTH_OF_ADDRESS 6
144 #define MAX_NUM_OF_EVENT 10 // entry # in EVENT table
145 #define MAX_LEN_OF_MAC_TABLE 32
148 // Defines the state of the LAN media
150 typedef enum _NDIS_MEDIA_STATE
152 NdisMediaStateConnected
,
153 NdisMediaStateDisconnected
154 } NDIS_MEDIA_STATE
, *PNDIS_MEDIA_STATE
;
156 typedef enum _NDIS_802_11_STATUS_TYPE
158 Ndis802_11StatusType_Authentication
,
159 Ndis802_11StatusTypeMax
// not a real type, defined as an upper bound
160 } NDIS_802_11_STATUS_TYPE
, *PNDIS_802_11_STATUS_TYPE
;
162 typedef UCHAR NDIS_802_11_MAC_ADDRESS
[6];
164 typedef struct _NDIS_802_11_STATUS_INDICATION
166 NDIS_802_11_STATUS_TYPE StatusType
;
167 } NDIS_802_11_STATUS_INDICATION
, *PNDIS_802_11_STATUS_INDICATION
;
169 // mask for authentication/integrity fields
170 #define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS 0x0f
172 #define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01
173 #define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02
174 #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06
175 #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E
177 typedef struct _NDIS_802_11_AUTHENTICATION_REQUEST
179 ULONG Length
; // Length of structure
180 NDIS_802_11_MAC_ADDRESS Bssid
;
182 } NDIS_802_11_AUTHENTICATION_REQUEST
, *PNDIS_802_11_AUTHENTICATION_REQUEST
;
184 // Added new types for OFDM 5G and 2.4G
185 typedef enum _NDIS_802_11_NETWORK_TYPE
191 Ndis802_11NetworkTypeMax
// not a real type, defined as an upper bound
192 } NDIS_802_11_NETWORK_TYPE
, *PNDIS_802_11_NETWORK_TYPE
;
194 typedef struct _NDIS_802_11_NETWORK_TYPE_LIST
196 ULONG NumberOfItems
; // in list below, at least 1
197 NDIS_802_11_NETWORK_TYPE NetworkType
[1];
198 } NDIS_802_11_NETWORK_TYPE_LIST
, *PNDIS_802_11_NETWORK_TYPE_LIST
;
200 typedef enum _NDIS_802_11_POWER_MODE
202 Ndis802_11PowerModeCAM
,
203 Ndis802_11PowerModeMAX_PSP
,
204 Ndis802_11PowerModeFast_PSP
,
205 Ndis802_11PowerModeMax
// not a real mode, defined as an upper bound
206 } NDIS_802_11_POWER_MODE
, *PNDIS_802_11_POWER_MODE
;
208 typedef ULONG NDIS_802_11_TX_POWER_LEVEL
; // in milliwatts
211 // Received Signal Strength Indication
213 typedef LONG NDIS_802_11_RSSI
; // in dBm
215 typedef struct _NDIS_802_11_CONFIGURATION_FH
217 ULONG Length
; // Length of structure
218 ULONG HopPattern
; // As defined by 802.11, MSB set
219 ULONG HopSet
; // to one if non-802.11
220 ULONG DwellTime
; // units are Kusec
221 } NDIS_802_11_CONFIGURATION_FH
, *PNDIS_802_11_CONFIGURATION_FH
;
223 typedef struct _NDIS_802_11_CONFIGURATION
225 ULONG Length
; // Length of structure
226 ULONG BeaconPeriod
; // units are Kusec
227 ULONG ATIMWindow
; // units are Kusec
228 ULONG DSConfig
; // Frequency, units are kHz
229 NDIS_802_11_CONFIGURATION_FH FHConfig
;
230 } NDIS_802_11_CONFIGURATION
, *PNDIS_802_11_CONFIGURATION
;
232 typedef struct _NDIS_802_11_STATISTICS
234 ULONG Length
; // Length of structure
235 LARGE_INTEGER TransmittedFragmentCount
;
236 LARGE_INTEGER MulticastTransmittedFrameCount
;
237 LARGE_INTEGER FailedCount
;
238 LARGE_INTEGER RetryCount
;
239 LARGE_INTEGER MultipleRetryCount
;
240 LARGE_INTEGER RTSSuccessCount
;
241 LARGE_INTEGER RTSFailureCount
;
242 LARGE_INTEGER ACKFailureCount
;
243 LARGE_INTEGER FrameDuplicateCount
;
244 LARGE_INTEGER ReceivedFragmentCount
;
245 LARGE_INTEGER MulticastReceivedFrameCount
;
246 LARGE_INTEGER FCSErrorCount
;
247 } NDIS_802_11_STATISTICS
, *PNDIS_802_11_STATISTICS
;
249 typedef ULONG NDIS_802_11_KEY_INDEX
;
250 typedef ULONGLONG NDIS_802_11_KEY_RSC
;
252 // Key mapping keys require a BSSID
253 typedef struct _NDIS_802_11_KEY
255 ULONG Length
; // Length of this structure
257 ULONG KeyLength
; // length of key in bytes
258 NDIS_802_11_MAC_ADDRESS BSSID
;
259 NDIS_802_11_KEY_RSC KeyRSC
;
260 UCHAR KeyMaterial
[1]; // variable length depending on above field
261 } NDIS_802_11_KEY
, *PNDIS_802_11_KEY
;
263 typedef struct _NDIS_802_11_REMOVE_KEY
265 ULONG Length
; // Length of this structure
267 NDIS_802_11_MAC_ADDRESS BSSID
;
268 } NDIS_802_11_REMOVE_KEY
, *PNDIS_802_11_REMOVE_KEY
;
270 typedef struct _NDIS_802_11_WEP
272 ULONG Length
; // Length of this structure
273 ULONG KeyIndex
; // 0 is the per-client key, 1-N are the
275 ULONG KeyLength
; // length of key in bytes
276 UCHAR KeyMaterial
[1]; // variable length depending on above field
277 } NDIS_802_11_WEP
, *PNDIS_802_11_WEP
;
279 typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE
282 Ndis802_11Infrastructure
,
283 Ndis802_11AutoUnknown
,
284 Ndis802_11InfrastructureMax
// Not a real value, defined as upper bound
285 } NDIS_802_11_NETWORK_INFRASTRUCTURE
, *PNDIS_802_11_NETWORK_INFRASTRUCTURE
;
287 // Add new authentication modes
288 typedef enum _NDIS_802_11_AUTHENTICATION_MODE
290 Ndis802_11AuthModeOpen
,
291 Ndis802_11AuthModeShared
,
292 Ndis802_11AuthModeAutoSwitch
,
293 Ndis802_11AuthModeWPA
,
294 Ndis802_11AuthModeWPAPSK
,
295 Ndis802_11AuthModeWPANone
,
296 Ndis802_11AuthModeMax
// Not a real mode, defined as upper bound
297 } NDIS_802_11_AUTHENTICATION_MODE
, *PNDIS_802_11_AUTHENTICATION_MODE
;
299 typedef UCHAR NDIS_802_11_RATES
[NDIS_802_11_LENGTH_RATES
]; // Set of 8 data rates
300 typedef UCHAR NDIS_802_11_RATES_EX
[NDIS_802_11_LENGTH_RATES_EX
]; // Set of 16 data rates
302 typedef struct _NDIS_802_11_SSID
304 ULONG SsidLength
; // length of SSID field below, in bytes;
306 UCHAR Ssid
[NDIS_802_11_LENGTH_SSID
]; // SSID information field
307 } NDIS_802_11_SSID
, *PNDIS_802_11_SSID
;
310 typedef struct _NDIS_WLAN_BSSID
312 ULONG Length
; // Length of this structure
313 NDIS_802_11_MAC_ADDRESS MacAddress
; // BSSID
315 NDIS_802_11_SSID Ssid
; // SSID
316 ULONG Privacy
; // WEP encryption requirement
317 NDIS_802_11_RSSI Rssi
; // receive signal
319 NDIS_802_11_NETWORK_TYPE NetworkTypeInUse
;
320 NDIS_802_11_CONFIGURATION Configuration
;
321 NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode
;
322 NDIS_802_11_RATES SupportedRates
;
323 } NDIS_WLAN_BSSID
, *PNDIS_WLAN_BSSID
;
325 typedef struct _NDIS_802_11_BSSID_LIST
327 ULONG NumberOfItems
; // in list below, at least 1
328 NDIS_WLAN_BSSID Bssid
[1];
329 } NDIS_802_11_BSSID_LIST
, *PNDIS_802_11_BSSID_LIST
;
331 // Added Capabilities, IELength and IEs for each BSSID
332 typedef struct _NDIS_WLAN_BSSID_EX
334 ULONG Length
; // Length of this structure
335 NDIS_802_11_MAC_ADDRESS MacAddress
; // BSSID
337 NDIS_802_11_SSID Ssid
; // SSID
338 ULONG Privacy
; // WEP encryption requirement
339 NDIS_802_11_RSSI Rssi
; // receive signal
341 NDIS_802_11_NETWORK_TYPE NetworkTypeInUse
;
342 NDIS_802_11_CONFIGURATION Configuration
;
343 NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode
;
344 NDIS_802_11_RATES_EX SupportedRates
;
347 } NDIS_WLAN_BSSID_EX
, *PNDIS_WLAN_BSSID_EX
;
349 typedef struct _NDIS_802_11_BSSID_LIST_EX
351 ULONG NumberOfItems
; // in list below, at least 1
352 NDIS_WLAN_BSSID_EX Bssid
[1];
353 } NDIS_802_11_BSSID_LIST_EX
, *PNDIS_802_11_BSSID_LIST_EX
;
355 typedef struct _NDIS_802_11_FIXED_IEs
358 USHORT BeaconInterval
;
360 } NDIS_802_11_FIXED_IEs
, *PNDIS_802_11_FIXED_IEs
;
362 typedef struct _NDIS_802_11_VARIABLE_IEs
365 UCHAR Length
; // Number of bytes in data field
367 } NDIS_802_11_VARIABLE_IEs
, *PNDIS_802_11_VARIABLE_IEs
;
369 typedef ULONG NDIS_802_11_FRAGMENTATION_THRESHOLD
;
371 typedef ULONG NDIS_802_11_RTS_THRESHOLD
;
373 typedef ULONG NDIS_802_11_ANTENNA
;
375 typedef enum _NDIS_802_11_PRIVACY_FILTER
377 Ndis802_11PrivFilterAcceptAll
,
378 Ndis802_11PrivFilter8021xWEP
379 } NDIS_802_11_PRIVACY_FILTER
, *PNDIS_802_11_PRIVACY_FILTER
;
381 // Added new encryption types
382 // Also aliased typedef to new name
383 typedef enum _NDIS_802_11_WEP_STATUS
385 Ndis802_11WEPEnabled
,
386 Ndis802_11Encryption1Enabled
= Ndis802_11WEPEnabled
,
387 Ndis802_11WEPDisabled
,
388 Ndis802_11EncryptionDisabled
= Ndis802_11WEPDisabled
,
389 Ndis802_11WEPKeyAbsent
,
390 Ndis802_11Encryption1KeyAbsent
= Ndis802_11WEPKeyAbsent
,
391 Ndis802_11WEPNotSupported
,
392 Ndis802_11EncryptionNotSupported
= Ndis802_11WEPNotSupported
,
393 Ndis802_11Encryption2Enabled
,
394 Ndis802_11Encryption2KeyAbsent
,
395 Ndis802_11Encryption3Enabled
,
396 Ndis802_11Encryption3KeyAbsent
397 } NDIS_802_11_WEP_STATUS
, *PNDIS_802_11_WEP_STATUS
,
398 NDIS_802_11_ENCRYPTION_STATUS
, *PNDIS_802_11_ENCRYPTION_STATUS
;
400 typedef enum _NDIS_802_11_RELOAD_DEFAULTS
402 Ndis802_11ReloadWEPKeys
403 } NDIS_802_11_RELOAD_DEFAULTS
, *PNDIS_802_11_RELOAD_DEFAULTS
;
405 #define NDIS_802_11_AI_REQFI_CAPABILITIES 1
406 #define NDIS_802_11_AI_REQFI_LISTENINTERVAL 2
407 #define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS 4
409 #define NDIS_802_11_AI_RESFI_CAPABILITIES 1
410 #define NDIS_802_11_AI_RESFI_STATUSCODE 2
411 #define NDIS_802_11_AI_RESFI_ASSOCIATIONID 4
413 typedef struct _NDIS_802_11_AI_REQFI
416 USHORT ListenInterval
;
417 NDIS_802_11_MAC_ADDRESS CurrentAPAddress
;
418 } NDIS_802_11_AI_REQFI
, *PNDIS_802_11_AI_REQFI
;
420 typedef struct _NDIS_802_11_AI_RESFI
424 USHORT AssociationId
;
425 } NDIS_802_11_AI_RESFI
, *PNDIS_802_11_AI_RESFI
;
427 typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
430 USHORT AvailableRequestFixedIEs
;
431 NDIS_802_11_AI_REQFI RequestFixedIEs
;
432 ULONG RequestIELength
;
433 ULONG OffsetRequestIEs
;
434 USHORT AvailableResponseFixedIEs
;
435 NDIS_802_11_AI_RESFI ResponseFixedIEs
;
436 ULONG ResponseIELength
;
437 ULONG OffsetResponseIEs
;
438 } NDIS_802_11_ASSOCIATION_INFORMATION
, *PNDIS_802_11_ASSOCIATION_INFORMATION
;
440 typedef struct _NDIS_802_11_AUTHENTICATION_EVENT
442 NDIS_802_11_STATUS_INDICATION Status
;
443 NDIS_802_11_AUTHENTICATION_REQUEST Request
[1];
444 } NDIS_802_11_AUTHENTICATION_EVENT
, *PNDIS_802_11_AUTHENTICATION_EVENT
;
446 typedef struct _NDIS_802_11_TEST
452 NDIS_802_11_AUTHENTICATION_EVENT AuthenticationEvent
;
453 NDIS_802_11_RSSI RssiTrigger
;
455 } NDIS_802_11_TEST
, *PNDIS_802_11_TEST
;
458 typedef enum _RT_802_11_PREAMBLE
{
459 Rt802_11PreambleLong
,
460 Rt802_11PreambleShort
,
462 } RT_802_11_PREAMBLE
, *PRT_802_11_PREAMBLE
;
464 typedef enum _RT_802_11_PHY_MODE
{
469 } RT_802_11_PHY_MODE
;
471 // put all proprietery for-query objects here to reduce # of Query_OID
472 typedef struct _RT_802_11_LINK_STATUS
{
473 ULONG CurrTxRate
; // in units of 0.5Mbps
474 ULONG ChannelQuality
; // 0..100 %
475 ULONG TxByteCount
; // both ok and fail
476 ULONG RxByteCount
; // both ok and fail
477 } RT_802_11_LINK_STATUS
, *PRT_802_11_LINK_STATUS
;
479 typedef struct _RT_802_11_EVENT_LOG
{
480 LARGE_INTEGER SystemTime
; // timestammp via NdisGetCurrentSystemTime()
481 UCHAR Addr
[ETH_LENGTH_OF_ADDRESS
];
482 USHORT Event
; // EVENT_xxx
483 } RT_802_11_EVENT_LOG
, *PRT_802_11_EVENT_LOG
;
485 typedef struct _RT_802_11_EVENT_TABLE
{
487 ULONG Rsv
; // to align Log[] at LARGE_INEGER boundary
488 RT_802_11_EVENT_LOG Log
[MAX_NUM_OF_EVENT
];
489 } RT_802_11_EVENT_TABLE
, PRT_802_11_EVENT_TABLE
;
491 typedef struct _RT_802_11_MAC_ENTRY
{
492 UCHAR Addr
[ETH_LENGTH_OF_ADDRESS
];
494 UCHAR Psm
; // 0:PWR_ACTIVE, 1:PWR_SAVE
495 } RT_802_11_MAC_ENTRY
, *PRT_802_11_MAC_ENTRY
;
497 typedef struct _RT_802_11_MAC_TABLE
{
499 RT_802_11_MAC_ENTRY Entry
[MAX_LEN_OF_MAC_TABLE
];
500 } RT_802_11_MAC_TABLE
, *PRT_802_11_MAC_TABLE
;
502 // structure for query/set hardware register - MAC, BBP, RF register
503 typedef struct _RT_802_11_HARDWARE_REGISTER
{
504 ULONG HardwareType
; // 0:MAC, 1:BBP, 2:RF register
505 ULONG Offset
; // Q/S register offset addr
506 ULONG Data
; // R/W data buffer
507 } RT_802_11_HARDWARE_REGISTER
, *PRT_802_11_HARDWARE_REGISTER
;
509 // structure to tune BBP R13 "RX AGC VGC init"
510 typedef struct _RT_802_11_RX_AGC_VGC_TUNING
{
511 UCHAR Duration
; // unit: sec
512 UCHAR FlaseCcaThreshold
; // delta of flase CCA happen in the latest "Duration"
513 UCHAR RxAgcVgcDelta
; // R13 += RxAgcVgcDelta whenever flase CCA >= threshold
514 UCHAR MaxRxAgcVgc
; // max value of R13
515 } RT_802_11_RX_AGC_VGC_TUNING
, *PRT_802_11_RX_AGC_VGC_TUNING
;
517 // structure to define Radius Data
518 typedef struct _RT_802_11_RADIUS_DATA
{
519 DWORD RediusIP
; // Radius Server IP Address
520 ULONG RediusPort
; // Radius Server Port
522 }RT_802_11_RADIUS_DATA
, *PRT_802_11_RADIUS_DATA
;
524 // structure to define WPA Group Key Rekey Interval
525 typedef struct _RT_802_11_WPA_REKEY
{
526 ULONG ReKeyMethod
; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based
527 ULONG ReKeyInterval
; // time-based: seconds, packet-based: kilo-packets
528 }RT_802_11_WPA_REKEY
, *PRT_802_11_WPA_REKEY
;
530 typedef struct _RT_802_11_AP_CONFIG
{
531 ULONG EnableTxBurst
; // 0-disable, 1-enable
532 ULONG EnableTurboRate
; // 0-disable, 1-enable 72/100mbps turbo rate
533 ULONG IsolateInterStaTraffic
; // 0-disable, 1-enable isolation
534 ULONG HideSsid
; // 0-disable, 1-enable hiding
535 ULONG UseBGProtection
; // 0-AUTO, 1-always ON, 2-always OFF
536 ULONG UseShortSlotTime
; // 0-no use, 1-use 9-us short slot time
537 ULONG Rsv1
; // must be 0
538 ULONG Rsv2
; // must be 0
539 } RT_802_11_AP_CONFIG
, *PRT_802_11_AP_CONFIG
;
541 // structure to query/set STA_CONFIG
542 typedef struct _RT_802_11_STA_CONFIG
{
543 ULONG EnableTxBurst
; // 0-disable, 1-enable
544 ULONG EnableTurboRate
; // 0-disable, 1-enable 72/100mbps turbo rate
545 ULONG UseBGProtection
; // 0-AUTO, 1-always ON, 2-always OFF
546 ULONG UseShortSlotTime
; // 0-no use, 1-use 9-us short slot time when applicable
547 ULONG UseOfdmRatesIn11gAdhoc
; // 0-11b rates only (WIFI spec), 1 - allow OFDM rates
548 ULONG Rsv1
; // must be 0
549 ULONG Rsv2
; // must be 0
550 ULONG SystemErrorBitmap
; // ignore upon SET, return system error upon QUERY
551 } RT_802_11_STA_CONFIG
, *PRT_802_11_STA_CONFIG
;
553 typedef struct _RT_802_11_ACL_ENTRY
{
554 UCHAR Addr
[ETH_LENGTH_OF_ADDRESS
];
556 } RT_802_11_ACL_ENTRY
, *PRT_802_11_ACL_ENTRY
;
558 typedef struct _RT_802_11_ACL
{
559 ULONG Policy
; // 0-disable, 1-positive list, 2-negative list
561 RT_802_11_ACL_ENTRY Entry
[MAX_LEN_OF_MAC_TABLE
];
562 } RT_802_11_ACL
, *PRT_802_11_ACL
;
564 typedef struct _RT_802_11_WDS
{
566 NDIS_802_11_MAC_ADDRESS MacAddress
[3];
568 UCHAR KeyMaterial
[32];
569 } RT_802_11_WDS
, *PRT_802_11_WDS
;
571 typedef struct _RT_PROFILE_SETTING
{
572 ULONG ProfileDataType
; //0x18140201
574 UCHAR SSID
[NDIS_802_11_LENGTH_SSID
+1];
577 NDIS_802_11_AUTHENTICATION_MODE Authentication
; //Ndis802_11AuthModeOpen, Ndis802_11AuthModeShared
578 //Ndis802_11AuthModeWPAPSK
579 NDIS_802_11_WEP_STATUS Encryption
; //Ndis802_11WEPEnabled, Ndis802_11WEPDisabled
580 //Ndis802_11Encryption2Enabled, Ndis802_11Encryption3Enabled
581 NDIS_802_11_NETWORK_INFRASTRUCTURE NetworkType
;
598 NDIS_802_11_POWER_MODE PSmode
;
599 RT_802_11_PREAMBLE PreamType
;
604 struct _RT_PROFILE_SETTING
*Next
;
605 } RT_PROFILE_SETTING
, *PRT_PROFILE_SETTING
;
607 typedef struct _RT_DEVICE_ADAPTER
{
609 struct _RT_DEVICE_ADAPTER
*Next
;
610 } RT_DEVICE_ADAPTER
, *PRT_DEVICE_ADAPTER
;
612 typedef struct _RT_VERSION_INFO
{
613 UCHAR DriverVersionW
;
614 UCHAR DriverVersionX
;
615 UCHAR DriverVersionY
;
616 UCHAR DriverVersionZ
;
617 UINT DriverBuildYear
;
618 UINT DriverBuildMonth
;
620 } RT_VERSION_INFO
, *PRT_VERSION_INFO
;
622 int Open_Socket(void);
623 int OidQueryInformation(USHORT OidQueryCode
, int socket_id
, char *DeviceName
, void *ptr
, ULONG PtrLength
);
624 int OidSetInformation(USHORT OidQueryCode
, int socket_id
, char *DeviceName
, void *ptr
, ULONG PtrLength
);
625 UINT
ConvertRssiToSignalQuality(NDIS_802_11_RSSI RSSI
);
626 unsigned char BtoH(char ch
);
627 void AtoH(char * src
, UCHAR
* dest
, int destlen
);
628 int PasswordHash(char *password
, unsigned char *ssid
, int ssidlength
, unsigned char *output
);
630 #define WPA_OUI_TYPE 0x01F25000
631 #define WPA_OUI 0x00F25000
633 #define MAX_TX_POWER_LEVEL 100 /* mW */
634 #define MAX_RTS_THRESHOLD 2347 /* byte count */
636 #define PROFILE_EDIT 1
637 #define PROFILE_ADD 0