2 * wpa_supplicant - Internal definitions
3 * Copyright (c) 2003-2009, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
15 #ifndef WPA_SUPPLICANT_I_H
16 #define WPA_SUPPLICANT_I_H
18 #include "utils/list.h"
19 #include "common/defs.h"
21 extern const char *wpa_supplicant_version;
22 extern const char *wpa_supplicant_license;
23 #ifndef CONFIG_NO_STDOUT_DEBUG
24 extern const char *wpa_supplicant_full_license1;
25 extern const char *wpa_supplicant_full_license2;
26 extern const char *wpa_supplicant_full_license3;
27 extern const char *wpa_supplicant_full_license4;
28 extern const char *wpa_supplicant_full_license5;
29 #endif /* CONFIG_NO_STDOUT_DEBUG */
31 struct wpa_scan_result;
34 struct wpa_supplicant;
38 * Forward declarations of private structures used within the ctrl_iface
39 * backends. Other parts of wpa_supplicant do not have access to data stored in
42 struct ctrl_iface_priv;
43 struct ctrl_iface_global_priv;
44 struct ctrl_iface_dbus_priv;
47 * struct wpa_interface - Parameters for wpa_supplicant_add_iface()
49 struct wpa_interface {
51 * confname - Configuration name (file or profile) name
53 * This can also be %NULL when a configuration file is not used. In
54 * that case, ctrl_interface must be set to allow the interface to be
60 * ctrl_interface - Control interface parameter
62 * If a configuration file is not used, this variable can be used to
63 * set the ctrl_interface parameter that would have otherwise been read
64 * from the configuration file. If both confname and ctrl_interface are
65 * set, ctrl_interface is used to override the value from configuration
68 const char *ctrl_interface;
71 * driver - Driver interface name, or %NULL to use the default driver
76 * driver_param - Driver interface parameters
78 * If a configuration file is not used, this variable can be used to
79 * set the driver_param parameters that would have otherwise been read
80 * from the configuration file. If both confname and driver_param are
81 * set, driver_param is used to override the value from configuration
84 const char *driver_param;
87 * ifname - Interface name
92 * bridge_ifname - Optional bridge interface name
94 * If the driver interface (ifname) is included in a Linux bridge
95 * device, the bridge interface may need to be used for receiving EAPOL
96 * frames. This can be enabled by setting this variable to enable
97 * receiving of EAPOL frames from an additional interface.
99 const char *bridge_ifname;
103 * struct wpa_params - Parameters for wpa_supplicant_init()
107 * daemonize - Run %wpa_supplicant in the background
112 * wait_for_monitor - Wait for a monitor program before starting
114 int wait_for_monitor;
117 * pid_file - Path to a PID (process ID) file
119 * If this and daemonize are set, process ID of the background process
120 * will be written to the specified file.
125 * wpa_debug_level - Debugging verbosity level (e.g., MSG_INFO)
130 * wpa_debug_show_keys - Whether keying material is included in debug
132 * This parameter can be used to allow keying material to be included
133 * in debug messages. This is a security risk and this option should
134 * not be enabled in normal configuration. If needed during
135 * development or while troubleshooting, this option can provide more
136 * details for figuring out what is happening.
138 int wpa_debug_show_keys;
141 * wpa_debug_timestamp - Whether to include timestamp in debug messages
143 int wpa_debug_timestamp;
146 * ctrl_interface - Global ctrl_iface path/parameter
148 char *ctrl_interface;
151 * dbus_ctrl_interface - Enable the DBus control interface
153 int dbus_ctrl_interface;
156 * wpa_debug_file_path - Path of debug file or %NULL to use stdout
158 const char *wpa_debug_file_path;
161 * wpa_debug_syslog - Enable log output through syslog
163 int wpa_debug_syslog;
166 * override_driver - Optional driver parameter override
168 * This parameter can be used to override the driver parameter in
169 * dynamic interface addition to force a specific driver wrapper to be
172 char *override_driver;
175 * override_ctrl_interface - Optional ctrl_interface override
177 * This parameter can be used to override the ctrl_interface parameter
178 * in dynamic interface addition to force a control interface to be
181 char *override_ctrl_interface;
185 * struct wpa_global - Internal, global data for all %wpa_supplicant interfaces
187 * This structure is initialized by calling wpa_supplicant_init() when starting
191 struct wpa_supplicant *ifaces;
192 struct wpa_params params;
193 struct ctrl_iface_global_priv *ctrl_iface;
194 /* old DBus API data */
195 struct ctrl_iface_dbus_priv *dbus_ctrl_iface;
196 /* new DBus API data */
197 struct ctrl_iface_dbus_new_priv *dbus_new_ctrl_iface;
203 struct wpa_client_mlme {
204 #ifdef CONFIG_CLIENT_MLME
206 IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
207 IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
208 IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED
210 u8 prev_bssid[ETH_ALEN];
215 u8 *extra_ie; /* to be added to the end of AssocReq */
217 u8 *extra_probe_ie; /* to be added to the end of ProbeReq */
218 size_t extra_probe_ie_len;
219 enum wpa_key_mgmt key_mgmt;
221 /* The last AssocReq/Resp IEs */
222 u8 *assocreq_ies, *assocresp_ies;
223 size_t assocreq_ies_len, assocresp_ies_len;
225 int auth_tries, assoc_tries;
227 unsigned int ssid_set:1;
228 unsigned int bssid_set:1;
229 unsigned int prev_bssid_set:1;
230 unsigned int authenticated:1;
231 unsigned int associated:1;
232 unsigned int probereq_poll:1;
233 unsigned int use_protection:1;
234 unsigned int create_ibss:1;
235 unsigned int mixed_cell:1;
236 unsigned int wmm_enabled:1;
238 struct os_time last_probe;
240 #define IEEE80211_AUTH_ALG_OPEN BIT(0)
241 #define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1)
242 #define IEEE80211_AUTH_ALG_LEAP BIT(2)
243 unsigned int auth_algs; /* bitfield of allowed auth algs */
244 int auth_alg; /* currently used IEEE 802.11 authentication algorithm */
245 int auth_transaction;
247 struct os_time ibss_join_req;
248 u8 *probe_resp; /* ProbeResp template for IBSS */
249 size_t probe_resp_len;
252 int wmm_last_param_set;
255 int scan_hw_mode_idx;
256 int scan_channel_idx;
257 enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
258 struct os_time last_scan_completed;
259 int scan_oper_channel;
261 int scan_oper_phymode;
263 size_t scan_ssid_len;
266 struct ieee80211_sta_bss *sta_bss_list;
267 #define STA_HASH_SIZE 256
268 #define STA_HASH(sta) (sta[5])
269 struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE];
271 int cts_protect_erp_frames;
273 enum hostapd_hw_mode phymode; /* current mode */
274 struct hostapd_hw_modes *modes;
276 unsigned int hw_modes; /* bitfield of allowed hardware modes;
277 * (1 << HOSTAPD_MODE_*) */
280 int freq; /* The current frequency in MHz */
281 int channel; /* The current IEEE 802.11 channel number */
283 #ifdef CONFIG_IEEE80211R
287 #endif /* CONFIG_IEEE80211R */
289 #else /* CONFIG_CLIENT_MLME */
290 int dummy; /* to keep MSVC happy */
291 #endif /* CONFIG_CLIENT_MLME */
295 * struct wpa_supplicant - Internal data for wpa_supplicant interface
297 * This structure contains the internal data for core wpa_supplicant code. This
298 * should be only used directly from the core code. However, a pointer to this
299 * data is used from other files as an arbitrary context pointer in calls to
302 struct wpa_supplicant {
303 struct wpa_global *global;
304 struct wpa_supplicant *next;
305 struct l2_packet_data *l2;
306 struct l2_packet_data *l2_br;
307 unsigned char own_addr[ETH_ALEN];
309 #ifdef CONFIG_CTRL_IFACE_DBUS
311 #endif /* CONFIG_CTRL_IFACE_DBUS */
312 #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
314 #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
315 char bridge_ifname[16];
318 struct wpa_config *conf;
320 os_time_t last_michael_mic_error;
322 u8 pending_bssid[ETH_ALEN]; /* If wpa_state == WPA_ASSOCIATING, this
323 * field contains the targer BSSID. */
324 int reassociate; /* reassociation requested */
325 int disconnected; /* all connections disabled; i.e., do no reassociate
326 * before this has been cleared */
327 struct wpa_ssid *current_ssid;
328 int ap_ies_from_associnfo;
330 /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
334 int mgmt_group_cipher;
336 void *drv_priv; /* private data used by driver_ops */
337 void *global_drv_priv;
339 struct wpa_ssid *prev_scan_ssid; /* previously scanned SSID;
340 * NULL = not yet initialized (start
341 * with wildcard SSID)
342 * WILDCARD_SSID_SCAN = wildcard
343 * SSID was used in the previous scan
345 #define WILDCARD_SSID_SCAN ((struct wpa_ssid *) 1)
347 struct wpa_scan_results *scan_res;
348 struct dl_list bss; /* struct wpa_bss::list */
350 unsigned int bss_update_idx;
351 unsigned int bss_next_id;
353 struct wpa_driver_ops *driver;
354 int interface_removed; /* whether the network interface has been
357 struct eapol_sm *eapol;
359 struct ctrl_iface_priv *ctrl_iface;
361 enum wpa_states wpa_state;
364 int reassociated_connection;
366 int eapol_received; /* number of EAPOL packets received after the
367 * previous association event */
369 struct scard_data *scard;
371 unsigned char last_eapol_src[ETH_ALEN];
375 struct wpa_blacklist *blacklist;
377 int scan_req; /* manual scan request; this forces a scan even if there
378 * are no enabled networks in the configuration */
379 int scan_res_tried; /* whether ap_scan=1 mode has tried to fetch scan
380 * results without a new scan request; this is used
381 * to speed up the first association if the driver
382 * has already available scan results. */
383 int scan_runs; /* number of scan runs since WPS was started */
385 struct wpa_client_mlme mlme;
386 unsigned int drv_flags;
389 int pending_mic_error_report;
390 int pending_mic_error_pairwise;
391 int mic_errors_seen; /* Michael MIC errors with the current PTK */
393 struct wps_context *wps;
394 int wps_success; /* WPS success event received */
395 struct wps_er *wps_er;
396 int blacklist_cleared;
398 struct wpabuf *pending_eapol_rx;
399 struct os_time pending_eapol_rx_time;
400 u8 pending_eapol_rx_src[ETH_ALEN];
402 struct ibss_rsn *ibss_rsn;
410 size_t assoc_req_ie_len;
413 u8 mobility_domain[2];
416 u8 prev_bssid[ETH_ALEN];
419 #endif /* CONFIG_SME */
422 struct hostapd_iface *ap_iface;
423 #endif /* CONFIG_AP */
425 struct wpa_ssid *bgscan_ssid;
426 const struct bgscan_ops *bgscan;
431 /* wpa_supplicant.c */
432 int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
434 int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);
436 const char * wpa_supplicant_state_txt(enum wpa_states state);
437 int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s);
438 int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
439 struct wpa_scan_res *bss,
440 struct wpa_ssid *ssid,
441 u8 *wpa_ie, size_t *wpa_ie_len);
442 void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
443 struct wpa_scan_res *bss,
444 struct wpa_ssid *ssid);
445 void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant *wpa_s,
446 struct wpa_ssid *ssid);
447 void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s);
448 int wpa_supplicant_get_scan_results(struct wpa_supplicant *wpa_s);
449 void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
450 void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
452 void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
453 enum wpa_states state);
454 struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);
455 void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s);
456 void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
458 void wpa_supplicant_disassociate(struct wpa_supplicant *wpa_s,
461 void wpa_supplicant_enable_network(struct wpa_supplicant *wpa_s,
462 struct wpa_ssid *ssid);
463 void wpa_supplicant_disable_network(struct wpa_supplicant *wpa_s,
464 struct wpa_ssid *ssid);
465 void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
466 struct wpa_ssid *ssid);
467 int wpa_supplicant_set_ap_scan(struct wpa_supplicant *wpa_s,
469 int wpa_supplicant_set_debug_params(struct wpa_global *global,
470 int debug_level, int debug_timestamp,
471 int debug_show_keys);
473 void wpa_show_license(void);
475 struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
476 struct wpa_interface *iface);
477 int wpa_supplicant_remove_iface(struct wpa_global *global,
478 struct wpa_supplicant *wpa_s);
479 struct wpa_supplicant * wpa_supplicant_get_iface(struct wpa_global *global,
481 struct wpa_global * wpa_supplicant_init(struct wpa_params *params);
482 int wpa_supplicant_run(struct wpa_global *global);
483 void wpa_supplicant_deinit(struct wpa_global *global);
485 int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
486 struct wpa_ssid *ssid);
487 void wpa_supplicant_terminate_proc(struct wpa_global *global);
490 int wpa_supplicant_enabled_networks(struct wpa_config *conf);
491 void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec);
492 void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s);
493 void wpa_supplicant_notify_scanning(struct wpa_supplicant *wpa_s,
495 struct wpa_driver_scan_params;
496 int wpa_supplicant_trigger_scan(struct wpa_supplicant *wpa_s,
497 struct wpa_driver_scan_params *params);
500 void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
503 int eap_register_methods(void);
505 #endif /* WPA_SUPPLICANT_I_H */