driver_ralink.h
Go to the documentation of this file.
00001 /*
00002  * WPA Supplicant - driver_ralink exported functions
00003  * Copyright (c) 2003-2005, Jouni Malinen <j@w1.fi>
00004  * Copyright (c) 2007, Snowpin Lee <snowpin_lee@ralinktech.com.tw>
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License version 2 as
00008  * published by the Free Software Foundation.
00009  *
00010  * Alternatively, this software may be distributed under the terms of BSD
00011  * license.
00012  *
00013  * See README and COPYING for more details.
00014  */
00015 
00016 // Ralink defined OIDs
00017 #if WIRELESS_EXT <= 11
00018 #ifndef SIOCDEVPRIVATE
00019 #define SIOCDEVPRIVATE                              0x8BE0
00020 #endif
00021 #define SIOCIWFIRSTPRIV                                                         SIOCDEVPRIVATE
00022 #endif
00023 
00024 #define RT_PRIV_IOCTL                                                           (SIOCIWFIRSTPRIV + 0x0E)  
00025 #define RTPRIV_IOCTL_SET                                                        (SIOCIWFIRSTPRIV + 0x02)
00026 
00027 // IEEE 802.11 OIDs  &  Ralink defined OIDs  ******
00028 
00029 // (RaConfig Set/QueryInform) ==>
00030 #define OID_GET_SET_TOGGLE                                                      0x8000
00031 
00032 #define OID_802_11_ADD_WEP                          0x0112
00033 #define OID_802_11_REMOVE_WEP                       0x0113
00034 #define OID_802_11_DISASSOCIATE                     0x0114
00035 #define OID_802_11_PRIVACY_FILTER                   0x0118
00036 #define OID_802_11_ASSOCIATION_INFORMATION          0x011E
00037 #define OID_802_11_BSSID_LIST_SCAN                  0x0508
00038 #define OID_802_11_SSID                             0x0509
00039 #define OID_802_11_BSSID                            0x050A
00040 #define OID_802_11_WEP_STATUS                       0x0510
00041 #define OID_802_11_AUTHENTICATION_MODE              0x0511
00042 #define OID_802_11_INFRASTRUCTURE_MODE              0x0512
00043 #define OID_802_11_TX_POWER_LEVEL                   0x0517
00044 #define OID_802_11_REMOVE_KEY                       0x0519
00045 #define OID_802_11_ADD_KEY                          0x0520
00046 #define OID_802_11_DEAUTHENTICATION                 0x0526
00047 #define OID_802_11_DROP_UNENCRYPTED                 0x0527
00048 #define OID_802_11_BSSID_LIST                       0x0609
00049 #define OID_802_3_CURRENT_ADDRESS                   0x060A
00050 #define OID_SET_COUNTERMEASURES                     0x0616
00051 #define OID_802_11_SET_IEEE8021X                    0x0617      // For IEEE8021x mode 
00052 #define OID_802_11_SET_IEEE8021X_REQUIRE_KEY        0x0618  // For DynamicWEP in IEEE802.1x mode
00053 #define OID_802_11_PMKID                            0x0620
00054 #define RT_OID_WPA_SUPPLICANT_SUPPORT               0x0621  // for trigger driver enable/disable wpa_supplicant support 
00055 #define RT_OID_WE_VERSION_COMPILED                  0x0622
00056 #define RT_OID_NEW_DRIVER                           0x0623
00057 #define RT_OID_WPS_PROBE_REQ_IE                                         0x0625
00058 
00059 #define PACKED  __attribute__ ((packed))
00060 
00061 //wpa_supplicant event flags
00062 #define RT_ASSOC_EVENT_FLAG                         0x0101
00063 #define RT_DISASSOC_EVENT_FLAG                      0x0102
00064 #define RT_REQIE_EVENT_FLAG                         0x0103
00065 #define RT_RESPIE_EVENT_FLAG                        0x0104
00066 #define RT_ASSOCINFO_EVENT_FLAG                     0x0105
00067 #define RT_PMKIDCAND_FLAG                           0x0106
00068 #define RT_INTERFACE_DOWN                           0x0107
00069 #define RT_INTERFACE_UP                                 0x0108
00070 
00071 //
00072 // IEEE 802.11 Structures and definitions
00073 //
00074 // new types for Media Specific Indications
00075 
00076 #ifndef ULONG
00077 #define CHAR            char
00078 #define INT             int
00079 #define SHORT           int
00080 #define UINT            u32
00081 #undef  ULONG           
00082 //#define ULONG           u32
00083 #define ULONG           unsigned long /* 32-bit in 32-bit CPU or 64-bit in 64-bit CPU */
00084 #define USHORT          unsigned short
00085 #define UCHAR           unsigned char
00086 
00087 #define uint32          u32
00088 #define uint8           u8
00089 
00090 
00091 #define BOOLEAN         u8
00092 //#define LARGE_INTEGER s64
00093 #define VOID            void
00094 #define LONG            long
00095 #define LONGLONG        s64
00096 #define ULONGLONG       u64
00097 typedef VOID            *PVOID;
00098 typedef CHAR            *PCHAR;
00099 typedef UCHAR           *PUCHAR;
00100 typedef USHORT          *PUSHORT;
00101 typedef LONG            *PLONG;
00102 typedef ULONG           *PULONG;
00103 
00104 typedef union _LARGE_INTEGER {
00105     struct {
00106         ULONG LowPart;
00107         LONG HighPart;
00108     }vv;
00109     struct {
00110         ULONG LowPart;
00111         LONG HighPart;
00112     } u;
00113     s64 QuadPart;
00114 } LARGE_INTEGER;
00115 
00116 #endif
00117 
00118 #define NDIS_802_11_LENGTH_SSID         32
00119 #define NDIS_802_11_LENGTH_RATES        8
00120 #define NDIS_802_11_LENGTH_RATES_EX     16
00121 #define MAX_LEN_OF_SSID                 32
00122 #define MAC_ADDR_LEN                    6
00123 
00124 typedef UCHAR   NDIS_802_11_MAC_ADDRESS[6];
00125 
00126 // mask for authentication/integrity fields
00127 #define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS        0x0f
00128 
00129 #define NDIS_802_11_AUTH_REQUEST_REAUTH             0x01
00130 #define NDIS_802_11_AUTH_REQUEST_KEYUPDATE          0x02
00131 #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR     0x06
00132 #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR        0x0E
00133 
00134 // Added new types for OFDM 5G and 2.4G
00135 typedef enum _NDIS_802_11_NETWORK_TYPE
00136 {
00137     Ndis802_11FH, 
00138     Ndis802_11DS, 
00139     Ndis802_11OFDM5,
00140     Ndis802_11OFDM24,
00141     Ndis802_11Automode,
00142     Ndis802_11NetworkTypeMax    // not a real type, defined as an upper bound
00143 } NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE;
00144 
00145 //
00146 // Received Signal Strength Indication
00147 //
00148 typedef LONG    NDIS_802_11_RSSI;           // in dBm
00149 
00150 typedef struct _NDIS_802_11_CONFIGURATION_FH
00151 {
00152    ULONG           Length;            // Length of structure
00153    ULONG           HopPattern;        // As defined by 802.11, MSB set 
00154    ULONG           HopSet;            // to one if non-802.11
00155    ULONG           DwellTime;         // units are Kusec
00156 } NDIS_802_11_CONFIGURATION_FH, *PNDIS_802_11_CONFIGURATION_FH;
00157 
00158 typedef struct _NDIS_802_11_CONFIGURATION
00159 {
00160    ULONG                           Length;             // Length of structure
00161    ULONG                           BeaconPeriod;       // units are Kusec
00162    ULONG                           ATIMWindow;         // units are Kusec
00163    ULONG                           DSConfig;           // Frequency, units are kHz
00164    NDIS_802_11_CONFIGURATION_FH    FHConfig;
00165 } NDIS_802_11_CONFIGURATION, *PNDIS_802_11_CONFIGURATION;
00166 
00167 typedef  ULONG  NDIS_802_11_KEY_INDEX;
00168 typedef ULONGLONG   NDIS_802_11_KEY_RSC;
00169 
00170 // Key mapping keys require a BSSID
00171 typedef struct _NDIS_802_11_KEY
00172 {
00173     UINT           Length;             // Length of this structure
00174     UINT           KeyIndex;           
00175     UINT           KeyLength;          // length of key in bytes
00176     NDIS_802_11_MAC_ADDRESS BSSID;
00177     NDIS_802_11_KEY_RSC KeyRSC;
00178     UCHAR           KeyMaterial[1];     // variable length depending on above field
00179 } NDIS_802_11_KEY, *PNDIS_802_11_KEY;
00180 
00181 typedef struct _NDIS_802_11_REMOVE_KEY
00182 {
00183     UINT                   Length;        // Length of this structure
00184     UINT                   KeyIndex;           
00185     NDIS_802_11_MAC_ADDRESS BSSID;      
00186 } NDIS_802_11_REMOVE_KEY, *PNDIS_802_11_REMOVE_KEY;
00187 
00188 typedef struct PACKED _NDIS_802_11_WEP
00189 {
00190    UINT     Length;        // Length of this structure
00191    UINT           KeyIndex;           // 0 is the per-client key, 1-N are the
00192                                         // global keys
00193    UINT     KeyLength;     // length of key in bytes
00194    UCHAR     KeyMaterial[1];// variable length depending on above field
00195 } NDIS_802_11_WEP, *PNDIS_802_11_WEP;
00196 
00197 
00198 typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE
00199 {
00200    Ndis802_11IBSS,
00201    Ndis802_11Infrastructure,
00202    Ndis802_11AutoUnknown,
00203    Ndis802_11InfrastructureMax     // Not a real value, defined as upper bound
00204 } NDIS_802_11_NETWORK_INFRASTRUCTURE, *PNDIS_802_11_NETWORK_INFRASTRUCTURE;
00205 
00206 // PMKID Structures
00207 typedef UCHAR   NDIS_802_11_PMKID_VALUE[16];
00208 
00209 typedef struct _BSSID_INFO
00210 {
00211         NDIS_802_11_MAC_ADDRESS BSSID;
00212         NDIS_802_11_PMKID_VALUE PMKID;
00213 } BSSID_INFO, *PBSSID_INFO;
00214 
00215 typedef struct _NDIS_802_11_PMKID
00216 {
00217         ULONG Length;
00218         ULONG BSSIDInfoCount;
00219         BSSID_INFO BSSIDInfo[1];
00220 } NDIS_802_11_PMKID, *PNDIS_802_11_PMKID;
00221 
00222 //Added new types for PMKID Candidate lists.
00223 typedef struct _PMKID_CANDIDATE {
00224         NDIS_802_11_MAC_ADDRESS BSSID;
00225         ULONG Flags;
00226 } PMKID_CANDIDATE, *PPMKID_CANDIDATE;
00227 
00228 typedef struct _NDIS_802_11_PMKID_CANDIDATE_LIST
00229 {
00230         ULONG Version;       // Version of the structure
00231         ULONG NumCandidates; // No. of pmkid candidates
00232         PMKID_CANDIDATE CandidateList[1];
00233 } NDIS_802_11_PMKID_CANDIDATE_LIST, *PNDIS_802_11_PMKID_CANDIDATE_LIST;
00234 
00235 //Flags for PMKID Candidate list structure
00236 #define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED     0x01
00237 
00238 // Add new authentication modes
00239 typedef enum _NDIS_802_11_AUTHENTICATION_MODE
00240 {
00241    Ndis802_11AuthModeOpen,
00242    Ndis802_11AuthModeShared,
00243    Ndis802_11AuthModeAutoSwitch,
00244    Ndis802_11AuthModeWPA,
00245    Ndis802_11AuthModeWPAPSK,
00246    Ndis802_11AuthModeWPANone,
00247    Ndis802_11AuthModeWPA2,
00248    Ndis802_11AuthModeWPA2PSK,    
00249    Ndis802_11AuthModeMax           // Not a real mode, defined as upper bound
00250 } NDIS_802_11_AUTHENTICATION_MODE, *PNDIS_802_11_AUTHENTICATION_MODE;
00251 
00252 typedef UCHAR  NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES];        // Set of 8 data rates
00253 typedef UCHAR  NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX];  // Set of 16 data rates
00254 
00255 typedef struct PACKED _NDIS_802_11_SSID 
00256 {
00257     INT   SsidLength;         // length of SSID field below, in bytes;
00258                                 // this can be zero.
00259     UCHAR   Ssid[NDIS_802_11_LENGTH_SSID];           // SSID information field
00260 } NDIS_802_11_SSID, *PNDIS_802_11_SSID;
00261 
00262 
00263 typedef struct PACKED _NDIS_WLAN_BSSID
00264 {
00265    ULONG                               Length;     // Length of this structure
00266    NDIS_802_11_MAC_ADDRESS             MacAddress; // BSSID
00267    UCHAR                               Reserved[2];
00268    NDIS_802_11_SSID                    Ssid;       // SSID
00269    ULONG                               Privacy;    // WEP encryption requirement
00270     NDIS_802_11_RSSI                    Rssi;               // receive signal
00271                                                             // strength in dBm
00272    NDIS_802_11_NETWORK_TYPE            NetworkTypeInUse;
00273    NDIS_802_11_CONFIGURATION           Configuration;
00274    NDIS_802_11_NETWORK_INFRASTRUCTURE  InfrastructureMode;
00275    NDIS_802_11_RATES                   SupportedRates;
00276 } NDIS_WLAN_BSSID, *PNDIS_WLAN_BSSID;
00277 
00278 typedef struct PACKED _NDIS_802_11_BSSID_LIST
00279 {
00280    UINT             NumberOfItems;      // in list below, at least 1
00281    NDIS_WLAN_BSSID Bssid[1];
00282 } NDIS_802_11_BSSID_LIST, *PNDIS_802_11_BSSID_LIST;
00283 
00284 // Added Capabilities, IELength and IEs for each BSSID
00285 typedef struct PACKED _NDIS_WLAN_BSSID_EX
00286 {
00287     ULONG                               Length;             // Length of this structure
00288     NDIS_802_11_MAC_ADDRESS             MacAddress;         // BSSID
00289     UCHAR                               Reserved[2];
00290     NDIS_802_11_SSID                    Ssid;               // SSID
00291     UINT                                Privacy;            // WEP encryption requirement
00292     NDIS_802_11_RSSI                    Rssi;               // receive signal
00293                                                             // strength in dBm
00294     NDIS_802_11_NETWORK_TYPE            NetworkTypeInUse;
00295     NDIS_802_11_CONFIGURATION           Configuration;
00296     NDIS_802_11_NETWORK_INFRASTRUCTURE  InfrastructureMode;
00297     NDIS_802_11_RATES_EX                SupportedRates;
00298     ULONG                               IELength;
00299     UCHAR                               IEs[1];
00300 } NDIS_WLAN_BSSID_EX, *PNDIS_WLAN_BSSID_EX;
00301 
00302 typedef struct PACKED _NDIS_802_11_BSSID_LIST_EX
00303 {
00304     UINT                   NumberOfItems;      // in list below, at least 1
00305     NDIS_WLAN_BSSID_EX      Bssid[1];
00306 } NDIS_802_11_BSSID_LIST_EX, *PNDIS_802_11_BSSID_LIST_EX;
00307 
00308 typedef struct PACKED _NDIS_802_11_FIXED_IEs 
00309 {
00310     UCHAR Timestamp[8];
00311     USHORT BeaconInterval;
00312     USHORT Capabilities;
00313 } NDIS_802_11_FIXED_IEs, *PNDIS_802_11_FIXED_IEs;
00314 
00315 // Added new encryption types
00316 // Also aliased typedef to new name
00317 typedef enum _NDIS_802_11_WEP_STATUS
00318 {
00319    Ndis802_11WEPEnabled,
00320    Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
00321    Ndis802_11WEPDisabled,
00322    Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
00323    Ndis802_11WEPKeyAbsent,
00324    Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
00325    Ndis802_11WEPNotSupported,
00326    Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
00327    Ndis802_11Encryption2Enabled,
00328    Ndis802_11Encryption2KeyAbsent,
00329    Ndis802_11Encryption3Enabled,
00330    Ndis802_11Encryption3KeyAbsent
00331 } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
00332   NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
00333 
00334 typedef enum _NDIS_802_11_RELOAD_DEFAULTS
00335 {
00336    Ndis802_11ReloadWEPKeys
00337 } NDIS_802_11_RELOAD_DEFAULTS, *PNDIS_802_11_RELOAD_DEFAULTS;
00338 
00339 #define NDIS_802_11_AI_REQFI_CAPABILITIES      1
00340 #define NDIS_802_11_AI_REQFI_LISTENINTERVAL    2
00341 #define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS  4
00342 
00343 #define NDIS_802_11_AI_RESFI_CAPABILITIES      1
00344 #define NDIS_802_11_AI_RESFI_STATUSCODE        2
00345 #define NDIS_802_11_AI_RESFI_ASSOCIATIONID     4
00346 
00347 typedef struct _NDIS_802_11_AI_REQFI
00348 {
00349     USHORT Capabilities;
00350     USHORT ListenInterval;
00351     NDIS_802_11_MAC_ADDRESS  CurrentAPAddress;
00352 } NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI;
00353 
00354 typedef struct _NDIS_802_11_AI_RESFI
00355 {
00356     USHORT Capabilities;
00357     USHORT StatusCode;
00358     USHORT AssociationId;
00359 } NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI;
00360 
00361 typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
00362 {
00363     ULONG                   Length;
00364     USHORT                  AvailableRequestFixedIEs;
00365     NDIS_802_11_AI_REQFI    RequestFixedIEs;
00366     ULONG                   RequestIELength;
00367     ULONG                   OffsetRequestIEs;
00368     USHORT                  AvailableResponseFixedIEs;
00369     NDIS_802_11_AI_RESFI    ResponseFixedIEs;
00370     ULONG                   ResponseIELength;
00371     ULONG                   OffsetResponseIEs;
00372 } NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION;
00373 
00374 struct ndis_pmkid_entry {
00375         struct ndis_pmkid_entry *next;
00376         u8 bssid[ETH_ALEN];
00377         u8 pmkid[16];
00378 };
00379 
00380 typedef struct _MLME_DEAUTH_REQ_STRUCT {
00381     UCHAR        Addr[MAC_ADDR_LEN];
00382     USHORT       Reason;
00383 } MLME_DEAUTH_REQ_STRUCT, *PMLME_DEAUTH_REQ_STRUCT;


wpa_supplicant
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Apr 24 2014 15:34:34