wpa_supplicant_i.h

Go to the documentation of this file.
00001 
00016 #ifndef WPA_SUPPLICANT_I_H
00017 #define WPA_SUPPLICANT_I_H
00018 
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_scan_result;
00032 struct wpa_scan_res;
00033 struct wpa_sm;
00034 struct wpa_supplicant;
00035 struct ibss_rsn;
00036 
00037 /*
00038  * Forward declarations of private structures used within the ctrl_iface
00039  * backends. Other parts of wpa_supplicant do not have access to data stored in
00040  * these structures.
00041  */
00042 struct ctrl_iface_priv;
00043 struct ctrl_iface_global_priv;
00044 struct ctrl_iface_dbus_priv;
00045 
00050 struct wpa_interface {
00059         const char *confname;
00060 
00071         const char *ctrl_interface;
00072 
00077         const char *driver;
00078 
00089         const char *driver_param;
00090 
00095         const char *ifname;
00096 
00106         const char *bridge_ifname;
00107 };
00108 
00113 struct wpa_params {
00118         int daemonize;
00119 
00124         int wait_for_monitor;
00125 
00133         char *pid_file;
00134 
00139         int wpa_debug_level;
00140 
00151         int wpa_debug_show_keys;
00152 
00157         int wpa_debug_timestamp;
00158 
00163         char *ctrl_interface;
00164 
00169         int dbus_ctrl_interface;
00170 
00175         const char *wpa_debug_file_path;
00176 
00181         int wpa_debug_syslog;
00182 
00191         char *override_driver;
00192 
00201         char *override_ctrl_interface;
00202 };
00203 
00211 struct wpa_global {
00212         struct wpa_supplicant *ifaces;
00213         struct wpa_params params;
00214         struct ctrl_iface_global_priv *ctrl_iface;
00215         /* old DBus API data */
00216         struct ctrl_iface_dbus_priv *dbus_ctrl_iface;
00217         /* new DBus API data */
00218         struct ctrl_iface_dbus_new_priv *dbus_new_ctrl_iface;
00219         void **drv_priv;
00220         size_t drv_count;
00221 };
00222 
00223 
00224 struct wpa_client_mlme {
00225 #ifdef CONFIG_CLIENT_MLME
00226         enum {
00227                 IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
00228                 IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
00229                 IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED
00230         } state;
00231         u8 prev_bssid[ETH_ALEN];
00232         u8 ssid[32];
00233         size_t ssid_len;
00234         u16 aid;
00235         u16 ap_capab, capab;
00236         u8 *extra_ie; /* to be added to the end of AssocReq */
00237         size_t extra_ie_len;
00238         u8 *extra_probe_ie; /* to be added to the end of ProbeReq */
00239         size_t extra_probe_ie_len;
00240         wpa_key_mgmt key_mgmt;
00241 
00242         /* The last AssocReq/Resp IEs */
00243         u8 *assocreq_ies, *assocresp_ies;
00244         size_t assocreq_ies_len, assocresp_ies_len;
00245 
00246         int auth_tries, assoc_tries;
00247 
00248         unsigned int ssid_set:1;
00249         unsigned int bssid_set:1;
00250         unsigned int prev_bssid_set:1;
00251         unsigned int authenticated:1;
00252         unsigned int associated:1;
00253         unsigned int probereq_poll:1;
00254         unsigned int use_protection:1;
00255         unsigned int create_ibss:1;
00256         unsigned int mixed_cell:1;
00257         unsigned int wmm_enabled:1;
00258 
00259         struct os_time last_probe;
00260 
00261 #define IEEE80211_AUTH_ALG_OPEN BIT(0)
00262 #define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1)
00263 #define IEEE80211_AUTH_ALG_LEAP BIT(2)
00264         unsigned int auth_algs; /* bitfield of allowed auth algs */
00265         int auth_alg; /* currently used IEEE 802.11 authentication algorithm */
00266         int auth_transaction;
00267 
00268         struct os_time ibss_join_req;
00269         u8 *probe_resp; /* ProbeResp template for IBSS */
00270         size_t probe_resp_len;
00271         u32 supp_rates_bits;
00272 
00273         int wmm_last_param_set;
00274 
00275         int sta_scanning;
00276         int scan_hw_mode_idx;
00277         int scan_channel_idx;
00278         enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
00279         struct os_time last_scan_completed;
00280         int scan_oper_channel;
00281         int scan_oper_freq;
00282         int scan_oper_phymode;
00283         u8 scan_ssid[32];
00284         size_t scan_ssid_len;
00285         int scan_skip_11b;
00286 
00287         struct ieee80211_sta_bss *sta_bss_list;
00288 #define STA_HASH_SIZE 256
00289 #define STA_HASH(sta) (sta[5])
00290         struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE];
00291 
00292         int cts_protect_erp_frames;
00293 
00294         hostapd_hw_mode phymode; /* current mode */
00295         struct hostapd_hw_modes *modes;
00296         size_t num_modes;
00297         unsigned int hw_modes; /* bitfield of allowed hardware modes;
00298                                 * (1 << HOSTAPD_MODE_*) */
00299         int num_curr_rates;
00300         struct hostapd_rate_data *curr_rates;
00301         int freq; /* The current frequency in MHz */
00302         int channel; /* The current IEEE 802.11 channel number */
00303 
00304 #ifdef CONFIG_IEEE80211R
00305         u8 current_md[6];
00306         u8 *ft_ies;
00307         size_t ft_ies_len;
00308 #endif /* CONFIG_IEEE80211R */
00309 
00310 #else /* CONFIG_CLIENT_MLME */
00311         int dummy; /* to keep MSVC happy */
00312 #endif /* CONFIG_CLIENT_MLME */
00313 };
00314 
00324 struct wpa_supplicant {
00325         struct wpa_global *global;
00326         struct wpa_supplicant *next;
00327         struct l2_packet_data *l2;
00328         struct l2_packet_data *l2_br;
00329         unsigned char own_addr[ETH_ALEN];
00330         char ifname[100];
00331 #ifdef CONFIG_CTRL_IFACE_DBUS
00332         char *dbus_path;
00333 #endif /* CONFIG_CTRL_IFACE_DBUS */
00334 #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
00335         char *dbus_new_path;
00336 #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
00337         char bridge_ifname[16];
00338 
00339         char *confname;
00340         struct wpa_config *conf;
00341         int countermeasures;
00342         os_time_t last_michael_mic_error;
00343         u8 bssid[ETH_ALEN];
00344         u8 pending_bssid[ETH_ALEN]; /* If wpa_state == WPA_ASSOCIATING, this
00345                                      * field contains the targer BSSID. */
00346         int reassociate; /* reassociation requested */
00347         int disconnected; /* all connections disabled; i.e., do no reassociate
00348                            * before this has been cleared */
00349         struct wpa_ssid *current_ssid;
00350         int ap_ies_from_associnfo;
00351 
00352         /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
00353         int pairwise_cipher;
00354         int group_cipher;
00355         int key_mgmt;
00356         int mgmt_group_cipher;
00357 
00358         void *drv_priv; /* private data used by driver_ops */
00359         void *global_drv_priv;
00360 
00361         struct wpa_ssid *prev_scan_ssid; /* previously scanned SSID;
00362                                           * NULL = not yet initialized (start
00363                                           * with wildcard SSID)
00364                                           * WILDCARD_SSID_SCAN = wildcard
00365                                           * SSID was used in the previous scan
00366                                           */
00367 #define WILDCARD_SSID_SCAN ((struct wpa_ssid *) 1)
00368 
00369         struct wpa_scan_results *scan_res;
00370 
00371         struct wpa_driver_ops *driver;
00372         int interface_removed; /* whether the network interface has been
00373                                 * removed */
00374         struct wpa_sm *wpa;
00375         struct eapol_sm *eapol;
00376 
00377         struct ctrl_iface_priv *ctrl_iface;
00378 
00379         wpa_states wpa_state;
00380         int scanning;
00381         int new_connection;
00382         int reassociated_connection;
00383 
00384         int eapol_received; /* number of EAPOL packets received after the
00385                              * previous association event */
00386 
00387         struct scard_data *scard;
00388 
00389         unsigned char last_eapol_src[ETH_ALEN];
00390 
00391         int keys_cleared;
00392 
00393         struct wpa_blacklist *blacklist;
00394 
00395         int scan_req; /* manual scan request; this forces a scan even if there
00396                        * are no enabled networks in the configuration */
00397         int scan_res_tried; /* whether ap_scan=1 mode has tried to fetch scan
00398                              * results without a new scan request; this is used
00399                              * to speed up the first association if the driver
00400                              * has already available scan results. */
00401         int scan_runs; /* number of scan runs since WPS was started */
00402 
00403         struct wpa_client_mlme mlme;
00404         unsigned int drv_flags;
00405         int max_scan_ssids;
00406 
00407         int pending_mic_error_report;
00408         int pending_mic_error_pairwise;
00409         int mic_errors_seen; /* Michael MIC errors with the current PTK */
00410 
00411         struct wps_context *wps;
00412         int wps_success; /* WPS success event received */
00413         struct wps_er *wps_er;
00414         int blacklist_cleared;
00415 
00416         struct wpabuf *pending_eapol_rx;
00417         struct os_time pending_eapol_rx_time;
00418         u8 pending_eapol_rx_src[ETH_ALEN];
00419 
00420         struct ibss_rsn *ibss_rsn;
00421 
00422 #ifdef CONFIG_SME
00423         struct {
00424                 u8 ssid[32];
00425                 size_t ssid_len;
00426                 int freq;
00427                 u8 assoc_req_ie[80];
00428                 size_t assoc_req_ie_len;
00429                 int mfp;
00430                 int ft_used;
00431                 u8 mobility_domain[2];
00432                 u8 *ft_ies;
00433                 size_t ft_ies_len;
00434                 u8 prev_bssid[ETH_ALEN];
00435                 int prev_bssid_set;
00436         } sme;
00437 #endif /* CONFIG_SME */
00438 
00439 #ifdef CONFIG_AP
00440         struct hostapd_iface *ap_iface;
00441 #endif /* CONFIG_AP */
00442 
00443         struct wpa_ssid *bgscan_ssid;
00444         const struct bgscan_ops *bgscan;
00445         void *bgscan_priv;
00446 };
00447 
00448 
00449 /* wpa_supplicant.c */
00450 int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
00451 
00452 int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);
00453 
00454 const char * wpa_supplicant_state_txt(int state);
00455 int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s);
00456 int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
00457                               struct wpa_scan_res *bss,
00458                               struct wpa_ssid *ssid,
00459                               u8 *wpa_ie, size_t *wpa_ie_len);
00460 void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
00461                               struct wpa_scan_res *bss,
00462                               struct wpa_ssid *ssid);
00463 void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant *wpa_s,
00464                                        struct wpa_ssid *ssid);
00465 void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s);
00466 int wpa_supplicant_get_scan_results(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, wpa_states state);
00471 struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);
00472 void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s);
00473 void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
00474                                    int reason_code);
00475 void wpa_supplicant_disassociate(struct wpa_supplicant *wpa_s,
00476                                  int reason_code);
00477 
00478 void wpa_supplicant_enable_network(struct wpa_supplicant *wpa_s,
00479                                    struct wpa_ssid *ssid);
00480 void wpa_supplicant_disable_network(struct wpa_supplicant *wpa_s,
00481                                     struct wpa_ssid *ssid);
00482 void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
00483                                    struct wpa_ssid *ssid);
00484 int wpa_supplicant_set_ap_scan(struct wpa_supplicant *wpa_s,
00485                                int ap_scan);
00486 int wpa_supplicant_set_debug_params(struct wpa_global *global,
00487                                     int debug_level, int debug_timestamp,
00488                                     int debug_show_keys);
00489 
00490 void wpa_show_license(void);
00491 
00492 struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
00493                                                  struct wpa_interface *iface);
00494 int wpa_supplicant_remove_iface(struct wpa_global *global,
00495                                 struct wpa_supplicant *wpa_s);
00496 struct wpa_supplicant * wpa_supplicant_get_iface(struct wpa_global *global,
00497                                                  const char *ifname);
00498 struct wpa_global * wpa_supplicant_init(struct wpa_params *params);
00499 int wpa_supplicant_run(struct wpa_global *global);
00500 void wpa_supplicant_deinit(struct wpa_global *global);
00501 
00502 int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
00503                               struct wpa_ssid *ssid);
00504 
00505 /* scan.c */
00506 int wpa_supplicant_enabled_networks(struct wpa_config *conf);
00507 void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec);
00508 void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s);
00509 void wpa_supplicant_notify_scanning(struct wpa_supplicant *wpa_s,
00510                                     int scanning);
00511 struct wpa_driver_scan_params;
00512 int wpa_supplicant_trigger_scan(struct wpa_supplicant *wpa_s,
00513                                 struct wpa_driver_scan_params *params);
00514 
00515 /* events.c */
00516 void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
00517 
00518 #endif /* WPA_SUPPLICANT_I_H */
00519 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on Sat Nov 28 23:07:49 2009 for wpa_supplicant/hostapd by  doxygen 1.6.1