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 struct ros_interface;
00038 
00039 /*
00040  * Forward declarations of private structures used within the ctrl_iface
00041  * backends. Other parts of wpa_supplicant do not have access to data stored in
00042  * these structures.
00043  */
00044 struct ctrl_iface_priv;
00045 struct ctrl_iface_global_priv;
00046 struct wpas_dbus_priv;
00047 
00051 struct wpa_interface {
00059         const char *confname;
00060 
00070         const char *ctrl_interface;
00071 
00075         const char *driver;
00076 
00086         const char *driver_param;
00087 
00091         const char *ifname;
00092 
00101         const char *bridge_ifname;
00102 };
00103 
00107 struct wpa_params {
00111         int daemonize;
00112 
00116         int wait_for_monitor;
00117 
00124         char *pid_file;
00125 
00129         int wpa_debug_level;
00130 
00140         int wpa_debug_show_keys;
00141 
00145         int wpa_debug_timestamp;
00146 
00150         char *ctrl_interface;
00151 
00155         int dbus_ctrl_interface;
00156 
00160         const char *wpa_debug_file_path;
00161 
00165         int wpa_debug_syslog;
00166 
00174         char *override_driver;
00175 
00183         char *override_ctrl_interface;
00184 };
00185 
00192 struct wpa_global {
00193         struct wpa_supplicant *ifaces;
00194         struct wpa_params params;
00195         struct ctrl_iface_global_priv *ctrl_iface;
00196         struct wpas_dbus_priv *dbus;
00197         void **drv_priv;
00198         size_t drv_count;
00199         struct os_time suspend_time;
00200 };
00201 
00202 
00203 struct wpa_client_mlme {
00204 #ifdef CONFIG_CLIENT_MLME
00205         enum {
00206                 IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
00207                 IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
00208                 IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED
00209         } state;
00210         u8 prev_bssid[ETH_ALEN];
00211         u8 ssid[32];
00212         size_t ssid_len;
00213         u16 aid;
00214         u16 ap_capab, capab;
00215         u8 *extra_ie; /* to be added to the end of AssocReq */
00216         size_t extra_ie_len;
00217         u8 *extra_probe_ie; /* to be added to the end of ProbeReq */
00218         size_t extra_probe_ie_len;
00219         enum wpa_key_mgmt key_mgmt;
00220 
00221         /* The last AssocReq/Resp IEs */
00222         u8 *assocreq_ies, *assocresp_ies;
00223         size_t assocreq_ies_len, assocresp_ies_len;
00224 
00225         int auth_tries, assoc_tries;
00226 
00227         unsigned int ssid_set:1;
00228         unsigned int bssid_set:1;
00229         unsigned int prev_bssid_set:1;
00230         unsigned int authenticated:1;
00231         unsigned int associated:1;
00232         unsigned int probereq_poll:1;
00233         unsigned int use_protection:1;
00234         unsigned int create_ibss:1;
00235         unsigned int mixed_cell:1;
00236         unsigned int wmm_enabled:1;
00237 
00238         struct os_time last_probe;
00239 
00240         unsigned int auth_algs; /* bitfield of allowed auth algs
00241                                  * (WPA_AUTH_ALG_*) */
00242         int auth_alg; /* currently used IEEE 802.11 authentication algorithm */
00243         int auth_transaction;
00244 
00245         struct os_time ibss_join_req;
00246         u8 *probe_resp; /* ProbeResp template for IBSS */
00247         size_t probe_resp_len;
00248         u32 supp_rates_bits;
00249 
00250         int wmm_last_param_set;
00251 
00252         int sta_scanning;
00253         int scan_hw_mode_idx;
00254         int scan_channel_idx;
00255         enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
00256         struct os_time last_scan_completed;
00257         int scan_oper_channel;
00258         int scan_oper_freq;
00259         int scan_oper_phymode;
00260         u8 scan_ssid[32];
00261         size_t scan_ssid_len;
00262         int scan_skip_11b;
00263         int *scan_freqs;
00264 
00265         struct ieee80211_sta_bss *sta_bss_list;
00266 #define STA_HASH_SIZE 256
00267 #define STA_HASH(sta) (sta[5])
00268         struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE];
00269 
00270         int cts_protect_erp_frames;
00271 
00272         enum hostapd_hw_mode phymode; /* current mode */
00273         struct hostapd_hw_modes *modes;
00274         size_t num_modes;
00275         unsigned int hw_modes; /* bitfield of allowed hardware modes;
00276                                 * (1 << HOSTAPD_MODE_*) */
00277         int num_curr_rates;
00278         int *curr_rates;
00279         int freq; /* The current frequency in MHz */
00280         int channel; /* The current IEEE 802.11 channel number */
00281 
00282 #ifdef CONFIG_IEEE80211R
00283         u8 current_md[6];
00284         u8 *ft_ies;
00285         size_t ft_ies_len;
00286 #endif /* CONFIG_IEEE80211R */
00287 
00288         void (*public_action_cb)(void *ctx, const u8 *buf, size_t len,
00289                                  int freq);
00290         void *public_action_cb_ctx;
00291 
00292 #else /* CONFIG_CLIENT_MLME */
00293         int dummy; /* to keep MSVC happy */
00294 #endif /* CONFIG_CLIENT_MLME */
00295 };
00296 
00305 struct wpa_supplicant {
00306         struct wpa_global *global;
00307         struct wpa_supplicant *next;
00308         struct l2_packet_data *l2;
00309         struct l2_packet_data *l2_br;
00310         unsigned char own_addr[ETH_ALEN];
00311         char ifname[100];
00312 #ifdef CONFIG_CTRL_IFACE_DBUS
00313         char *dbus_path;
00314 #endif /* CONFIG_CTRL_IFACE_DBUS */
00315 #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
00316         char *dbus_new_path;
00317 #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
00318         char bridge_ifname[16];
00319 
00320         char *confname;
00321         struct wpa_config *conf;
00322         int countermeasures;
00323         os_time_t last_michael_mic_error;
00324         u8 bssid[ETH_ALEN];
00325         u8 pending_bssid[ETH_ALEN]; /* If wpa_state == WPA_ASSOCIATING, this
00326                                      * field contains the targer BSSID. */
00327         int reassociate; /* reassociation requested */
00328         int disconnected; /* all connections disabled; i.e., do no reassociate
00329                            * before this has been cleared */
00330         struct wpa_ssid *current_ssid;
00331         struct wpa_bss *current_bss;
00332         int ap_ies_from_associnfo;
00333         unsigned int assoc_freq;
00334 
00335         /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
00336         int pairwise_cipher;
00337         int group_cipher;
00338         int key_mgmt;
00339         int mgmt_group_cipher;
00340 
00341         void *drv_priv; /* private data used by driver_ops */
00342         void *global_drv_priv;
00343 
00344         struct wpa_ssid *prev_scan_ssid; /* previously scanned SSID;
00345                                           * NULL = not yet initialized (start
00346                                           * with wildcard SSID)
00347                                           * WILDCARD_SSID_SCAN = wildcard
00348                                           * SSID was used in the previous scan
00349                                           */
00350 #define WILDCARD_SSID_SCAN ((struct wpa_ssid *) 1)
00351 
00352         void (*scan_res_handler)(struct wpa_supplicant *wpa_s,
00353                                  struct wpa_scan_results *scan_res);
00354         struct dl_list bss; /* struct wpa_bss::list */
00355         struct dl_list bss_id; /* struct wpa_bss::list_id */
00356         size_t num_bss;
00357         unsigned int bss_update_idx;
00358         unsigned int bss_next_id;
00359 
00360         struct wpa_driver_ops *driver;
00361         int interface_removed; /* whether the network interface has been
00362                                 * removed */
00363         struct wpa_sm *wpa;
00364         struct eapol_sm *eapol;
00365 
00366         struct ctrl_iface_priv *ctrl_iface;
00367 
00368         enum wpa_states wpa_state;
00369         int scanning;
00370         int new_connection;
00371         int reassociated_connection;
00372         int more_bss_to_try;
00373 
00374         int eapol_received; /* number of EAPOL packets received after the
00375                              * previous association event */
00376 
00377         struct scard_data *scard;
00378 
00379         unsigned char last_eapol_src[ETH_ALEN];
00380 
00381         int keys_cleared;
00382 
00383         struct wpa_blacklist *blacklist;
00384 
00385         int scan_req; /* manual scan request; this forces a scan even if there
00386                        * are no enabled networks in the configuration */
00387         int scan_res_tried; /* whether ap_scan=1 mode has tried to fetch scan
00388                              * results without a new scan request; this is used
00389                              * to speed up the first association if the driver
00390                              * has already available scan results. */
00391         int scan_runs; /* number of scan runs since WPS was started */
00392 
00393         struct wpa_client_mlme mlme;
00394         unsigned int drv_flags;
00395         int max_scan_ssids;
00396         unsigned int max_remain_on_chan;
00397 
00398         int pending_mic_error_report;
00399         int pending_mic_error_pairwise;
00400         int mic_errors_seen; /* Michael MIC errors with the current PTK */
00401 
00402         struct wps_context *wps;
00403         int wps_success; /* WPS success event received */
00404         struct wps_er *wps_er;
00405         int blacklist_cleared;
00406 
00407         struct wpabuf *pending_eapol_rx;
00408         struct os_time pending_eapol_rx_time;
00409         u8 pending_eapol_rx_src[ETH_ALEN];
00410 
00411         struct ibss_rsn *ibss_rsn;
00412 
00413 #ifdef CONFIG_SME
00414         struct {
00415                 u8 ssid[32];
00416                 size_t ssid_len;
00417                 int freq;
00418                 u8 assoc_req_ie[80];
00419                 size_t assoc_req_ie_len;
00420                 int mfp;
00421                 int ft_used;
00422                 u8 mobility_domain[2];
00423                 u8 *ft_ies;
00424                 size_t ft_ies_len;
00425                 u8 prev_bssid[ETH_ALEN];
00426                 int prev_bssid_set;
00427                 int auth_alg;
00428         } sme;
00429 #endif /* CONFIG_SME */
00430 
00431 #ifdef CONFIG_AP
00432         struct hostapd_iface *ap_iface;
00433         void (*ap_configured_cb)(void *ctx, void *data);
00434         void *ap_configured_cb_ctx;
00435         void *ap_configured_cb_data;
00436 #endif /* CONFIG_AP */
00437 
00438         struct wpa_ssid *bgscan_ssid;
00439         const struct bgscan_ops *bgscan;
00440         void *bgscan_priv;
00441 
00442         int connect_without_scan;
00443 
00444         int after_wps;
00445         unsigned int wps_freq;
00446 
00447         struct ros_interface *ros_api;
00448 };
00449 
00450 
00451 /* wpa_supplicant.c */
00452 int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
00453 
00454 int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);
00455 
00456 const char * wpa_supplicant_state_txt(enum wpa_states state);
00457 int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s);
00458 int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
00459                               struct wpa_bss *bss, struct wpa_ssid *ssid,
00460                               u8 *wpa_ie, size_t *wpa_ie_len);
00461 void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
00462                               struct wpa_bss *bss,
00463                               struct wpa_ssid *ssid);
00464 void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant *wpa_s,
00465                                        struct wpa_ssid *ssid);
00466 void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s);
00467 void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
00468 void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
00469                                      int sec, int usec);
00470 void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
00471                               enum wpa_states state);
00472 struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);
00473 void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s);
00474 void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
00475                                    int reason_code);
00476 void wpa_supplicant_disassociate(struct wpa_supplicant *wpa_s,
00477                                  int reason_code);
00478 
00479 void wpa_supplicant_enable_network(struct wpa_supplicant *wpa_s,
00480                                    struct wpa_ssid *ssid);
00481 void wpa_supplicant_disable_network(struct wpa_supplicant *wpa_s,
00482                                     struct wpa_ssid *ssid);
00483 void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
00484                                    struct wpa_ssid *ssid);
00485 int wpa_supplicant_set_ap_scan(struct wpa_supplicant *wpa_s,
00486                                int ap_scan);
00487 int wpa_supplicant_set_debug_params(struct wpa_global *global,
00488                                     int debug_level, int debug_timestamp,
00489                                     int debug_show_keys);
00490 
00491 void wpa_show_license(void);
00492 
00493 struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
00494                                                  struct wpa_interface *iface);
00495 int wpa_supplicant_remove_iface(struct wpa_global *global,
00496                                 struct wpa_supplicant *wpa_s);
00497 struct wpa_supplicant * wpa_supplicant_get_iface(struct wpa_global *global,
00498                                                  const char *ifname);
00499 struct wpa_global * wpa_supplicant_init(struct wpa_params *params);
00500 int wpa_supplicant_run(struct wpa_global *global);
00501 void wpa_supplicant_deinit(struct wpa_global *global);
00502 
00503 int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
00504                               struct wpa_ssid *ssid);
00505 void wpa_supplicant_terminate_proc(struct wpa_global *global);
00506 void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
00507                              const u8 *buf, size_t len);
00508 enum wpa_key_mgmt key_mgmt2driver(int key_mgmt);
00509 enum wpa_cipher cipher_suite2driver(int cipher);
00510 
00511 /* events.c */
00512 void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
00513 void wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
00514                             struct wpa_bss *selected,
00515                             struct wpa_ssid *ssid);
00516 
00517 /* eap_register.c */
00518 int eap_register_methods(void);
00519 
00520 #endif /* WPA_SUPPLICANT_I_H */


wpa_supplicant_node
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Apr 24 2014 15:33:21