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