Line data Source code
1 : /*
2 : * wpa_supplicant - Internal driver interface wrappers
3 : * Copyright (c) 2003-2009, Jouni Malinen <j@w1.fi>
4 : *
5 : * This software may be distributed under the terms of the BSD license.
6 : * See README for more details.
7 : */
8 :
9 : #ifndef DRIVER_I_H
10 : #define DRIVER_I_H
11 :
12 : #include "drivers/driver.h"
13 :
14 : /* driver_ops */
15 71 : static inline void * wpa_drv_init(struct wpa_supplicant *wpa_s,
16 : const char *ifname)
17 : {
18 71 : if (wpa_s->driver->init2)
19 71 : return wpa_s->driver->init2(wpa_s, ifname,
20 : wpa_s->global_drv_priv);
21 0 : if (wpa_s->driver->init) {
22 0 : return wpa_s->driver->init(wpa_s, ifname);
23 : }
24 0 : return NULL;
25 : }
26 :
27 69 : static inline void wpa_drv_deinit(struct wpa_supplicant *wpa_s)
28 : {
29 69 : if (wpa_s->driver->deinit)
30 69 : wpa_s->driver->deinit(wpa_s->drv_priv);
31 69 : }
32 :
33 69 : static inline int wpa_drv_set_param(struct wpa_supplicant *wpa_s,
34 : const char *param)
35 : {
36 69 : if (wpa_s->driver->set_param)
37 69 : return wpa_s->driver->set_param(wpa_s->drv_priv, param);
38 0 : return 0;
39 : }
40 :
41 140 : static inline int wpa_drv_set_countermeasures(struct wpa_supplicant *wpa_s,
42 : int enabled)
43 : {
44 140 : if (wpa_s->driver->set_countermeasures) {
45 0 : return wpa_s->driver->set_countermeasures(wpa_s->drv_priv,
46 : enabled);
47 : }
48 140 : return -1;
49 : }
50 :
51 1079 : static inline int wpa_drv_authenticate(struct wpa_supplicant *wpa_s,
52 : struct wpa_driver_auth_params *params)
53 : {
54 1079 : if (wpa_s->driver->authenticate)
55 1079 : return wpa_s->driver->authenticate(wpa_s->drv_priv, params);
56 0 : return -1;
57 : }
58 :
59 1170 : static inline int wpa_drv_associate(struct wpa_supplicant *wpa_s,
60 : struct wpa_driver_associate_params *params)
61 : {
62 1170 : if (wpa_s->driver->associate) {
63 1170 : return wpa_s->driver->associate(wpa_s->drv_priv, params);
64 : }
65 0 : return -1;
66 : }
67 :
68 1849 : static inline int wpa_drv_scan(struct wpa_supplicant *wpa_s,
69 : struct wpa_driver_scan_params *params)
70 : {
71 1849 : if (wpa_s->driver->scan2)
72 1849 : return wpa_s->driver->scan2(wpa_s->drv_priv, params);
73 0 : return -1;
74 : }
75 :
76 0 : static inline int wpa_drv_sched_scan(struct wpa_supplicant *wpa_s,
77 : struct wpa_driver_scan_params *params,
78 : u32 interval)
79 : {
80 0 : if (wpa_s->driver->sched_scan)
81 0 : return wpa_s->driver->sched_scan(wpa_s->drv_priv,
82 : params, interval);
83 0 : return -1;
84 : }
85 :
86 0 : static inline int wpa_drv_stop_sched_scan(struct wpa_supplicant *wpa_s)
87 : {
88 0 : if (wpa_s->driver->stop_sched_scan)
89 0 : return wpa_s->driver->stop_sched_scan(wpa_s->drv_priv);
90 0 : return -1;
91 : }
92 :
93 1855 : static inline struct wpa_scan_results * wpa_drv_get_scan_results2(
94 : struct wpa_supplicant *wpa_s)
95 : {
96 1855 : if (wpa_s->driver->get_scan_results2)
97 1855 : return wpa_s->driver->get_scan_results2(wpa_s->drv_priv);
98 0 : return NULL;
99 : }
100 :
101 1793 : static inline int wpa_drv_get_bssid(struct wpa_supplicant *wpa_s, u8 *bssid)
102 : {
103 1793 : if (wpa_s->driver->get_bssid) {
104 1793 : return wpa_s->driver->get_bssid(wpa_s->drv_priv, bssid);
105 : }
106 0 : return -1;
107 : }
108 :
109 664 : static inline int wpa_drv_get_ssid(struct wpa_supplicant *wpa_s, u8 *ssid)
110 : {
111 664 : if (wpa_s->driver->get_ssid) {
112 664 : return wpa_s->driver->get_ssid(wpa_s->drv_priv, ssid);
113 : }
114 0 : return -1;
115 : }
116 :
117 3766 : static inline int wpa_drv_set_key(struct wpa_supplicant *wpa_s,
118 : enum wpa_alg alg, const u8 *addr,
119 : int key_idx, int set_tx,
120 : const u8 *seq, size_t seq_len,
121 : const u8 *key, size_t key_len)
122 : {
123 3766 : if (alg != WPA_ALG_NONE) {
124 1454 : if (key_idx >= 0 && key_idx <= 6)
125 1384 : wpa_s->keys_cleared &= ~BIT(key_idx);
126 : else
127 70 : wpa_s->keys_cleared = 0;
128 : }
129 3766 : if (wpa_s->driver->set_key) {
130 3766 : return wpa_s->driver->set_key(wpa_s->ifname, wpa_s->drv_priv,
131 : alg, addr, key_idx, set_tx,
132 : seq, seq_len, key, key_len);
133 : }
134 0 : return -1;
135 : }
136 :
137 2 : static inline int wpa_drv_sta_deauth(struct wpa_supplicant *wpa_s,
138 : const u8 *addr, int reason_code)
139 : {
140 2 : if (wpa_s->driver->sta_deauth) {
141 4 : return wpa_s->driver->sta_deauth(wpa_s->drv_priv,
142 2 : wpa_s->own_addr, addr,
143 : reason_code);
144 : }
145 0 : return -1;
146 : }
147 :
148 963 : static inline int wpa_drv_deauthenticate(struct wpa_supplicant *wpa_s,
149 : const u8 *addr, int reason_code)
150 : {
151 963 : if (wpa_s->driver->deauthenticate) {
152 963 : return wpa_s->driver->deauthenticate(wpa_s->drv_priv, addr,
153 : reason_code);
154 : }
155 0 : return -1;
156 : }
157 :
158 274 : static inline int wpa_drv_add_pmkid(struct wpa_supplicant *wpa_s,
159 : const u8 *bssid, const u8 *pmkid)
160 : {
161 274 : if (wpa_s->driver->add_pmkid) {
162 274 : return wpa_s->driver->add_pmkid(wpa_s->drv_priv, bssid, pmkid);
163 : }
164 0 : return -1;
165 : }
166 :
167 274 : static inline int wpa_drv_remove_pmkid(struct wpa_supplicant *wpa_s,
168 : const u8 *bssid, const u8 *pmkid)
169 : {
170 274 : if (wpa_s->driver->remove_pmkid) {
171 274 : return wpa_s->driver->remove_pmkid(wpa_s->drv_priv, bssid,
172 : pmkid);
173 : }
174 0 : return -1;
175 : }
176 :
177 69 : static inline int wpa_drv_flush_pmkid(struct wpa_supplicant *wpa_s)
178 : {
179 69 : if (wpa_s->driver->flush_pmkid) {
180 69 : return wpa_s->driver->flush_pmkid(wpa_s->drv_priv);
181 : }
182 0 : return -1;
183 : }
184 :
185 334 : static inline int wpa_drv_get_capa(struct wpa_supplicant *wpa_s,
186 : struct wpa_driver_capa *capa)
187 : {
188 334 : if (wpa_s->driver->get_capa) {
189 334 : return wpa_s->driver->get_capa(wpa_s->drv_priv, capa);
190 : }
191 0 : return -1;
192 : }
193 :
194 1280 : static inline void wpa_drv_poll(struct wpa_supplicant *wpa_s)
195 : {
196 1280 : if (wpa_s->driver->poll) {
197 0 : wpa_s->driver->poll(wpa_s->drv_priv);
198 : }
199 1280 : }
200 :
201 69 : static inline const char * wpa_drv_get_ifname(struct wpa_supplicant *wpa_s)
202 : {
203 69 : if (wpa_s->driver->get_ifname) {
204 0 : return wpa_s->driver->get_ifname(wpa_s->drv_priv);
205 : }
206 69 : return NULL;
207 : }
208 :
209 : static inline const char *
210 1557 : wpa_driver_get_radio_name(struct wpa_supplicant *wpa_s)
211 : {
212 1557 : if (wpa_s->driver->get_radio_name)
213 1557 : return wpa_s->driver->get_radio_name(wpa_s->drv_priv);
214 0 : return NULL;
215 : }
216 :
217 72 : static inline const u8 * wpa_drv_get_mac_addr(struct wpa_supplicant *wpa_s)
218 : {
219 72 : if (wpa_s->driver->get_mac_addr) {
220 72 : return wpa_s->driver->get_mac_addr(wpa_s->drv_priv);
221 : }
222 0 : return NULL;
223 : }
224 :
225 0 : static inline int wpa_drv_send_eapol(struct wpa_supplicant *wpa_s,
226 : const u8 *dst, u16 proto,
227 : const u8 *data, size_t data_len)
228 : {
229 0 : if (wpa_s->driver->send_eapol)
230 0 : return wpa_s->driver->send_eapol(wpa_s->drv_priv, dst, proto,
231 : data, data_len);
232 0 : return -1;
233 : }
234 :
235 5489 : static inline int wpa_drv_set_operstate(struct wpa_supplicant *wpa_s,
236 : int state)
237 : {
238 5489 : if (wpa_s->driver->set_operstate)
239 5489 : return wpa_s->driver->set_operstate(wpa_s->drv_priv, state);
240 0 : return 0;
241 : }
242 :
243 1825 : static inline int wpa_drv_mlme_setprotection(struct wpa_supplicant *wpa_s,
244 : const u8 *addr, int protect_type,
245 : int key_type)
246 : {
247 1825 : if (wpa_s->driver->mlme_setprotection)
248 0 : return wpa_s->driver->mlme_setprotection(wpa_s->drv_priv, addr,
249 : protect_type,
250 : key_type);
251 1825 : return 0;
252 : }
253 :
254 : static inline struct hostapd_hw_modes *
255 2763 : wpa_drv_get_hw_feature_data(struct wpa_supplicant *wpa_s, u16 *num_modes,
256 : u16 *flags)
257 : {
258 2763 : if (wpa_s->driver->get_hw_feature_data)
259 2763 : return wpa_s->driver->get_hw_feature_data(wpa_s->drv_priv,
260 : num_modes, flags);
261 0 : return NULL;
262 : }
263 :
264 2 : static inline int wpa_drv_set_country(struct wpa_supplicant *wpa_s,
265 : const char *alpha2)
266 : {
267 2 : if (wpa_s->driver->set_country)
268 2 : return wpa_s->driver->set_country(wpa_s->drv_priv, alpha2);
269 0 : return 0;
270 : }
271 :
272 445 : static inline int wpa_drv_send_mlme(struct wpa_supplicant *wpa_s,
273 : const u8 *data, size_t data_len, int noack)
274 : {
275 445 : if (wpa_s->driver->send_mlme)
276 445 : return wpa_s->driver->send_mlme(wpa_s->drv_priv,
277 : data, data_len, noack);
278 0 : return -1;
279 : }
280 :
281 0 : static inline int wpa_drv_update_ft_ies(struct wpa_supplicant *wpa_s,
282 : const u8 *md,
283 : const u8 *ies, size_t ies_len)
284 : {
285 0 : if (wpa_s->driver->update_ft_ies)
286 0 : return wpa_s->driver->update_ft_ies(wpa_s->drv_priv, md,
287 : ies, ies_len);
288 0 : return -1;
289 : }
290 :
291 13 : static inline int wpa_drv_send_ft_action(struct wpa_supplicant *wpa_s,
292 : u8 action, const u8 *target_ap,
293 : const u8 *ies, size_t ies_len)
294 : {
295 13 : if (wpa_s->driver->send_ft_action)
296 13 : return wpa_s->driver->send_ft_action(wpa_s->drv_priv, action,
297 : target_ap, ies, ies_len);
298 0 : return -1;
299 : }
300 :
301 : static inline int wpa_drv_set_ap(struct wpa_supplicant *wpa_s,
302 : struct wpa_driver_ap_params *params)
303 : {
304 : if (wpa_s->driver->set_ap)
305 : return wpa_s->driver->set_ap(wpa_s->drv_priv, params);
306 : return -1;
307 : }
308 :
309 87 : static inline int wpa_drv_sta_add(struct wpa_supplicant *wpa_s,
310 : struct hostapd_sta_add_params *params)
311 : {
312 87 : if (wpa_s->driver->sta_add)
313 87 : return wpa_s->driver->sta_add(wpa_s->drv_priv, params);
314 0 : return -1;
315 : }
316 :
317 : static inline int wpa_drv_sta_remove(struct wpa_supplicant *wpa_s,
318 : const u8 *addr)
319 : {
320 : if (wpa_s->driver->sta_remove)
321 : return wpa_s->driver->sta_remove(wpa_s->drv_priv, addr);
322 : return -1;
323 : }
324 :
325 : static inline int wpa_drv_hapd_send_eapol(struct wpa_supplicant *wpa_s,
326 : const u8 *addr, const u8 *data,
327 : size_t data_len, int encrypt,
328 : const u8 *own_addr, u32 flags)
329 : {
330 : if (wpa_s->driver->hapd_send_eapol)
331 : return wpa_s->driver->hapd_send_eapol(wpa_s->drv_priv, addr,
332 : data, data_len, encrypt,
333 : own_addr, flags);
334 : return -1;
335 : }
336 :
337 24 : static inline int wpa_drv_sta_set_flags(struct wpa_supplicant *wpa_s,
338 : const u8 *addr, int total_flags,
339 : int flags_or, int flags_and)
340 : {
341 24 : if (wpa_s->driver->sta_set_flags)
342 24 : return wpa_s->driver->sta_set_flags(wpa_s->drv_priv, addr,
343 : total_flags, flags_or,
344 : flags_and);
345 0 : return -1;
346 : }
347 :
348 2151 : static inline int wpa_drv_set_supp_port(struct wpa_supplicant *wpa_s,
349 : int authorized)
350 : {
351 2151 : if (wpa_s->driver->set_supp_port) {
352 2151 : return wpa_s->driver->set_supp_port(wpa_s->drv_priv,
353 : authorized);
354 : }
355 0 : return 0;
356 : }
357 :
358 1077 : static inline int wpa_drv_send_action(struct wpa_supplicant *wpa_s,
359 : unsigned int freq,
360 : unsigned int wait,
361 : const u8 *dst, const u8 *src,
362 : const u8 *bssid,
363 : const u8 *data, size_t data_len,
364 : int no_cck)
365 : {
366 1077 : if (wpa_s->driver->send_action)
367 1077 : return wpa_s->driver->send_action(wpa_s->drv_priv, freq,
368 : wait, dst, src, bssid,
369 : data, data_len, no_cck);
370 0 : return -1;
371 : }
372 :
373 553 : static inline void wpa_drv_send_action_cancel_wait(struct wpa_supplicant *wpa_s)
374 : {
375 553 : if (wpa_s->driver->send_action_cancel_wait)
376 553 : wpa_s->driver->send_action_cancel_wait(wpa_s->drv_priv);
377 553 : }
378 :
379 : static inline int wpa_drv_set_freq(struct wpa_supplicant *wpa_s,
380 : struct hostapd_freq_params *freq)
381 : {
382 : if (wpa_s->driver->set_freq)
383 : return wpa_s->driver->set_freq(wpa_s->drv_priv, freq);
384 : return -1;
385 : }
386 :
387 38 : static inline int wpa_drv_if_add(struct wpa_supplicant *wpa_s,
388 : enum wpa_driver_if_type type,
389 : const char *ifname, const u8 *addr,
390 : void *bss_ctx, char *force_ifname,
391 : u8 *if_addr, const char *bridge)
392 : {
393 38 : if (wpa_s->driver->if_add)
394 38 : return wpa_s->driver->if_add(wpa_s->drv_priv, type, ifname,
395 : addr, bss_ctx, NULL, force_ifname,
396 : if_addr, bridge, 0);
397 0 : return -1;
398 : }
399 :
400 37 : static inline int wpa_drv_if_remove(struct wpa_supplicant *wpa_s,
401 : enum wpa_driver_if_type type,
402 : const char *ifname)
403 : {
404 37 : if (wpa_s->driver->if_remove)
405 37 : return wpa_s->driver->if_remove(wpa_s->drv_priv, type, ifname);
406 0 : return -1;
407 : }
408 :
409 1095 : static inline int wpa_drv_remain_on_channel(struct wpa_supplicant *wpa_s,
410 : unsigned int freq,
411 : unsigned int duration)
412 : {
413 1095 : if (wpa_s->driver->remain_on_channel)
414 1095 : return wpa_s->driver->remain_on_channel(wpa_s->drv_priv, freq,
415 : duration);
416 0 : return -1;
417 : }
418 :
419 363 : static inline int wpa_drv_cancel_remain_on_channel(
420 : struct wpa_supplicant *wpa_s)
421 : {
422 363 : if (wpa_s->driver->cancel_remain_on_channel)
423 363 : return wpa_s->driver->cancel_remain_on_channel(
424 : wpa_s->drv_priv);
425 0 : return -1;
426 : }
427 :
428 8033 : static inline int wpa_drv_probe_req_report(struct wpa_supplicant *wpa_s,
429 : int report)
430 : {
431 8033 : if (wpa_s->driver->probe_req_report)
432 8033 : return wpa_s->driver->probe_req_report(wpa_s->drv_priv,
433 : report);
434 0 : return -1;
435 : }
436 :
437 126 : static inline int wpa_drv_deinit_ap(struct wpa_supplicant *wpa_s)
438 : {
439 126 : if (wpa_s->driver->deinit_ap)
440 126 : return wpa_s->driver->deinit_ap(wpa_s->drv_priv);
441 0 : return 0;
442 : }
443 :
444 106 : static inline int wpa_drv_deinit_p2p_cli(struct wpa_supplicant *wpa_s)
445 : {
446 106 : if (wpa_s->driver->deinit_p2p_cli)
447 106 : return wpa_s->driver->deinit_p2p_cli(wpa_s->drv_priv);
448 0 : return 0;
449 : }
450 :
451 2 : static inline void wpa_drv_suspend(struct wpa_supplicant *wpa_s)
452 : {
453 2 : if (wpa_s->driver->suspend)
454 0 : wpa_s->driver->suspend(wpa_s->drv_priv);
455 2 : }
456 :
457 2 : static inline void wpa_drv_resume(struct wpa_supplicant *wpa_s)
458 : {
459 2 : if (wpa_s->driver->resume)
460 2 : wpa_s->driver->resume(wpa_s->drv_priv);
461 2 : }
462 :
463 8 : static inline int wpa_drv_signal_monitor(struct wpa_supplicant *wpa_s,
464 : int threshold, int hysteresis)
465 : {
466 8 : if (wpa_s->driver->signal_monitor)
467 8 : return wpa_s->driver->signal_monitor(wpa_s->drv_priv,
468 : threshold, hysteresis);
469 0 : return -1;
470 : }
471 :
472 5 : static inline int wpa_drv_signal_poll(struct wpa_supplicant *wpa_s,
473 : struct wpa_signal_info *si)
474 : {
475 5 : if (wpa_s->driver->signal_poll)
476 5 : return wpa_s->driver->signal_poll(wpa_s->drv_priv, si);
477 0 : return -1;
478 : }
479 :
480 1 : static inline int wpa_drv_pktcnt_poll(struct wpa_supplicant *wpa_s,
481 : struct hostap_sta_driver_data *sta)
482 : {
483 1 : if (wpa_s->driver->read_sta_data)
484 2 : return wpa_s->driver->read_sta_data(wpa_s->drv_priv, sta,
485 1 : wpa_s->bssid);
486 0 : return -1;
487 : }
488 :
489 7964 : static inline int wpa_drv_set_ap_wps_ie(struct wpa_supplicant *wpa_s,
490 : const struct wpabuf *beacon,
491 : const struct wpabuf *proberesp,
492 : const struct wpabuf *assocresp)
493 : {
494 7964 : if (!wpa_s->driver->set_ap_wps_ie)
495 7964 : return -1;
496 0 : return wpa_s->driver->set_ap_wps_ie(wpa_s->drv_priv, beacon,
497 : proberesp, assocresp);
498 : }
499 :
500 0 : static inline int wpa_drv_shared_freq(struct wpa_supplicant *wpa_s)
501 : {
502 0 : if (!wpa_s->driver->shared_freq)
503 0 : return -1;
504 0 : return wpa_s->driver->shared_freq(wpa_s->drv_priv);
505 : }
506 :
507 2 : static inline int wpa_drv_get_noa(struct wpa_supplicant *wpa_s,
508 : u8 *buf, size_t buf_len)
509 : {
510 2 : if (!wpa_s->driver->get_noa)
511 2 : return -1;
512 0 : return wpa_s->driver->get_noa(wpa_s->drv_priv, buf, buf_len);
513 : }
514 :
515 0 : static inline int wpa_drv_set_p2p_powersave(struct wpa_supplicant *wpa_s,
516 : int legacy_ps, int opp_ps,
517 : int ctwindow)
518 : {
519 0 : if (!wpa_s->driver->set_p2p_powersave)
520 0 : return -1;
521 0 : return wpa_s->driver->set_p2p_powersave(wpa_s->drv_priv, legacy_ps,
522 : opp_ps, ctwindow);
523 : }
524 :
525 0 : static inline int wpa_drv_ampdu(struct wpa_supplicant *wpa_s, int ampdu)
526 : {
527 0 : if (!wpa_s->driver->ampdu)
528 0 : return -1;
529 0 : return wpa_s->driver->ampdu(wpa_s->drv_priv, ampdu);
530 : }
531 :
532 127 : static inline int wpa_drv_send_tdls_mgmt(struct wpa_supplicant *wpa_s,
533 : const u8 *dst, u8 action_code,
534 : u8 dialog_token, u16 status_code,
535 : u32 peer_capab, const u8 *buf,
536 : size_t len)
537 : {
538 127 : if (wpa_s->driver->send_tdls_mgmt) {
539 127 : return wpa_s->driver->send_tdls_mgmt(wpa_s->drv_priv, dst,
540 : action_code, dialog_token,
541 : status_code, peer_capab,
542 : buf, len);
543 : }
544 0 : return -1;
545 : }
546 :
547 2050 : static inline int wpa_drv_tdls_oper(struct wpa_supplicant *wpa_s,
548 : enum tdls_oper oper, const u8 *peer)
549 : {
550 2050 : if (!wpa_s->driver->tdls_oper)
551 0 : return -1;
552 2050 : return wpa_s->driver->tdls_oper(wpa_s->drv_priv, oper, peer);
553 : }
554 :
555 : #ifdef ANDROID
556 : static inline int wpa_drv_driver_cmd(struct wpa_supplicant *wpa_s,
557 : char *cmd, char *buf, size_t buf_len)
558 : {
559 : if (!wpa_s->driver->driver_cmd)
560 : return -1;
561 : return wpa_s->driver->driver_cmd(wpa_s->drv_priv, cmd, buf, buf_len);
562 : }
563 : #endif /* ANDROID */
564 :
565 618 : static inline void wpa_drv_set_rekey_info(struct wpa_supplicant *wpa_s,
566 : const u8 *kek, const u8 *kck,
567 : const u8 *replay_ctr)
568 : {
569 618 : if (!wpa_s->driver->set_rekey_info)
570 618 : return;
571 618 : wpa_s->driver->set_rekey_info(wpa_s->drv_priv, kek, kck, replay_ctr);
572 : }
573 :
574 1903 : static inline int wpa_drv_radio_disable(struct wpa_supplicant *wpa_s,
575 : int disabled)
576 : {
577 1903 : if (!wpa_s->driver->radio_disable)
578 1903 : return -1;
579 0 : return wpa_s->driver->radio_disable(wpa_s->drv_priv, disabled);
580 : }
581 :
582 : static inline int wpa_drv_switch_channel(struct wpa_supplicant *wpa_s,
583 : struct csa_settings *settings)
584 : {
585 : if (!wpa_s->driver->switch_channel)
586 : return -1;
587 : return wpa_s->driver->switch_channel(wpa_s->drv_priv, settings);
588 : }
589 :
590 19 : static inline int wpa_drv_wnm_oper(struct wpa_supplicant *wpa_s,
591 : enum wnm_oper oper, const u8 *peer,
592 : u8 *buf, u16 *buf_len)
593 : {
594 19 : if (!wpa_s->driver->wnm_oper)
595 19 : return -1;
596 0 : return wpa_s->driver->wnm_oper(wpa_s->drv_priv, oper, peer, buf,
597 : buf_len);
598 : }
599 :
600 1906 : static inline int wpa_drv_status(struct wpa_supplicant *wpa_s,
601 : char *buf, size_t buflen)
602 : {
603 1906 : if (!wpa_s->driver->status)
604 0 : return -1;
605 1906 : return wpa_s->driver->status(wpa_s->drv_priv, buf, buflen);
606 : }
607 :
608 2 : static inline int wpa_drv_set_qos_map(struct wpa_supplicant *wpa_s,
609 : const u8 *qos_map_set, u8 qos_map_set_len)
610 : {
611 2 : if (!wpa_s->driver->set_qos_map)
612 0 : return -1;
613 2 : return wpa_s->driver->set_qos_map(wpa_s->drv_priv, qos_map_set,
614 : qos_map_set_len);
615 : }
616 :
617 0 : static inline int wpa_drv_wowlan(struct wpa_supplicant *wpa_s,
618 : const struct wowlan_triggers *triggers)
619 : {
620 0 : if (!wpa_s->driver->set_wowlan)
621 0 : return -1;
622 0 : return wpa_s->driver->set_wowlan(wpa_s->drv_priv, triggers);
623 : }
624 :
625 1 : static inline int wpa_drv_vendor_cmd(struct wpa_supplicant *wpa_s,
626 : int vendor_id, int subcmd, const u8 *data,
627 : size_t data_len, struct wpabuf *buf)
628 : {
629 1 : if (!wpa_s->driver->vendor_cmd)
630 0 : return -1;
631 1 : return wpa_s->driver->vendor_cmd(wpa_s->drv_priv, vendor_id, subcmd,
632 : data, data_len, buf);
633 : }
634 :
635 :
636 : #ifdef CONFIG_MACSEC
637 :
638 : static inline int wpa_drv_macsec_init(struct wpa_supplicant *wpa_s,
639 : struct macsec_init_params *params)
640 : {
641 : if (!wpa_s->driver->macsec_init)
642 : return -1;
643 : return wpa_s->driver->macsec_init(wpa_s->drv_priv, params);
644 : }
645 :
646 : static inline int wpa_drv_macsec_deinit(struct wpa_supplicant *wpa_s)
647 : {
648 : if (!wpa_s->driver->macsec_deinit)
649 : return -1;
650 : return wpa_s->driver->macsec_deinit(wpa_s->drv_priv);
651 : }
652 :
653 : static inline int wpa_drv_enable_protect_frames(struct wpa_supplicant *wpa_s,
654 : Boolean enabled)
655 : {
656 : if (!wpa_s->driver->enable_protect_frames)
657 : return -1;
658 : return wpa_s->driver->enable_protect_frames(wpa_s->drv_priv, enabled);
659 : }
660 :
661 : static inline int wpa_drv_set_replay_protect(struct wpa_supplicant *wpa_s,
662 : Boolean enabled, u32 window)
663 : {
664 : if (!wpa_s->driver->set_replay_protect)
665 : return -1;
666 : return wpa_s->driver->set_replay_protect(wpa_s->drv_priv, enabled,
667 : window);
668 : }
669 :
670 : static inline int wpa_drv_set_current_cipher_suite(struct wpa_supplicant *wpa_s,
671 : const u8 *cs, size_t cs_len)
672 : {
673 : if (!wpa_s->driver->set_current_cipher_suite)
674 : return -1;
675 : return wpa_s->driver->set_current_cipher_suite(wpa_s->drv_priv, cs,
676 : cs_len);
677 : }
678 :
679 : static inline int wpa_drv_enable_controlled_port(struct wpa_supplicant *wpa_s,
680 : Boolean enabled)
681 : {
682 : if (!wpa_s->driver->enable_controlled_port)
683 : return -1;
684 : return wpa_s->driver->enable_controlled_port(wpa_s->drv_priv, enabled);
685 : }
686 :
687 : static inline int wpa_drv_get_receive_lowest_pn(struct wpa_supplicant *wpa_s,
688 : u32 channel, u8 an,
689 : u32 *lowest_pn)
690 : {
691 : if (!wpa_s->driver->get_receive_lowest_pn)
692 : return -1;
693 : return wpa_s->driver->get_receive_lowest_pn(wpa_s->drv_priv, channel,
694 : an, lowest_pn);
695 : }
696 :
697 : static inline int wpa_drv_get_transmit_next_pn(struct wpa_supplicant *wpa_s,
698 : u32 channel, u8 an,
699 : u32 *next_pn)
700 : {
701 : if (!wpa_s->driver->get_transmit_next_pn)
702 : return -1;
703 : return wpa_s->driver->get_transmit_next_pn(wpa_s->drv_priv, channel,
704 : an, next_pn);
705 : }
706 :
707 : static inline int wpa_drv_set_transmit_next_pn(struct wpa_supplicant *wpa_s,
708 : u32 channel, u8 an,
709 : u32 next_pn)
710 : {
711 : if (!wpa_s->driver->set_transmit_next_pn)
712 : return -1;
713 : return wpa_s->driver->set_transmit_next_pn(wpa_s->drv_priv, channel,
714 : an, next_pn);
715 : }
716 :
717 : static inline int wpa_drv_get_available_receive_sc(struct wpa_supplicant *wpa_s,
718 : u32 *channel)
719 : {
720 : if (!wpa_s->driver->get_available_receive_sc)
721 : return -1;
722 : return wpa_s->driver->get_available_receive_sc(wpa_s->drv_priv,
723 : channel);
724 : }
725 :
726 : static inline int
727 : wpa_drv_create_receive_sc(struct wpa_supplicant *wpa_s, u32 channel,
728 : const u8 *sci_addr, u16 sci_port,
729 : unsigned int conf_offset, int validation)
730 : {
731 : if (!wpa_s->driver->create_receive_sc)
732 : return -1;
733 : return wpa_s->driver->create_receive_sc(wpa_s->drv_priv, channel,
734 : sci_addr, sci_port, conf_offset,
735 : validation);
736 : }
737 :
738 : static inline int wpa_drv_delete_receive_sc(struct wpa_supplicant *wpa_s,
739 : u32 channel)
740 : {
741 : if (!wpa_s->driver->delete_receive_sc)
742 : return -1;
743 : return wpa_s->driver->delete_receive_sc(wpa_s->drv_priv, channel);
744 : }
745 :
746 : static inline int wpa_drv_create_receive_sa(struct wpa_supplicant *wpa_s,
747 : u32 channel, u8 an,
748 : u32 lowest_pn, const u8 *sak)
749 : {
750 : if (!wpa_s->driver->create_receive_sa)
751 : return -1;
752 : return wpa_s->driver->create_receive_sa(wpa_s->drv_priv, channel, an,
753 : lowest_pn, sak);
754 : }
755 :
756 : static inline int wpa_drv_enable_receive_sa(struct wpa_supplicant *wpa_s,
757 : u32 channel, u8 an)
758 : {
759 : if (!wpa_s->driver->enable_receive_sa)
760 : return -1;
761 : return wpa_s->driver->enable_receive_sa(wpa_s->drv_priv, channel, an);
762 : }
763 :
764 : static inline int wpa_drv_disable_receive_sa(struct wpa_supplicant *wpa_s,
765 : u32 channel, u8 an)
766 : {
767 : if (!wpa_s->driver->disable_receive_sa)
768 : return -1;
769 : return wpa_s->driver->disable_receive_sa(wpa_s->drv_priv, channel, an);
770 : }
771 :
772 : static inline int
773 : wpa_drv_get_available_transmit_sc(struct wpa_supplicant *wpa_s, u32 *channel)
774 : {
775 : if (!wpa_s->driver->get_available_transmit_sc)
776 : return -1;
777 : return wpa_s->driver->get_available_transmit_sc(wpa_s->drv_priv,
778 : channel);
779 : }
780 :
781 : static inline int
782 : wpa_drv_create_transmit_sc(struct wpa_supplicant *wpa_s, u32 channel,
783 : const u8 *sci_addr, u16 sci_port,
784 : unsigned int conf_offset)
785 : {
786 : if (!wpa_s->driver->create_transmit_sc)
787 : return -1;
788 : return wpa_s->driver->create_transmit_sc(wpa_s->drv_priv, channel,
789 : sci_addr, sci_port,
790 : conf_offset);
791 : }
792 :
793 : static inline int wpa_drv_delete_transmit_sc(struct wpa_supplicant *wpa_s,
794 : u32 channel)
795 : {
796 : if (!wpa_s->driver->delete_transmit_sc)
797 : return -1;
798 : return wpa_s->driver->delete_transmit_sc(wpa_s->drv_priv, channel);
799 : }
800 :
801 : static inline int wpa_drv_create_transmit_sa(struct wpa_supplicant *wpa_s,
802 : u32 channel, u8 an,
803 : u32 next_pn,
804 : Boolean confidentiality,
805 : const u8 *sak)
806 : {
807 : if (!wpa_s->driver->create_transmit_sa)
808 : return -1;
809 : return wpa_s->driver->create_transmit_sa(wpa_s->drv_priv, channel, an,
810 : next_pn, confidentiality, sak);
811 : }
812 :
813 : static inline int wpa_drv_enable_transmit_sa(struct wpa_supplicant *wpa_s,
814 : u32 channel, u8 an)
815 : {
816 : if (!wpa_s->driver->enable_transmit_sa)
817 : return -1;
818 : return wpa_s->driver->enable_transmit_sa(wpa_s->drv_priv, channel, an);
819 : }
820 :
821 : static inline int wpa_drv_disable_transmit_sa(struct wpa_supplicant *wpa_s,
822 : u32 channel, u8 an)
823 : {
824 : if (!wpa_s->driver->disable_transmit_sa)
825 : return -1;
826 : return wpa_s->driver->disable_transmit_sa(wpa_s->drv_priv, channel, an);
827 : }
828 : #endif /* CONFIG_MACSEC */
829 :
830 : #endif /* DRIVER_I_H */
|