wps_supplicant.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /*
  2. * wpa_supplicant / WPS integration
  3. * Copyright (c) 2008-2012, 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 WPS_SUPPLICANT_H
  9. #define WPS_SUPPLICANT_H
  10. struct wpa_scan_results;
  11. #ifdef CONFIG_WPS
  12. #include "wps/wps.h"
  13. #include "wps/wps_defs.h"
  14. struct wpa_bss;
  15. struct wps_new_ap_settings {
  16. const char *ssid_hex;
  17. const char *auth;
  18. const char *encr;
  19. const char *key_hex;
  20. };
  21. int wpas_wps_init(struct wpa_supplicant *wpa_s);
  22. void wpas_wps_deinit(struct wpa_supplicant *wpa_s);
  23. int wpas_wps_eapol_cb(struct wpa_supplicant *wpa_s);
  24. enum wps_request_type wpas_wps_get_req_type(struct wpa_ssid *ssid);
  25. int wpas_wps_start_pbc(struct wpa_supplicant *wpa_s, const u8 *bssid,
  26. int p2p_group);
  27. int wpas_wps_start_pin(struct wpa_supplicant *wpa_s, const u8 *bssid,
  28. const char *pin, int p2p_group, u16 dev_pw_id);
  29. int wpas_wps_cancel(struct wpa_supplicant *wpa_s);
  30. int wpas_wps_start_reg(struct wpa_supplicant *wpa_s, const u8 *bssid,
  31. const char *pin, struct wps_new_ap_settings *settings);
  32. int wpas_wps_ssid_bss_match(struct wpa_supplicant *wpa_s,
  33. struct wpa_ssid *ssid, struct wpa_bss *bss);
  34. int wpas_wps_ssid_wildcard_ok(struct wpa_supplicant *wpa_s,
  35. struct wpa_ssid *ssid, struct wpa_bss *bss);
  36. int wpas_wps_scan_pbc_overlap(struct wpa_supplicant *wpa_s,
  37. struct wpa_bss *selected, struct wpa_ssid *ssid);
  38. void wpas_wps_notify_scan_results(struct wpa_supplicant *wpa_s);
  39. int wpas_wps_searching(struct wpa_supplicant *wpa_s);
  40. int wpas_wps_scan_result_text(const u8 *ies, size_t ies_len, char *pos,
  41. char *end);
  42. int wpas_wps_er_start(struct wpa_supplicant *wpa_s, const char *filter);
  43. int wpas_wps_er_stop(struct wpa_supplicant *wpa_s);
  44. int wpas_wps_er_add_pin(struct wpa_supplicant *wpa_s, const u8 *addr,
  45. const char *uuid, const char *pin);
  46. int wpas_wps_er_pbc(struct wpa_supplicant *wpa_s, const char *uuid);
  47. int wpas_wps_er_learn(struct wpa_supplicant *wpa_s, const char *uuid,
  48. const char *pin);
  49. int wpas_wps_er_set_config(struct wpa_supplicant *wpa_s, const char *uuid,
  50. int id);
  51. int wpas_wps_er_config(struct wpa_supplicant *wpa_s, const char *uuid,
  52. const char *pin, struct wps_new_ap_settings *settings);
  53. struct wpabuf * wpas_wps_er_nfc_config_token(struct wpa_supplicant *wpa_s,
  54. int ndef, const char *uuid);
  55. int wpas_wps_terminate_pending(struct wpa_supplicant *wpa_s);
  56. int wpas_wps_in_progress(struct wpa_supplicant *wpa_s);
  57. void wpas_wps_update_config(struct wpa_supplicant *wpa_s);
  58. struct wpabuf * wpas_wps_nfc_config_token(struct wpa_supplicant *wpa_s,
  59. int ndef);
  60. struct wpabuf * wpas_wps_nfc_token(struct wpa_supplicant *wpa_s, int ndef);
  61. int wpas_wps_start_nfc(struct wpa_supplicant *wpa_s, const u8 *bssid);
  62. int wpas_wps_nfc_tag_read(struct wpa_supplicant *wpa_s,
  63. const struct wpabuf *data);
  64. struct wpabuf * wpas_wps_nfc_handover_req(struct wpa_supplicant *wpa_s, int cr);
  65. struct wpabuf * wpas_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s);
  66. int wpas_wps_nfc_rx_handover_req(struct wpa_supplicant *wpa_s,
  67. const struct wpabuf *data);
  68. int wpas_wps_nfc_rx_handover_sel(struct wpa_supplicant *wpa_s,
  69. const struct wpabuf *data);
  70. int wpas_wps_nfc_report_handover(struct wpa_supplicant *wpa_s,
  71. const struct wpabuf *req,
  72. const struct wpabuf *sel);
  73. void wpas_wps_update_ap_info(struct wpa_supplicant *wpa_s,
  74. struct wpa_scan_results *scan_res);
  75. void wpas_wps_notify_assoc(struct wpa_supplicant *wpa_s, const u8 *bssid);
  76. #else /* CONFIG_WPS */
  77. static inline int wpas_wps_init(struct wpa_supplicant *wpa_s)
  78. {
  79. return 0;
  80. }
  81. static inline void wpas_wps_deinit(struct wpa_supplicant *wpa_s)
  82. {
  83. }
  84. static inline int wpas_wps_eapol_cb(struct wpa_supplicant *wpa_s)
  85. {
  86. return 0;
  87. }
  88. static inline u8 wpas_wps_get_req_type(struct wpa_ssid *ssid)
  89. {
  90. return 0;
  91. }
  92. static inline int wpas_wps_ssid_bss_match(struct wpa_supplicant *wpa_s,
  93. struct wpa_ssid *ssid,
  94. struct wpa_bss *bss)
  95. {
  96. return -1;
  97. }
  98. static inline int wpas_wps_ssid_wildcard_ok(struct wpa_supplicant *wpa_s,
  99. struct wpa_ssid *ssid,
  100. struct wpa_bss *bss)
  101. {
  102. return 0;
  103. }
  104. static inline int wpas_wps_scan_pbc_overlap(struct wpa_supplicant *wpa_s,
  105. struct wpa_bss *selected,
  106. struct wpa_ssid *ssid)
  107. {
  108. return 0;
  109. }
  110. static inline void wpas_wps_notify_scan_results(struct wpa_supplicant *wpa_s)
  111. {
  112. }
  113. static inline int wpas_wps_searching(struct wpa_supplicant *wpa_s)
  114. {
  115. return 0;
  116. }
  117. static inline void wpas_wps_update_ap_info(struct wpa_supplicant *wpa_s,
  118. struct wpa_scan_results *scan_res)
  119. {
  120. }
  121. static inline void wpas_wps_notify_assoc(struct wpa_supplicant *wpa_s,
  122. const u8 *bssid)
  123. {
  124. }
  125. #endif /* CONFIG_WPS */
  126. #endif /* WPS_SUPPLICANT_H */