wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
driver_i.h
Go to the documentation of this file.
1 
5 #ifndef DRIVER_I_H
6 #define DRIVER_I_H
7 
8 #include "drivers/driver.h"
9 
10 /* driver_ops */
11 static inline void * wpa_drv_init(struct wpa_supplicant *wpa_s,
12  const char *ifname)
13 {
14  if (wpa_s->driver->init2)
15  return wpa_s->driver->init2(wpa_s, ifname,
16  wpa_s->global_drv_priv);
17  if (wpa_s->driver->init) {
18  return wpa_s->driver->init(wpa_s, ifname);
19  }
20  return NULL;
21 }
22 
23 static inline void wpa_drv_deinit(struct wpa_supplicant *wpa_s)
24 {
25  if (wpa_s->driver->deinit)
26  wpa_s->driver->deinit(wpa_s->drv_priv);
27 }
28 
29 static inline int wpa_drv_set_param(struct wpa_supplicant *wpa_s,
30  const char *param)
31 {
32  if (wpa_s->driver->set_param)
33  return wpa_s->driver->set_param(wpa_s->drv_priv, param);
34  return 0;
35 }
36 
37 static inline int wpa_drv_set_countermeasures(struct wpa_supplicant *wpa_s,
38  int enabled)
39 {
40  if (wpa_s->driver->set_countermeasures) {
41  return wpa_s->driver->set_countermeasures(wpa_s->drv_priv,
42  enabled);
43  }
44  return -1;
45 }
46 
47 static inline int wpa_drv_authenticate(struct wpa_supplicant *wpa_s,
48  struct wpa_driver_auth_params *params)
49 {
50  if (wpa_s->driver->authenticate)
51  return wpa_s->driver->authenticate(wpa_s->drv_priv, params);
52  return -1;
53 }
54 
55 static inline int wpa_drv_associate(struct wpa_supplicant *wpa_s,
56  struct wpa_driver_associate_params *params)
57 {
58  if (wpa_s->driver->associate) {
59  return wpa_s->driver->associate(wpa_s->drv_priv, params);
60  }
61  return -1;
62 }
63 
64 static inline int wpa_drv_init_mesh(struct wpa_supplicant *wpa_s)
65 {
66  if (wpa_s->driver->init_mesh)
67  return wpa_s->driver->init_mesh(wpa_s->drv_priv);
68  return -1;
69 }
70 
71 static inline int wpa_drv_join_mesh(struct wpa_supplicant *wpa_s,
72  struct wpa_driver_mesh_join_params *params)
73 {
74  if (wpa_s->driver->join_mesh)
75  return wpa_s->driver->join_mesh(wpa_s->drv_priv, params);
76  return -1;
77 }
78 
79 static inline int wpa_drv_leave_mesh(struct wpa_supplicant *wpa_s)
80 {
81  if (wpa_s->driver->leave_mesh)
82  return wpa_s->driver->leave_mesh(wpa_s->drv_priv);
83  return -1;
84 }
85 
86 static inline int wpa_drv_scan(struct wpa_supplicant *wpa_s,
87  struct wpa_driver_scan_params *params)
88 {
89 #ifdef CONFIG_TESTING_OPTIONS
90  if (wpa_s->test_failure == WPAS_TEST_FAILURE_SCAN_TRIGGER)
91  return -EBUSY;
92 #endif /* CONFIG_TESTING_OPTIONS */
93  if (wpa_s->driver->scan2)
94  return wpa_s->driver->scan2(wpa_s->drv_priv, params);
95  return -1;
96 }
97 
98 static inline int wpa_drv_sched_scan(struct wpa_supplicant *wpa_s,
99  struct wpa_driver_scan_params *params,
100  u32 interval)
101 {
102  if (wpa_s->driver->sched_scan)
103  return wpa_s->driver->sched_scan(wpa_s->drv_priv,
104  params, interval);
105  return -1;
106 }
107 
108 static inline int wpa_drv_stop_sched_scan(struct wpa_supplicant *wpa_s)
109 {
110  if (wpa_s->driver->stop_sched_scan)
111  return wpa_s->driver->stop_sched_scan(wpa_s->drv_priv);
112  return -1;
113 }
114 
115 static inline struct wpa_scan_results * wpa_drv_get_scan_results2(
116  struct wpa_supplicant *wpa_s)
117 {
118  if (wpa_s->driver->get_scan_results2)
119  return wpa_s->driver->get_scan_results2(wpa_s->drv_priv);
120  return NULL;
121 }
122 
123 static inline int wpa_drv_get_bssid(struct wpa_supplicant *wpa_s, u8 *bssid)
124 {
125  if (wpa_s->driver->get_bssid) {
126  return wpa_s->driver->get_bssid(wpa_s->drv_priv, bssid);
127  }
128  return -1;
129 }
130 
131 static inline int wpa_drv_get_ssid(struct wpa_supplicant *wpa_s, u8 *ssid)
132 {
133  if (wpa_s->driver->get_ssid) {
134  return wpa_s->driver->get_ssid(wpa_s->drv_priv, ssid);
135  }
136  return -1;
137 }
138 
139 static inline int wpa_drv_set_key(struct wpa_supplicant *wpa_s,
140  enum wpa_alg alg, const u8 *addr,
141  int key_idx, int set_tx,
142  const u8 *seq, size_t seq_len,
143  const u8 *key, size_t key_len)
144 {
145  if (alg != WPA_ALG_NONE) {
146  if (key_idx >= 0 && key_idx <= 6)
147  wpa_s->keys_cleared &= ~BIT(key_idx);
148  else
149  wpa_s->keys_cleared = 0;
150  }
151  if (wpa_s->driver->set_key) {
152  return wpa_s->driver->set_key(wpa_s->ifname, wpa_s->drv_priv,
153  alg, addr, key_idx, set_tx,
154  seq, seq_len, key, key_len);
155  }
156  return -1;
157 }
158 
159 static inline int wpa_drv_sta_deauth(struct wpa_supplicant *wpa_s,
160  const u8 *addr, int reason_code)
161 {
162  if (wpa_s->driver->sta_deauth) {
163  return wpa_s->driver->sta_deauth(wpa_s->drv_priv,
164  wpa_s->own_addr, addr,
165  reason_code);
166  }
167  return -1;
168 }
169 
170 static inline int wpa_drv_deauthenticate(struct wpa_supplicant *wpa_s,
171  const u8 *addr, int reason_code)
172 {
173  if (wpa_s->driver->deauthenticate) {
174  return wpa_s->driver->deauthenticate(wpa_s->drv_priv, addr,
175  reason_code);
176  }
177  return -1;
178 }
179 
180 static inline int wpa_drv_add_pmkid(struct wpa_supplicant *wpa_s,
181  const u8 *bssid, const u8 *pmkid)
182 {
183  if (wpa_s->driver->add_pmkid) {
184  return wpa_s->driver->add_pmkid(wpa_s->drv_priv, bssid, pmkid);
185  }
186  return -1;
187 }
188 
189 static inline int wpa_drv_remove_pmkid(struct wpa_supplicant *wpa_s,
190  const u8 *bssid, const u8 *pmkid)
191 {
192  if (wpa_s->driver->remove_pmkid) {
193  return wpa_s->driver->remove_pmkid(wpa_s->drv_priv, bssid,
194  pmkid);
195  }
196  return -1;
197 }
198 
199 static inline int wpa_drv_flush_pmkid(struct wpa_supplicant *wpa_s)
200 {
201  if (wpa_s->driver->flush_pmkid) {
202  return wpa_s->driver->flush_pmkid(wpa_s->drv_priv);
203  }
204  return -1;
205 }
206 
207 static inline int wpa_drv_get_capa(struct wpa_supplicant *wpa_s,
208  struct wpa_driver_capa *capa)
209 {
210  if (wpa_s->driver->get_capa) {
211  return wpa_s->driver->get_capa(wpa_s->drv_priv, capa);
212  }
213  return -1;
214 }
215 
216 static inline void wpa_drv_poll(struct wpa_supplicant *wpa_s)
217 {
218  if (wpa_s->driver->poll) {
219  wpa_s->driver->poll(wpa_s->drv_priv);
220  }
221 }
222 
223 static inline const char * wpa_drv_get_ifname(struct wpa_supplicant *wpa_s)
224 {
225  if (wpa_s->driver->get_ifname) {
226  return wpa_s->driver->get_ifname(wpa_s->drv_priv);
227  }
228  return NULL;
229 }
230 
231 static inline const char *
232 wpa_driver_get_radio_name(struct wpa_supplicant *wpa_s)
233 {
234  if (wpa_s->driver->get_radio_name)
235  return wpa_s->driver->get_radio_name(wpa_s->drv_priv);
236  return NULL;
237 }
238 
239 static inline const u8 * wpa_drv_get_mac_addr(struct wpa_supplicant *wpa_s)
240 {
241  if (wpa_s->driver->get_mac_addr) {
242  return wpa_s->driver->get_mac_addr(wpa_s->drv_priv);
243  }
244  return NULL;
245 }
246 
247 static inline int wpa_drv_set_operstate(struct wpa_supplicant *wpa_s,
248  int state)
249 {
250  if (wpa_s->driver->set_operstate)
251  return wpa_s->driver->set_operstate(wpa_s->drv_priv, state);
252  return 0;
253 }
254 
255 static inline int wpa_drv_mlme_setprotection(struct wpa_supplicant *wpa_s,
256  const u8 *addr, int protect_type,
257  int key_type)
258 {
259  if (wpa_s->driver->mlme_setprotection)
260  return wpa_s->driver->mlme_setprotection(wpa_s->drv_priv, addr,
261  protect_type,
262  key_type);
263  return 0;
264 }
265 
266 static inline struct hostapd_hw_modes *
267 wpa_drv_get_hw_feature_data(struct wpa_supplicant *wpa_s, u16 *num_modes,
268  u16 *flags)
269 {
270  if (wpa_s->driver->get_hw_feature_data)
271  return wpa_s->driver->get_hw_feature_data(wpa_s->drv_priv,
272  num_modes, flags);
273  return NULL;
274 }
275 
276 static inline int wpa_drv_set_country(struct wpa_supplicant *wpa_s,
277  const char *alpha2)
278 {
279  if (wpa_s->driver->set_country)
280  return wpa_s->driver->set_country(wpa_s->drv_priv, alpha2);
281  return 0;
282 }
283 
284 static inline int wpa_drv_send_mlme(struct wpa_supplicant *wpa_s,
285  const u8 *data, size_t data_len, int noack,
286  unsigned int freq)
287 {
288  if (wpa_s->driver->send_mlme)
289  return wpa_s->driver->send_mlme(wpa_s->drv_priv,
290  data, data_len, noack,
291  freq);
292  return -1;
293 }
294 
295 static inline int wpa_drv_update_ft_ies(struct wpa_supplicant *wpa_s,
296  const u8 *md,
297  const u8 *ies, size_t ies_len)
298 {
299  if (wpa_s->driver->update_ft_ies)
300  return wpa_s->driver->update_ft_ies(wpa_s->drv_priv, md,
301  ies, ies_len);
302  return -1;
303 }
304 
305 static inline int wpa_drv_set_ap(struct wpa_supplicant *wpa_s,
306  struct wpa_driver_ap_params *params)
307 {
308  if (wpa_s->driver->set_ap)
309  return wpa_s->driver->set_ap(wpa_s->drv_priv, params);
310  return -1;
311 }
312 
313 static inline int wpa_drv_sta_add(struct wpa_supplicant *wpa_s,
314  struct hostapd_sta_add_params *params)
315 {
316  if (wpa_s->driver->sta_add)
317  return wpa_s->driver->sta_add(wpa_s->drv_priv, params);
318  return -1;
319 }
320 
321 static inline int wpa_drv_sta_remove(struct wpa_supplicant *wpa_s,
322  const u8 *addr)
323 {
324  if (wpa_s->driver->sta_remove)
325  return wpa_s->driver->sta_remove(wpa_s->drv_priv, addr);
326  return -1;
327 }
328 
329 static inline int wpa_drv_hapd_send_eapol(struct wpa_supplicant *wpa_s,
330  const u8 *addr, const u8 *data,
331  size_t data_len, int encrypt,
332  const u8 *own_addr, u32 flags)
333 {
334  if (wpa_s->driver->hapd_send_eapol)
335  return wpa_s->driver->hapd_send_eapol(wpa_s->drv_priv, addr,
336  data, data_len, encrypt,
337  own_addr, flags);
338  return -1;
339 }
340 
341 static inline int wpa_drv_sta_set_flags(struct wpa_supplicant *wpa_s,
342  const u8 *addr, int total_flags,
343  int flags_or, int flags_and)
344 {
345  if (wpa_s->driver->sta_set_flags)
346  return wpa_s->driver->sta_set_flags(wpa_s->drv_priv, addr,
347  total_flags, flags_or,
348  flags_and);
349  return -1;
350 }
351 
352 static inline int wpa_drv_set_supp_port(struct wpa_supplicant *wpa_s,
353  int authorized)
354 {
355  if (wpa_s->driver->set_supp_port) {
356  return wpa_s->driver->set_supp_port(wpa_s->drv_priv,
357  authorized);
358  }
359  return 0;
360 }
361 
362 static inline int wpa_drv_send_action(struct wpa_supplicant *wpa_s,
363  unsigned int freq,
364  unsigned int wait,
365  const u8 *dst, const u8 *src,
366  const u8 *bssid,
367  const u8 *data, size_t data_len,
368  int no_cck)
369 {
370  if (wpa_s->driver->send_action)
371  return wpa_s->driver->send_action(wpa_s->drv_priv, freq,
372  wait, dst, src, bssid,
373  data, data_len, no_cck);
374  return -1;
375 }
376 
377 static inline void wpa_drv_send_action_cancel_wait(struct wpa_supplicant *wpa_s)
378 {
379  if (wpa_s->driver->send_action_cancel_wait)
380  wpa_s->driver->send_action_cancel_wait(wpa_s->drv_priv);
381 }
382 
383 static inline int wpa_drv_set_freq(struct wpa_supplicant *wpa_s,
384  struct hostapd_freq_params *freq)
385 {
386  if (wpa_s->driver->set_freq)
387  return wpa_s->driver->set_freq(wpa_s->drv_priv, freq);
388  return -1;
389 }
390 
391 static inline int wpa_drv_if_add(struct wpa_supplicant *wpa_s,
392  enum wpa_driver_if_type type,
393  const char *ifname, const u8 *addr,
394  void *bss_ctx, char *force_ifname,
395  u8 *if_addr, const char *bridge)
396 {
397  if (wpa_s->driver->if_add)
398  return wpa_s->driver->if_add(wpa_s->drv_priv, type, ifname,
399  addr, bss_ctx, NULL, force_ifname,
400  if_addr, bridge, 0);
401  return -1;
402 }
403 
404 static inline int wpa_drv_if_remove(struct wpa_supplicant *wpa_s,
405  enum wpa_driver_if_type type,
406  const char *ifname)
407 {
408  if (wpa_s->driver->if_remove)
409  return wpa_s->driver->if_remove(wpa_s->drv_priv, type, ifname);
410  return -1;
411 }
412 
413 static inline int wpa_drv_remain_on_channel(struct wpa_supplicant *wpa_s,
414  unsigned int freq,
415  unsigned int duration)
416 {
417  if (wpa_s->driver->remain_on_channel)
418  return wpa_s->driver->remain_on_channel(wpa_s->drv_priv, freq,
419  duration);
420  return -1;
421 }
422 
423 static inline int wpa_drv_cancel_remain_on_channel(
424  struct wpa_supplicant *wpa_s)
425 {
426  if (wpa_s->driver->cancel_remain_on_channel)
427  return wpa_s->driver->cancel_remain_on_channel(
428  wpa_s->drv_priv);
429  return -1;
430 }
431 
432 static inline int wpa_drv_probe_req_report(struct wpa_supplicant *wpa_s,
433  int report)
434 {
435  if (wpa_s->driver->probe_req_report)
436  return wpa_s->driver->probe_req_report(wpa_s->drv_priv,
437  report);
438  return -1;
439 }
440 
441 static inline int wpa_drv_deinit_ap(struct wpa_supplicant *wpa_s)
442 {
443  if (wpa_s->driver->deinit_ap)
444  return wpa_s->driver->deinit_ap(wpa_s->drv_priv);
445  return 0;
446 }
447 
448 static inline int wpa_drv_deinit_p2p_cli(struct wpa_supplicant *wpa_s)
449 {
450  if (wpa_s->driver->deinit_p2p_cli)
451  return wpa_s->driver->deinit_p2p_cli(wpa_s->drv_priv);
452  return 0;
453 }
454 
455 static inline void wpa_drv_suspend(struct wpa_supplicant *wpa_s)
456 {
457  if (wpa_s->driver->suspend)
458  wpa_s->driver->suspend(wpa_s->drv_priv);
459 }
460 
461 static inline void wpa_drv_resume(struct wpa_supplicant *wpa_s)
462 {
463  if (wpa_s->driver->resume)
464  wpa_s->driver->resume(wpa_s->drv_priv);
465 }
466 
467 static inline int wpa_drv_signal_monitor(struct wpa_supplicant *wpa_s,
468  int threshold, int hysteresis)
469 {
470  if (wpa_s->driver->signal_monitor)
471  return wpa_s->driver->signal_monitor(wpa_s->drv_priv,
472  threshold, hysteresis);
473  return -1;
474 }
475 
476 static inline int wpa_drv_signal_poll(struct wpa_supplicant *wpa_s,
477  struct wpa_signal_info *si)
478 {
479  if (wpa_s->driver->signal_poll)
480  return wpa_s->driver->signal_poll(wpa_s->drv_priv, si);
481  return -1;
482 }
483 
484 static inline int wpa_drv_pktcnt_poll(struct wpa_supplicant *wpa_s,
485  struct hostap_sta_driver_data *sta)
486 {
487  if (wpa_s->driver->read_sta_data)
488  return wpa_s->driver->read_sta_data(wpa_s->drv_priv, sta,
489  wpa_s->bssid);
490  return -1;
491 }
492 
493 static inline int wpa_drv_set_ap_wps_ie(struct wpa_supplicant *wpa_s,
494  const struct wpabuf *beacon,
495  const struct wpabuf *proberesp,
496  const struct wpabuf *assocresp)
497 {
498  if (!wpa_s->driver->set_ap_wps_ie)
499  return -1;
500  return wpa_s->driver->set_ap_wps_ie(wpa_s->drv_priv, beacon,
501  proberesp, assocresp);
502 }
503 
504 static inline int wpa_drv_get_noa(struct wpa_supplicant *wpa_s,
505  u8 *buf, size_t buf_len)
506 {
507  if (!wpa_s->driver->get_noa)
508  return -1;
509  return wpa_s->driver->get_noa(wpa_s->drv_priv, buf, buf_len);
510 }
511 
512 static inline int wpa_drv_set_p2p_powersave(struct wpa_supplicant *wpa_s,
513  int legacy_ps, int opp_ps,
514  int ctwindow)
515 {
516  if (!wpa_s->driver->set_p2p_powersave)
517  return -1;
518  return wpa_s->driver->set_p2p_powersave(wpa_s->drv_priv, legacy_ps,
519  opp_ps, ctwindow);
520 }
521 
522 static inline int wpa_drv_ampdu(struct wpa_supplicant *wpa_s, int ampdu)
523 {
524  if (!wpa_s->driver->ampdu)
525  return -1;
526  return wpa_s->driver->ampdu(wpa_s->drv_priv, ampdu);
527 }
528 
529 static inline int wpa_drv_send_tdls_mgmt(struct wpa_supplicant *wpa_s,
530  const u8 *dst, u8 action_code,
531  u8 dialog_token, u16 status_code,
532  u32 peer_capab, int initiator,
533  const u8 *buf, size_t len)
534 {
535  if (wpa_s->driver->send_tdls_mgmt) {
536  return wpa_s->driver->send_tdls_mgmt(wpa_s->drv_priv, dst,
537  action_code, dialog_token,
538  status_code, peer_capab,
539  initiator, buf, len);
540  }
541  return -1;
542 }
543 
544 static inline int wpa_drv_tdls_oper(struct wpa_supplicant *wpa_s,
545  enum tdls_oper oper, const u8 *peer)
546 {
547  if (!wpa_s->driver->tdls_oper)
548  return -1;
549  return wpa_s->driver->tdls_oper(wpa_s->drv_priv, oper, peer);
550 }
551 
552 #ifdef ANDROID
553 static inline int wpa_drv_driver_cmd(struct wpa_supplicant *wpa_s,
554  char *cmd, char *buf, size_t buf_len)
555 {
556  if (!wpa_s->driver->driver_cmd)
557  return -1;
558  return wpa_s->driver->driver_cmd(wpa_s->drv_priv, cmd, buf, buf_len);
559 }
560 #endif /* ANDROID */
561 
562 static inline void wpa_drv_set_rekey_info(struct wpa_supplicant *wpa_s,
563  const u8 *kek, size_t kek_len,
564  const u8 *kck, size_t kck_len,
565  const u8 *replay_ctr)
566 {
567  if (!wpa_s->driver->set_rekey_info)
568  return;
569  wpa_s->driver->set_rekey_info(wpa_s->drv_priv, kek, kek_len,
570  kck, kck_len, replay_ctr);
571 }
572 
573 static inline int wpa_drv_radio_disable(struct wpa_supplicant *wpa_s,
574  int disabled)
575 {
576  if (!wpa_s->driver->radio_disable)
577  return -1;
578  return wpa_s->driver->radio_disable(wpa_s->drv_priv, disabled);
579 }
580 
581 static inline int wpa_drv_switch_channel(struct wpa_supplicant *wpa_s,
582  struct csa_settings *settings)
583 {
584  if (!wpa_s->driver->switch_channel)
585  return -1;
586  return wpa_s->driver->switch_channel(wpa_s->drv_priv, settings);
587 }
588 
589 static inline int wpa_drv_add_ts(struct wpa_supplicant *wpa_s, u8 tsid,
590  const u8 *address, u8 user_priority,
591  u16 admitted_time)
592 {
593  if (!wpa_s->driver->add_tx_ts)
594  return -1;
595  return wpa_s->driver->add_tx_ts(wpa_s->drv_priv, tsid, address,
596  user_priority, admitted_time);
597 }
598 
599 static inline int wpa_drv_del_ts(struct wpa_supplicant *wpa_s, u8 tid,
600  const u8 *address)
601 {
602  if (!wpa_s->driver->del_tx_ts)
603  return -1;
604  return wpa_s->driver->del_tx_ts(wpa_s->drv_priv, tid, address);
605 }
606 
607 static inline int wpa_drv_tdls_enable_channel_switch(
608  struct wpa_supplicant *wpa_s, const u8 *addr, u8 oper_class,
609  const struct hostapd_freq_params *freq_params)
610 {
611  if (!wpa_s->driver->tdls_enable_channel_switch)
612  return -1;
613  return wpa_s->driver->tdls_enable_channel_switch(wpa_s->drv_priv, addr,
614  oper_class,
615  freq_params);
616 }
617 
618 static inline int
619 wpa_drv_tdls_disable_channel_switch(struct wpa_supplicant *wpa_s,
620  const u8 *addr)
621 {
622  if (!wpa_s->driver->tdls_disable_channel_switch)
623  return -1;
624  return wpa_s->driver->tdls_disable_channel_switch(wpa_s->drv_priv,
625  addr);
626 }
627 
628 static inline int wpa_drv_wnm_oper(struct wpa_supplicant *wpa_s,
629  enum wnm_oper oper, const u8 *peer,
630  u8 *buf, u16 *buf_len)
631 {
632  if (!wpa_s->driver->wnm_oper)
633  return -1;
634  return wpa_s->driver->wnm_oper(wpa_s->drv_priv, oper, peer, buf,
635  buf_len);
636 }
637 
638 static inline int wpa_drv_status(struct wpa_supplicant *wpa_s,
639  char *buf, size_t buflen)
640 {
641  if (!wpa_s->driver->status)
642  return -1;
643  return wpa_s->driver->status(wpa_s->drv_priv, buf, buflen);
644 }
645 
646 static inline int wpa_drv_set_qos_map(struct wpa_supplicant *wpa_s,
647  const u8 *qos_map_set, u8 qos_map_set_len)
648 {
649  if (!wpa_s->driver->set_qos_map)
650  return -1;
651  return wpa_s->driver->set_qos_map(wpa_s->drv_priv, qos_map_set,
652  qos_map_set_len);
653 }
654 
655 static inline int wpa_drv_wowlan(struct wpa_supplicant *wpa_s,
656  const struct wowlan_triggers *triggers)
657 {
658  if (!wpa_s->driver->set_wowlan)
659  return -1;
660  return wpa_s->driver->set_wowlan(wpa_s->drv_priv, triggers);
661 }
662 
663 static inline int wpa_drv_vendor_cmd(struct wpa_supplicant *wpa_s,
664  int vendor_id, int subcmd, const u8 *data,
665  size_t data_len, struct wpabuf *buf)
666 {
667  if (!wpa_s->driver->vendor_cmd)
668  return -1;
669  return wpa_s->driver->vendor_cmd(wpa_s->drv_priv, vendor_id, subcmd,
670  data, data_len, buf);
671 }
672 
673 static inline int wpa_drv_roaming(struct wpa_supplicant *wpa_s, int allowed,
674  const u8 *bssid)
675 {
676  if (!wpa_s->driver->roaming)
677  return -1;
678  return wpa_s->driver->roaming(wpa_s->drv_priv, allowed, bssid);
679 }
680 
681 static inline int wpa_drv_set_mac_addr(struct wpa_supplicant *wpa_s,
682  const u8 *addr)
683 {
684  if (!wpa_s->driver->set_mac_addr)
685  return -1;
686  return wpa_s->driver->set_mac_addr(wpa_s->drv_priv, addr);
687 }
688 
689 
690 #ifdef CONFIG_MACSEC
691 
692 static inline int wpa_drv_macsec_init(struct wpa_supplicant *wpa_s,
693  struct macsec_init_params *params)
694 {
695  if (!wpa_s->driver->macsec_init)
696  return -1;
697  return wpa_s->driver->macsec_init(wpa_s->drv_priv, params);
698 }
699 
700 static inline int wpa_drv_macsec_deinit(struct wpa_supplicant *wpa_s)
701 {
702  if (!wpa_s->driver->macsec_deinit)
703  return -1;
704  return wpa_s->driver->macsec_deinit(wpa_s->drv_priv);
705 }
706 
707 static inline int wpa_drv_enable_protect_frames(struct wpa_supplicant *wpa_s,
708  Boolean enabled)
709 {
710  if (!wpa_s->driver->enable_protect_frames)
711  return -1;
712  return wpa_s->driver->enable_protect_frames(wpa_s->drv_priv, enabled);
713 }
714 
715 static inline int wpa_drv_set_replay_protect(struct wpa_supplicant *wpa_s,
716  Boolean enabled, u32 window)
717 {
718  if (!wpa_s->driver->set_replay_protect)
719  return -1;
720  return wpa_s->driver->set_replay_protect(wpa_s->drv_priv, enabled,
721  window);
722 }
723 
724 static inline int wpa_drv_set_current_cipher_suite(struct wpa_supplicant *wpa_s,
725  const u8 *cs, size_t cs_len)
726 {
727  if (!wpa_s->driver->set_current_cipher_suite)
728  return -1;
729  return wpa_s->driver->set_current_cipher_suite(wpa_s->drv_priv, cs,
730  cs_len);
731 }
732 
733 static inline int wpa_drv_enable_controlled_port(struct wpa_supplicant *wpa_s,
734  Boolean enabled)
735 {
736  if (!wpa_s->driver->enable_controlled_port)
737  return -1;
738  return wpa_s->driver->enable_controlled_port(wpa_s->drv_priv, enabled);
739 }
740 
741 static inline int wpa_drv_get_receive_lowest_pn(struct wpa_supplicant *wpa_s,
742  u32 channel, u8 an,
743  u32 *lowest_pn)
744 {
745  if (!wpa_s->driver->get_receive_lowest_pn)
746  return -1;
747  return wpa_s->driver->get_receive_lowest_pn(wpa_s->drv_priv, channel,
748  an, lowest_pn);
749 }
750 
751 static inline int wpa_drv_get_transmit_next_pn(struct wpa_supplicant *wpa_s,
752  u32 channel, u8 an,
753  u32 *next_pn)
754 {
755  if (!wpa_s->driver->get_transmit_next_pn)
756  return -1;
757  return wpa_s->driver->get_transmit_next_pn(wpa_s->drv_priv, channel,
758  an, next_pn);
759 }
760 
761 static inline int wpa_drv_set_transmit_next_pn(struct wpa_supplicant *wpa_s,
762  u32 channel, u8 an,
763  u32 next_pn)
764 {
765  if (!wpa_s->driver->set_transmit_next_pn)
766  return -1;
767  return wpa_s->driver->set_transmit_next_pn(wpa_s->drv_priv, channel,
768  an, next_pn);
769 }
770 
771 static inline int wpa_drv_get_available_receive_sc(struct wpa_supplicant *wpa_s,
772  u32 *channel)
773 {
774  if (!wpa_s->driver->get_available_receive_sc)
775  return -1;
776  return wpa_s->driver->get_available_receive_sc(wpa_s->drv_priv,
777  channel);
778 }
779 
780 static inline int
781 wpa_drv_create_receive_sc(struct wpa_supplicant *wpa_s, u32 channel,
782  const u8 *sci_addr, u16 sci_port,
783  unsigned int conf_offset, int validation)
784 {
785  if (!wpa_s->driver->create_receive_sc)
786  return -1;
787  return wpa_s->driver->create_receive_sc(wpa_s->drv_priv, channel,
788  sci_addr, sci_port, conf_offset,
789  validation);
790 }
791 
792 static inline int wpa_drv_delete_receive_sc(struct wpa_supplicant *wpa_s,
793  u32 channel)
794 {
795  if (!wpa_s->driver->delete_receive_sc)
796  return -1;
797  return wpa_s->driver->delete_receive_sc(wpa_s->drv_priv, channel);
798 }
799 
800 static inline int wpa_drv_create_receive_sa(struct wpa_supplicant *wpa_s,
801  u32 channel, u8 an,
802  u32 lowest_pn, const u8 *sak)
803 {
804  if (!wpa_s->driver->create_receive_sa)
805  return -1;
806  return wpa_s->driver->create_receive_sa(wpa_s->drv_priv, channel, an,
807  lowest_pn, sak);
808 }
809 
810 static inline int wpa_drv_enable_receive_sa(struct wpa_supplicant *wpa_s,
811  u32 channel, u8 an)
812 {
813  if (!wpa_s->driver->enable_receive_sa)
814  return -1;
815  return wpa_s->driver->enable_receive_sa(wpa_s->drv_priv, channel, an);
816 }
817 
818 static inline int wpa_drv_disable_receive_sa(struct wpa_supplicant *wpa_s,
819  u32 channel, u8 an)
820 {
821  if (!wpa_s->driver->disable_receive_sa)
822  return -1;
823  return wpa_s->driver->disable_receive_sa(wpa_s->drv_priv, channel, an);
824 }
825 
826 static inline int
827 wpa_drv_get_available_transmit_sc(struct wpa_supplicant *wpa_s, u32 *channel)
828 {
829  if (!wpa_s->driver->get_available_transmit_sc)
830  return -1;
831  return wpa_s->driver->get_available_transmit_sc(wpa_s->drv_priv,
832  channel);
833 }
834 
835 static inline int
836 wpa_drv_create_transmit_sc(struct wpa_supplicant *wpa_s, u32 channel,
837  const u8 *sci_addr, u16 sci_port,
838  unsigned int conf_offset)
839 {
840  if (!wpa_s->driver->create_transmit_sc)
841  return -1;
842  return wpa_s->driver->create_transmit_sc(wpa_s->drv_priv, channel,
843  sci_addr, sci_port,
844  conf_offset);
845 }
846 
847 static inline int wpa_drv_delete_transmit_sc(struct wpa_supplicant *wpa_s,
848  u32 channel)
849 {
850  if (!wpa_s->driver->delete_transmit_sc)
851  return -1;
852  return wpa_s->driver->delete_transmit_sc(wpa_s->drv_priv, channel);
853 }
854 
855 static inline int wpa_drv_create_transmit_sa(struct wpa_supplicant *wpa_s,
856  u32 channel, u8 an,
857  u32 next_pn,
858  Boolean confidentiality,
859  const u8 *sak)
860 {
861  if (!wpa_s->driver->create_transmit_sa)
862  return -1;
863  return wpa_s->driver->create_transmit_sa(wpa_s->drv_priv, channel, an,
864  next_pn, confidentiality, sak);
865 }
866 
867 static inline int wpa_drv_enable_transmit_sa(struct wpa_supplicant *wpa_s,
868  u32 channel, u8 an)
869 {
870  if (!wpa_s->driver->enable_transmit_sa)
871  return -1;
872  return wpa_s->driver->enable_transmit_sa(wpa_s->drv_priv, channel, an);
873 }
874 
875 static inline int wpa_drv_disable_transmit_sa(struct wpa_supplicant *wpa_s,
876  u32 channel, u8 an)
877 {
878  if (!wpa_s->driver->disable_transmit_sa)
879  return -1;
880  return wpa_s->driver->disable_transmit_sa(wpa_s->drv_priv, channel, an);
881 }
882 #endif /* CONFIG_MACSEC */
883 
884 static inline int wpa_drv_setband(struct wpa_supplicant *wpa_s,
885  enum set_band band)
886 {
887  if (!wpa_s->driver->set_band)
888  return -1;
889  return wpa_s->driver->set_band(wpa_s->drv_priv, band);
890 }
891 
892 static inline int wpa_drv_get_pref_freq_list(struct wpa_supplicant *wpa_s,
893  enum wpa_driver_if_type if_type,
894  unsigned int *num,
895  unsigned int *freq_list)
896 {
897  if (!wpa_s->driver->get_pref_freq_list)
898  return -1;
899  return wpa_s->driver->get_pref_freq_list(wpa_s->drv_priv, if_type,
900  num, freq_list);
901 }
902 
903 static inline int wpa_drv_set_prob_oper_freq(struct wpa_supplicant *wpa_s,
904  unsigned int freq)
905 {
906  if (!wpa_s->driver->set_prob_oper_freq)
907  return 0;
908  return wpa_s->driver->set_prob_oper_freq(wpa_s->drv_priv, freq);
909 }
910 
911 #endif /* DRIVER_I_H */
int(* sta_add)(void *priv, struct hostapd_sta_add_params *params)
Add a station entry.
Definition: driver.h:2431
int(* get_bssid)(void *priv, u8 *bssid)
Get the current BSSID.
Definition: driver.h:1763
int(* signal_monitor)(void *priv, int threshold, int hysteresis)
Set signal monitoring parameters.
Definition: driver.h:2791
int(* set_band)(void *priv, enum set_band band)
Notify driver of band selection.
Definition: driver.h:3528
int(* set_p2p_powersave)(void *priv, int legacy_ps, int opp_ps, int ctwindow)
Set P2P power save options.
Definition: driver.h:2842
void(* suspend)(void *priv)
Notification on system suspend/hibernate event.
Definition: driver.h:2769
int(* set_ap)(void *priv, struct wpa_driver_ap_params *params)
Set Beacon and Probe Response information for AP mode.
Definition: driver.h:2218
Settings for channel switch command.
Definition: driver.h:1661
const char *(* get_radio_name)(void *priv)
Get physical radio name for the device.
Definition: driver.h:2864
int(* probe_req_report)(void *priv, int report)
Request Probe Request frames to be indicated.
Definition: driver.h:2740
int(* add_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid)
Add PMKSA cache entry to the driver.
Definition: driver.h:1934
int(* set_freq)(void *priv, struct hostapd_freq_params *freq)
Set channel/frequency (AP only)
Definition: driver.h:2455
int(* leave_mesh)(void *priv)
Leave a mesh network.
Definition: driver.h:3509
int(* set_prob_oper_freq)(void *priv, unsigned int freq)
Indicate probable P2P operating channel.
Definition: driver.h:3554
int(* wnm_oper)(void *priv, enum wnm_oper oper, const u8 *peer, u8 *buf, u16 *buf_len)
Notify driver of the WNM frame reception.
Definition: driver.h:2907
int(* deauthenticate)(void *priv, const u8 *addr, int reason_code)
Request driver to deauthenticate.
Definition: driver.h:1905
int(* join_mesh)(void *priv, struct wpa_driver_mesh_join_params *params)
Join a mesh network.
Definition: driver.h:3501
int(* get_pref_freq_list)(void *priv, enum wpa_driver_if_type if_type, unsigned int *num, unsigned int *freq_list)
Get preferred frequency list for an interface.
Definition: driver.h:3541
int(* get_ssid)(void *priv, u8 *ssid)
Get the current SSID.
Definition: driver.h:1780
int(* vendor_cmd)(void *priv, unsigned int vendor_id, unsigned int subcmd, const u8 *data, size_t data_len, struct wpabuf *buf)
Execute vendor specific command.
Definition: driver.h:3018
int(* flush_pmkid)(void *priv)
Flush PMKSA cache.
Definition: driver.h:1972
int(* set_wowlan)(void *priv, const struct wowlan_triggers *triggers)
Set wake-on-wireless triggers.
Definition: driver.h:2963
Driver interface definition.
Definition: driver.h:1418
struct hostapd_hw_modes *(* get_hw_feature_data)(void *priv, u16 *num_modes, u16 *flags)
Get hardware support data (channels and rates)
Definition: driver.h:2064
Scan parameters Data for struct wpa_driver_ops::scan2().
Definition: driver.h:306
void(* deinit)(void *priv)
Deinitialize driver interface.
Definition: driver.h:1870
int(* associate)(void *priv, struct wpa_driver_associate_params *params)
Request driver to associate.
Definition: driver.h:1914
int(* tdls_oper)(void *priv, enum tdls_oper oper, const u8 *peer)
Ask the driver to perform high-level TDLS operations.
Definition: driver.h:2896
wpa_driver_if_type
Definition: driver.h:1466
int(* set_mac_addr)(void *priv, const u8 *addr)
Set MAC address.
Definition: driver.h:3289
int(* tdls_disable_channel_switch)(void *priv, const u8 *addr)
Disable channel switching with TDLS peer.
Definition: driver.h:3212
Definition: wpabuf.h:16
void(* send_action_cancel_wait)(void *priv)
Cancel action frame TX wait.
Definition: driver.h:2686
int(* set_country)(void *priv, const char *alpha2)
Set country.
Definition: driver.h:2117
int(* send_action)(void *priv, unsigned int freq, unsigned int wait, const u8 *dst, const u8 *src, const u8 *bssid, const u8 *data, size_t data_len, int no_cck)
Transmit an Action frame.
Definition: driver.h:2674
int(* set_supp_port)(void *priv, int authorized)
Set IEEE 802.1X Supplicant Port status.
Definition: driver.h:2631
int(* if_remove)(void *priv, enum wpa_driver_if_type type, const char *ifname)
Remove a virtual interface.
Definition: driver.h:2529
int(* status)(void *priv, char *buf, size_t buflen)
Get driver interface status information.
Definition: driver.h:3265
int(* sta_remove)(void *priv, const u8 *addr)
Remove a station entry (AP only)
Definition: driver.h:2382
int(* deinit_p2p_cli)(void *priv)
Deinitialize P2P client mode.
Definition: driver.h:2763
int(* ampdu)(void *priv, int ampdu)
Enable/disable aggregation.
Definition: driver.h:2851
int(* del_tx_ts)(void *priv, u8 tsid, const u8 *addr)
Delete traffic stream.
Definition: driver.h:3185
int(* set_param)(void *priv, const char *param)
Set driver configuration parameters.
Definition: driver.h:1882
void(* resume)(void *priv)
Notification on system resume/thaw event.
Definition: driver.h:2775
int(* scan2)(void *priv, struct wpa_driver_scan_params *params)
Request the driver to initiate scan.
Definition: driver.h:2182
void(* set_rekey_info)(void *priv, const u8 *kek, size_t kek_len, const u8 *kck, size_t kck_len, const u8 *replay_ctr)
Set rekey information.
Definition: driver.h:3035
int(* stop_sched_scan)(void *priv)
Request the driver to stop a scheduled scan.
Definition: driver.h:3125
int(* authenticate)(void *priv, struct wpa_driver_auth_params *params)
Request driver to authenticate.
Definition: driver.h:2196
void(* poll)(void *priv)
Poll driver for association information.
Definition: driver.h:1996
int(* if_add)(void *priv, enum wpa_driver_if_type type, const char *ifname, const u8 *addr, void *bss_ctx, void **drv_priv, char *force_ifname, u8 *if_addr, const char *bridge, int use_existing)
Add a virtual interface.
Definition: driver.h:2517
Definition: driver.h:919
Definition: driver.h:909
Supported hardware mode information.
Definition: driver.h:132
int(* get_capa)(void *priv, struct wpa_driver_capa *capa)
Get driver capabilities.
Definition: driver.h:1982
int(* send_mlme)(void *priv, const u8 *data, size_t data_len, int noack, unsigned int freq)
Send management frame from MLME.
Definition: driver.h:2078
Authentication parameters Data for struct wpa_driver_ops::authenticate().
Definition: driver.h:447
int(* get_noa)(void *priv, u8 *buf, size_t buf_len)
Get current Notice of Absence attribute payload.
Definition: driver.h:2818
Association parameters Data for struct wpa_driver_ops::associate().
Definition: driver.h:578
const u8 *(* get_mac_addr)(void *priv)
Get own MAC address.
Definition: driver.h:2021
int(* set_operstate)(void *priv, int state)
Sets device operating state to DORMANT or UP.
Definition: driver.h:2035
int(* set_ap_wps_ie)(void *priv, const struct wpabuf *beacon, const struct wpabuf *proberesp, const struct wpabuf *assocresp)
Add WPS IE(s) into Beacon/Probe Response frames (AP)
Definition: driver.h:2621
int(* sta_deauth)(void *priv, const u8 *own_addr, const u8 *addr, int reason)
Deauthenticate a station (AP only)
Definition: driver.h:2359
int(* remove_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid)
Remove PMKSA cache entry to the driver.
Definition: driver.h:1954
int(* deinit_ap)(void *priv)
Deinitialize AP mode.
Definition: driver.h:2752
int(* tdls_enable_channel_switch)(void *priv, const u8 *addr, u8 oper_class, const struct hostapd_freq_params *params)
Enable channel-switching with TDLS peer.
Definition: driver.h:3199
int(* mlme_setprotection)(void *priv, const u8 *addr, int protect_type, int key_type)
MLME-SETPROTECTION.request primitive.
Definition: driver.h:2053
int(* signal_poll)(void *priv, struct wpa_signal_info *signal_info)
Get current connection information.
Definition: driver.h:2970
int(* add_tx_ts)(void *priv, u8 tsid, const u8 *addr, u8 user_prio, u16 admitted_time)
Add traffic stream.
Definition: driver.h:3175
int(* switch_channel)(void *priv, struct csa_settings *settings)
Announce channel switch and migrate the GO to the given frequency.
Definition: driver.h:3163
struct wpa_scan_results *(* get_scan_results2)(void *priv)
Fetch the latest scan results.
Definition: driver.h:2106
Scan results.
Definition: driver.h:277
void *(* init2)(void *ctx, const char *ifname, void *global_priv)
Initialize driver interface (with global data)
Definition: driver.h:2160
int(* remain_on_channel)(void *priv, unsigned int freq, unsigned int duration)
Remain awake on a channel.
Definition: driver.h:2710
int(* radio_disable)(void *priv, int disabled)
Disable/enable radio.
Definition: driver.h:3151
int(* update_ft_ies)(void *priv, const u8 *md, const u8 *ies, size_t ies_len)
Update FT (IEEE 802.11r) IEs.
Definition: driver.h:2096
int(* set_key)(const char *ifname, void *priv, enum wpa_alg alg, const u8 *addr, int key_idx, int set_tx, const u8 *seq, size_t seq_len, const u8 *key, size_t key_len)
Configure encryption key.
Definition: driver.h:1833
Internal data for wpa_supplicant interface.
Definition: wpa_supplicant_i.h:451
int(* cancel_remain_on_channel)(void *priv)
Cancel remain-on-channel operation.
Definition: driver.h:2724
int(* set_countermeasures)(void *priv, int enabled)
Enable/disable TKIP countermeasures.
Definition: driver.h:1894
void *(* init)(void *ctx, const char *ifname)
Initialize driver interface.
Definition: driver.h:1861
int(* sta_set_flags)(void *priv, const u8 *addr, unsigned int total_flags, unsigned int flags_or, unsigned int flags_and)
Set station flags (AP only)
Definition: driver.h:2482
Information about channel signal quality.
Definition: driver.h:1607
Driver capability information.
Definition: driver.h:1196
Channel parameters.
Definition: driver.h:510
int(* init_mesh)(void *priv)
Driver specific initialization for mesh.
Definition: driver.h:3493
Definition: driver.h:1175
int(* send_tdls_mgmt)(void *priv, const u8 *dst, u8 action_code, u8 dialog_token, u16 status_code, u32 peer_capab, int initiator, const u8 *buf, size_t len)
for sending TDLS management packets
Definition: driver.h:2882
Definition: driver.h:1430
const char *(* get_ifname)(void *priv)
Get interface name.
Definition: driver.h:2009
int(* roaming)(void *priv, int allowed, const u8 *bssid)
Set roaming policy for driver-based BSS selection.
Definition: driver.h:3281
int(* hapd_send_eapol)(void *priv, const u8 *addr, const u8 *data, size_t data_len, int encrypt, const u8 *own_addr, u32 flags)
Send an EAPOL packet (AP only)
Definition: driver.h:2344
int(* read_sta_data)(void *priv, struct hostap_sta_driver_data *data, const u8 *addr)
Fetch station data.
Definition: driver.h:2329
int(* sched_scan)(void *priv, struct wpa_driver_scan_params *params, u32 interval)
Request the driver to initiate scheduled scan.
Definition: driver.h:3113
int(* set_qos_map)(void *priv, const u8 *qos_map_set, u8 qos_map_set_len)
Set QoS Map.
Definition: driver.h:2916