2 * wpa_supplicant - Internal definitions
3 * Copyright (c) 2003-2010, 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 */
32 struct wpa_supplicant
;
36 struct wpa_scan_results
;
39 * Forward declarations of private structures used within the ctrl_iface
40 * backends. Other parts of wpa_supplicant do not have access to data stored in
43 struct ctrl_iface_priv
;
44 struct ctrl_iface_global_priv
;
45 struct wpas_dbus_priv
;
48 * struct wpa_interface - Parameters for wpa_supplicant_add_iface()
50 struct wpa_interface
{
52 * confname - Configuration name (file or profile) name
54 * This can also be %NULL when a configuration file is not used. In
55 * that case, ctrl_interface must be set to allow the interface to be
61 * ctrl_interface - Control interface parameter
63 * If a configuration file is not used, this variable can be used to
64 * set the ctrl_interface parameter that would have otherwise been read
65 * from the configuration file. If both confname and ctrl_interface are
66 * set, ctrl_interface is used to override the value from configuration
69 const char *ctrl_interface
;
72 * driver - Driver interface name, or %NULL to use the default driver
77 * driver_param - Driver interface parameters
79 * If a configuration file is not used, this variable can be used to
80 * set the driver_param parameters that would have otherwise been read
81 * from the configuration file. If both confname and driver_param are
82 * set, driver_param is used to override the value from configuration
85 const char *driver_param
;
88 * ifname - Interface name
93 * bridge_ifname - Optional bridge interface name
95 * If the driver interface (ifname) is included in a Linux bridge
96 * device, the bridge interface may need to be used for receiving EAPOL
97 * frames. This can be enabled by setting this variable to enable
98 * receiving of EAPOL frames from an additional interface.
100 const char *bridge_ifname
;
104 * struct wpa_params - Parameters for wpa_supplicant_init()
108 * daemonize - Run %wpa_supplicant in the background
113 * wait_for_monitor - Wait for a monitor program before starting
115 int wait_for_monitor
;
118 * pid_file - Path to a PID (process ID) file
120 * If this and daemonize are set, process ID of the background process
121 * will be written to the specified file.
126 * wpa_debug_level - Debugging verbosity level (e.g., MSG_INFO)
131 * wpa_debug_show_keys - Whether keying material is included in debug
133 * This parameter can be used to allow keying material to be included
134 * in debug messages. This is a security risk and this option should
135 * not be enabled in normal configuration. If needed during
136 * development or while troubleshooting, this option can provide more
137 * details for figuring out what is happening.
139 int wpa_debug_show_keys
;
142 * wpa_debug_timestamp - Whether to include timestamp in debug messages
144 int wpa_debug_timestamp
;
147 * ctrl_interface - Global ctrl_iface path/parameter
149 char *ctrl_interface
;
152 * dbus_ctrl_interface - Enable the DBus control interface
154 int dbus_ctrl_interface
;
157 * wpa_debug_file_path - Path of debug file or %NULL to use stdout
159 const char *wpa_debug_file_path
;
162 * wpa_debug_syslog - Enable log output through syslog
164 int wpa_debug_syslog
;
167 * override_driver - Optional driver parameter override
169 * This parameter can be used to override the driver parameter in
170 * dynamic interface addition to force a specific driver wrapper to be
173 char *override_driver
;
176 * override_ctrl_interface - Optional ctrl_interface override
178 * This parameter can be used to override the ctrl_interface parameter
179 * in dynamic interface addition to force a control interface to be
182 char *override_ctrl_interface
;
185 struct p2p_srv_bonjour
{
187 struct wpabuf
*query
;
191 struct p2p_srv_upnp
{
198 * struct wpa_global - Internal, global data for all %wpa_supplicant interfaces
200 * This structure is initialized by calling wpa_supplicant_init() when starting
204 struct wpa_supplicant
*ifaces
;
205 struct wpa_params params
;
206 struct ctrl_iface_global_priv
*ctrl_iface
;
207 struct wpas_dbus_priv
*dbus
;
210 struct os_time suspend_time
;
211 struct p2p_data
*p2p
;
212 struct wpa_supplicant
*p2p_group_formation
;
213 u8 p2p_dev_addr
[ETH_ALEN
];
214 struct dl_list p2p_srv_bonjour
; /* struct p2p_srv_bonjour */
215 struct dl_list p2p_srv_upnp
; /* struct p2p_srv_upnp */
220 struct wpa_client_mlme
{
221 #ifdef CONFIG_CLIENT_MLME
223 IEEE80211_DISABLED
, IEEE80211_AUTHENTICATE
,
224 IEEE80211_ASSOCIATE
, IEEE80211_ASSOCIATED
,
225 IEEE80211_IBSS_SEARCH
, IEEE80211_IBSS_JOINED
227 u8 prev_bssid
[ETH_ALEN
];
232 u8
*extra_ie
; /* to be added to the end of AssocReq */
234 u8
*extra_probe_ie
; /* to be added to the end of ProbeReq */
235 size_t extra_probe_ie_len
;
236 enum wpa_key_mgmt key_mgmt
;
238 /* The last AssocReq/Resp IEs */
239 u8
*assocreq_ies
, *assocresp_ies
;
240 size_t assocreq_ies_len
, assocresp_ies_len
;
242 int auth_tries
, assoc_tries
;
244 unsigned int ssid_set
:1;
245 unsigned int bssid_set
:1;
246 unsigned int prev_bssid_set
:1;
247 unsigned int authenticated
:1;
248 unsigned int associated
:1;
249 unsigned int probereq_poll
:1;
250 unsigned int use_protection
:1;
251 unsigned int create_ibss
:1;
252 unsigned int mixed_cell
:1;
253 unsigned int wmm_enabled
:1;
255 struct os_time last_probe
;
257 unsigned int auth_algs
; /* bitfield of allowed auth algs
258 * (WPA_AUTH_ALG_*) */
259 int auth_alg
; /* currently used IEEE 802.11 authentication algorithm */
260 int auth_transaction
;
262 struct os_time ibss_join_req
;
263 u8
*probe_resp
; /* ProbeResp template for IBSS */
264 size_t probe_resp_len
;
267 int wmm_last_param_set
;
270 int scan_hw_mode_idx
;
271 int scan_channel_idx
;
272 enum { SCAN_SET_CHANNEL
, SCAN_SEND_PROBE
} scan_state
;
273 struct os_time last_scan_completed
;
274 int scan_oper_channel
;
276 int scan_oper_phymode
;
278 size_t scan_ssid_len
;
282 struct ieee80211_sta_bss
*sta_bss_list
;
283 #define STA_HASH_SIZE 256
284 #define STA_HASH(sta) (sta[5])
285 struct ieee80211_sta_bss
*sta_bss_hash
[STA_HASH_SIZE
];
287 int cts_protect_erp_frames
;
289 enum hostapd_hw_mode phymode
; /* current mode */
290 struct hostapd_hw_modes
*modes
;
292 unsigned int hw_modes
; /* bitfield of allowed hardware modes;
293 * (1 << HOSTAPD_MODE_*) */
296 int freq
; /* The current frequency in MHz */
297 int channel
; /* The current IEEE 802.11 channel number */
299 #ifdef CONFIG_IEEE80211R
303 #endif /* CONFIG_IEEE80211R */
305 void (*public_action_cb
)(void *ctx
, const u8
*buf
, size_t len
,
307 void *public_action_cb_ctx
;
309 #else /* CONFIG_CLIENT_MLME */
310 int dummy
; /* to keep MSVC happy */
311 #endif /* CONFIG_CLIENT_MLME */
315 * struct wpa_supplicant - Internal data for wpa_supplicant interface
317 * This structure contains the internal data for core wpa_supplicant code. This
318 * should be only used directly from the core code. However, a pointer to this
319 * data is used from other files as an arbitrary context pointer in calls to
322 struct wpa_supplicant
{
323 struct wpa_global
*global
;
324 struct wpa_supplicant
*parent
;
325 struct wpa_supplicant
*next
;
326 struct l2_packet_data
*l2
;
327 struct l2_packet_data
*l2_br
;
328 unsigned char own_addr
[ETH_ALEN
];
330 #ifdef CONFIG_CTRL_IFACE_DBUS
332 #endif /* CONFIG_CTRL_IFACE_DBUS */
333 #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
335 #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
336 char bridge_ifname
[16];
339 struct wpa_config
*conf
;
341 os_time_t last_michael_mic_error
;
343 u8 pending_bssid
[ETH_ALEN
]; /* If wpa_state == WPA_ASSOCIATING, this
344 * field contains the targer BSSID. */
345 int reassociate
; /* reassociation requested */
346 int disconnected
; /* all connections disabled; i.e., do no reassociate
347 * before this has been cleared */
348 struct wpa_ssid
*current_ssid
;
349 struct wpa_bss
*current_bss
;
350 int ap_ies_from_associnfo
;
351 unsigned int assoc_freq
;
353 /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
357 int mgmt_group_cipher
;
359 void *drv_priv
; /* private data used by driver_ops */
360 void *global_drv_priv
;
362 struct wpa_ssid
*prev_scan_ssid
; /* previously scanned SSID;
363 * NULL = not yet initialized (start
364 * with wildcard SSID)
365 * WILDCARD_SSID_SCAN = wildcard
366 * SSID was used in the previous scan
368 #define WILDCARD_SSID_SCAN ((struct wpa_ssid *) 1)
370 void (*scan_res_handler
)(struct wpa_supplicant
*wpa_s
,
371 struct wpa_scan_results
*scan_res
);
372 struct dl_list bss
; /* struct wpa_bss::list */
373 struct dl_list bss_id
; /* struct wpa_bss::list_id */
375 unsigned int bss_update_idx
;
376 unsigned int bss_next_id
;
378 struct wpa_driver_ops
*driver
;
379 int interface_removed
; /* whether the network interface has been
382 struct eapol_sm
*eapol
;
384 struct ctrl_iface_priv
*ctrl_iface
;
386 enum wpa_states wpa_state
;
389 int reassociated_connection
;
391 int eapol_received
; /* number of EAPOL packets received after the
392 * previous association event */
394 struct scard_data
*scard
;
396 unsigned char last_eapol_src
[ETH_ALEN
];
400 struct wpa_blacklist
*blacklist
;
402 int scan_req
; /* manual scan request; this forces a scan even if there
403 * are no enabled networks in the configuration */
404 int scan_runs
; /* number of scan runs since WPS was started */
406 struct wpa_client_mlme mlme
;
407 unsigned int drv_flags
;
409 unsigned int max_remain_on_chan
;
411 int pending_mic_error_report
;
412 int pending_mic_error_pairwise
;
413 int mic_errors_seen
; /* Michael MIC errors with the current PTK */
415 struct wps_context
*wps
;
416 int wps_success
; /* WPS success event received */
417 struct wps_er
*wps_er
;
418 int blacklist_cleared
;
420 struct wpabuf
*pending_eapol_rx
;
421 struct os_time pending_eapol_rx_time
;
422 u8 pending_eapol_rx_src
[ETH_ALEN
];
424 struct ibss_rsn
*ibss_rsn
;
431 u8 assoc_req_ie
[200];
432 size_t assoc_req_ie_len
;
435 u8 mobility_domain
[2];
438 u8 prev_bssid
[ETH_ALEN
];
442 #endif /* CONFIG_SME */
445 struct hostapd_iface
*ap_iface
;
446 void (*ap_configured_cb
)(void *ctx
, void *data
);
447 void *ap_configured_cb_ctx
;
448 void *ap_configured_cb_data
;
449 #endif /* CONFIG_AP */
452 struct p2p_go_neg_results
*go_params
;
453 int create_p2p_iface
;
454 u8 pending_interface_addr
[ETH_ALEN
];
455 char pending_interface_name
[IFNAMSIZ
];
456 int pending_interface_type
;
458 unsigned int off_channel_freq
;
459 struct wpabuf
*pending_action_tx
;
460 u8 pending_action_src
[ETH_ALEN
];
461 u8 pending_action_dst
[ETH_ALEN
];
462 u8 pending_action_bssid
[ETH_ALEN
];
463 unsigned int pending_action_freq
;
464 int pending_action_without_roc
;
465 unsigned int pending_listen_freq
;
466 unsigned int pending_listen_duration
;
468 NOT_P2P_GROUP_INTERFACE
,
469 P2P_GROUP_INTERFACE_PENDING
,
470 P2P_GROUP_INTERFACE_GO
,
471 P2P_GROUP_INTERFACE_CLIENT
472 } p2p_group_interface
;
473 struct p2p_group
*p2p_group
;
476 int p2p_sd_over_ctrl_iface
;
477 int p2p_in_provisioning
;
478 int pending_invite_ssid_id
;
479 int show_group_started
;
480 u8 go_dev_addr
[ETH_ALEN
];
481 int pending_pd_before_join
;
482 u8 pending_join_iface_addr
[ETH_ALEN
];
483 u8 pending_join_dev_addr
[ETH_ALEN
];
484 int pending_join_wps_method
;
485 #endif /* CONFIG_P2P */
487 struct wpa_ssid
*bgscan_ssid
;
488 const struct bgscan_ops
*bgscan
;
491 int connect_without_scan
;
494 unsigned int wps_freq
;
495 int wps_fragment_size
;
499 /* wpa_supplicant.c */
500 int wpa_set_wep_keys(struct wpa_supplicant
*wpa_s
, struct wpa_ssid
*ssid
);
502 int wpa_supplicant_reload_configuration(struct wpa_supplicant
*wpa_s
);
504 const char * wpa_supplicant_state_txt(enum wpa_states state
);
505 int wpa_supplicant_driver_init(struct wpa_supplicant
*wpa_s
);
506 int wpa_supplicant_set_suites(struct wpa_supplicant
*wpa_s
,
507 struct wpa_bss
*bss
, struct wpa_ssid
*ssid
,
508 u8
*wpa_ie
, size_t *wpa_ie_len
);
509 void wpa_supplicant_associate(struct wpa_supplicant
*wpa_s
,
511 struct wpa_ssid
*ssid
);
512 void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant
*wpa_s
,
513 struct wpa_ssid
*ssid
);
514 void wpa_supplicant_initiate_eapol(struct wpa_supplicant
*wpa_s
);
515 void wpa_clear_keys(struct wpa_supplicant
*wpa_s
, const u8
*addr
);
516 void wpa_supplicant_req_auth_timeout(struct wpa_supplicant
*wpa_s
,
518 void wpa_supplicant_set_state(struct wpa_supplicant
*wpa_s
,
519 enum wpa_states state
);
520 struct wpa_ssid
* wpa_supplicant_get_ssid(struct wpa_supplicant
*wpa_s
);
521 void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant
*wpa_s
);
522 void wpa_supplicant_deauthenticate(struct wpa_supplicant
*wpa_s
,
524 void wpa_supplicant_disassociate(struct wpa_supplicant
*wpa_s
,
527 void wpa_supplicant_enable_network(struct wpa_supplicant
*wpa_s
,
528 struct wpa_ssid
*ssid
);
529 void wpa_supplicant_disable_network(struct wpa_supplicant
*wpa_s
,
530 struct wpa_ssid
*ssid
);
531 void wpa_supplicant_select_network(struct wpa_supplicant
*wpa_s
,
532 struct wpa_ssid
*ssid
);
533 int wpa_supplicant_set_ap_scan(struct wpa_supplicant
*wpa_s
,
535 int wpa_supplicant_set_debug_params(struct wpa_global
*global
,
536 int debug_level
, int debug_timestamp
,
537 int debug_show_keys
);
539 void wpa_show_license(void);
541 struct wpa_supplicant
* wpa_supplicant_add_iface(struct wpa_global
*global
,
542 struct wpa_interface
*iface
);
543 int wpa_supplicant_remove_iface(struct wpa_global
*global
,
544 struct wpa_supplicant
*wpa_s
);
545 struct wpa_supplicant
* wpa_supplicant_get_iface(struct wpa_global
*global
,
547 struct wpa_global
* wpa_supplicant_init(struct wpa_params
*params
);
548 int wpa_supplicant_run(struct wpa_global
*global
);
549 void wpa_supplicant_deinit(struct wpa_global
*global
);
551 int wpa_supplicant_scard_init(struct wpa_supplicant
*wpa_s
,
552 struct wpa_ssid
*ssid
);
553 void wpa_supplicant_terminate_proc(struct wpa_global
*global
);
554 void wpa_supplicant_rx_eapol(void *ctx
, const u8
*src_addr
,
555 const u8
*buf
, size_t len
);
556 enum wpa_key_mgmt
key_mgmt2driver(int key_mgmt
);
557 enum wpa_cipher
cipher_suite2driver(int cipher
);
558 void wpa_supplicant_update_config(struct wpa_supplicant
*wpa_s
);
559 void wpa_supplicant_clear_status(struct wpa_supplicant
*wpa_s
);
562 void wpa_supplicant_mark_disassoc(struct wpa_supplicant
*wpa_s
);
563 void wpa_supplicant_connect(struct wpa_supplicant
*wpa_s
,
564 struct wpa_bss
*selected
,
565 struct wpa_ssid
*ssid
);
568 int eap_register_methods(void);
570 #endif /* WPA_SUPPLICANT_I_H */