driver.h

Go to the documentation of this file.
00001 
00016 #ifndef DRIVER_H
00017 #define DRIVER_H
00018 
00019 #define WPA_SUPPLICANT_DRIVER_VERSION 2
00020 
00021 #include "defs.h"
00022 
00023 #define AUTH_ALG_OPEN_SYSTEM    0x01
00024 #define AUTH_ALG_SHARED_KEY     0x02
00025 #define AUTH_ALG_LEAP           0x04
00026 
00027 #define IEEE80211_MODE_INFRA    0
00028 #define IEEE80211_MODE_IBSS     1
00029 
00030 #define IEEE80211_CAP_ESS       0x0001
00031 #define IEEE80211_CAP_IBSS      0x0002
00032 #define IEEE80211_CAP_PRIVACY   0x0010
00033 
00034 #define SSID_MAX_WPA_IE_LEN 40
00035 
00056 struct wpa_scan_result {
00057         u8 bssid[ETH_ALEN];
00058         u8 ssid[32];
00059         size_t ssid_len;
00060         u8 wpa_ie[SSID_MAX_WPA_IE_LEN];
00061         size_t wpa_ie_len;
00062         u8 rsn_ie[SSID_MAX_WPA_IE_LEN];
00063         size_t rsn_ie_len;
00064         int freq;
00065         u16 caps;
00066         int qual;
00067         int noise;
00068         int level;
00069         int maxrate;
00070 };
00071 
00077 struct wpa_driver_associate_params {
00083         const u8 *bssid;
00084 
00089         const u8 *ssid;
00090         size_t ssid_len;
00091 
00098         int freq;
00099 
00116         const u8 *wpa_ie;
00121         size_t wpa_ie_len;
00122 
00123         /* The selected pairwise/group cipher and key management
00124          * suites. These are usually ignored if @wpa_ie is used. */
00125         wpa_cipher pairwise_suite;
00126         wpa_cipher group_suite;
00127         wpa_key_mgmt key_mgmt_suite;
00128 
00134         int auth_alg;
00135 
00140         int mode;
00141 
00146         const u8 *wep_key[4];
00147 
00152         size_t wep_key_len[4];
00153 
00158         int wep_tx_keyidx;
00159 
00164         enum {
00165                 NO_MGMT_FRAME_PROTECTION,
00166                 MGMT_FRAME_PROTECTION_OPTIONAL,
00167                 MGMT_FRAME_PROTECTION_REQUIRED
00168         } mgmt_frame_protection;
00169 };
00170 
00175 struct wpa_driver_capa {
00176 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA            0x00000001
00177 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA2           0x00000002
00178 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK        0x00000004
00179 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK       0x00000008
00180 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE       0x00000010
00181         unsigned int key_mgmt;
00182 
00183 #define WPA_DRIVER_CAPA_ENC_WEP40       0x00000001
00184 #define WPA_DRIVER_CAPA_ENC_WEP104      0x00000002
00185 #define WPA_DRIVER_CAPA_ENC_TKIP        0x00000004
00186 #define WPA_DRIVER_CAPA_ENC_CCMP        0x00000008
00187         unsigned int enc;
00188 
00189 #define WPA_DRIVER_AUTH_OPEN            0x00000001
00190 #define WPA_DRIVER_AUTH_SHARED          0x00000002
00191 #define WPA_DRIVER_AUTH_LEAP            0x00000004
00192         unsigned int auth;
00193 
00194 /* Driver generated WPA/RSN IE */
00195 #define WPA_DRIVER_FLAGS_DRIVER_IE      0x00000001
00196 #define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC 0x00000002
00197 #define WPA_DRIVER_FLAGS_USER_SPACE_MLME 0x00000004
00198         unsigned int flags;
00199 };
00200 
00201 
00202 #define WPA_CHAN_W_SCAN 0x00000001
00203 #define WPA_CHAN_W_ACTIVE_SCAN 0x00000002
00204 #define WPA_CHAN_W_IBSS 0x00000004
00205 
00206 struct wpa_channel_data {
00207         short chan; /* channel number (IEEE 802.11) */
00208         short freq; /* frequency in MHz */
00209         int flag; /* flag for user space use (WPA_CHAN_*) */
00210 };
00211 
00212 #define WPA_RATE_ERP 0x00000001
00213 #define WPA_RATE_BASIC 0x00000002
00214 #define WPA_RATE_PREAMBLE2 0x00000004
00215 #define WPA_RATE_SUPPORTED 0x00000010
00216 #define WPA_RATE_OFDM 0x00000020
00217 #define WPA_RATE_CCK 0x00000040
00218 #define WPA_RATE_MANDATORY 0x00000100
00219 
00220 struct wpa_rate_data {
00221         int rate; /* rate in 100 kbps */
00222         int flags; /* WPA_RATE_ flags */
00223 };
00224 
00225 typedef enum {
00226         WPA_MODE_IEEE80211B,
00227         WPA_MODE_IEEE80211G,
00228         WPA_MODE_IEEE80211A,
00229         NUM_WPA_MODES
00230 } wpa_hw_mode;
00231 
00232 struct wpa_hw_modes {
00233         wpa_hw_mode mode;
00234         int num_channels;
00235         struct wpa_channel_data *channels;
00236         int num_rates;
00237         struct wpa_rate_data *rates;
00238 };
00239 
00240 
00241 struct ieee80211_rx_status {
00242         int channel;
00243         int ssi;
00244 };
00245 
00246 
00255 struct wpa_driver_ops {
00257         const char *name;
00259         const char *desc;
00260 
00273         int (*get_bssid)(void *priv, u8 *bssid);
00274 
00291         int (*get_ssid)(void *priv, u8 *ssid);
00292 
00316         int (*set_wpa)(void *priv, int enabled);
00317 
00362         int (*set_key)(void *priv, wpa_alg alg, const u8 *addr,
00363                        int key_idx, int set_tx, const u8 *seq, size_t seq_len,
00364                        const u8 *key, size_t key_len);
00365 
00390         void * (*init)(void *ctx, const char *ifname);
00391 
00400         void (*deinit)(void *priv);
00401 
00413         int (*set_param)(void *priv, const char *param);
00414 
00426         int (*set_countermeasures)(void *priv, int enabled);
00427 
00440         int (*set_drop_unencrypted)(void *priv, int enabled);
00441 
00457         int (*scan)(void *priv, const u8 *ssid, size_t ssid_len);
00458 
00473         int (*get_scan_results)(void *priv,
00474                                 struct wpa_scan_result *results,
00475                                 size_t max_size);
00476 
00487         int (*deauthenticate)(void *priv, const u8 *addr, int reason_code);
00488 
00499         int (*disassociate)(void *priv, const u8 *addr, int reason_code);
00500 
00509         int (*associate)(void *priv,
00510                          struct wpa_driver_associate_params *params);
00511 
00532         int (*set_auth_alg)(void *priv, int auth_alg);
00533 
00552         int (*add_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
00553 
00573         int (*remove_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
00574 
00592         int (*flush_pmkid)(void *priv);
00593 
00603         int (*get_capa)(void *priv, struct wpa_driver_capa *capa);
00604 
00618         void (*poll)(void *priv);
00619 
00632         const char * (*get_ifname)(void *priv);
00633 
00645         const u8 * (*get_mac_addr)(void *priv);
00646 
00666         int (*send_eapol)(void *priv, const u8 *dest, u16 proto,
00667                           const u8 *data, size_t data_len);
00668 
00682         int (*set_operstate)(void *priv, int state);
00683 
00701         int (*mlme_setprotection)(void *priv, const u8 *addr, int protect_type,
00702                                   int key_type);
00703 
00716         struct wpa_hw_modes * (*get_hw_feature_data)(void *priv,
00717                                                      u16 *num_modes,
00718                                                      u16 *flags);
00719 
00732         int (*set_channel)(void *priv, wpa_hw_mode phymode, int chan,
00733                            int freq);
00734 
00746         int (*set_ssid)(void *priv, const u8 *ssid, size_t ssid_len);
00747 
00758         int (*set_bssid)(void *priv, const u8 *bssid);
00759 
00771         int (*send_mlme)(void *priv, const u8 *data, size_t data_len);
00772 
00789          int (*mlme_add_sta)(void *priv, const u8 *addr, const u8 *supp_rates,
00790                              size_t supp_rates_len);
00791 
00802          int (*mlme_remove_sta)(void *priv, const u8 *addr);
00803 };
00804 
00805 #endif /* DRIVER_H */
00806 

Generated on Sun Dec 31 13:48:52 2006 for wpa_supplicant by  doxygen 1.4.2