Deleted Added
full compact
wpa_supplicant_i.h (209158) wpa_supplicant_i.h (214734)
1/*
2 * wpa_supplicant - Internal definitions
1/*
2 * wpa_supplicant - Internal definitions
3 * Copyright (c) 2003-2007, Jouni Malinen <j@w1.fi>
3 * Copyright (c) 2003-2010, Jouni Malinen <j@w1.fi>
4 *
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.
8 *
9 * Alternatively, this software may be distributed under the terms of BSD
10 * license.
11 *
12 * See README and COPYING for more details.
13 */
14
15#ifndef WPA_SUPPLICANT_I_H
16#define WPA_SUPPLICANT_I_H
17
4 *
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.
8 *
9 * Alternatively, this software may be distributed under the terms of BSD
10 * license.
11 *
12 * See README and COPYING for more details.
13 */
14
15#ifndef WPA_SUPPLICANT_I_H
16#define WPA_SUPPLICANT_I_H
17
18#include "drivers/driver.h"
18#include "utils/list.h"
19#include "common/defs.h"
19
20extern const char *wpa_supplicant_version;
21extern const char *wpa_supplicant_license;
22#ifndef CONFIG_NO_STDOUT_DEBUG
23extern const char *wpa_supplicant_full_license1;
24extern const char *wpa_supplicant_full_license2;
25extern const char *wpa_supplicant_full_license3;
26extern const char *wpa_supplicant_full_license4;
27extern const char *wpa_supplicant_full_license5;
28#endif /* CONFIG_NO_STDOUT_DEBUG */
29
20
21extern const char *wpa_supplicant_version;
22extern const char *wpa_supplicant_license;
23#ifndef CONFIG_NO_STDOUT_DEBUG
24extern const char *wpa_supplicant_full_license1;
25extern const char *wpa_supplicant_full_license2;
26extern const char *wpa_supplicant_full_license3;
27extern const char *wpa_supplicant_full_license4;
28extern const char *wpa_supplicant_full_license5;
29#endif /* CONFIG_NO_STDOUT_DEBUG */
30
30extern struct wpa_driver_ops *wpa_supplicant_drivers[];
31
32
33struct wpa_scan_result;
34struct wpa_sm;
35struct wpa_supplicant;
31struct wpa_sm;
32struct wpa_supplicant;
33struct ibss_rsn;
34struct scan_info;
35struct wpa_bss;
36struct wpa_scan_results;
36
37/*
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
40 * these structures.
41 */
42struct ctrl_iface_priv;
43struct ctrl_iface_global_priv;
37
38/*
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
41 * these structures.
42 */
43struct ctrl_iface_priv;
44struct ctrl_iface_global_priv;
44struct ctrl_iface_dbus_priv;
45struct wpas_dbus_priv;
45
46/**
47 * struct wpa_interface - Parameters for wpa_supplicant_add_iface()
48 */
49struct wpa_interface {
50 /**
51 * confname - Configuration name (file or profile) name
52 *

--- 102 unchanged lines hidden (view full) ---

155 /**
156 * wpa_debug_file_path - Path of debug file or %NULL to use stdout
157 */
158 const char *wpa_debug_file_path;
159
160 /**
161 * wpa_debug_syslog - Enable log output through syslog
162 */
46
47/**
48 * struct wpa_interface - Parameters for wpa_supplicant_add_iface()
49 */
50struct wpa_interface {
51 /**
52 * confname - Configuration name (file or profile) name
53 *

--- 102 unchanged lines hidden (view full) ---

156 /**
157 * wpa_debug_file_path - Path of debug file or %NULL to use stdout
158 */
159 const char *wpa_debug_file_path;
160
161 /**
162 * wpa_debug_syslog - Enable log output through syslog
163 */
163 const char *wpa_debug_syslog;
164 int wpa_debug_syslog;
165
166 /**
167 * override_driver - Optional driver parameter override
168 *
169 * This parameter can be used to override the driver parameter in
170 * dynamic interface addition to force a specific driver wrapper to be
171 * used instead.
172 */
173 char *override_driver;
174
175 /**
176 * override_ctrl_interface - Optional ctrl_interface override
177 *
178 * This parameter can be used to override the ctrl_interface parameter
179 * in dynamic interface addition to force a control interface to be
180 * created.
181 */
182 char *override_ctrl_interface;
164};
165
166/**
167 * struct wpa_global - Internal, global data for all %wpa_supplicant interfaces
168 *
169 * This structure is initialized by calling wpa_supplicant_init() when starting
170 * %wpa_supplicant.
171 */
172struct wpa_global {
173 struct wpa_supplicant *ifaces;
174 struct wpa_params params;
175 struct ctrl_iface_global_priv *ctrl_iface;
183};
184
185/**
186 * struct wpa_global - Internal, global data for all %wpa_supplicant interfaces
187 *
188 * This structure is initialized by calling wpa_supplicant_init() when starting
189 * %wpa_supplicant.
190 */
191struct wpa_global {
192 struct wpa_supplicant *ifaces;
193 struct wpa_params params;
194 struct ctrl_iface_global_priv *ctrl_iface;
176 struct ctrl_iface_dbus_priv *dbus_ctrl_iface;
195 struct wpas_dbus_priv *dbus;
177 void **drv_priv;
178 size_t drv_count;
196 void **drv_priv;
197 size_t drv_count;
198 struct os_time suspend_time;
179};
180
181
182struct wpa_client_mlme {
183#ifdef CONFIG_CLIENT_MLME
184 enum {
185 IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
186 IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
187 IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED
188 } state;
189 u8 prev_bssid[ETH_ALEN];
190 u8 ssid[32];
191 size_t ssid_len;
192 u16 aid;
193 u16 ap_capab, capab;
194 u8 *extra_ie; /* to be added to the end of AssocReq */
195 size_t extra_ie_len;
196 u8 *extra_probe_ie; /* to be added to the end of ProbeReq */
197 size_t extra_probe_ie_len;
199};
200
201
202struct wpa_client_mlme {
203#ifdef CONFIG_CLIENT_MLME
204 enum {
205 IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
206 IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
207 IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED
208 } state;
209 u8 prev_bssid[ETH_ALEN];
210 u8 ssid[32];
211 size_t ssid_len;
212 u16 aid;
213 u16 ap_capab, capab;
214 u8 *extra_ie; /* to be added to the end of AssocReq */
215 size_t extra_ie_len;
216 u8 *extra_probe_ie; /* to be added to the end of ProbeReq */
217 size_t extra_probe_ie_len;
198 wpa_key_mgmt key_mgmt;
218 enum wpa_key_mgmt key_mgmt;
199
200 /* The last AssocReq/Resp IEs */
201 u8 *assocreq_ies, *assocresp_ies;
202 size_t assocreq_ies_len, assocresp_ies_len;
203
204 int auth_tries, assoc_tries;
205
206 unsigned int ssid_set:1;

--- 4 unchanged lines hidden (view full) ---

211 unsigned int probereq_poll:1;
212 unsigned int use_protection:1;
213 unsigned int create_ibss:1;
214 unsigned int mixed_cell:1;
215 unsigned int wmm_enabled:1;
216
217 struct os_time last_probe;
218
219
220 /* The last AssocReq/Resp IEs */
221 u8 *assocreq_ies, *assocresp_ies;
222 size_t assocreq_ies_len, assocresp_ies_len;
223
224 int auth_tries, assoc_tries;
225
226 unsigned int ssid_set:1;

--- 4 unchanged lines hidden (view full) ---

231 unsigned int probereq_poll:1;
232 unsigned int use_protection:1;
233 unsigned int create_ibss:1;
234 unsigned int mixed_cell:1;
235 unsigned int wmm_enabled:1;
236
237 struct os_time last_probe;
238
219#define IEEE80211_AUTH_ALG_OPEN BIT(0)
220#define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1)
221#define IEEE80211_AUTH_ALG_LEAP BIT(2)
222 unsigned int auth_algs; /* bitfield of allowed auth algs */
239 unsigned int auth_algs; /* bitfield of allowed auth algs
240 * (WPA_AUTH_ALG_*) */
223 int auth_alg; /* currently used IEEE 802.11 authentication algorithm */
224 int auth_transaction;
225
226 struct os_time ibss_join_req;
227 u8 *probe_resp; /* ProbeResp template for IBSS */
228 size_t probe_resp_len;
229 u32 supp_rates_bits;
230

--- 5 unchanged lines hidden (view full) ---

236 enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
237 struct os_time last_scan_completed;
238 int scan_oper_channel;
239 int scan_oper_freq;
240 int scan_oper_phymode;
241 u8 scan_ssid[32];
242 size_t scan_ssid_len;
243 int scan_skip_11b;
241 int auth_alg; /* currently used IEEE 802.11 authentication algorithm */
242 int auth_transaction;
243
244 struct os_time ibss_join_req;
245 u8 *probe_resp; /* ProbeResp template for IBSS */
246 size_t probe_resp_len;
247 u32 supp_rates_bits;
248

--- 5 unchanged lines hidden (view full) ---

254 enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
255 struct os_time last_scan_completed;
256 int scan_oper_channel;
257 int scan_oper_freq;
258 int scan_oper_phymode;
259 u8 scan_ssid[32];
260 size_t scan_ssid_len;
261 int scan_skip_11b;
262 int *scan_freqs;
244
245 struct ieee80211_sta_bss *sta_bss_list;
246#define STA_HASH_SIZE 256
247#define STA_HASH(sta) (sta[5])
248 struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE];
249
250 int cts_protect_erp_frames;
251
263
264 struct ieee80211_sta_bss *sta_bss_list;
265#define STA_HASH_SIZE 256
266#define STA_HASH(sta) (sta[5])
267 struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE];
268
269 int cts_protect_erp_frames;
270
252 int phymode; /* current mode; WPA_MODE_IEEE80211A, .. */
253 struct wpa_hw_modes *modes;
271 enum hostapd_hw_mode phymode; /* current mode */
272 struct hostapd_hw_modes *modes;
254 size_t num_modes;
255 unsigned int hw_modes; /* bitfield of allowed hardware modes;
273 size_t num_modes;
274 unsigned int hw_modes; /* bitfield of allowed hardware modes;
256 * (1 << MODE_*) */
275 * (1 << HOSTAPD_MODE_*) */
257 int num_curr_rates;
276 int num_curr_rates;
258 struct wpa_rate_data *curr_rates;
277 int *curr_rates;
259 int freq; /* The current frequency in MHz */
260 int channel; /* The current IEEE 802.11 channel number */
261
262#ifdef CONFIG_IEEE80211R
263 u8 current_md[6];
264 u8 *ft_ies;
265 size_t ft_ies_len;
266#endif /* CONFIG_IEEE80211R */
267
278 int freq; /* The current frequency in MHz */
279 int channel; /* The current IEEE 802.11 channel number */
280
281#ifdef CONFIG_IEEE80211R
282 u8 current_md[6];
283 u8 *ft_ies;
284 size_t ft_ies_len;
285#endif /* CONFIG_IEEE80211R */
286
287 void (*public_action_cb)(void *ctx, const u8 *buf, size_t len,
288 int freq);
289 void *public_action_cb_ctx;
290
268#else /* CONFIG_CLIENT_MLME */
269 int dummy; /* to keep MSVC happy */
270#endif /* CONFIG_CLIENT_MLME */
271};
272
273/**
274 * struct wpa_supplicant - Internal data for wpa_supplicant interface
275 *

--- 7 unchanged lines hidden (view full) ---

283 struct wpa_supplicant *next;
284 struct l2_packet_data *l2;
285 struct l2_packet_data *l2_br;
286 unsigned char own_addr[ETH_ALEN];
287 char ifname[100];
288#ifdef CONFIG_CTRL_IFACE_DBUS
289 char *dbus_path;
290#endif /* CONFIG_CTRL_IFACE_DBUS */
291#else /* CONFIG_CLIENT_MLME */
292 int dummy; /* to keep MSVC happy */
293#endif /* CONFIG_CLIENT_MLME */
294};
295
296/**
297 * struct wpa_supplicant - Internal data for wpa_supplicant interface
298 *

--- 7 unchanged lines hidden (view full) ---

306 struct wpa_supplicant *next;
307 struct l2_packet_data *l2;
308 struct l2_packet_data *l2_br;
309 unsigned char own_addr[ETH_ALEN];
310 char ifname[100];
311#ifdef CONFIG_CTRL_IFACE_DBUS
312 char *dbus_path;
313#endif /* CONFIG_CTRL_IFACE_DBUS */
314#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
315 char *dbus_new_path;
316#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
291 char bridge_ifname[16];
292
293 char *confname;
294 struct wpa_config *conf;
295 int countermeasures;
296 os_time_t last_michael_mic_error;
297 u8 bssid[ETH_ALEN];
298 u8 pending_bssid[ETH_ALEN]; /* If wpa_state == WPA_ASSOCIATING, this
299 * field contains the targer BSSID. */
300 int reassociate; /* reassociation requested */
301 int disconnected; /* all connections disabled; i.e., do no reassociate
302 * before this has been cleared */
303 struct wpa_ssid *current_ssid;
317 char bridge_ifname[16];
318
319 char *confname;
320 struct wpa_config *conf;
321 int countermeasures;
322 os_time_t last_michael_mic_error;
323 u8 bssid[ETH_ALEN];
324 u8 pending_bssid[ETH_ALEN]; /* If wpa_state == WPA_ASSOCIATING, this
325 * field contains the targer BSSID. */
326 int reassociate; /* reassociation requested */
327 int disconnected; /* all connections disabled; i.e., do no reassociate
328 * before this has been cleared */
329 struct wpa_ssid *current_ssid;
330 struct wpa_bss *current_bss;
304 int ap_ies_from_associnfo;
331 int ap_ies_from_associnfo;
332 unsigned int assoc_freq;
305
306 /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
307 int pairwise_cipher;
308 int group_cipher;
309 int key_mgmt;
310 int mgmt_group_cipher;
311
312 void *drv_priv; /* private data used by driver_ops */
313 void *global_drv_priv;
314
315 struct wpa_ssid *prev_scan_ssid; /* previously scanned SSID;
316 * NULL = not yet initialized (start
333
334 /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
335 int pairwise_cipher;
336 int group_cipher;
337 int key_mgmt;
338 int mgmt_group_cipher;
339
340 void *drv_priv; /* private data used by driver_ops */
341 void *global_drv_priv;
342
343 struct wpa_ssid *prev_scan_ssid; /* previously scanned SSID;
344 * NULL = not yet initialized (start
317 * with broadcast SSID)
318 * BROADCAST_SSID_SCAN = broadcast
345 * with wildcard SSID)
346 * WILDCARD_SSID_SCAN = wildcard
319 * SSID was used in the previous scan
320 */
347 * SSID was used in the previous scan
348 */
321#define BROADCAST_SSID_SCAN ((struct wpa_ssid *) 1)
349#define WILDCARD_SSID_SCAN ((struct wpa_ssid *) 1)
322
350
323 struct wpa_scan_results *scan_res;
351 void (*scan_res_handler)(struct wpa_supplicant *wpa_s,
352 struct wpa_scan_results *scan_res);
353 struct dl_list bss; /* struct wpa_bss::list */
354 struct dl_list bss_id; /* struct wpa_bss::list_id */
355 size_t num_bss;
356 unsigned int bss_update_idx;
357 unsigned int bss_next_id;
324
325 struct wpa_driver_ops *driver;
326 int interface_removed; /* whether the network interface has been
327 * removed */
328 struct wpa_sm *wpa;
329 struct eapol_sm *eapol;
330
331 struct ctrl_iface_priv *ctrl_iface;
332
358
359 struct wpa_driver_ops *driver;
360 int interface_removed; /* whether the network interface has been
361 * removed */
362 struct wpa_sm *wpa;
363 struct eapol_sm *eapol;
364
365 struct ctrl_iface_priv *ctrl_iface;
366
333 wpa_states wpa_state;
367 enum wpa_states wpa_state;
334 int scanning;
335 int new_connection;
336 int reassociated_connection;
337
338 int eapol_received; /* number of EAPOL packets received after the
339 * previous association event */
340
341 struct scard_data *scard;
342
343 unsigned char last_eapol_src[ETH_ALEN];
344
345 int keys_cleared;
346
347 struct wpa_blacklist *blacklist;
348
349 int scan_req; /* manual scan request; this forces a scan even if there
350 * are no enabled networks in the configuration */
368 int scanning;
369 int new_connection;
370 int reassociated_connection;
371
372 int eapol_received; /* number of EAPOL packets received after the
373 * previous association event */
374
375 struct scard_data *scard;
376
377 unsigned char last_eapol_src[ETH_ALEN];
378
379 int keys_cleared;
380
381 struct wpa_blacklist *blacklist;
382
383 int scan_req; /* manual scan request; this forces a scan even if there
384 * are no enabled networks in the configuration */
351 int scan_res_tried; /* whether ap_scan=1 mode has tried to fetch scan
352 * results without a new scan request; this is used
353 * to speed up the first association if the driver
354 * has already available scan results. */
355 int scan_runs; /* number of scan runs since WPS was started */
356
357 struct wpa_client_mlme mlme;
385 int scan_runs; /* number of scan runs since WPS was started */
386
387 struct wpa_client_mlme mlme;
358 int use_client_mlme;
359 int driver_4way_handshake;
388 unsigned int drv_flags;
389 int max_scan_ssids;
390 unsigned int max_remain_on_chan;
360
361 int pending_mic_error_report;
362 int pending_mic_error_pairwise;
363 int mic_errors_seen; /* Michael MIC errors with the current PTK */
364
365 struct wps_context *wps;
366 int wps_success; /* WPS success event received */
391
392 int pending_mic_error_report;
393 int pending_mic_error_pairwise;
394 int mic_errors_seen; /* Michael MIC errors with the current PTK */
395
396 struct wps_context *wps;
397 int wps_success; /* WPS success event received */
398 struct wps_er *wps_er;
367 int blacklist_cleared;
368
369 struct wpabuf *pending_eapol_rx;
370 struct os_time pending_eapol_rx_time;
371 u8 pending_eapol_rx_src[ETH_ALEN];
399 int blacklist_cleared;
400
401 struct wpabuf *pending_eapol_rx;
402 struct os_time pending_eapol_rx_time;
403 u8 pending_eapol_rx_src[ETH_ALEN];
404
405 struct ibss_rsn *ibss_rsn;
406
407#ifdef CONFIG_SME
408 struct {
409 u8 ssid[32];
410 size_t ssid_len;
411 int freq;
412 u8 assoc_req_ie[80];
413 size_t assoc_req_ie_len;
414 int mfp;
415 int ft_used;
416 u8 mobility_domain[2];
417 u8 *ft_ies;
418 size_t ft_ies_len;
419 u8 prev_bssid[ETH_ALEN];
420 int prev_bssid_set;
421 int auth_alg;
422 } sme;
423#endif /* CONFIG_SME */
424
425#ifdef CONFIG_AP
426 struct hostapd_iface *ap_iface;
427 void (*ap_configured_cb)(void *ctx, void *data);
428 void *ap_configured_cb_ctx;
429 void *ap_configured_cb_data;
430#endif /* CONFIG_AP */
431
432 struct wpa_ssid *bgscan_ssid;
433 const struct bgscan_ops *bgscan;
434 void *bgscan_priv;
435
436 int connect_without_scan;
437
438 int after_wps;
439 unsigned int wps_freq;
372};
373
374
375/* wpa_supplicant.c */
440};
441
442
443/* wpa_supplicant.c */
444int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
445
376int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);
377
446int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);
447
378const char * wpa_supplicant_state_txt(int state);
448const char * wpa_supplicant_state_txt(enum wpa_states state);
379int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s);
380int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
449int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s);
450int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
381 struct wpa_scan_res *bss,
382 struct wpa_ssid *ssid,
451 struct wpa_bss *bss, struct wpa_ssid *ssid,
383 u8 *wpa_ie, size_t *wpa_ie_len);
384void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
452 u8 *wpa_ie, size_t *wpa_ie_len);
453void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
385 struct wpa_scan_res *bss,
454 struct wpa_bss *bss,
386 struct wpa_ssid *ssid);
387void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant *wpa_s,
388 struct wpa_ssid *ssid);
389void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s);
455 struct wpa_ssid *ssid);
456void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant *wpa_s,
457 struct wpa_ssid *ssid);
458void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s);
390int wpa_supplicant_get_scan_results(struct wpa_supplicant *wpa_s);
391void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
392void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
393 int sec, int usec);
459void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
460void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
461 int sec, int usec);
394void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s, wpa_states state);
462void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
463 enum wpa_states state);
395struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);
396void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s);
397void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
398 int reason_code);
399void wpa_supplicant_disassociate(struct wpa_supplicant *wpa_s,
400 int reason_code);
401
464struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);
465void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s);
466void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
467 int reason_code);
468void wpa_supplicant_disassociate(struct wpa_supplicant *wpa_s,
469 int reason_code);
470
471void wpa_supplicant_enable_network(struct wpa_supplicant *wpa_s,
472 struct wpa_ssid *ssid);
473void wpa_supplicant_disable_network(struct wpa_supplicant *wpa_s,
474 struct wpa_ssid *ssid);
475void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
476 struct wpa_ssid *ssid);
477int wpa_supplicant_set_ap_scan(struct wpa_supplicant *wpa_s,
478 int ap_scan);
479int wpa_supplicant_set_debug_params(struct wpa_global *global,
480 int debug_level, int debug_timestamp,
481 int debug_show_keys);
482
402void wpa_show_license(void);
403
404struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
405 struct wpa_interface *iface);
406int wpa_supplicant_remove_iface(struct wpa_global *global,
407 struct wpa_supplicant *wpa_s);
408struct wpa_supplicant * wpa_supplicant_get_iface(struct wpa_global *global,
409 const char *ifname);
410struct wpa_global * wpa_supplicant_init(struct wpa_params *params);
411int wpa_supplicant_run(struct wpa_global *global);
412void wpa_supplicant_deinit(struct wpa_global *global);
413
414int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
415 struct wpa_ssid *ssid);
483void wpa_show_license(void);
484
485struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
486 struct wpa_interface *iface);
487int wpa_supplicant_remove_iface(struct wpa_global *global,
488 struct wpa_supplicant *wpa_s);
489struct wpa_supplicant * wpa_supplicant_get_iface(struct wpa_global *global,
490 const char *ifname);
491struct wpa_global * wpa_supplicant_init(struct wpa_params *params);
492int wpa_supplicant_run(struct wpa_global *global);
493void wpa_supplicant_deinit(struct wpa_global *global);
494
495int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
496 struct wpa_ssid *ssid);
497void wpa_supplicant_terminate_proc(struct wpa_global *global);
498void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
499 const u8 *buf, size_t len);
500enum wpa_key_mgmt key_mgmt2driver(int key_mgmt);
501enum wpa_cipher cipher_suite2driver(int cipher);
416
502
417/* scan.c */
418int wpa_supplicant_enabled_networks(struct wpa_config *conf);
419void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec);
420void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s);
421void wpa_supplicant_notify_scanning(struct wpa_supplicant *wpa_s,
422 int scanning);
423
424/* events.c */
425void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
503/* events.c */
504void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
505void wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
506 struct wpa_bss *selected,
507 struct wpa_ssid *ssid);
426
508
427/* driver_ops */
428static inline void * wpa_drv_init(struct wpa_supplicant *wpa_s,
429 const char *ifname)
430{
431 if (wpa_s->driver->init2)
432 return wpa_s->driver->init2(wpa_s, ifname,
433 wpa_s->global_drv_priv);
434 if (wpa_s->driver->init) {
435 return wpa_s->driver->init(wpa_s, ifname);
436 }
437 return NULL;
438}
509/* eap_register.c */
510int eap_register_methods(void);
439
511
440static inline void wpa_drv_deinit(struct wpa_supplicant *wpa_s)
441{
442 if (wpa_s->driver->deinit)
443 wpa_s->driver->deinit(wpa_s->drv_priv);
444}
445
446static inline int wpa_drv_set_param(struct wpa_supplicant *wpa_s,
447 const char *param)
448{
449 if (wpa_s->driver->set_param)
450 return wpa_s->driver->set_param(wpa_s->drv_priv, param);
451 return 0;
452}
453
454static inline int wpa_drv_set_drop_unencrypted(struct wpa_supplicant *wpa_s,
455 int enabled)
456{
457 if (wpa_s->driver->set_drop_unencrypted) {
458 return wpa_s->driver->set_drop_unencrypted(wpa_s->drv_priv,
459 enabled);
460 }
461 return -1;
462}
463
464static inline int wpa_drv_set_countermeasures(struct wpa_supplicant *wpa_s,
465 int enabled)
466{
467 if (wpa_s->driver->set_countermeasures) {
468 return wpa_s->driver->set_countermeasures(wpa_s->drv_priv,
469 enabled);
470 }
471 return -1;
472}
473
474static inline int wpa_drv_set_auth_alg(struct wpa_supplicant *wpa_s,
475 int auth_alg)
476{
477 if (wpa_s->driver->set_auth_alg) {
478 return wpa_s->driver->set_auth_alg(wpa_s->drv_priv,
479 auth_alg);
480 }
481 return -1;
482}
483
484static inline int wpa_drv_set_wpa(struct wpa_supplicant *wpa_s, int enabled)
485{
486 if (wpa_s->driver->set_wpa) {
487 return wpa_s->driver->set_wpa(wpa_s->drv_priv, enabled);
488 }
489 return 0;
490}
491
492static inline int wpa_drv_set_mode(struct wpa_supplicant *wpa_s, int mode)
493{
494 if (wpa_s->driver->set_mode) {
495 return wpa_s->driver->set_mode(wpa_s->drv_priv, mode);
496 }
497 return 0;
498}
499
500static inline int wpa_drv_associate(struct wpa_supplicant *wpa_s,
501 struct wpa_driver_associate_params *params)
502{
503 if (wpa_s->driver->associate) {
504 return wpa_s->driver->associate(wpa_s->drv_priv, params);
505 }
506 return -1;
507}
508
509static inline int wpa_drv_scan(struct wpa_supplicant *wpa_s, const u8 *ssid,
510 size_t ssid_len)
511{
512 if (wpa_s->driver->scan) {
513 return wpa_s->driver->scan(wpa_s->drv_priv, ssid, ssid_len);
514 }
515 return -1;
516}
517
518static inline int wpa_drv_get_scan_results(struct wpa_supplicant *wpa_s,
519 struct wpa_scan_result *results,
520 size_t max_size)
521{
522 if (wpa_s->driver->get_scan_results) {
523 return wpa_s->driver->get_scan_results(wpa_s->drv_priv,
524 results, max_size);
525 }
526 return -1;
527}
528
529static inline struct wpa_scan_results * wpa_drv_get_scan_results2(
530 struct wpa_supplicant *wpa_s)
531{
532 if (wpa_s->driver->get_scan_results2)
533 return wpa_s->driver->get_scan_results2(wpa_s->drv_priv);
534 return NULL;
535}
536
537static inline int wpa_drv_get_bssid(struct wpa_supplicant *wpa_s, u8 *bssid)
538{
539 if (wpa_s->driver->get_bssid) {
540 return wpa_s->driver->get_bssid(wpa_s->drv_priv, bssid);
541 }
542 return -1;
543}
544
545static inline int wpa_drv_get_ssid(struct wpa_supplicant *wpa_s, u8 *ssid)
546{
547 if (wpa_s->driver->get_ssid) {
548 return wpa_s->driver->get_ssid(wpa_s->drv_priv, ssid);
549 }
550 return -1;
551}
552
553static inline int wpa_drv_set_key(struct wpa_supplicant *wpa_s, wpa_alg alg,
554 const u8 *addr, int key_idx, int set_tx,
555 const u8 *seq, size_t seq_len,
556 const u8 *key, size_t key_len)
557{
558 if (wpa_s->driver->set_key) {
559 wpa_s->keys_cleared = 0;
560 return wpa_s->driver->set_key(wpa_s->drv_priv, alg, addr,
561 key_idx, set_tx, seq, seq_len,
562 key, key_len);
563 }
564 return -1;
565}
566
567static inline int wpa_drv_deauthenticate(struct wpa_supplicant *wpa_s,
568 const u8 *addr, int reason_code)
569{
570 if (wpa_s->driver->deauthenticate) {
571 return wpa_s->driver->deauthenticate(wpa_s->drv_priv, addr,
572 reason_code);
573 }
574 return -1;
575}
576
577static inline int wpa_drv_disassociate(struct wpa_supplicant *wpa_s,
578 const u8 *addr, int reason_code)
579{
580 if (wpa_s->driver->disassociate) {
581 return wpa_s->driver->disassociate(wpa_s->drv_priv, addr,
582 reason_code);
583 }
584 return -1;
585}
586
587static inline int wpa_drv_add_pmkid(struct wpa_supplicant *wpa_s,
588 const u8 *bssid, const u8 *pmkid)
589{
590 if (wpa_s->driver->add_pmkid) {
591 return wpa_s->driver->add_pmkid(wpa_s->drv_priv, bssid, pmkid);
592 }
593 return -1;
594}
595
596static inline int wpa_drv_remove_pmkid(struct wpa_supplicant *wpa_s,
597 const u8 *bssid, const u8 *pmkid)
598{
599 if (wpa_s->driver->remove_pmkid) {
600 return wpa_s->driver->remove_pmkid(wpa_s->drv_priv, bssid,
601 pmkid);
602 }
603 return -1;
604}
605
606static inline int wpa_drv_flush_pmkid(struct wpa_supplicant *wpa_s)
607{
608 if (wpa_s->driver->flush_pmkid) {
609 return wpa_s->driver->flush_pmkid(wpa_s->drv_priv);
610 }
611 return -1;
612}
613
614static inline int wpa_drv_get_capa(struct wpa_supplicant *wpa_s,
615 struct wpa_driver_capa *capa)
616{
617 if (wpa_s->driver->get_capa) {
618 return wpa_s->driver->get_capa(wpa_s->drv_priv, capa);
619 }
620 return -1;
621}
622
623static inline void wpa_drv_poll(struct wpa_supplicant *wpa_s)
624{
625 if (wpa_s->driver->poll) {
626 wpa_s->driver->poll(wpa_s->drv_priv);
627 }
628}
629
630static inline const char * wpa_drv_get_ifname(struct wpa_supplicant *wpa_s)
631{
632 if (wpa_s->driver->get_ifname) {
633 return wpa_s->driver->get_ifname(wpa_s->drv_priv);
634 }
635 return NULL;
636}
637
638static inline const u8 * wpa_drv_get_mac_addr(struct wpa_supplicant *wpa_s)
639{
640 if (wpa_s->driver->get_mac_addr) {
641 return wpa_s->driver->get_mac_addr(wpa_s->drv_priv);
642 }
643 return NULL;
644}
645
646static inline int wpa_drv_send_eapol(struct wpa_supplicant *wpa_s,
647 const u8 *dst, u16 proto,
648 const u8 *data, size_t data_len)
649{
650 if (wpa_s->driver->send_eapol)
651 return wpa_s->driver->send_eapol(wpa_s->drv_priv, dst, proto,
652 data, data_len);
653 return -1;
654}
655
656static inline int wpa_drv_set_operstate(struct wpa_supplicant *wpa_s,
657 int state)
658{
659 if (wpa_s->driver->set_operstate)
660 return wpa_s->driver->set_operstate(wpa_s->drv_priv, state);
661 return 0;
662}
663
664static inline int wpa_drv_mlme_setprotection(struct wpa_supplicant *wpa_s,
665 const u8 *addr, int protect_type,
666 int key_type)
667{
668 if (wpa_s->driver->mlme_setprotection)
669 return wpa_s->driver->mlme_setprotection(wpa_s->drv_priv, addr,
670 protect_type,
671 key_type);
672 return 0;
673}
674
675static inline struct wpa_hw_modes *
676wpa_drv_get_hw_feature_data(struct wpa_supplicant *wpa_s, u16 *num_modes,
677 u16 *flags)
678{
679 if (wpa_s->driver->get_hw_feature_data)
680 return wpa_s->driver->get_hw_feature_data(wpa_s->drv_priv,
681 num_modes, flags);
682 return NULL;
683}
684
685static inline int wpa_drv_set_channel(struct wpa_supplicant *wpa_s,
686 wpa_hw_mode phymode, int chan,
687 int freq)
688{
689 if (wpa_s->driver->set_channel)
690 return wpa_s->driver->set_channel(wpa_s->drv_priv, phymode,
691 chan, freq);
692 return -1;
693}
694
695static inline int wpa_drv_set_ssid(struct wpa_supplicant *wpa_s,
696 const u8 *ssid, size_t ssid_len)
697{
698 if (wpa_s->driver->set_ssid) {
699 return wpa_s->driver->set_ssid(wpa_s->drv_priv, ssid,
700 ssid_len);
701 }
702 return -1;
703}
704
705static inline int wpa_drv_set_bssid(struct wpa_supplicant *wpa_s,
706 const u8 *bssid)
707{
708 if (wpa_s->driver->set_bssid) {
709 return wpa_s->driver->set_bssid(wpa_s->drv_priv, bssid);
710 }
711 return -1;
712}
713
714static inline int wpa_drv_set_country(struct wpa_supplicant *wpa_s,
715 const char *alpha2)
716{
717 if (wpa_s->driver->set_country)
718 return wpa_s->driver->set_country(wpa_s->drv_priv, alpha2);
719 return 0;
720}
721
722static inline int wpa_drv_send_mlme(struct wpa_supplicant *wpa_s,
723 const u8 *data, size_t data_len)
724{
725 if (wpa_s->driver->send_mlme)
726 return wpa_s->driver->send_mlme(wpa_s->drv_priv,
727 data, data_len);
728 return -1;
729}
730
731static inline int wpa_drv_mlme_add_sta(struct wpa_supplicant *wpa_s,
732 const u8 *addr, const u8 *supp_rates,
733 size_t supp_rates_len)
734{
735 if (wpa_s->driver->mlme_add_sta)
736 return wpa_s->driver->mlme_add_sta(wpa_s->drv_priv, addr,
737 supp_rates, supp_rates_len);
738 return -1;
739}
740
741static inline int wpa_drv_mlme_remove_sta(struct wpa_supplicant *wpa_s,
742 const u8 *addr)
743{
744 if (wpa_s->driver->mlme_remove_sta)
745 return wpa_s->driver->mlme_remove_sta(wpa_s->drv_priv, addr);
746 return -1;
747}
748
749static inline int wpa_drv_update_ft_ies(struct wpa_supplicant *wpa_s,
750 const u8 *md,
751 const u8 *ies, size_t ies_len)
752{
753 if (wpa_s->driver->update_ft_ies)
754 return wpa_s->driver->update_ft_ies(wpa_s->drv_priv, md,
755 ies, ies_len);
756 return -1;
757}
758
759static inline int wpa_drv_send_ft_action(struct wpa_supplicant *wpa_s,
760 u8 action, const u8 *target_ap,
761 const u8 *ies, size_t ies_len)
762{
763 if (wpa_s->driver->send_ft_action)
764 return wpa_s->driver->send_ft_action(wpa_s->drv_priv, action,
765 target_ap, ies, ies_len);
766 return -1;
767}
768
769static inline int wpa_drv_set_probe_req_ie(struct wpa_supplicant *wpa_s,
770 const u8 *ies, size_t ies_len)
771{
772 if (wpa_s->driver->set_probe_req_ie)
773 return wpa_s->driver->set_probe_req_ie(wpa_s->drv_priv, ies,
774 ies_len);
775 return -1;
776}
777
778#endif /* WPA_SUPPLICANT_I_H */
512#endif /* WPA_SUPPLICANT_I_H */