2 * wpa_supplicant - Internal definitions
3 * Copyright (c) 2003-2007, 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 "common/defs.h"
20 extern const char *wpa_supplicant_version;
21 extern const char *wpa_supplicant_license;
22 #ifndef CONFIG_NO_STDOUT_DEBUG
23 extern const char *wpa_supplicant_full_license1;
24 extern const char *wpa_supplicant_full_license2;
25 extern const char *wpa_supplicant_full_license3;
26 extern const char *wpa_supplicant_full_license4;
27 extern const char *wpa_supplicant_full_license5;
28 #endif /* CONFIG_NO_STDOUT_DEBUG */
30 struct wpa_scan_result;
33 struct wpa_supplicant;
37 * Forward declarations of private structures used within the ctrl_iface
38 * backends. Other parts of wpa_supplicant do not have access to data stored in
41 struct ctrl_iface_priv;
42 struct ctrl_iface_global_priv;
43 struct ctrl_iface_dbus_priv;
46 * struct wpa_interface - Parameters for wpa_supplicant_add_iface()
48 struct wpa_interface {
50 * confname - Configuration name (file or profile) name
52 * This can also be %NULL when a configuration file is not used. In
53 * that case, ctrl_interface must be set to allow the interface to be
59 * ctrl_interface - Control interface parameter
61 * If a configuration file is not used, this variable can be used to
62 * set the ctrl_interface parameter that would have otherwise been read
63 * from the configuration file. If both confname and ctrl_interface are
64 * set, ctrl_interface is used to override the value from configuration
67 const char *ctrl_interface;
70 * driver - Driver interface name, or %NULL to use the default driver
75 * driver_param - Driver interface parameters
77 * If a configuration file is not used, this variable can be used to
78 * set the driver_param parameters that would have otherwise been read
79 * from the configuration file. If both confname and driver_param are
80 * set, driver_param is used to override the value from configuration
83 const char *driver_param;
86 * ifname - Interface name
91 * bridge_ifname - Optional bridge interface name
93 * If the driver interface (ifname) is included in a Linux bridge
94 * device, the bridge interface may need to be used for receiving EAPOL
95 * frames. This can be enabled by setting this variable to enable
96 * receiving of EAPOL frames from an additional interface.
98 const char *bridge_ifname;
102 * struct wpa_params - Parameters for wpa_supplicant_init()
106 * daemonize - Run %wpa_supplicant in the background
111 * wait_for_monitor - Wait for a monitor program before starting
113 int wait_for_monitor;
116 * pid_file - Path to a PID (process ID) file
118 * If this and daemonize are set, process ID of the background process
119 * will be written to the specified file.
124 * wpa_debug_level - Debugging verbosity level (e.g., MSG_INFO)
129 * wpa_debug_show_keys - Whether keying material is included in debug
131 * This parameter can be used to allow keying material to be included
132 * in debug messages. This is a security risk and this option should
133 * not be enabled in normal configuration. If needed during
134 * development or while troubleshooting, this option can provide more
135 * details for figuring out what is happening.
137 int wpa_debug_show_keys;
140 * wpa_debug_timestamp - Whether to include timestamp in debug messages
142 int wpa_debug_timestamp;
145 * ctrl_interface - Global ctrl_iface path/parameter
147 char *ctrl_interface;
150 * dbus_ctrl_interface - Enable the DBus control interface
152 int dbus_ctrl_interface;
155 * wpa_debug_file_path - Path of debug file or %NULL to use stdout
157 const char *wpa_debug_file_path;
160 * wpa_debug_syslog - Enable log output through syslog
162 int wpa_debug_syslog;
166 * struct wpa_global - Internal, global data for all %wpa_supplicant interfaces
168 * This structure is initialized by calling wpa_supplicant_init() when starting
172 struct wpa_supplicant *ifaces;
173 struct wpa_params params;
174 struct ctrl_iface_global_priv *ctrl_iface;
175 struct ctrl_iface_dbus_priv *dbus_ctrl_iface;
181 struct wpa_client_mlme {
182 #ifdef CONFIG_CLIENT_MLME
184 IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
185 IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
186 IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED
188 u8 prev_bssid[ETH_ALEN];
193 u8 *extra_ie; /* to be added to the end of AssocReq */
195 u8 *extra_probe_ie; /* to be added to the end of ProbeReq */
196 size_t extra_probe_ie_len;
197 wpa_key_mgmt key_mgmt;
199 /* The last AssocReq/Resp IEs */
200 u8 *assocreq_ies, *assocresp_ies;
201 size_t assocreq_ies_len, assocresp_ies_len;
203 int auth_tries, assoc_tries;
205 unsigned int ssid_set:1;
206 unsigned int bssid_set:1;
207 unsigned int prev_bssid_set:1;
208 unsigned int authenticated:1;
209 unsigned int associated:1;
210 unsigned int probereq_poll:1;
211 unsigned int use_protection:1;
212 unsigned int create_ibss:1;
213 unsigned int mixed_cell:1;
214 unsigned int wmm_enabled:1;
216 struct os_time last_probe;
218 #define IEEE80211_AUTH_ALG_OPEN BIT(0)
219 #define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1)
220 #define IEEE80211_AUTH_ALG_LEAP BIT(2)
221 unsigned int auth_algs; /* bitfield of allowed auth algs */
222 int auth_alg; /* currently used IEEE 802.11 authentication algorithm */
223 int auth_transaction;
225 struct os_time ibss_join_req;
226 u8 *probe_resp; /* ProbeResp template for IBSS */
227 size_t probe_resp_len;
230 int wmm_last_param_set;
233 int scan_hw_mode_idx;
234 int scan_channel_idx;
235 enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
236 struct os_time last_scan_completed;
237 int scan_oper_channel;
239 int scan_oper_phymode;
241 size_t scan_ssid_len;
244 struct ieee80211_sta_bss *sta_bss_list;
245 #define STA_HASH_SIZE 256
246 #define STA_HASH(sta) (sta[5])
247 struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE];
249 int cts_protect_erp_frames;
251 hostapd_hw_mode phymode; /* current mode */
252 struct hostapd_hw_modes *modes;
254 unsigned int hw_modes; /* bitfield of allowed hardware modes;
255 * (1 << HOSTAPD_MODE_*) */
257 struct hostapd_rate_data *curr_rates;
258 int freq; /* The current frequency in MHz */
259 int channel; /* The current IEEE 802.11 channel number */
261 #ifdef CONFIG_IEEE80211R
265 #endif /* CONFIG_IEEE80211R */
267 #else /* CONFIG_CLIENT_MLME */
268 int dummy; /* to keep MSVC happy */
269 #endif /* CONFIG_CLIENT_MLME */
273 * struct wpa_supplicant - Internal data for wpa_supplicant interface
275 * This structure contains the internal data for core wpa_supplicant code. This
276 * should be only used directly from the core code. However, a pointer to this
277 * data is used from other files as an arbitrary context pointer in calls to
280 struct wpa_supplicant {
281 struct wpa_global *global;
282 struct wpa_supplicant *next;
283 struct l2_packet_data *l2;
284 struct l2_packet_data *l2_br;
285 unsigned char own_addr[ETH_ALEN];
287 #ifdef CONFIG_CTRL_IFACE_DBUS
289 #endif /* CONFIG_CTRL_IFACE_DBUS */
290 char bridge_ifname[16];
293 struct wpa_config *conf;
295 os_time_t last_michael_mic_error;
297 u8 pending_bssid[ETH_ALEN]; /* If wpa_state == WPA_ASSOCIATING, this
298 * field contains the targer BSSID. */
299 int reassociate; /* reassociation requested */
300 int disconnected; /* all connections disabled; i.e., do no reassociate
301 * before this has been cleared */
302 struct wpa_ssid *current_ssid;
303 int ap_ies_from_associnfo;
305 /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
309 int mgmt_group_cipher;
311 void *drv_priv; /* private data used by driver_ops */
313 struct wpa_ssid *prev_scan_ssid; /* previously scanned SSID;
314 * NULL = not yet initialized (start
315 * with wildcard SSID)
316 * WILDCARD_SSID_SCAN = wildcard
317 * SSID was used in the previous scan
319 #define WILDCARD_SSID_SCAN ((struct wpa_ssid *) 1)
321 struct wpa_scan_results *scan_res;
323 struct wpa_driver_ops *driver;
324 int interface_removed; /* whether the network interface has been
327 struct eapol_sm *eapol;
329 struct ctrl_iface_priv *ctrl_iface;
331 wpa_states wpa_state;
334 int reassociated_connection;
336 int eapol_received; /* number of EAPOL packets received after the
337 * previous association event */
339 struct scard_data *scard;
341 unsigned char last_eapol_src[ETH_ALEN];
345 struct wpa_blacklist *blacklist;
347 int scan_req; /* manual scan request; this forces a scan even if there
348 * are no enabled networks in the configuration */
349 int scan_res_tried; /* whether ap_scan=1 mode has tried to fetch scan
350 * results without a new scan request; this is used
351 * to speed up the first association if the driver
352 * has already available scan results. */
353 int scan_runs; /* number of scan runs since WPS was started */
355 struct wpa_client_mlme mlme;
356 unsigned int drv_flags;
359 int pending_mic_error_report;
360 int pending_mic_error_pairwise;
361 int mic_errors_seen; /* Michael MIC errors with the current PTK */
363 struct wps_context *wps;
364 int wps_success; /* WPS success event received */
365 int blacklist_cleared;
367 struct ibss_rsn *ibss_rsn;
375 size_t assoc_req_ie_len;
378 u8 mobility_domain[2];
382 #endif /* CONFIG_SME */
385 struct hostapd_iface *ap_iface;
386 #endif /* CONFIG_AP */
390 /* wpa_supplicant.c */
391 int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);
393 const char * wpa_supplicant_state_txt(int state);
394 int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s);
395 int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
396 struct wpa_scan_res *bss,
397 struct wpa_ssid *ssid,
398 u8 *wpa_ie, size_t *wpa_ie_len);
399 void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
400 struct wpa_scan_res *bss,
401 struct wpa_ssid *ssid);
402 void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant *wpa_s,
403 struct wpa_ssid *ssid);
404 void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s);
405 int wpa_supplicant_get_scan_results(struct wpa_supplicant *wpa_s);
406 void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
407 void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
409 void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s, wpa_states state);
410 struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);
411 void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s);
412 void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
414 void wpa_supplicant_disassociate(struct wpa_supplicant *wpa_s,
417 void wpa_show_license(void);
419 struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
420 struct wpa_interface *iface);
421 int wpa_supplicant_remove_iface(struct wpa_global *global,
422 struct wpa_supplicant *wpa_s);
423 struct wpa_supplicant * wpa_supplicant_get_iface(struct wpa_global *global,
425 struct wpa_global * wpa_supplicant_init(struct wpa_params *params);
426 int wpa_supplicant_run(struct wpa_global *global);
427 void wpa_supplicant_deinit(struct wpa_global *global);
429 int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
430 struct wpa_ssid *ssid);
433 void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec);
434 void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s);
435 void wpa_supplicant_notify_scanning(struct wpa_supplicant *wpa_s,
439 void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
441 #endif /* WPA_SUPPLICANT_I_H */