xref: /freebsd/contrib/wpa/wpa_supplicant/wps_supplicant.h (revision a98ff317388a00b992f1bf8404dee596f9383f5e)
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 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_token(struct wpa_supplicant *wpa_s, int ndef);
66 int wpas_wps_start_nfc(struct wpa_supplicant *wpa_s, const u8 *bssid);
67 int wpas_wps_nfc_tag_read(struct wpa_supplicant *wpa_s,
68 			  const struct wpabuf *data);
69 struct wpabuf * wpas_wps_nfc_handover_req(struct wpa_supplicant *wpa_s);
70 struct wpabuf * wpas_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s);
71 int wpas_wps_nfc_rx_handover_req(struct wpa_supplicant *wpa_s,
72 				 const struct wpabuf *data);
73 int wpas_wps_nfc_rx_handover_sel(struct wpa_supplicant *wpa_s,
74 				 const struct wpabuf *data);
75 void wpas_wps_update_ap_info(struct wpa_supplicant *wpa_s,
76 			     struct wpa_scan_results *scan_res);
77 void wpas_wps_notify_assoc(struct wpa_supplicant *wpa_s, const u8 *bssid);
78 
79 #else /* CONFIG_WPS */
80 
81 static inline int wpas_wps_init(struct wpa_supplicant *wpa_s)
82 {
83 	return 0;
84 }
85 
86 static inline void wpas_wps_deinit(struct wpa_supplicant *wpa_s)
87 {
88 }
89 
90 static inline int wpas_wps_eapol_cb(struct wpa_supplicant *wpa_s)
91 {
92 	return 0;
93 }
94 
95 static inline u8 wpas_wps_get_req_type(struct wpa_ssid *ssid)
96 {
97 	return 0;
98 }
99 
100 static inline int wpas_wps_ssid_bss_match(struct wpa_supplicant *wpa_s,
101 					  struct wpa_ssid *ssid,
102 					  struct wpa_bss *bss)
103 {
104 	return -1;
105 }
106 
107 static inline int wpas_wps_ssid_wildcard_ok(struct wpa_supplicant *wpa_s,
108 					    struct wpa_ssid *ssid,
109 					    struct wpa_bss *bss)
110 {
111 	return 0;
112 }
113 
114 static inline int wpas_wps_scan_pbc_overlap(struct wpa_supplicant *wpa_s,
115 					    struct wpa_bss *selected,
116 					    struct wpa_ssid *ssid)
117 {
118 	return 0;
119 }
120 
121 static inline void wpas_wps_notify_scan_results(struct wpa_supplicant *wpa_s)
122 {
123 }
124 
125 static inline int wpas_wps_searching(struct wpa_supplicant *wpa_s)
126 {
127 	return 0;
128 }
129 
130 static inline void wpas_wps_update_ap_info(struct wpa_supplicant *wpa_s,
131 					   struct wpa_scan_results *scan_res)
132 {
133 }
134 
135 static inline void wpas_wps_notify_assoc(struct wpa_supplicant *wpa_s,
136 					 const u8 *bssid)
137 {
138 }
139 
140 #endif /* CONFIG_WPS */
141 
142 #endif /* WPS_SUPPLICANT_H */
143