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
00124
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 };
00142
00147 struct wpa_driver_capa {
00148 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA 0x00000001
00149 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA2 0x00000002
00150 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK 0x00000004
00151 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK 0x00000008
00152 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE 0x00000010
00153 unsigned int key_mgmt;
00154
00155 #define WPA_DRIVER_CAPA_ENC_WEP40 0x00000001
00156 #define WPA_DRIVER_CAPA_ENC_WEP104 0x00000002
00157 #define WPA_DRIVER_CAPA_ENC_TKIP 0x00000004
00158 #define WPA_DRIVER_CAPA_ENC_CCMP 0x00000008
00159 unsigned int enc;
00160
00161 #define WPA_DRIVER_AUTH_OPEN 0x00000001
00162 #define WPA_DRIVER_AUTH_SHARED 0x00000002
00163 #define WPA_DRIVER_AUTH_LEAP 0x00000004
00164 unsigned int auth;
00165
00166
00167 #define WPA_DRIVER_FLAGS_DRIVER_IE 0x00000001
00168 #define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC 0x00000002
00169 unsigned int flags;
00170 };
00171
00172
00181 struct wpa_driver_ops {
00183 const char *name;
00185 const char *desc;
00186
00199 int (*get_bssid)(void *priv, u8 *bssid);
00200
00217 int (*get_ssid)(void *priv, u8 *ssid);
00218
00242 int (*set_wpa)(void *priv, int enabled);
00243
00286 int (*set_key)(void *priv, wpa_alg alg, const u8 *addr,
00287 int key_idx, int set_tx, const u8 *seq, size_t seq_len,
00288 const u8 *key, size_t key_len);
00289
00314 void * (*init)(void *ctx, const char *ifname);
00315
00324 void (*deinit)(void *priv);
00325
00337 int (*set_param)(void *priv, const char *param);
00338
00350 int (*set_countermeasures)(void *priv, int enabled);
00351
00364 int (*set_drop_unencrypted)(void *priv, int enabled);
00365
00381 int (*scan)(void *priv, const u8 *ssid, size_t ssid_len);
00382
00397 int (*get_scan_results)(void *priv,
00398 struct wpa_scan_result *results,
00399 size_t max_size);
00400
00411 int (*deauthenticate)(void *priv, const u8 *addr, int reason_code);
00412
00423 int (*disassociate)(void *priv, const u8 *addr, int reason_code);
00424
00433 int (*associate)(void *priv,
00434 struct wpa_driver_associate_params *params);
00435
00456 int (*set_auth_alg)(void *priv, int auth_alg);
00457
00476 int (*add_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
00477
00497 int (*remove_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
00498
00516 int (*flush_pmkid)(void *priv);
00517
00527 int (*get_capa)(void *priv, struct wpa_driver_capa *capa);
00528
00542 void (*poll)(void *priv);
00543
00556 const char * (*get_ifname)(void *priv);
00557
00569 const u8 * (*get_mac_addr)(void *priv);
00570
00590 int (*send_eapol)(void *priv, const u8 *dest, u16 proto,
00591 const u8 *data, size_t data_len);
00592 };
00593
00594 #endif
00595