]> git.ipfire.org Git - thirdparty/hostap.git/blame - wpa_supplicant/wpa_supplicant_i.h
New driver capability info: max number of scan SSIDs
[thirdparty/hostap.git] / wpa_supplicant / wpa_supplicant_i.h
CommitLineData
6fc6879b
JM
1/*
2 * wpa_supplicant - Internal definitions
3 * Copyright (c) 2003-2007, 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
18#include "drivers/driver.h"
19
7e5ba1b9
JM
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
30extern struct wpa_driver_ops *wpa_supplicant_drivers[];
31
32
6fc6879b
JM
33struct wpa_scan_result;
34struct wpa_sm;
35struct wpa_supplicant;
11ef8d35 36struct ibss_rsn;
6fc6879b
JM
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;
45struct ctrl_iface_dbus_priv;
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 *
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
56 * configured.
57 */
58 const char *confname;
59
60 /**
61 * ctrl_interface - Control interface parameter
62 *
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
67 * file.
68 */
69 const char *ctrl_interface;
70
71 /**
72 * driver - Driver interface name, or %NULL to use the default driver
73 */
74 const char *driver;
75
76 /**
77 * driver_param - Driver interface parameters
78 *
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
83 * file.
84 */
85 const char *driver_param;
86
87 /**
88 * ifname - Interface name
89 */
90 const char *ifname;
91
92 /**
93 * bridge_ifname - Optional bridge interface name
94 *
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.
99 */
100 const char *bridge_ifname;
101};
102
103/**
104 * struct wpa_params - Parameters for wpa_supplicant_init()
105 */
106struct wpa_params {
107 /**
108 * daemonize - Run %wpa_supplicant in the background
109 */
110 int daemonize;
111
112 /**
113 * wait_for_monitor - Wait for a monitor program before starting
114 */
115 int wait_for_monitor;
116
117 /**
118 * pid_file - Path to a PID (process ID) file
119 *
120 * If this and daemonize are set, process ID of the background process
121 * will be written to the specified file.
122 */
123 char *pid_file;
124
125 /**
126 * wpa_debug_level - Debugging verbosity level (e.g., MSG_INFO)
127 */
128 int wpa_debug_level;
129
130 /**
131 * wpa_debug_show_keys - Whether keying material is included in debug
132 *
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.
138 */
139 int wpa_debug_show_keys;
140
141 /**
142 * wpa_debug_timestamp - Whether to include timestamp in debug messages
143 */
144 int wpa_debug_timestamp;
145
146 /**
147 * ctrl_interface - Global ctrl_iface path/parameter
148 */
149 char *ctrl_interface;
150
151 /**
152 * dbus_ctrl_interface - Enable the DBus control interface
153 */
154 int dbus_ctrl_interface;
155
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/**
163 * struct wpa_global - Internal, global data for all %wpa_supplicant interfaces
164 *
165 * This structure is initialized by calling wpa_supplicant_init() when starting
166 * %wpa_supplicant.
167 */
168struct wpa_global {
169 struct wpa_supplicant *ifaces;
170 struct wpa_params params;
171 struct ctrl_iface_global_priv *ctrl_iface;
172 struct ctrl_iface_dbus_priv *dbus_ctrl_iface;
ac305589
JM
173 void **drv_priv;
174 size_t drv_count;
6fc6879b
JM
175};
176
177
178struct wpa_client_mlme {
179#ifdef CONFIG_CLIENT_MLME
180 enum {
181 IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
182 IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
183 IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED
184 } state;
185 u8 prev_bssid[ETH_ALEN];
186 u8 ssid[32];
187 size_t ssid_len;
188 u16 aid;
189 u16 ap_capab, capab;
190 u8 *extra_ie; /* to be added to the end of AssocReq */
191 size_t extra_ie_len;
192 u8 *extra_probe_ie; /* to be added to the end of ProbeReq */
193 size_t extra_probe_ie_len;
194 wpa_key_mgmt key_mgmt;
195
196 /* The last AssocReq/Resp IEs */
197 u8 *assocreq_ies, *assocresp_ies;
198 size_t assocreq_ies_len, assocresp_ies_len;
199
200 int auth_tries, assoc_tries;
201
202 unsigned int ssid_set:1;
203 unsigned int bssid_set:1;
204 unsigned int prev_bssid_set:1;
205 unsigned int authenticated:1;
206 unsigned int associated:1;
207 unsigned int probereq_poll:1;
208 unsigned int use_protection:1;
209 unsigned int create_ibss:1;
210 unsigned int mixed_cell:1;
211 unsigned int wmm_enabled:1;
212
213 struct os_time last_probe;
214
215#define IEEE80211_AUTH_ALG_OPEN BIT(0)
216#define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1)
217#define IEEE80211_AUTH_ALG_LEAP BIT(2)
218 unsigned int auth_algs; /* bitfield of allowed auth algs */
219 int auth_alg; /* currently used IEEE 802.11 authentication algorithm */
220 int auth_transaction;
221
222 struct os_time ibss_join_req;
223 u8 *probe_resp; /* ProbeResp template for IBSS */
224 size_t probe_resp_len;
225 u32 supp_rates_bits;
226
227 int wmm_last_param_set;
228
229 int sta_scanning;
230 int scan_hw_mode_idx;
231 int scan_channel_idx;
232 enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
233 struct os_time last_scan_completed;
234 int scan_oper_channel;
235 int scan_oper_freq;
236 int scan_oper_phymode;
237 u8 scan_ssid[32];
238 size_t scan_ssid_len;
239 int scan_skip_11b;
240
241 struct ieee80211_sta_bss *sta_bss_list;
242#define STA_HASH_SIZE 256
243#define STA_HASH(sta) (sta[5])
244 struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE];
245
246 int cts_protect_erp_frames;
247
248 int phymode; /* current mode; WPA_MODE_IEEE80211A, .. */
249 struct wpa_hw_modes *modes;
250 size_t num_modes;
251 unsigned int hw_modes; /* bitfield of allowed hardware modes;
252 * (1 << MODE_*) */
253 int num_curr_rates;
254 struct wpa_rate_data *curr_rates;
255 int freq; /* The current frequency in MHz */
256 int channel; /* The current IEEE 802.11 channel number */
257
258#ifdef CONFIG_IEEE80211R
259 u8 current_md[6];
260 u8 *ft_ies;
261 size_t ft_ies_len;
262#endif /* CONFIG_IEEE80211R */
263
264#else /* CONFIG_CLIENT_MLME */
265 int dummy; /* to keep MSVC happy */
266#endif /* CONFIG_CLIENT_MLME */
267};
268
269/**
270 * struct wpa_supplicant - Internal data for wpa_supplicant interface
271 *
272 * This structure contains the internal data for core wpa_supplicant code. This
273 * should be only used directly from the core code. However, a pointer to this
274 * data is used from other files as an arbitrary context pointer in calls to
275 * core functions.
276 */
277struct wpa_supplicant {
278 struct wpa_global *global;
279 struct wpa_supplicant *next;
280 struct l2_packet_data *l2;
281 struct l2_packet_data *l2_br;
282 unsigned char own_addr[ETH_ALEN];
283 char ifname[100];
284#ifdef CONFIG_CTRL_IFACE_DBUS
285 char *dbus_path;
286#endif /* CONFIG_CTRL_IFACE_DBUS */
287 char bridge_ifname[16];
288
289 char *confname;
290 struct wpa_config *conf;
291 int countermeasures;
292 os_time_t last_michael_mic_error;
293 u8 bssid[ETH_ALEN];
294 u8 pending_bssid[ETH_ALEN]; /* If wpa_state == WPA_ASSOCIATING, this
295 * field contains the targer BSSID. */
296 int reassociate; /* reassociation requested */
297 int disconnected; /* all connections disabled; i.e., do no reassociate
298 * before this has been cleared */
299 struct wpa_ssid *current_ssid;
300 int ap_ies_from_associnfo;
301
302 /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
303 int pairwise_cipher;
304 int group_cipher;
305 int key_mgmt;
306 int mgmt_group_cipher;
307
308 void *drv_priv; /* private data used by driver_ops */
309
310 struct wpa_ssid *prev_scan_ssid; /* previously scanned SSID;
311 * NULL = not yet initialized (start
312 * with broadcast SSID)
313 * BROADCAST_SSID_SCAN = broadcast
314 * SSID was used in the previous scan
315 */
316#define BROADCAST_SSID_SCAN ((struct wpa_ssid *) 1)
317
318 struct wpa_scan_results *scan_res;
319
320 struct wpa_driver_ops *driver;
321 int interface_removed; /* whether the network interface has been
322 * removed */
323 struct wpa_sm *wpa;
324 struct eapol_sm *eapol;
325
326 struct ctrl_iface_priv *ctrl_iface;
327
328 wpa_states wpa_state;
329 int new_connection;
330 int reassociated_connection;
331
332 int eapol_received; /* number of EAPOL packets received after the
333 * previous association event */
334
335 struct scard_data *scard;
336
337 unsigned char last_eapol_src[ETH_ALEN];
338
339 int keys_cleared;
340
341 struct wpa_blacklist *blacklist;
342
343 int scan_req; /* manual scan request; this forces a scan even if there
344 * are no enabled networks in the configuration */
345 int scan_res_tried; /* whether ap_scan=1 mode has tried to fetch scan
346 * results without a new scan request; this is used
347 * to speed up the first association if the driver
348 * has already available scan results. */
a6099152 349 int scan_runs; /* number of scan runs since WPS was started */
6fc6879b
JM
350
351 struct wpa_client_mlme mlme;
352 int use_client_mlme;
353 int driver_4way_handshake;
80bc75f1 354 int max_scan_ssids;
46690a3b
JM
355
356 int pending_mic_error_report;
357 int pending_mic_error_pairwise;
358 int mic_errors_seen; /* Michael MIC errors with the current PTK */
116654ce
JM
359
360 struct wps_context *wps;
a6099152
JM
361 int wps_success; /* WPS success event received */
362 int blacklist_cleared;
11ef8d35
JM
363
364 struct ibss_rsn *ibss_rsn;
6fc6879b
JM
365};
366
367
368/* wpa_supplicant.c */
369int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);
370
371const char * wpa_supplicant_state_txt(int state);
372int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s);
373int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
374 struct wpa_scan_res *bss,
375 struct wpa_ssid *ssid,
376 u8 *wpa_ie, size_t *wpa_ie_len);
377void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
378 struct wpa_scan_res *bss,
379 struct wpa_ssid *ssid);
380void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant *wpa_s,
381 struct wpa_ssid *ssid);
382void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s);
383int wpa_supplicant_get_scan_results(struct wpa_supplicant *wpa_s);
384void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
385void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
386 int sec, int usec);
387void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s, wpa_states state);
388struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);
389void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s);
390void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
391 int reason_code);
392void wpa_supplicant_disassociate(struct wpa_supplicant *wpa_s,
393 int reason_code);
394
395void wpa_show_license(void);
396
397struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
398 struct wpa_interface *iface);
399int wpa_supplicant_remove_iface(struct wpa_global *global,
400 struct wpa_supplicant *wpa_s);
401struct wpa_supplicant * wpa_supplicant_get_iface(struct wpa_global *global,
402 const char *ifname);
403struct wpa_global * wpa_supplicant_init(struct wpa_params *params);
404int wpa_supplicant_run(struct wpa_global *global);
405void wpa_supplicant_deinit(struct wpa_global *global);
406
407int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
408 struct wpa_ssid *ssid);
409
410/* scan.c */
411void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec);
412void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s);
413
414/* events.c */
415void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
416
417/* driver_ops */
418static inline void * wpa_drv_init(struct wpa_supplicant *wpa_s,
419 const char *ifname)
420{
ac305589
JM
421 if (wpa_s->driver->init2)
422 return wpa_s->driver->init2(wpa_s, ifname, wpa_s->global);
6fc6879b
JM
423 if (wpa_s->driver->init) {
424 return wpa_s->driver->init(wpa_s, ifname);
425 }
426 return NULL;
427}
428
429static inline void wpa_drv_deinit(struct wpa_supplicant *wpa_s)
430{
431 if (wpa_s->driver->deinit)
432 wpa_s->driver->deinit(wpa_s->drv_priv);
433}
434
435static inline int wpa_drv_set_param(struct wpa_supplicant *wpa_s,
436 const char *param)
437{
438 if (wpa_s->driver->set_param)
439 return wpa_s->driver->set_param(wpa_s->drv_priv, param);
440 return 0;
441}
442
443static inline int wpa_drv_set_drop_unencrypted(struct wpa_supplicant *wpa_s,
444 int enabled)
445{
446 if (wpa_s->driver->set_drop_unencrypted) {
447 return wpa_s->driver->set_drop_unencrypted(wpa_s->drv_priv,
448 enabled);
449 }
450 return -1;
451}
452
453static inline int wpa_drv_set_countermeasures(struct wpa_supplicant *wpa_s,
454 int enabled)
455{
456 if (wpa_s->driver->set_countermeasures) {
457 return wpa_s->driver->set_countermeasures(wpa_s->drv_priv,
458 enabled);
459 }
460 return -1;
461}
462
463static inline int wpa_drv_set_auth_alg(struct wpa_supplicant *wpa_s,
464 int auth_alg)
465{
466 if (wpa_s->driver->set_auth_alg) {
467 return wpa_s->driver->set_auth_alg(wpa_s->drv_priv,
468 auth_alg);
469 }
470 return -1;
471}
472
473static inline int wpa_drv_set_wpa(struct wpa_supplicant *wpa_s, int enabled)
474{
475 if (wpa_s->driver->set_wpa) {
476 return wpa_s->driver->set_wpa(wpa_s->drv_priv, enabled);
477 }
478 return 0;
479}
480
ec5f180a
DW
481static inline int wpa_drv_set_mode(struct wpa_supplicant *wpa_s, int mode)
482{
483 if (wpa_s->driver->set_mode) {
484 return wpa_s->driver->set_mode(wpa_s->drv_priv, mode);
485 }
486 return 0;
487}
488
6fc6879b
JM
489static inline int wpa_drv_associate(struct wpa_supplicant *wpa_s,
490 struct wpa_driver_associate_params *params)
491{
492 if (wpa_s->driver->associate) {
493 return wpa_s->driver->associate(wpa_s->drv_priv, params);
494 }
495 return -1;
496}
497
498static inline int wpa_drv_scan(struct wpa_supplicant *wpa_s, const u8 *ssid,
499 size_t ssid_len)
500{
501 if (wpa_s->driver->scan) {
502 return wpa_s->driver->scan(wpa_s->drv_priv, ssid, ssid_len);
503 }
504 return -1;
505}
506
507static inline int wpa_drv_get_scan_results(struct wpa_supplicant *wpa_s,
508 struct wpa_scan_result *results,
509 size_t max_size)
510{
511 if (wpa_s->driver->get_scan_results) {
512 return wpa_s->driver->get_scan_results(wpa_s->drv_priv,
513 results, max_size);
514 }
515 return -1;
516}
517
518static inline struct wpa_scan_results * wpa_drv_get_scan_results2(
519 struct wpa_supplicant *wpa_s)
520{
521 if (wpa_s->driver->get_scan_results2)
522 return wpa_s->driver->get_scan_results2(wpa_s->drv_priv);
523 return NULL;
524}
525
526static inline int wpa_drv_get_bssid(struct wpa_supplicant *wpa_s, u8 *bssid)
527{
528 if (wpa_s->driver->get_bssid) {
529 return wpa_s->driver->get_bssid(wpa_s->drv_priv, bssid);
530 }
531 return -1;
532}
533
534static inline int wpa_drv_get_ssid(struct wpa_supplicant *wpa_s, u8 *ssid)
535{
536 if (wpa_s->driver->get_ssid) {
537 return wpa_s->driver->get_ssid(wpa_s->drv_priv, ssid);
538 }
539 return -1;
540}
541
542static inline int wpa_drv_set_key(struct wpa_supplicant *wpa_s, wpa_alg alg,
543 const u8 *addr, int key_idx, int set_tx,
544 const u8 *seq, size_t seq_len,
545 const u8 *key, size_t key_len)
546{
547 if (wpa_s->driver->set_key) {
548 wpa_s->keys_cleared = 0;
549 return wpa_s->driver->set_key(wpa_s->drv_priv, alg, addr,
550 key_idx, set_tx, seq, seq_len,
551 key, key_len);
552 }
553 return -1;
554}
555
556static inline int wpa_drv_deauthenticate(struct wpa_supplicant *wpa_s,
557 const u8 *addr, int reason_code)
558{
559 if (wpa_s->driver->deauthenticate) {
560 return wpa_s->driver->deauthenticate(wpa_s->drv_priv, addr,
561 reason_code);
562 }
563 return -1;
564}
565
566static inline int wpa_drv_disassociate(struct wpa_supplicant *wpa_s,
567 const u8 *addr, int reason_code)
568{
569 if (wpa_s->driver->disassociate) {
570 return wpa_s->driver->disassociate(wpa_s->drv_priv, addr,
571 reason_code);
572 }
573 return -1;
574}
575
576static inline int wpa_drv_add_pmkid(struct wpa_supplicant *wpa_s,
577 const u8 *bssid, const u8 *pmkid)
578{
579 if (wpa_s->driver->add_pmkid) {
580 return wpa_s->driver->add_pmkid(wpa_s->drv_priv, bssid, pmkid);
581 }
582 return -1;
583}
584
585static inline int wpa_drv_remove_pmkid(struct wpa_supplicant *wpa_s,
586 const u8 *bssid, const u8 *pmkid)
587{
588 if (wpa_s->driver->remove_pmkid) {
589 return wpa_s->driver->remove_pmkid(wpa_s->drv_priv, bssid,
590 pmkid);
591 }
592 return -1;
593}
594
595static inline int wpa_drv_flush_pmkid(struct wpa_supplicant *wpa_s)
596{
597 if (wpa_s->driver->flush_pmkid) {
598 return wpa_s->driver->flush_pmkid(wpa_s->drv_priv);
599 }
600 return -1;
601}
602
603static inline int wpa_drv_get_capa(struct wpa_supplicant *wpa_s,
604 struct wpa_driver_capa *capa)
605{
606 if (wpa_s->driver->get_capa) {
607 return wpa_s->driver->get_capa(wpa_s->drv_priv, capa);
608 }
609 return -1;
610}
611
612static inline void wpa_drv_poll(struct wpa_supplicant *wpa_s)
613{
614 if (wpa_s->driver->poll) {
615 wpa_s->driver->poll(wpa_s->drv_priv);
616 }
617}
618
619static inline const char * wpa_drv_get_ifname(struct wpa_supplicant *wpa_s)
620{
621 if (wpa_s->driver->get_ifname) {
622 return wpa_s->driver->get_ifname(wpa_s->drv_priv);
623 }
624 return NULL;
625}
626
627static inline const u8 * wpa_drv_get_mac_addr(struct wpa_supplicant *wpa_s)
628{
629 if (wpa_s->driver->get_mac_addr) {
630 return wpa_s->driver->get_mac_addr(wpa_s->drv_priv);
631 }
632 return NULL;
633}
634
635static inline int wpa_drv_send_eapol(struct wpa_supplicant *wpa_s,
636 const u8 *dst, u16 proto,
637 const u8 *data, size_t data_len)
638{
639 if (wpa_s->driver->send_eapol)
640 return wpa_s->driver->send_eapol(wpa_s->drv_priv, dst, proto,
641 data, data_len);
642 return -1;
643}
644
645static inline int wpa_drv_set_operstate(struct wpa_supplicant *wpa_s,
646 int state)
647{
648 if (wpa_s->driver->set_operstate)
649 return wpa_s->driver->set_operstate(wpa_s->drv_priv, state);
650 return 0;
651}
652
653static inline int wpa_drv_mlme_setprotection(struct wpa_supplicant *wpa_s,
654 const u8 *addr, int protect_type,
655 int key_type)
656{
657 if (wpa_s->driver->mlme_setprotection)
658 return wpa_s->driver->mlme_setprotection(wpa_s->drv_priv, addr,
659 protect_type,
660 key_type);
661 return 0;
662}
663
664static inline struct wpa_hw_modes *
665wpa_drv_get_hw_feature_data(struct wpa_supplicant *wpa_s, u16 *num_modes,
666 u16 *flags)
667{
668 if (wpa_s->driver->get_hw_feature_data)
669 return wpa_s->driver->get_hw_feature_data(wpa_s->drv_priv,
670 num_modes, flags);
671 return NULL;
672}
673
674static inline int wpa_drv_set_channel(struct wpa_supplicant *wpa_s,
675 wpa_hw_mode phymode, int chan,
676 int freq)
677{
678 if (wpa_s->driver->set_channel)
679 return wpa_s->driver->set_channel(wpa_s->drv_priv, phymode,
680 chan, freq);
681 return -1;
682}
683
684static inline int wpa_drv_set_ssid(struct wpa_supplicant *wpa_s,
685 const u8 *ssid, size_t ssid_len)
686{
687 if (wpa_s->driver->set_ssid) {
688 return wpa_s->driver->set_ssid(wpa_s->drv_priv, ssid,
689 ssid_len);
690 }
691 return -1;
692}
693
694static inline int wpa_drv_set_bssid(struct wpa_supplicant *wpa_s,
695 const u8 *bssid)
696{
697 if (wpa_s->driver->set_bssid) {
698 return wpa_s->driver->set_bssid(wpa_s->drv_priv, bssid);
699 }
700 return -1;
701}
702
6d158490
LR
703static inline int wpa_drv_set_country(struct wpa_supplicant *wpa_s,
704 const char *alpha2)
705{
706 if (wpa_s->driver->set_country)
707 return wpa_s->driver->set_country(wpa_s->drv_priv, alpha2);
708 return 0;
709}
710
6fc6879b
JM
711static inline int wpa_drv_send_mlme(struct wpa_supplicant *wpa_s,
712 const u8 *data, size_t data_len)
713{
714 if (wpa_s->driver->send_mlme)
715 return wpa_s->driver->send_mlme(wpa_s->drv_priv,
716 data, data_len);
717 return -1;
718}
719
720static inline int wpa_drv_mlme_add_sta(struct wpa_supplicant *wpa_s,
721 const u8 *addr, const u8 *supp_rates,
722 size_t supp_rates_len)
723{
724 if (wpa_s->driver->mlme_add_sta)
725 return wpa_s->driver->mlme_add_sta(wpa_s->drv_priv, addr,
726 supp_rates, supp_rates_len);
727 return -1;
728}
729
730static inline int wpa_drv_mlme_remove_sta(struct wpa_supplicant *wpa_s,
731 const u8 *addr)
732{
733 if (wpa_s->driver->mlme_remove_sta)
734 return wpa_s->driver->mlme_remove_sta(wpa_s->drv_priv, addr);
735 return -1;
736}
737
738static inline int wpa_drv_update_ft_ies(struct wpa_supplicant *wpa_s,
739 const u8 *md,
740 const u8 *ies, size_t ies_len)
741{
742 if (wpa_s->driver->update_ft_ies)
743 return wpa_s->driver->update_ft_ies(wpa_s->drv_priv, md,
744 ies, ies_len);
745 return -1;
746}
747
748static inline int wpa_drv_send_ft_action(struct wpa_supplicant *wpa_s,
749 u8 action, const u8 *target_ap,
750 const u8 *ies, size_t ies_len)
751{
752 if (wpa_s->driver->send_ft_action)
753 return wpa_s->driver->send_ft_action(wpa_s->drv_priv, action,
754 target_ap, ies, ies_len);
755 return -1;
756}
757
758static inline int wpa_drv_set_probe_req_ie(struct wpa_supplicant *wpa_s,
759 const u8 *ies, size_t ies_len)
760{
761 if (wpa_s->driver->set_probe_req_ie)
762 return wpa_s->driver->set_probe_req_ie(wpa_s->drv_priv, ies,
763 ies_len);
764 return -1;
765}
766
767#endif /* WPA_SUPPLICANT_I_H */