• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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, int multi_ap_backhaul_sta);
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 void wpas_wps_pbc_overlap(struct wpa_supplicant *wpa_s);
37 int wpas_wps_cancel(struct wpa_supplicant *wpa_s);
38 int wpas_wps_start_reg(struct wpa_supplicant *wpa_s, const u8 *bssid,
39 		       const char *pin, struct wps_new_ap_settings *settings);
40 int wpas_wps_ssid_bss_match(struct wpa_supplicant *wpa_s,
41 			    struct wpa_ssid *ssid, struct wpa_bss *bss);
42 int wpas_wps_ssid_wildcard_ok(struct wpa_supplicant *wpa_s,
43 			      struct wpa_ssid *ssid, struct wpa_bss *bss);
44 int wpas_wps_scan_pbc_overlap(struct wpa_supplicant *wpa_s,
45 			      struct wpa_bss *selected, struct wpa_ssid *ssid);
46 void wpas_wps_notify_scan_results(struct wpa_supplicant *wpa_s);
47 int wpas_wps_searching(struct wpa_supplicant *wpa_s);
48 int wpas_wps_scan_result_text(const u8 *ies, size_t ies_len, char *pos,
49 			      char *end);
50 int wpas_wps_er_start(struct wpa_supplicant *wpa_s, const char *filter);
51 void wpas_wps_er_stop(struct wpa_supplicant *wpa_s);
52 int wpas_wps_er_add_pin(struct wpa_supplicant *wpa_s, const u8 *addr,
53 			const char *uuid, const char *pin);
54 int wpas_wps_er_pbc(struct wpa_supplicant *wpa_s, const char *uuid);
55 int wpas_wps_er_learn(struct wpa_supplicant *wpa_s, const char *uuid,
56 		      const char *pin);
57 int wpas_wps_er_set_config(struct wpa_supplicant *wpa_s, const char *uuid,
58 			   int id);
59 int wpas_wps_er_config(struct wpa_supplicant *wpa_s, const char *uuid,
60 		       const char *pin, struct wps_new_ap_settings *settings);
61 struct wpabuf * wpas_wps_er_nfc_config_token(struct wpa_supplicant *wpa_s,
62 					     int ndef, const char *uuid);
63 int wpas_wps_terminate_pending(struct wpa_supplicant *wpa_s);
64 void wpas_wps_update_config(struct wpa_supplicant *wpa_s);
65 struct wpabuf * wpas_wps_network_config_token(struct wpa_supplicant *wpa_s,
66 					  int ndef, struct wpa_ssid * ssid);
67 struct wpabuf * wpas_wps_nfc_config_token(struct wpa_supplicant *wpa_s,
68 					  int ndef, const char *id_str);
69 struct wpabuf * wpas_wps_nfc_token(struct wpa_supplicant *wpa_s, int ndef);
70 int wpas_wps_start_nfc(struct wpa_supplicant *wpa_s, const u8 *dev_addr,
71 		       const u8 *bssid,
72 		       const struct wpabuf *dev_pw, u16 dev_pw_id,
73 		       int p2p_group, const u8 *peer_pubkey_hash,
74 		       const u8 *ssid, size_t ssid_len, int freq);
75 int wpas_wps_nfc_tag_read(struct wpa_supplicant *wpa_s,
76 			  const struct wpabuf *data, int forced_freq);
77 struct wpabuf * wpas_wps_nfc_handover_req(struct wpa_supplicant *wpa_s,
78 					  int ndef);
79 struct wpabuf * wpas_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s,
80 					  int ndef, int cr, const char *uuid);
81 int wpas_wps_nfc_report_handover(struct wpa_supplicant *wpa_s,
82 				 const struct wpabuf *req,
83 				 const struct wpabuf *sel);
84 int wpas_er_wps_nfc_report_handover(struct wpa_supplicant *wpa_s,
85 				    const struct wpabuf *req,
86 				    const struct wpabuf *sel);
87 void wpas_wps_update_ap_info(struct wpa_supplicant *wpa_s,
88 			     struct wpa_scan_results *scan_res);
89 void wpas_wps_notify_assoc(struct wpa_supplicant *wpa_s, const u8 *bssid);
90 int wpas_wps_reenable_networks_pending(struct wpa_supplicant *wpa_s);
91 
92 #else /* CONFIG_WPS */
93 
wpas_wps_init(struct wpa_supplicant * wpa_s)94 static inline int wpas_wps_init(struct wpa_supplicant *wpa_s)
95 {
96 	return 0;
97 }
98 
wpas_wps_deinit(struct wpa_supplicant * wpa_s)99 static inline void wpas_wps_deinit(struct wpa_supplicant *wpa_s)
100 {
101 }
102 
wpas_wps_eapol_cb(struct wpa_supplicant * wpa_s)103 static inline int wpas_wps_eapol_cb(struct wpa_supplicant *wpa_s)
104 {
105 	return 0;
106 }
107 
wpas_wps_get_req_type(struct wpa_ssid * ssid)108 static inline u8 wpas_wps_get_req_type(struct wpa_ssid *ssid)
109 {
110 	return 0;
111 }
112 
wpas_wps_ssid_bss_match(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid,struct wpa_bss * bss)113 static inline int wpas_wps_ssid_bss_match(struct wpa_supplicant *wpa_s,
114 					  struct wpa_ssid *ssid,
115 					  struct wpa_bss *bss)
116 {
117 	return -1;
118 }
119 
wpas_wps_ssid_wildcard_ok(struct wpa_supplicant * wpa_s,struct wpa_ssid * ssid,struct wpa_bss * bss)120 static inline int wpas_wps_ssid_wildcard_ok(struct wpa_supplicant *wpa_s,
121 					    struct wpa_ssid *ssid,
122 					    struct wpa_bss *bss)
123 {
124 	return 0;
125 }
126 
wpas_wps_scan_pbc_overlap(struct wpa_supplicant * wpa_s,struct wpa_bss * selected,struct wpa_ssid * ssid)127 static inline int wpas_wps_scan_pbc_overlap(struct wpa_supplicant *wpa_s,
128 					    struct wpa_bss *selected,
129 					    struct wpa_ssid *ssid)
130 {
131 	return 0;
132 }
133 
wpas_wps_notify_scan_results(struct wpa_supplicant * wpa_s)134 static inline void wpas_wps_notify_scan_results(struct wpa_supplicant *wpa_s)
135 {
136 }
137 
wpas_wps_searching(struct wpa_supplicant * wpa_s)138 static inline int wpas_wps_searching(struct wpa_supplicant *wpa_s)
139 {
140 	return 0;
141 }
142 
wpas_wps_update_ap_info(struct wpa_supplicant * wpa_s,struct wpa_scan_results * scan_res)143 static inline void wpas_wps_update_ap_info(struct wpa_supplicant *wpa_s,
144 					   struct wpa_scan_results *scan_res)
145 {
146 }
147 
wpas_wps_notify_assoc(struct wpa_supplicant * wpa_s,const u8 * bssid)148 static inline void wpas_wps_notify_assoc(struct wpa_supplicant *wpa_s,
149 					 const u8 *bssid)
150 {
151 }
152 
153 static inline int
wpas_wps_reenable_networks_pending(struct wpa_supplicant * wpa_s)154 wpas_wps_reenable_networks_pending(struct wpa_supplicant *wpa_s)
155 {
156 	return 0;
157 }
158 
159 #endif /* CONFIG_WPS */
160 
161 #endif /* WPS_SUPPLICANT_H */
162