driver_i.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  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. #ifndef DRIVER_I_H
  9. #define DRIVER_I_H
  10. #include "drivers/driver.h"
  11. /* driver_ops */
  12. static inline void * wpa_drv_init(struct wpa_supplicant *wpa_s,
  13. const char *ifname)
  14. {
  15. if (wpa_s->driver->init2)
  16. return wpa_s->driver->init2(wpa_s, ifname,
  17. wpa_s->global_drv_priv);
  18. if (wpa_s->driver->init) {
  19. return wpa_s->driver->init(wpa_s, ifname);
  20. }
  21. return NULL;
  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. static inline int wpa_drv_set_param(struct wpa_supplicant *wpa_s,
  29. const char *param)
  30. {
  31. if (wpa_s->driver->set_param)
  32. return wpa_s->driver->set_param(wpa_s->drv_priv, param);
  33. return 0;
  34. }
  35. static inline int wpa_drv_set_countermeasures(struct wpa_supplicant *wpa_s,
  36. int enabled)
  37. {
  38. if (wpa_s->driver->set_countermeasures) {
  39. return wpa_s->driver->set_countermeasures(wpa_s->drv_priv,
  40. enabled);
  41. }
  42. return -1;
  43. }
  44. static inline int wpa_drv_authenticate(struct wpa_supplicant *wpa_s,
  45. struct wpa_driver_auth_params *params)
  46. {
  47. if (wpa_s->driver->authenticate)
  48. return wpa_s->driver->authenticate(wpa_s->drv_priv, params);
  49. return -1;
  50. }
  51. static inline int wpa_drv_associate(struct wpa_supplicant *wpa_s,
  52. struct wpa_driver_associate_params *params)
  53. {
  54. if (wpa_s->driver->associate) {
  55. return wpa_s->driver->associate(wpa_s->drv_priv, params);
  56. }
  57. return -1;
  58. }
  59. static inline int wpa_drv_scan(struct wpa_supplicant *wpa_s,
  60. struct wpa_driver_scan_params *params)
  61. {
  62. if (wpa_s->driver->scan2)
  63. return wpa_s->driver->scan2(wpa_s->drv_priv, params);
  64. return -1;
  65. }
  66. static inline int wpa_drv_sched_scan(struct wpa_supplicant *wpa_s,
  67. struct wpa_driver_scan_params *params,
  68. u32 interval)
  69. {
  70. if (wpa_s->driver->sched_scan)
  71. return wpa_s->driver->sched_scan(wpa_s->drv_priv,
  72. params, interval);
  73. return -1;
  74. }
  75. static inline int wpa_drv_stop_sched_scan(struct wpa_supplicant *wpa_s)
  76. {
  77. if (wpa_s->driver->stop_sched_scan)
  78. return wpa_s->driver->stop_sched_scan(wpa_s->drv_priv);
  79. return -1;
  80. }
  81. static inline struct wpa_scan_results * wpa_drv_get_scan_results2(
  82. struct wpa_supplicant *wpa_s)
  83. {
  84. if (wpa_s->driver->get_scan_results2)
  85. return wpa_s->driver->get_scan_results2(wpa_s->drv_priv);
  86. return NULL;
  87. }
  88. static inline int wpa_drv_get_bssid(struct wpa_supplicant *wpa_s, u8 *bssid)
  89. {
  90. if (wpa_s->driver->get_bssid) {
  91. return wpa_s->driver->get_bssid(wpa_s->drv_priv, bssid);
  92. }
  93. return -1;
  94. }
  95. static inline int wpa_drv_get_ssid(struct wpa_supplicant *wpa_s, u8 *ssid)
  96. {
  97. if (wpa_s->driver->get_ssid) {
  98. return wpa_s->driver->get_ssid(wpa_s->drv_priv, ssid);
  99. }
  100. return -1;
  101. }
  102. static inline int wpa_drv_set_key(struct wpa_supplicant *wpa_s,
  103. enum wpa_alg alg, const u8 *addr,
  104. int key_idx, int set_tx,
  105. const u8 *seq, size_t seq_len,
  106. const u8 *key, size_t key_len)
  107. {
  108. if (wpa_s->driver->set_key) {
  109. wpa_s->keys_cleared = 0;
  110. return wpa_s->driver->set_key(wpa_s->ifname, wpa_s->drv_priv,
  111. alg, addr, key_idx, set_tx,
  112. seq, seq_len, key, key_len);
  113. }
  114. return -1;
  115. }
  116. static inline int wpa_drv_deauthenticate(struct wpa_supplicant *wpa_s,
  117. const u8 *addr, int reason_code)
  118. {
  119. if (wpa_s->driver->deauthenticate) {
  120. return wpa_s->driver->deauthenticate(wpa_s->drv_priv, addr,
  121. reason_code);
  122. }
  123. return -1;
  124. }
  125. static inline int wpa_drv_disassociate(struct wpa_supplicant *wpa_s,
  126. const u8 *addr, int reason_code)
  127. {
  128. if (wpa_s->driver->disassociate) {
  129. return wpa_s->driver->disassociate(wpa_s->drv_priv, addr,
  130. reason_code);
  131. }
  132. return -1;
  133. }
  134. static inline int wpa_drv_add_pmkid(struct wpa_supplicant *wpa_s,
  135. const u8 *bssid, const u8 *pmkid)
  136. {
  137. if (wpa_s->driver->add_pmkid) {
  138. return wpa_s->driver->add_pmkid(wpa_s->drv_priv, bssid, pmkid);
  139. }
  140. return -1;
  141. }
  142. static inline int wpa_drv_remove_pmkid(struct wpa_supplicant *wpa_s,
  143. const u8 *bssid, const u8 *pmkid)
  144. {
  145. if (wpa_s->driver->remove_pmkid) {
  146. return wpa_s->driver->remove_pmkid(wpa_s->drv_priv, bssid,
  147. pmkid);
  148. }
  149. return -1;
  150. }
  151. static inline int wpa_drv_flush_pmkid(struct wpa_supplicant *wpa_s)
  152. {
  153. if (wpa_s->driver->flush_pmkid) {
  154. return wpa_s->driver->flush_pmkid(wpa_s->drv_priv);
  155. }
  156. return -1;
  157. }
  158. static inline int wpa_drv_get_capa(struct wpa_supplicant *wpa_s,
  159. struct wpa_driver_capa *capa)
  160. {
  161. if (wpa_s->driver->get_capa) {
  162. return wpa_s->driver->get_capa(wpa_s->drv_priv, capa);
  163. }
  164. return -1;
  165. }
  166. static inline void wpa_drv_poll(struct wpa_supplicant *wpa_s)
  167. {
  168. if (wpa_s->driver->poll) {
  169. wpa_s->driver->poll(wpa_s->drv_priv);
  170. }
  171. }
  172. static inline const char * wpa_drv_get_ifname(struct wpa_supplicant *wpa_s)
  173. {
  174. if (wpa_s->driver->get_ifname) {
  175. return wpa_s->driver->get_ifname(wpa_s->drv_priv);
  176. }
  177. return NULL;
  178. }
  179. static inline const u8 * wpa_drv_get_mac_addr(struct wpa_supplicant *wpa_s)
  180. {
  181. if (wpa_s->driver->get_mac_addr) {
  182. return wpa_s->driver->get_mac_addr(wpa_s->drv_priv);
  183. }
  184. return NULL;
  185. }
  186. static inline int wpa_drv_send_eapol(struct wpa_supplicant *wpa_s,
  187. const u8 *dst, u16 proto,
  188. const u8 *data, size_t data_len)
  189. {
  190. if (wpa_s->driver->send_eapol)
  191. return wpa_s->driver->send_eapol(wpa_s->drv_priv, dst, proto,
  192. data, data_len);
  193. return -1;
  194. }
  195. static inline int wpa_drv_set_operstate(struct wpa_supplicant *wpa_s,
  196. int state)
  197. {
  198. if (wpa_s->driver->set_operstate)
  199. return wpa_s->driver->set_operstate(wpa_s->drv_priv, state);
  200. return 0;
  201. }
  202. static inline int wpa_drv_mlme_setprotection(struct wpa_supplicant *wpa_s,
  203. const u8 *addr, int protect_type,
  204. int key_type)
  205. {
  206. if (wpa_s->driver->mlme_setprotection)
  207. return wpa_s->driver->mlme_setprotection(wpa_s->drv_priv, addr,
  208. protect_type,
  209. key_type);
  210. return 0;
  211. }
  212. static inline struct hostapd_hw_modes *
  213. wpa_drv_get_hw_feature_data(struct wpa_supplicant *wpa_s, u16 *num_modes,
  214. u16 *flags)
  215. {
  216. if (wpa_s->driver->get_hw_feature_data)
  217. return wpa_s->driver->get_hw_feature_data(wpa_s->drv_priv,
  218. num_modes, flags);
  219. return NULL;
  220. }
  221. static inline int wpa_drv_set_country(struct wpa_supplicant *wpa_s,
  222. const char *alpha2)
  223. {
  224. if (wpa_s->driver->set_country)
  225. return wpa_s->driver->set_country(wpa_s->drv_priv, alpha2);
  226. return 0;
  227. }
  228. static inline int wpa_drv_send_mlme(struct wpa_supplicant *wpa_s,
  229. const u8 *data, size_t data_len, int noack)
  230. {
  231. if (wpa_s->driver->send_mlme)
  232. return wpa_s->driver->send_mlme(wpa_s->drv_priv,
  233. data, data_len, noack);
  234. return -1;
  235. }
  236. static inline int wpa_drv_update_ft_ies(struct wpa_supplicant *wpa_s,
  237. const u8 *md,
  238. const u8 *ies, size_t ies_len)
  239. {
  240. if (wpa_s->driver->update_ft_ies)
  241. return wpa_s->driver->update_ft_ies(wpa_s->drv_priv, md,
  242. ies, ies_len);
  243. return -1;
  244. }
  245. static inline int wpa_drv_send_ft_action(struct wpa_supplicant *wpa_s,
  246. u8 action, const u8 *target_ap,
  247. const u8 *ies, size_t ies_len)
  248. {
  249. if (wpa_s->driver->send_ft_action)
  250. return wpa_s->driver->send_ft_action(wpa_s->drv_priv, action,
  251. target_ap, ies, ies_len);
  252. return -1;
  253. }
  254. static inline int wpa_drv_set_ap(struct wpa_supplicant *wpa_s,
  255. struct wpa_driver_ap_params *params)
  256. {
  257. if (wpa_s->driver->set_ap)
  258. return wpa_s->driver->set_ap(wpa_s->drv_priv, params);
  259. return -1;
  260. }
  261. static inline int wpa_drv_sta_add(struct wpa_supplicant *wpa_s,
  262. struct hostapd_sta_add_params *params)
  263. {
  264. if (wpa_s->driver->sta_add)
  265. return wpa_s->driver->sta_add(wpa_s->drv_priv, params);
  266. return -1;
  267. }
  268. static inline int wpa_drv_sta_remove(struct wpa_supplicant *wpa_s,
  269. const u8 *addr)
  270. {
  271. if (wpa_s->driver->sta_remove)
  272. return wpa_s->driver->sta_remove(wpa_s->drv_priv, addr);
  273. return -1;
  274. }
  275. static inline int wpa_drv_hapd_send_eapol(struct wpa_supplicant *wpa_s,
  276. const u8 *addr, const u8 *data,
  277. size_t data_len, int encrypt,
  278. const u8 *own_addr, u32 flags)
  279. {
  280. if (wpa_s->driver->hapd_send_eapol)
  281. return wpa_s->driver->hapd_send_eapol(wpa_s->drv_priv, addr,
  282. data, data_len, encrypt,
  283. own_addr, flags);
  284. return -1;
  285. }
  286. static inline int wpa_drv_sta_set_flags(struct wpa_supplicant *wpa_s,
  287. const u8 *addr, int total_flags,
  288. int flags_or, int flags_and)
  289. {
  290. if (wpa_s->driver->sta_set_flags)
  291. return wpa_s->driver->sta_set_flags(wpa_s->drv_priv, addr,
  292. total_flags, flags_or,
  293. flags_and);
  294. return -1;
  295. }
  296. static inline int wpa_drv_set_supp_port(struct wpa_supplicant *wpa_s,
  297. int authorized)
  298. {
  299. if (wpa_s->driver->set_supp_port) {
  300. return wpa_s->driver->set_supp_port(wpa_s->drv_priv,
  301. authorized);
  302. }
  303. return 0;
  304. }
  305. static inline int wpa_drv_send_action(struct wpa_supplicant *wpa_s,
  306. unsigned int freq,
  307. unsigned int wait,
  308. const u8 *dst, const u8 *src,
  309. const u8 *bssid,
  310. const u8 *data, size_t data_len,
  311. int no_cck)
  312. {
  313. if (wpa_s->driver->send_action)
  314. return wpa_s->driver->send_action(wpa_s->drv_priv, freq,
  315. wait, dst, src, bssid,
  316. data, data_len, no_cck);
  317. return -1;
  318. }
  319. static inline void wpa_drv_send_action_cancel_wait(struct wpa_supplicant *wpa_s)
  320. {
  321. if (wpa_s->driver->send_action_cancel_wait)
  322. wpa_s->driver->send_action_cancel_wait(wpa_s->drv_priv);
  323. }
  324. static inline int wpa_drv_set_freq(struct wpa_supplicant *wpa_s,
  325. struct hostapd_freq_params *freq)
  326. {
  327. if (wpa_s->driver->set_freq)
  328. return wpa_s->driver->set_freq(wpa_s->drv_priv, freq);
  329. return -1;
  330. }
  331. static inline int wpa_drv_if_add(struct wpa_supplicant *wpa_s,
  332. enum wpa_driver_if_type type,
  333. const char *ifname, const u8 *addr,
  334. void *bss_ctx, char *force_ifname,
  335. u8 *if_addr, const char *bridge)
  336. {
  337. if (wpa_s->driver->if_add)
  338. return wpa_s->driver->if_add(wpa_s->drv_priv, type, ifname,
  339. addr, bss_ctx, NULL, force_ifname,
  340. if_addr, bridge);
  341. return -1;
  342. }
  343. static inline int wpa_drv_if_remove(struct wpa_supplicant *wpa_s,
  344. enum wpa_driver_if_type type,
  345. const char *ifname)
  346. {
  347. if (wpa_s->driver->if_remove)
  348. return wpa_s->driver->if_remove(wpa_s->drv_priv, type, ifname);
  349. return -1;
  350. }
  351. static inline int wpa_drv_remain_on_channel(struct wpa_supplicant *wpa_s,
  352. unsigned int freq,
  353. unsigned int duration)
  354. {
  355. if (wpa_s->driver->remain_on_channel)
  356. return wpa_s->driver->remain_on_channel(wpa_s->drv_priv, freq,
  357. duration);
  358. return -1;
  359. }
  360. static inline int wpa_drv_cancel_remain_on_channel(
  361. struct wpa_supplicant *wpa_s)
  362. {
  363. if (wpa_s->driver->cancel_remain_on_channel)
  364. return wpa_s->driver->cancel_remain_on_channel(
  365. wpa_s->drv_priv);
  366. return -1;
  367. }
  368. static inline int wpa_drv_probe_req_report(struct wpa_supplicant *wpa_s,
  369. int report)
  370. {
  371. if (wpa_s->driver->probe_req_report)
  372. return wpa_s->driver->probe_req_report(wpa_s->drv_priv,
  373. report);
  374. return -1;
  375. }
  376. static inline int wpa_drv_deinit_ap(struct wpa_supplicant *wpa_s)
  377. {
  378. if (wpa_s->driver->deinit_ap)
  379. return wpa_s->driver->deinit_ap(wpa_s->drv_priv);
  380. return 0;
  381. }
  382. static inline void wpa_drv_suspend(struct wpa_supplicant *wpa_s)
  383. {
  384. if (wpa_s->driver->suspend)
  385. wpa_s->driver->suspend(wpa_s->drv_priv);
  386. }
  387. static inline void wpa_drv_resume(struct wpa_supplicant *wpa_s)
  388. {
  389. if (wpa_s->driver->resume)
  390. wpa_s->driver->resume(wpa_s->drv_priv);
  391. }
  392. static inline int wpa_drv_signal_monitor(struct wpa_supplicant *wpa_s,
  393. int threshold, int hysteresis)
  394. {
  395. if (wpa_s->driver->signal_monitor)
  396. return wpa_s->driver->signal_monitor(wpa_s->drv_priv,
  397. threshold, hysteresis);
  398. return -1;
  399. }
  400. static inline int wpa_drv_signal_poll(struct wpa_supplicant *wpa_s,
  401. struct wpa_signal_info *si)
  402. {
  403. if (wpa_s->driver->signal_poll)
  404. return wpa_s->driver->signal_poll(wpa_s->drv_priv, si);
  405. return -1;
  406. }
  407. static inline int wpa_drv_set_ap_wps_ie(struct wpa_supplicant *wpa_s,
  408. const struct wpabuf *beacon,
  409. const struct wpabuf *proberesp,
  410. const struct wpabuf *assocresp)
  411. {
  412. if (!wpa_s->driver->set_ap_wps_ie)
  413. return -1;
  414. return wpa_s->driver->set_ap_wps_ie(wpa_s->drv_priv, beacon,
  415. proberesp, assocresp);
  416. }
  417. static inline int wpa_drv_shared_freq(struct wpa_supplicant *wpa_s)
  418. {
  419. if (!wpa_s->driver->shared_freq)
  420. return -1;
  421. return wpa_s->driver->shared_freq(wpa_s->drv_priv);
  422. }
  423. static inline int wpa_drv_get_noa(struct wpa_supplicant *wpa_s,
  424. u8 *buf, size_t buf_len)
  425. {
  426. if (!wpa_s->driver->get_noa)
  427. return -1;
  428. return wpa_s->driver->get_noa(wpa_s->drv_priv, buf, buf_len);
  429. }
  430. static inline int wpa_drv_set_p2p_powersave(struct wpa_supplicant *wpa_s,
  431. int legacy_ps, int opp_ps,
  432. int ctwindow)
  433. {
  434. if (!wpa_s->driver->set_p2p_powersave)
  435. return -1;
  436. return wpa_s->driver->set_p2p_powersave(wpa_s->drv_priv, legacy_ps,
  437. opp_ps, ctwindow);
  438. }
  439. static inline int wpa_drv_ampdu(struct wpa_supplicant *wpa_s, int ampdu)
  440. {
  441. if (!wpa_s->driver->ampdu)
  442. return -1;
  443. return wpa_s->driver->ampdu(wpa_s->drv_priv, ampdu);
  444. }
  445. static inline int wpa_drv_p2p_find(struct wpa_supplicant *wpa_s,
  446. unsigned int timeout, int type)
  447. {
  448. if (!wpa_s->driver->p2p_find)
  449. return -1;
  450. return wpa_s->driver->p2p_find(wpa_s->drv_priv, timeout, type);
  451. }
  452. static inline int wpa_drv_p2p_stop_find(struct wpa_supplicant *wpa_s)
  453. {
  454. if (!wpa_s->driver->p2p_stop_find)
  455. return -1;
  456. return wpa_s->driver->p2p_stop_find(wpa_s->drv_priv);
  457. }
  458. static inline int wpa_drv_p2p_listen(struct wpa_supplicant *wpa_s,
  459. unsigned int timeout)
  460. {
  461. if (!wpa_s->driver->p2p_listen)
  462. return -1;
  463. return wpa_s->driver->p2p_listen(wpa_s->drv_priv, timeout);
  464. }
  465. static inline int wpa_drv_p2p_connect(struct wpa_supplicant *wpa_s,
  466. const u8 *peer_addr, int wps_method,
  467. int go_intent,
  468. const u8 *own_interface_addr,
  469. unsigned int force_freq,
  470. int persistent_group)
  471. {
  472. if (!wpa_s->driver->p2p_connect)
  473. return -1;
  474. return wpa_s->driver->p2p_connect(wpa_s->drv_priv, peer_addr,
  475. wps_method, go_intent,
  476. own_interface_addr, force_freq,
  477. persistent_group);
  478. }
  479. static inline int wpa_drv_wps_success_cb(struct wpa_supplicant *wpa_s,
  480. const u8 *peer_addr)
  481. {
  482. if (!wpa_s->driver->wps_success_cb)
  483. return -1;
  484. return wpa_s->driver->wps_success_cb(wpa_s->drv_priv, peer_addr);
  485. }
  486. static inline int
  487. wpa_drv_p2p_group_formation_failed(struct wpa_supplicant *wpa_s)
  488. {
  489. if (!wpa_s->driver->p2p_group_formation_failed)
  490. return -1;
  491. return wpa_s->driver->p2p_group_formation_failed(wpa_s->drv_priv);
  492. }
  493. static inline int wpa_drv_p2p_set_params(struct wpa_supplicant *wpa_s,
  494. const struct p2p_params *params)
  495. {
  496. if (!wpa_s->driver->p2p_set_params)
  497. return -1;
  498. return wpa_s->driver->p2p_set_params(wpa_s->drv_priv, params);
  499. }
  500. static inline int wpa_drv_p2p_prov_disc_req(struct wpa_supplicant *wpa_s,
  501. const u8 *peer_addr,
  502. u16 config_methods, int join)
  503. {
  504. if (!wpa_s->driver->p2p_prov_disc_req)
  505. return -1;
  506. return wpa_s->driver->p2p_prov_disc_req(wpa_s->drv_priv, peer_addr,
  507. config_methods, join);
  508. }
  509. static inline u64 wpa_drv_p2p_sd_request(struct wpa_supplicant *wpa_s,
  510. const u8 *dst,
  511. const struct wpabuf *tlvs)
  512. {
  513. if (!wpa_s->driver->p2p_sd_request)
  514. return 0;
  515. return wpa_s->driver->p2p_sd_request(wpa_s->drv_priv, dst, tlvs);
  516. }
  517. static inline int wpa_drv_p2p_sd_cancel_request(struct wpa_supplicant *wpa_s,
  518. u64 req)
  519. {
  520. if (!wpa_s->driver->p2p_sd_cancel_request)
  521. return -1;
  522. return wpa_s->driver->p2p_sd_cancel_request(wpa_s->drv_priv, req);
  523. }
  524. static inline int wpa_drv_p2p_sd_response(struct wpa_supplicant *wpa_s,
  525. int freq, const u8 *dst,
  526. u8 dialog_token,
  527. const struct wpabuf *resp_tlvs)
  528. {
  529. if (!wpa_s->driver->p2p_sd_response)
  530. return -1;
  531. return wpa_s->driver->p2p_sd_response(wpa_s->drv_priv, freq, dst,
  532. dialog_token, resp_tlvs);
  533. }
  534. static inline int wpa_drv_p2p_service_update(struct wpa_supplicant *wpa_s)
  535. {
  536. if (!wpa_s->driver->p2p_service_update)
  537. return -1;
  538. return wpa_s->driver->p2p_service_update(wpa_s->drv_priv);
  539. }
  540. static inline int wpa_drv_p2p_reject(struct wpa_supplicant *wpa_s,
  541. const u8 *addr)
  542. {
  543. if (!wpa_s->driver->p2p_reject)
  544. return -1;
  545. return wpa_s->driver->p2p_reject(wpa_s->drv_priv, addr);
  546. }
  547. static inline int wpa_drv_p2p_invite(struct wpa_supplicant *wpa_s,
  548. const u8 *peer, int role, const u8 *bssid,
  549. const u8 *ssid, size_t ssid_len,
  550. const u8 *go_dev_addr,
  551. int persistent_group)
  552. {
  553. if (!wpa_s->driver->p2p_invite)
  554. return -1;
  555. return wpa_s->driver->p2p_invite(wpa_s->drv_priv, peer, role, bssid,
  556. ssid, ssid_len, go_dev_addr,
  557. persistent_group);
  558. }
  559. static inline int wpa_drv_send_tdls_mgmt(struct wpa_supplicant *wpa_s,
  560. const u8 *dst, u8 action_code,
  561. u8 dialog_token, u16 status_code,
  562. const u8 *buf, size_t len)
  563. {
  564. if (wpa_s->driver->send_tdls_mgmt) {
  565. return wpa_s->driver->send_tdls_mgmt(wpa_s->drv_priv, dst,
  566. action_code, dialog_token,
  567. status_code, buf, len);
  568. }
  569. return -1;
  570. }
  571. static inline int wpa_drv_tdls_oper(struct wpa_supplicant *wpa_s,
  572. enum tdls_oper oper, const u8 *peer)
  573. {
  574. if (!wpa_s->driver->tdls_oper)
  575. return -1;
  576. return wpa_s->driver->tdls_oper(wpa_s->drv_priv, oper, peer);
  577. }
  578. static inline void wpa_drv_set_rekey_info(struct wpa_supplicant *wpa_s,
  579. const u8 *kek, const u8 *kck,
  580. const u8 *replay_ctr)
  581. {
  582. if (!wpa_s->driver->set_rekey_info)
  583. return;
  584. wpa_s->driver->set_rekey_info(wpa_s->drv_priv, kek, kck, replay_ctr);
  585. }
  586. static inline int wpa_drv_radio_disable(struct wpa_supplicant *wpa_s,
  587. int disabled)
  588. {
  589. if (!wpa_s->driver->radio_disable)
  590. return -1;
  591. return wpa_s->driver->radio_disable(wpa_s->drv_priv, disabled);
  592. }
  593. #endif /* DRIVER_I_H */