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
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 void wpas_wps_update_config(struct wpa_supplicant *wpa_s);
64 struct wpabuf * wpas_wps_nfc_config_token(struct wpa_supplicant *wpa_s,
65 int ndef, const char *id_str);
66 struct wpabuf * wpas_wps_nfc_token(struct wpa_supplicant *wpa_s, int ndef);
67 int wpas_wps_start_nfc(struct wpa_supplicant *wpa_s, const u8 *dev_addr,
68 const u8 *bssid,
69 const struct wpabuf *dev_pw, u16 dev_pw_id,
70 int p2p_group, const u8 *peer_pubkey_hash,
71 const u8 *ssid, size_t ssid_len, int freq);
72 int wpas_wps_nfc_tag_read(struct wpa_supplicant *wpa_s,
73 const struct wpabuf *data, int forced_freq);
74 struct wpabuf * wpas_wps_nfc_handover_req(struct wpa_supplicant *wpa_s,
75 int ndef);
76 struct wpabuf * wpas_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s,
77 int ndef, int cr, const char *uuid);
78 int wpas_wps_nfc_report_handover(struct wpa_supplicant *wpa_s,
79 const struct wpabuf *req,
80 const struct wpabuf *sel);
81 int wpas_er_wps_nfc_report_handover(struct wpa_supplicant *wpa_s,
82 const struct wpabuf *req,
83 const struct wpabuf *sel);
84 void wpas_wps_update_ap_info(struct wpa_supplicant *wpa_s,
85 struct wpa_scan_results *scan_res);
86 void wpas_wps_notify_assoc(struct wpa_supplicant *wpa_s, const u8 *bssid);
87
88 #else /* CONFIG_WPS */
89
wpas_wps_init(struct wpa_supplicant * wpa_s)90 static inline int wpas_wps_init(struct wpa_supplicant *wpa_s)
91 {
92 return 0;
93 }
94
wpas_wps_deinit(struct wpa_supplicant * wpa_s)95 static inline void wpas_wps_deinit(struct wpa_supplicant *wpa_s)
96 {
97 }
98
wpas_wps_eapol_cb(struct wpa_supplicant * wpa_s)99 static inline int wpas_wps_eapol_cb(struct wpa_supplicant *wpa_s)
100 {
101 return 0;
102 }
103
wpas_wps_get_req_type(struct wpa_ssid * ssid)104 static inline u8 wpas_wps_get_req_type(struct wpa_ssid *ssid)
105 {
106 return 0;
107 }
108
wpas_wps_ssid_bss_match(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid,struct wpa_bss * bss)109 static inline int wpas_wps_ssid_bss_match(struct wpa_supplicant *wpa_s,
110 struct wpa_ssid *ssid,
111 struct wpa_bss *bss)
112 {
113 return -1;
114 }
115
wpas_wps_ssid_wildcard_ok(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid,struct wpa_bss * bss)116 static inline int wpas_wps_ssid_wildcard_ok(struct wpa_supplicant *wpa_s,
117 struct wpa_ssid *ssid,
118 struct wpa_bss *bss)
119 {
120 return 0;
121 }
122
wpas_wps_scan_pbc_overlap(struct wpa_supplicant * wpa_s,struct wpa_bss * selected,struct wpa_ssid * ssid)123 static inline int wpas_wps_scan_pbc_overlap(struct wpa_supplicant *wpa_s,
124 struct wpa_bss *selected,
125 struct wpa_ssid *ssid)
126 {
127 return 0;
128 }
129
wpas_wps_notify_scan_results(struct wpa_supplicant * wpa_s)130 static inline void wpas_wps_notify_scan_results(struct wpa_supplicant *wpa_s)
131 {
132 }
133
wpas_wps_searching(struct wpa_supplicant * wpa_s)134 static inline int wpas_wps_searching(struct wpa_supplicant *wpa_s)
135 {
136 return 0;
137 }
138
wpas_wps_update_ap_info(struct wpa_supplicant * wpa_s,struct wpa_scan_results * scan_res)139 static inline void wpas_wps_update_ap_info(struct wpa_supplicant *wpa_s,
140 struct wpa_scan_results *scan_res)
141 {
142 }
143
wpas_wps_notify_assoc(struct wpa_supplicant * wpa_s,const u8 * bssid)144 static inline void wpas_wps_notify_assoc(struct wpa_supplicant *wpa_s,
145 const u8 *bssid)
146 {
147 }
148
149 #endif /* CONFIG_WPS */
150
151 #endif /* WPS_SUPPLICANT_H */
152