00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef WPA_SUPPLICANT_I_H
00016 #define WPA_SUPPLICANT_I_H
00017
00018 #include "utils/list.h"
00019 #include "common/defs.h"
00020
00021 extern const char *wpa_supplicant_version;
00022 extern const char *wpa_supplicant_license;
00023 #ifndef CONFIG_NO_STDOUT_DEBUG
00024 extern const char *wpa_supplicant_full_license1;
00025 extern const char *wpa_supplicant_full_license2;
00026 extern const char *wpa_supplicant_full_license3;
00027 extern const char *wpa_supplicant_full_license4;
00028 extern const char *wpa_supplicant_full_license5;
00029 #endif
00030
00031 struct wpa_sm;
00032 struct wpa_supplicant;
00033 struct ibss_rsn;
00034 struct scan_info;
00035 struct wpa_bss;
00036 struct wpa_scan_results;
00037
00038
00039
00040
00041
00042
00043 struct ctrl_iface_priv;
00044 struct ctrl_iface_global_priv;
00045 struct wpas_dbus_priv;
00046
00050 struct wpa_interface {
00058 const char *confname;
00059
00069 const char *ctrl_interface;
00070
00074 const char *driver;
00075
00085 const char *driver_param;
00086
00090 const char *ifname;
00091
00100 const char *bridge_ifname;
00101 };
00102
00106 struct wpa_params {
00110 int daemonize;
00111
00115 int wait_for_monitor;
00116
00123 char *pid_file;
00124
00128 int wpa_debug_level;
00129
00139 int wpa_debug_show_keys;
00140
00144 int wpa_debug_timestamp;
00145
00149 char *ctrl_interface;
00150
00154 int dbus_ctrl_interface;
00155
00159 const char *wpa_debug_file_path;
00160
00164 int wpa_debug_syslog;
00165
00173 char *override_driver;
00174
00182 char *override_ctrl_interface;
00183 };
00184
00191 struct wpa_global {
00192 struct wpa_supplicant *ifaces;
00193 struct wpa_params params;
00194 struct ctrl_iface_global_priv *ctrl_iface;
00195 struct wpas_dbus_priv *dbus;
00196 void **drv_priv;
00197 size_t drv_count;
00198 struct os_time suspend_time;
00199 };
00200
00201
00202 struct wpa_client_mlme {
00203 #ifdef CONFIG_CLIENT_MLME
00204 enum {
00205 IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
00206 IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
00207 IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED
00208 } state;
00209 u8 prev_bssid[ETH_ALEN];
00210 u8 ssid[32];
00211 size_t ssid_len;
00212 u16 aid;
00213 u16 ap_capab, capab;
00214 u8 *extra_ie;
00215 size_t extra_ie_len;
00216 u8 *extra_probe_ie;
00217 size_t extra_probe_ie_len;
00218 enum wpa_key_mgmt key_mgmt;
00219
00220
00221 u8 *assocreq_ies, *assocresp_ies;
00222 size_t assocreq_ies_len, assocresp_ies_len;
00223
00224 int auth_tries, assoc_tries;
00225
00226 unsigned int ssid_set:1;
00227 unsigned int bssid_set:1;
00228 unsigned int prev_bssid_set:1;
00229 unsigned int authenticated:1;
00230 unsigned int associated:1;
00231 unsigned int probereq_poll:1;
00232 unsigned int use_protection:1;
00233 unsigned int create_ibss:1;
00234 unsigned int mixed_cell:1;
00235 unsigned int wmm_enabled:1;
00236
00237 struct os_time last_probe;
00238
00239 unsigned int auth_algs;
00240
00241 int auth_alg;
00242 int auth_transaction;
00243
00244 struct os_time ibss_join_req;
00245 u8 *probe_resp;
00246 size_t probe_resp_len;
00247 u32 supp_rates_bits;
00248
00249 int wmm_last_param_set;
00250
00251 int sta_scanning;
00252 int scan_hw_mode_idx;
00253 int scan_channel_idx;
00254 enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
00255 struct os_time last_scan_completed;
00256 int scan_oper_channel;
00257 int scan_oper_freq;
00258 int scan_oper_phymode;
00259 u8 scan_ssid[32];
00260 size_t scan_ssid_len;
00261 int scan_skip_11b;
00262 int *scan_freqs;
00263
00264 struct ieee80211_sta_bss *sta_bss_list;
00265 #define STA_HASH_SIZE 256
00266 #define STA_HASH(sta) (sta[5])
00267 struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE];
00268
00269 int cts_protect_erp_frames;
00270
00271 enum hostapd_hw_mode phymode;
00272 struct hostapd_hw_modes *modes;
00273 size_t num_modes;
00274 unsigned int hw_modes;
00275
00276 int num_curr_rates;
00277 int *curr_rates;
00278 int freq;
00279 int channel;
00280
00281 #ifdef CONFIG_IEEE80211R
00282 u8 current_md[6];
00283 u8 *ft_ies;
00284 size_t ft_ies_len;
00285 #endif
00286
00287 void (*public_action_cb)(void *ctx, const u8 *buf, size_t len,
00288 int freq);
00289 void *public_action_cb_ctx;
00290
00291 #else
00292 int dummy;
00293 #endif
00294 };
00295
00304 struct wpa_supplicant {
00305 struct wpa_global *global;
00306 struct wpa_supplicant *next;
00307 struct l2_packet_data *l2;
00308 struct l2_packet_data *l2_br;
00309 unsigned char own_addr[ETH_ALEN];
00310 char ifname[100];
00311 #ifdef CONFIG_CTRL_IFACE_DBUS
00312 char *dbus_path;
00313 #endif
00314 #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
00315 char *dbus_new_path;
00316 #endif
00317 char bridge_ifname[16];
00318
00319 char *confname;
00320 struct wpa_config *conf;
00321 int countermeasures;
00322 os_time_t last_michael_mic_error;
00323 u8 bssid[ETH_ALEN];
00324 u8 pending_bssid[ETH_ALEN];
00325
00326 int reassociate;
00327 int disconnected;
00328
00329 struct wpa_ssid *current_ssid;
00330 struct wpa_bss *current_bss;
00331 int ap_ies_from_associnfo;
00332 unsigned int assoc_freq;
00333
00334
00335 int pairwise_cipher;
00336 int group_cipher;
00337 int key_mgmt;
00338 int mgmt_group_cipher;
00339
00340 void *drv_priv;
00341 void *global_drv_priv;
00342
00343 struct wpa_ssid *prev_scan_ssid;
00344
00345
00346
00347
00348
00349 #define WILDCARD_SSID_SCAN ((struct wpa_ssid *) 1)
00350
00351 void (*scan_res_handler)(struct wpa_supplicant *wpa_s,
00352 struct wpa_scan_results *scan_res);
00353 struct dl_list bss;
00354 struct dl_list bss_id;
00355 size_t num_bss;
00356 unsigned int bss_update_idx;
00357 unsigned int bss_next_id;
00358
00359 struct wpa_driver_ops *driver;
00360 int interface_removed;
00361
00362 struct wpa_sm *wpa;
00363 struct eapol_sm *eapol;
00364
00365 struct ctrl_iface_priv *ctrl_iface;
00366
00367 enum wpa_states wpa_state;
00368 int scanning;
00369 int new_connection;
00370 int reassociated_connection;
00371 int more_bss_to_try;
00372
00373 int eapol_received;
00374
00375
00376 struct scard_data *scard;
00377
00378 unsigned char last_eapol_src[ETH_ALEN];
00379
00380 int keys_cleared;
00381
00382 struct wpa_blacklist *blacklist;
00383
00384 int scan_req;
00385
00386 int scan_res_tried;
00387
00388
00389
00390 int scan_runs;
00391
00392 struct wpa_client_mlme mlme;
00393 unsigned int drv_flags;
00394 int max_scan_ssids;
00395 unsigned int max_remain_on_chan;
00396
00397 int pending_mic_error_report;
00398 int pending_mic_error_pairwise;
00399 int mic_errors_seen;
00400
00401 struct wps_context *wps;
00402 int wps_success;
00403 struct wps_er *wps_er;
00404 int blacklist_cleared;
00405
00406 struct wpabuf *pending_eapol_rx;
00407 struct os_time pending_eapol_rx_time;
00408 u8 pending_eapol_rx_src[ETH_ALEN];
00409
00410 struct ibss_rsn *ibss_rsn;
00411
00412 #ifdef CONFIG_SME
00413 struct {
00414 u8 ssid[32];
00415 size_t ssid_len;
00416 int freq;
00417 u8 assoc_req_ie[80];
00418 size_t assoc_req_ie_len;
00419 int mfp;
00420 int ft_used;
00421 u8 mobility_domain[2];
00422 u8 *ft_ies;
00423 size_t ft_ies_len;
00424 u8 prev_bssid[ETH_ALEN];
00425 int prev_bssid_set;
00426 int auth_alg;
00427 } sme;
00428 #endif
00429
00430 #ifdef CONFIG_AP
00431 struct hostapd_iface *ap_iface;
00432 void (*ap_configured_cb)(void *ctx, void *data);
00433 void *ap_configured_cb_ctx;
00434 void *ap_configured_cb_data;
00435 #endif
00436
00437 struct wpa_ssid *bgscan_ssid;
00438 const struct bgscan_ops *bgscan;
00439 void *bgscan_priv;
00440
00441 int connect_without_scan;
00442
00443 int after_wps;
00444 unsigned int wps_freq;
00445 };
00446
00447
00448
00449 int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
00450
00451 int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);
00452
00453 const char * wpa_supplicant_state_txt(enum wpa_states state);
00454 int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s);
00455 int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
00456 struct wpa_bss *bss, struct wpa_ssid *ssid,
00457 u8 *wpa_ie, size_t *wpa_ie_len);
00458 void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
00459 struct wpa_bss *bss,
00460 struct wpa_ssid *ssid);
00461 void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant *wpa_s,
00462 struct wpa_ssid *ssid);
00463 void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s);
00464 void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
00465 void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
00466 int sec, int usec);
00467 void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
00468 enum wpa_states state);
00469 struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);
00470 void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s);
00471 void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
00472 int reason_code);
00473 void wpa_supplicant_disassociate(struct wpa_supplicant *wpa_s,
00474 int reason_code);
00475
00476 void wpa_supplicant_enable_network(struct wpa_supplicant *wpa_s,
00477 struct wpa_ssid *ssid);
00478 void wpa_supplicant_disable_network(struct wpa_supplicant *wpa_s,
00479 struct wpa_ssid *ssid);
00480 void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
00481 struct wpa_ssid *ssid);
00482 int wpa_supplicant_set_ap_scan(struct wpa_supplicant *wpa_s,
00483 int ap_scan);
00484 int wpa_supplicant_set_debug_params(struct wpa_global *global,
00485 int debug_level, int debug_timestamp,
00486 int debug_show_keys);
00487
00488 void wpa_show_license(void);
00489
00490 struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
00491 struct wpa_interface *iface);
00492 int wpa_supplicant_remove_iface(struct wpa_global *global,
00493 struct wpa_supplicant *wpa_s);
00494 struct wpa_supplicant * wpa_supplicant_get_iface(struct wpa_global *global,
00495 const char *ifname);
00496 struct wpa_global * wpa_supplicant_init(struct wpa_params *params);
00497 int wpa_supplicant_run(struct wpa_global *global);
00498 void wpa_supplicant_deinit(struct wpa_global *global);
00499
00500 int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
00501 struct wpa_ssid *ssid);
00502 void wpa_supplicant_terminate_proc(struct wpa_global *global);
00503 void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
00504 const u8 *buf, size_t len);
00505 enum wpa_key_mgmt key_mgmt2driver(int key_mgmt);
00506 enum wpa_cipher cipher_suite2driver(int cipher);
00507
00508
00509 void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
00510 void wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
00511 struct wpa_bss *selected,
00512 struct wpa_ssid *ssid);
00513
00514
00515 int eap_register_methods(void);
00516
00517 #endif