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