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"
20 #include "config_ssid.h"
22 extern const char *wpa_supplicant_version
;
23 extern const char *wpa_supplicant_license
;
24 #ifndef CONFIG_NO_STDOUT_DEBUG
25 extern const char *wpa_supplicant_full_license1
;
26 extern const char *wpa_supplicant_full_license2
;
27 extern const char *wpa_supplicant_full_license3
;
28 extern const char *wpa_supplicant_full_license4
;
29 extern const char *wpa_supplicant_full_license5
;
30 #endif /* CONFIG_NO_STDOUT_DEBUG */
33 struct wpa_supplicant
;
37 struct wpa_scan_results
;
38 struct hostapd_hw_modes
;
41 * Forward declarations of private structures used within the ctrl_iface
42 * backends. Other parts of wpa_supplicant do not have access to data stored in
45 struct ctrl_iface_priv
;
46 struct ctrl_iface_global_priv
;
47 struct wpas_dbus_priv
;
50 * struct wpa_interface - Parameters for wpa_supplicant_add_iface()
52 struct wpa_interface
{
54 * confname - Configuration name (file or profile) name
56 * This can also be %NULL when a configuration file is not used. In
57 * that case, ctrl_interface must be set to allow the interface to be
63 * ctrl_interface - Control interface parameter
65 * If a configuration file is not used, this variable can be used to
66 * set the ctrl_interface parameter that would have otherwise been read
67 * from the configuration file. If both confname and ctrl_interface are
68 * set, ctrl_interface is used to override the value from configuration
71 const char *ctrl_interface
;
74 * driver - Driver interface name, or %NULL to use the default driver
79 * driver_param - Driver interface parameters
81 * If a configuration file is not used, this variable can be used to
82 * set the driver_param parameters that would have otherwise been read
83 * from the configuration file. If both confname and driver_param are
84 * set, driver_param is used to override the value from configuration
87 const char *driver_param
;
90 * ifname - Interface name
95 * bridge_ifname - Optional bridge interface name
97 * If the driver interface (ifname) is included in a Linux bridge
98 * device, the bridge interface may need to be used for receiving EAPOL
99 * frames. This can be enabled by setting this variable to enable
100 * receiving of EAPOL frames from an additional interface.
102 const char *bridge_ifname
;
106 * struct wpa_params - Parameters for wpa_supplicant_init()
110 * daemonize - Run %wpa_supplicant in the background
115 * wait_for_monitor - Wait for a monitor program before starting
117 int wait_for_monitor
;
120 * pid_file - Path to a PID (process ID) file
122 * If this and daemonize are set, process ID of the background process
123 * will be written to the specified file.
128 * wpa_debug_level - Debugging verbosity level (e.g., MSG_INFO)
133 * wpa_debug_show_keys - Whether keying material is included in debug
135 * This parameter can be used to allow keying material to be included
136 * in debug messages. This is a security risk and this option should
137 * not be enabled in normal configuration. If needed during
138 * development or while troubleshooting, this option can provide more
139 * details for figuring out what is happening.
141 int wpa_debug_show_keys
;
144 * wpa_debug_timestamp - Whether to include timestamp in debug messages
146 int wpa_debug_timestamp
;
149 * ctrl_interface - Global ctrl_iface path/parameter
151 char *ctrl_interface
;
154 * dbus_ctrl_interface - Enable the DBus control interface
156 int dbus_ctrl_interface
;
159 * wpa_debug_file_path - Path of debug file or %NULL to use stdout
161 const char *wpa_debug_file_path
;
164 * wpa_debug_syslog - Enable log output through syslog
166 int wpa_debug_syslog
;
169 * override_driver - Optional driver parameter override
171 * This parameter can be used to override the driver parameter in
172 * dynamic interface addition to force a specific driver wrapper to be
175 char *override_driver
;
178 * override_ctrl_interface - Optional ctrl_interface override
180 * This parameter can be used to override the ctrl_interface parameter
181 * in dynamic interface addition to force a control interface to be
184 char *override_ctrl_interface
;
187 * entropy_file - Optional entropy file
189 * This parameter can be used to configure wpa_supplicant to maintain
190 * its internal entropy store over restarts.
195 struct p2p_srv_bonjour
{
197 struct wpabuf
*query
;
201 struct p2p_srv_upnp
{
208 * struct wpa_global - Internal, global data for all %wpa_supplicant interfaces
210 * This structure is initialized by calling wpa_supplicant_init() when starting
214 struct wpa_supplicant
*ifaces
;
215 struct wpa_params params
;
216 struct ctrl_iface_global_priv
*ctrl_iface
;
217 struct wpas_dbus_priv
*dbus
;
220 struct os_time suspend_time
;
221 struct p2p_data
*p2p
;
222 struct wpa_supplicant
*p2p_group_formation
;
223 u8 p2p_dev_addr
[ETH_ALEN
];
224 struct dl_list p2p_srv_bonjour
; /* struct p2p_srv_bonjour */
225 struct dl_list p2p_srv_upnp
; /* struct p2p_srv_upnp */
227 int cross_connection
;
231 enum offchannel_send_action_result
{
232 OFFCHANNEL_SEND_ACTION_SUCCESS
/* Frame was send and acknowledged */,
233 OFFCHANNEL_SEND_ACTION_NO_ACK
/* Frame was sent, but not acknowledged
235 OFFCHANNEL_SEND_ACTION_FAILED
/* Frame was not sent due to a failure */
239 * struct wpa_supplicant - Internal data for wpa_supplicant interface
241 * This structure contains the internal data for core wpa_supplicant code. This
242 * should be only used directly from the core code. However, a pointer to this
243 * data is used from other files as an arbitrary context pointer in calls to
246 struct wpa_supplicant
{
247 struct wpa_global
*global
;
248 struct wpa_supplicant
*parent
;
249 struct wpa_supplicant
*next
;
250 struct l2_packet_data
*l2
;
251 struct l2_packet_data
*l2_br
;
252 unsigned char own_addr
[ETH_ALEN
];
254 #ifdef CONFIG_CTRL_IFACE_DBUS
256 #endif /* CONFIG_CTRL_IFACE_DBUS */
257 #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
259 char *dbus_groupobj_path
;
260 #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
261 char bridge_ifname
[16];
264 struct wpa_config
*conf
;
266 os_time_t last_michael_mic_error
;
268 u8 pending_bssid
[ETH_ALEN
]; /* If wpa_state == WPA_ASSOCIATING, this
269 * field contains the target BSSID. */
270 int reassociate
; /* reassociation requested */
271 int disconnected
; /* all connections disabled; i.e., do no reassociate
272 * before this has been cleared */
273 struct wpa_ssid
*current_ssid
;
274 struct wpa_bss
*current_bss
;
275 int ap_ies_from_associnfo
;
276 unsigned int assoc_freq
;
278 /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
283 int mgmt_group_cipher
;
285 void *drv_priv
; /* private data used by driver_ops */
286 void *global_drv_priv
;
288 /* previous scan was wildcard when interleaving between
289 * wildcard scans and specific SSID scan when max_ssids=1 */
290 int prev_scan_wildcard
;
291 struct wpa_ssid
*prev_scan_ssid
; /* previously scanned SSID;
292 * NULL = not yet initialized (start
293 * with wildcard SSID)
294 * WILDCARD_SSID_SCAN = wildcard
295 * SSID was used in the previous scan
297 #define WILDCARD_SSID_SCAN ((struct wpa_ssid *) 1)
299 struct wpa_ssid
*prev_sched_ssid
; /* last SSID used in sched scan */
300 int sched_scan_timeout
;
301 int sched_scan_interval
;
302 int first_sched_scan
;
303 int sched_scan_timed_out
;
305 void (*scan_res_handler
)(struct wpa_supplicant
*wpa_s
,
306 struct wpa_scan_results
*scan_res
);
307 struct dl_list bss
; /* struct wpa_bss::list */
308 struct dl_list bss_id
; /* struct wpa_bss::list_id */
310 unsigned int bss_update_idx
;
311 unsigned int bss_next_id
;
313 struct wpa_driver_ops
*driver
;
314 int interface_removed
; /* whether the network interface has been
317 struct eapol_sm
*eapol
;
319 struct ctrl_iface_priv
*ctrl_iface
;
321 enum wpa_states wpa_state
;
325 int reassociated_connection
;
327 int eapol_received
; /* number of EAPOL packets received after the
328 * previous association event */
330 struct scard_data
*scard
;
332 unsigned char last_eapol_src
[ETH_ALEN
];
336 struct wpa_blacklist
*blacklist
;
338 int scan_req
; /* manual scan request; this forces a scan even if there
339 * are no enabled networks in the configuration */
340 int scan_runs
; /* number of scan runs since WPS was started */
341 int *next_scan_freqs
;
342 int scan_interval
; /* time in sec between scans to find suitable AP */
343 int normal_scans
; /* normal scans run before sched_scan */
345 unsigned int drv_flags
;
348 * A bitmap of supported protocols for probe response offload. See
349 * struct wpa_driver_capa in driver.h
351 unsigned int probe_resp_offloads
;
354 int max_sched_scan_ssids
;
355 int sched_scan_supported
;
356 unsigned int max_match_sets
;
357 unsigned int max_remain_on_chan
;
358 unsigned int max_stations
;
360 int pending_mic_error_report
;
361 int pending_mic_error_pairwise
;
362 int mic_errors_seen
; /* Michael MIC errors with the current PTK */
364 struct wps_context
*wps
;
365 int wps_success
; /* WPS success event received */
366 struct wps_er
*wps_er
;
367 int blacklist_cleared
;
369 struct wpabuf
*pending_eapol_rx
;
370 struct os_time pending_eapol_rx_time
;
371 u8 pending_eapol_rx_src
[ETH_ALEN
];
373 struct ibss_rsn
*ibss_rsn
;
385 u8 assoc_req_ie
[200];
386 size_t assoc_req_ie_len
;
389 u8 mobility_domain
[2];
392 u8 prev_bssid
[ETH_ALEN
];
397 int sa_query_count
; /* number of pending SA Query requests;
398 * 0 = no SA Query in progress */
399 int sa_query_timed_out
;
400 u8
*sa_query_trans_id
; /* buffer of WLAN_SA_QUERY_TR_ID_LEN *
401 * sa_query_count octets of pending
402 * SA Query transaction identifiers */
403 struct os_time sa_query_start
;
405 #endif /* CONFIG_SME */
408 struct hostapd_iface
*ap_iface
;
409 void (*ap_configured_cb
)(void *ctx
, void *data
);
410 void *ap_configured_cb_ctx
;
411 void *ap_configured_cb_data
;
412 #endif /* CONFIG_AP */
414 unsigned int off_channel_freq
;
415 struct wpabuf
*pending_action_tx
;
416 u8 pending_action_src
[ETH_ALEN
];
417 u8 pending_action_dst
[ETH_ALEN
];
418 u8 pending_action_bssid
[ETH_ALEN
];
419 unsigned int pending_action_freq
;
420 int pending_action_no_cck
;
421 int pending_action_without_roc
;
422 void (*pending_action_tx_status_cb
)(struct wpa_supplicant
*wpa_s
,
423 unsigned int freq
, const u8
*dst
,
424 const u8
*src
, const u8
*bssid
,
425 const u8
*data
, size_t data_len
,
426 enum offchannel_send_action_result
428 unsigned int roc_waiting_drv_freq
;
429 int action_tx_wait_time
;
432 struct p2p_go_neg_results
*go_params
;
433 int create_p2p_iface
;
434 u8 pending_interface_addr
[ETH_ALEN
];
435 char pending_interface_name
[100];
436 int pending_interface_type
;
438 unsigned int pending_listen_freq
;
439 unsigned int pending_listen_duration
;
441 NOT_P2P_GROUP_INTERFACE
,
442 P2P_GROUP_INTERFACE_PENDING
,
443 P2P_GROUP_INTERFACE_GO
,
444 P2P_GROUP_INTERFACE_CLIENT
445 } p2p_group_interface
;
446 struct p2p_group
*p2p_group
;
447 int p2p_long_listen
; /* remaining time in long Listen state in ms */
450 u8 p2p_auth_invite
[ETH_ALEN
];
451 int p2p_sd_over_ctrl_iface
;
452 int p2p_in_provisioning
;
453 int pending_invite_ssid_id
;
454 int show_group_started
;
455 u8 go_dev_addr
[ETH_ALEN
];
456 int pending_pd_before_join
;
457 u8 pending_join_iface_addr
[ETH_ALEN
];
458 u8 pending_join_dev_addr
[ETH_ALEN
];
459 int pending_join_wps_method
;
460 int p2p_join_scan_count
;
464 * Whether cross connection is disallowed by the AP to which this
465 * interface is associated (only valid if there is an association).
467 int cross_connect_disallowed
;
470 * Whether this P2P group is configured to use cross connection (only
471 * valid if this is P2P GO interface). The actual cross connect packet
472 * forwarding may not be configured depending on the uplink status.
474 int cross_connect_enabled
;
476 /* Whether cross connection forwarding is in use at the moment. */
477 int cross_connect_in_use
;
480 * Uplink interface name for cross connection
482 char cross_connect_uplink
[100];
485 P2P_GROUP_REMOVAL_UNKNOWN
,
486 P2P_GROUP_REMOVAL_REQUESTED
,
487 P2P_GROUP_REMOVAL_IDLE_TIMEOUT
,
488 P2P_GROUP_REMOVAL_UNAVAILABLE
491 unsigned int p2p_cb_on_scan_complete
:1;
492 #endif /* CONFIG_P2P */
494 struct wpa_ssid
*bgscan_ssid
;
495 const struct bgscan_ops
*bgscan
;
498 struct wpa_ssid
*connect_without_scan
;
502 unsigned int wps_freq
;
503 int wps_fragment_size
;
504 int auto_reconnect_disabled
;
506 /* Channel preferences for AP/P2P GO use */
509 int best_overall_freq
;
511 struct gas_query
*gas
;
513 #ifdef CONFIG_INTERWORKING
514 unsigned int fetch_anqp_in_progress
:1;
515 unsigned int network_select
:1;
516 unsigned int auto_select
:1;
517 #endif /* CONFIG_INTERWORKING */
518 unsigned int drv_capa_known
;
521 struct hostapd_hw_modes
*modes
;
530 /* wpa_supplicant.c */
531 int wpa_set_wep_keys(struct wpa_supplicant
*wpa_s
, struct wpa_ssid
*ssid
);
533 int wpa_supplicant_reload_configuration(struct wpa_supplicant
*wpa_s
);
535 const char * wpa_supplicant_state_txt(enum wpa_states state
);
536 int wpa_supplicant_update_mac_addr(struct wpa_supplicant
*wpa_s
);
537 int wpa_supplicant_driver_init(struct wpa_supplicant
*wpa_s
);
538 int wpa_supplicant_set_suites(struct wpa_supplicant
*wpa_s
,
539 struct wpa_bss
*bss
, struct wpa_ssid
*ssid
,
540 u8
*wpa_ie
, size_t *wpa_ie_len
);
541 void wpa_supplicant_associate(struct wpa_supplicant
*wpa_s
,
543 struct wpa_ssid
*ssid
);
544 void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant
*wpa_s
,
545 struct wpa_ssid
*ssid
);
546 void wpa_supplicant_initiate_eapol(struct wpa_supplicant
*wpa_s
);
547 void wpa_clear_keys(struct wpa_supplicant
*wpa_s
, const u8
*addr
);
548 void wpa_supplicant_req_auth_timeout(struct wpa_supplicant
*wpa_s
,
550 void wpa_supplicant_set_state(struct wpa_supplicant
*wpa_s
,
551 enum wpa_states state
);
552 struct wpa_ssid
* wpa_supplicant_get_ssid(struct wpa_supplicant
*wpa_s
);
553 const char * wpa_supplicant_get_eap_mode(struct wpa_supplicant
*wpa_s
);
554 void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant
*wpa_s
);
555 void wpa_supplicant_deauthenticate(struct wpa_supplicant
*wpa_s
,
557 void wpa_supplicant_disassociate(struct wpa_supplicant
*wpa_s
,
560 void wpa_supplicant_enable_network(struct wpa_supplicant
*wpa_s
,
561 struct wpa_ssid
*ssid
);
562 void wpa_supplicant_disable_network(struct wpa_supplicant
*wpa_s
,
563 struct wpa_ssid
*ssid
);
564 void wpa_supplicant_select_network(struct wpa_supplicant
*wpa_s
,
565 struct wpa_ssid
*ssid
);
566 int wpa_supplicant_set_ap_scan(struct wpa_supplicant
*wpa_s
,
568 int wpa_supplicant_set_bss_expiration_age(struct wpa_supplicant
*wpa_s
,
569 unsigned int expire_age
);
570 int wpa_supplicant_set_bss_expiration_count(struct wpa_supplicant
*wpa_s
,
571 unsigned int expire_count
);
572 int wpa_supplicant_set_debug_params(struct wpa_global
*global
,
573 int debug_level
, int debug_timestamp
,
574 int debug_show_keys
);
576 void wpa_show_license(void);
578 struct wpa_supplicant
* wpa_supplicant_add_iface(struct wpa_global
*global
,
579 struct wpa_interface
*iface
);
580 int wpa_supplicant_remove_iface(struct wpa_global
*global
,
581 struct wpa_supplicant
*wpa_s
);
582 struct wpa_supplicant
* wpa_supplicant_get_iface(struct wpa_global
*global
,
584 struct wpa_global
* wpa_supplicant_init(struct wpa_params
*params
);
585 int wpa_supplicant_run(struct wpa_global
*global
);
586 void wpa_supplicant_deinit(struct wpa_global
*global
);
588 int wpa_supplicant_scard_init(struct wpa_supplicant
*wpa_s
,
589 struct wpa_ssid
*ssid
);
590 void wpa_supplicant_terminate_proc(struct wpa_global
*global
);
591 void wpa_supplicant_rx_eapol(void *ctx
, const u8
*src_addr
,
592 const u8
*buf
, size_t len
);
593 enum wpa_key_mgmt
key_mgmt2driver(int key_mgmt
);
594 enum wpa_cipher
cipher_suite2driver(int cipher
);
595 void wpa_supplicant_update_config(struct wpa_supplicant
*wpa_s
);
596 void wpa_supplicant_clear_status(struct wpa_supplicant
*wpa_s
);
597 void wpas_connection_failed(struct wpa_supplicant
*wpa_s
, const u8
*bssid
);
598 int wpas_driver_bss_selection(struct wpa_supplicant
*wpa_s
);
601 void wpa_supplicant_mark_disassoc(struct wpa_supplicant
*wpa_s
);
602 int wpa_supplicant_connect(struct wpa_supplicant
*wpa_s
,
603 struct wpa_bss
*selected
,
604 struct wpa_ssid
*ssid
);
605 void wpa_supplicant_stop_countermeasures(void *eloop_ctx
, void *sock_ctx
);
606 void wpa_supplicant_delayed_mic_error_report(void *eloop_ctx
, void *sock_ctx
);
609 int eap_register_methods(void);
612 * Utility method to tell if a given network is a persistent group
613 * @ssid: Network object
614 * Returns: 1 if network is a persistent group, 0 otherwise
616 static inline int network_is_persistent_group(struct wpa_ssid
*ssid
)
618 return ((ssid
->disabled
== 2) || ssid
->p2p_persistent_group
);
621 #endif /* WPA_SUPPLICANT_I_H */