您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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