wpa_supplicant_i.h
Go to the documentation of this file.
00001 /*
00002  * wpa_supplicant - Internal definitions
00003  * Copyright (c) 2003-2010, Jouni Malinen <j@w1.fi>
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 2 as
00007  * published by the Free Software Foundation.
00008  *
00009  * Alternatively, this software may be distributed under the terms of BSD
00010  * license.
00011  *
00012  * See README and COPYING for more details.
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 /* CONFIG_NO_STDOUT_DEBUG */
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  * Forward declarations of private structures used within the ctrl_iface
00040  * backends. Other parts of wpa_supplicant do not have access to data stored in
00041  * these structures.
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; /* to be added to the end of AssocReq */
00215         size_t extra_ie_len;
00216         u8 *extra_probe_ie; /* to be added to the end of ProbeReq */
00217         size_t extra_probe_ie_len;
00218         enum wpa_key_mgmt key_mgmt;
00219 
00220         /* The last AssocReq/Resp IEs */
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; /* bitfield of allowed auth algs
00240                                  * (WPA_AUTH_ALG_*) */
00241         int auth_alg; /* currently used IEEE 802.11 authentication algorithm */
00242         int auth_transaction;
00243 
00244         struct os_time ibss_join_req;
00245         u8 *probe_resp; /* ProbeResp template for IBSS */
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; /* current mode */
00272         struct hostapd_hw_modes *modes;
00273         size_t num_modes;
00274         unsigned int hw_modes; /* bitfield of allowed hardware modes;
00275                                 * (1 << HOSTAPD_MODE_*) */
00276         int num_curr_rates;
00277         int *curr_rates;
00278         int freq; /* The current frequency in MHz */
00279         int channel; /* The current IEEE 802.11 channel number */
00280 
00281 #ifdef CONFIG_IEEE80211R
00282         u8 current_md[6];
00283         u8 *ft_ies;
00284         size_t ft_ies_len;
00285 #endif /* CONFIG_IEEE80211R */
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 /* CONFIG_CLIENT_MLME */
00292         int dummy; /* to keep MSVC happy */
00293 #endif /* CONFIG_CLIENT_MLME */
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 /* CONFIG_CTRL_IFACE_DBUS */
00314 #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
00315         char *dbus_new_path;
00316 #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
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]; /* If wpa_state == WPA_ASSOCIATING, this
00325                                      * field contains the targer BSSID. */
00326         int reassociate; /* reassociation requested */
00327         int disconnected; /* all connections disabled; i.e., do no reassociate
00328                            * before this has been cleared */
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         /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
00335         int pairwise_cipher;
00336         int group_cipher;
00337         int key_mgmt;
00338         int mgmt_group_cipher;
00339 
00340         void *drv_priv; /* private data used by driver_ops */
00341         void *global_drv_priv;
00342 
00343         struct wpa_ssid *prev_scan_ssid; /* previously scanned SSID;
00344                                           * NULL = not yet initialized (start
00345                                           * with wildcard SSID)
00346                                           * WILDCARD_SSID_SCAN = wildcard
00347                                           * SSID was used in the previous scan
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; /* struct wpa_bss::list */
00354         struct dl_list bss_id; /* struct wpa_bss::list_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; /* whether the network interface has been
00361                                 * removed */
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; /* number of EAPOL packets received after the
00374                              * previous association event */
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; /* manual scan request; this forces a scan even if there
00385                        * are no enabled networks in the configuration */
00386         int scan_res_tried; /* whether ap_scan=1 mode has tried to fetch scan
00387                              * results without a new scan request; this is used
00388                              * to speed up the first association if the driver
00389                              * has already available scan results. */
00390         int scan_runs; /* number of scan runs since WPS was started */
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; /* Michael MIC errors with the current PTK */
00400 
00401         struct wps_context *wps;
00402         int wps_success; /* WPS success event received */
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 /* CONFIG_SME */
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 /* CONFIG_AP */
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 /* wpa_supplicant.c */
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 /* events.c */
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 /* eap_register.c */
00515 int eap_register_methods(void);
00516 
00517 #endif /* WPA_SUPPLICANT_I_H */


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