• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * hidl interface for wpa_supplicant daemon
3  * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
4  * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
5  *
6  * This software may be distributed under the terms of the BSD license.
7  * See README for more details.
8  */
9 
10 #ifndef WPA_SUPPLICANT_HIDL_HIDL_MANAGER_H
11 #define WPA_SUPPLICANT_HIDL_HIDL_MANAGER_H
12 
13 #include <map>
14 #include <string>
15 
16 #include <android/hardware/wifi/supplicant/1.0/ISupplicantCallback.h>
17 #include <android/hardware/wifi/supplicant/1.0/ISupplicantP2pIfaceCallback.h>
18 #include <android/hardware/wifi/supplicant/1.0/ISupplicantP2pNetworkCallback.h>
19 #include <android/hardware/wifi/supplicant/1.4/ISupplicantStaIfaceCallback.h>
20 #include <android/hardware/wifi/supplicant/1.0/ISupplicantStaNetworkCallback.h>
21 #include <android/hardware/wifi/supplicant/1.4/ISupplicantStaNetworkCallback.h>
22 
23 #include "p2p_iface.h"
24 #include "p2p_network.h"
25 #include "rsn_supp/pmksa_cache.h"
26 #include "sta_iface.h"
27 #include "sta_network.h"
28 #include "supplicant.h"
29 
30 extern "C"
31 {
32 #include "utils/common.h"
33 #include "utils/includes.h"
34 #include "wpa_supplicant_i.h"
35 #include "driver_i.h"
36 }
37 
38 class DeathNotifier : public android::hardware::hidl_death_recipient
39 {
40 public:
DeathNotifier(struct wpa_global * wpa_global)41 	DeathNotifier(struct wpa_global *wpa_global)
42 	    : wpa_global_(wpa_global)
43 	{}
44 
serviceDied(uint64_t,const android::wp<android::hidl::base::V1_0::IBase> &)45 	void serviceDied(
46 	    uint64_t /*cookie*/,
47 	    const android::wp<android::hidl::base::V1_0::IBase>
48 		& /* who */) override
49 	{
50 		wpa_printf(MSG_ERROR, "Client died. Terminating...");
51 		wpa_supplicant_terminate_proc(wpa_global_);
52 	}
53 
54 private:
55 	struct wpa_global *wpa_global_;
56 };
57 
58 namespace android {
59 namespace hardware {
60 namespace wifi {
61 namespace supplicant {
62 namespace V1_4 {
63 namespace implementation {
64 using V1_0::ISupplicant;
65 using V1_0::ISupplicantP2pIface;
66 using V1_0::ISupplicantStaIface;
67 using V1_0::ISupplicantStaIfaceCallback;
68 using V1_0::P2pGroupCapabilityMask;
69 using V1_0::WpsConfigMethods;
70 
71 /**
72  * HidlManager is responsible for managing the lifetime of all
73  * hidl objects created by wpa_supplicant. This is a singleton
74  * class which is created by the supplicant core and can be used
75  * to get references to the hidl objects.
76  */
77 class HidlManager
78 {
79 public:
80 	static HidlManager *getInstance();
81 	static void destroyInstance();
82 
83 	// Methods called from wpa_supplicant core.
84 	int registerHidlService(struct wpa_global *global);
85 	int registerInterface(struct wpa_supplicant *wpa_s);
86 	int unregisterInterface(struct wpa_supplicant *wpa_s);
87 	int registerNetwork(
88 	    struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
89 	int unregisterNetwork(
90 	    struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
91 	int notifyStateChange(struct wpa_supplicant *wpa_s);
92 	int notifyNetworkRequest(
93 	    struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, int type,
94 	    const char *param);
95 	void notifyAnqpQueryDone(
96 	    struct wpa_supplicant *wpa_s, const u8 *bssid, const char *result,
97 	    const struct wpa_bss_anqp *anqp);
98 	void notifyHs20IconQueryDone(
99 	    struct wpa_supplicant *wpa_s, const u8 *bssid,
100 	    const char *file_name, const u8 *image, u32 image_length);
101 	void notifyHs20RxSubscriptionRemediation(
102 	    struct wpa_supplicant *wpa_s, const char *url, u8 osu_method);
103 	void notifyHs20RxDeauthImminentNotice(
104 	    struct wpa_supplicant *wpa_s, u8 code, u16 reauth_delay,
105 		const char *url);
106 	void notifyHs20RxTermsAndConditionsAcceptance(
107 			struct wpa_supplicant *wpa_s, const char *url);
108 	void notifyDisconnectReason(struct wpa_supplicant *wpa_s);
109 	void notifyAssocReject(struct wpa_supplicant *wpa_s, const u8 *bssid,
110 	    u8 timed_out, const u8 *assoc_resp_ie, size_t assoc_resp_ie_len);
111 	void notifyAuthTimeout(struct wpa_supplicant *wpa_s);
112 	void notifyBssidChanged(struct wpa_supplicant *wpa_s);
113 	void notifyWpsEventFail(
114 	    struct wpa_supplicant *wpa_s, uint8_t *peer_macaddr,
115 	    uint16_t config_error, uint16_t error_indication);
116 	void notifyWpsEventSuccess(struct wpa_supplicant *wpa_s);
117 	void notifyWpsEventPbcOverlap(struct wpa_supplicant *wpa_s);
118 	void notifyP2pDeviceFound(
119 	    struct wpa_supplicant *wpa_s, const u8 *addr,
120 	    const struct p2p_peer_info *info, const u8 *peer_wfd_device_info,
121 	    u8 peer_wfd_device_info_len, const u8 *peer_wfd_r2_device_info,
122 	    u8 peer_wfd_r2_device_info_len);
123 	void notifyP2pDeviceLost(
124 	    struct wpa_supplicant *wpa_s, const u8 *p2p_device_addr);
125 	void notifyP2pFindStopped(struct wpa_supplicant *wpa_s);
126 	void notifyP2pGoNegReq(
127 	    struct wpa_supplicant *wpa_s, const u8 *src_addr, u16 dev_passwd_id,
128 	    u8 go_intent);
129 	void notifyP2pGoNegCompleted(
130 	    struct wpa_supplicant *wpa_s, const struct p2p_go_neg_results *res);
131 	void notifyP2pGroupFormationFailure(
132 	    struct wpa_supplicant *wpa_s, const char *reason);
133 	void notifyP2pGroupStarted(
134 	    struct wpa_supplicant *wpa_group_s, const struct wpa_ssid *ssid,
135 	    int persistent, int client);
136 	void notifyP2pGroupRemoved(
137 	    struct wpa_supplicant *wpa_group_s, const struct wpa_ssid *ssid,
138 	    const char *role);
139 	void notifyP2pInvitationReceived(
140 	    struct wpa_supplicant *wpa_s, const u8 *sa, const u8 *go_dev_addr,
141 	    const u8 *bssid, int id, int op_freq);
142 	void notifyP2pInvitationResult(
143 	    struct wpa_supplicant *wpa_s, int status, const u8 *bssid);
144 	void notifyP2pProvisionDiscovery(
145 	    struct wpa_supplicant *wpa_s, const u8 *dev_addr, int request,
146 	    enum p2p_prov_disc_status status, u16 config_methods,
147 	    unsigned int generated_pin);
148 	void notifyP2pSdResponse(
149 	    struct wpa_supplicant *wpa_s, const u8 *sa, u16 update_indic,
150 	    const u8 *tlvs, size_t tlvs_len);
151 	void notifyApStaAuthorized(
152 	    struct wpa_supplicant *wpa_s, const u8 *sta,
153 	    const u8 *p2p_dev_addr);
154 	void notifyApStaDeauthorized(
155 	    struct wpa_supplicant *wpa_s, const u8 *sta,
156 	    const u8 *p2p_dev_addr);
157 	void notifyEapError(struct wpa_supplicant *wpa_s, int error_code);
158 	void notifyDppConfigReceived(struct wpa_supplicant *wpa_s,
159 			struct wpa_ssid *config);
160 	void notifyDppConfigSent(struct wpa_supplicant *wpa_s);
161 	void notifyDppSuccess(struct wpa_supplicant *wpa_s, V1_3::DppSuccessCode code);
162 	void notifyDppFailure(struct wpa_supplicant *wpa_s,
163 			android::hardware::wifi::supplicant::V1_3::DppFailureCode code);
164 	void notifyDppFailure(struct wpa_supplicant *wpa_s,
165 			android::hardware::wifi::supplicant::V1_3::DppFailureCode code,
166 			const char *ssid, const char *channel_list, unsigned short band_list[],
167 			int size);
168 	void notifyDppProgress(struct wpa_supplicant *wpa_s,
169 			android::hardware::wifi::supplicant::V1_3::DppProgressCode code);
170 	void notifyPmkCacheAdded(struct wpa_supplicant *wpa_s,
171 			struct rsn_pmksa_cache_entry *pmksa_entry);
172 	void notifyBssTmStatus(struct wpa_supplicant *wpa_s);
173 	void notifyTransitionDisable(struct wpa_supplicant *wpa_s,
174 			struct wpa_ssid *ssid,
175 			u8 bitmap);
176 	void notifyNetworkNotFound(struct wpa_supplicant *wpa_s);
177 
178 	// Methods called from hidl objects.
179 	void notifyExtRadioWorkStart(struct wpa_supplicant *wpa_s, uint32_t id);
180 	void notifyExtRadioWorkTimeout(
181 	    struct wpa_supplicant *wpa_s, uint32_t id);
182 
183 	int getP2pIfaceHidlObjectByIfname(
184 	    const std::string &ifname,
185 	    android::sp<ISupplicantP2pIface> *iface_object);
186 	int getStaIfaceHidlObjectByIfname(
187 	    const std::string &ifname,
188 	    android::sp<V1_1::ISupplicantStaIface> *iface_object);
189 	int getP2pNetworkHidlObjectByIfnameAndNetworkId(
190 	    const std::string &ifname, int network_id,
191 	    android::sp<ISupplicantP2pNetwork> *network_object);
192 	int getStaNetworkHidlObjectByIfnameAndNetworkId(
193 	    const std::string &ifname, int network_id,
194 	    android::sp<V1_3::ISupplicantStaNetwork> *network_object);
195 	int addSupplicantCallbackHidlObject(
196 	    const android::sp<ISupplicantCallback> &callback);
197 	int addP2pIfaceCallbackHidlObject(
198 	    const std::string &ifname,
199 	    const android::sp<ISupplicantP2pIfaceCallback> &callback);
200 	int addStaIfaceCallbackHidlObject(
201 	    const std::string &ifname,
202 	    const android::sp<ISupplicantStaIfaceCallback> &callback);
203 	int addP2pNetworkCallbackHidlObject(
204 	    const std::string &ifname, int network_id,
205 	    const android::sp<ISupplicantP2pNetworkCallback> &callback);
206 	int addStaNetworkCallbackHidlObject(
207 	    const std::string &ifname, int network_id,
208 	    const android::sp<ISupplicantStaNetworkCallback> &callback);
209 
210 private:
211 	HidlManager() = default;
212 	~HidlManager() = default;
213 	HidlManager(const HidlManager &) = default;
214 	HidlManager &operator=(const HidlManager &) = default;
215 
216 	struct wpa_supplicant *getTargetP2pIfaceForGroup(
217 	    struct wpa_supplicant *wpa_s);
218 	void removeSupplicantCallbackHidlObject(
219 	    const android::sp<ISupplicantCallback> &callback);
220 	void removeP2pIfaceCallbackHidlObject(
221 	    const std::string &ifname,
222 	    const android::sp<ISupplicantP2pIfaceCallback> &callback);
223 	void removeStaIfaceCallbackHidlObject(
224 	    const std::string &ifname,
225 	    const android::sp<ISupplicantStaIfaceCallback> &callback);
226 	void removeP2pNetworkCallbackHidlObject(
227 	    const std::string &ifname, int network_id,
228 	    const android::sp<ISupplicantP2pNetworkCallback> &callback);
229 	void removeStaNetworkCallbackHidlObject(
230 	    const std::string &ifname, int network_id,
231 	    const android::sp<ISupplicantStaNetworkCallback> &callback);
232 
233 	void callWithEachSupplicantCallback(
234 	    const std::function<android::hardware::Return<void>(
235 		android::sp<ISupplicantCallback>)> &method);
236 	void callWithEachP2pIfaceCallback(
237 	    const std::string &ifname,
238 	    const std::function<android::hardware::Return<void>(
239 		android::sp<ISupplicantP2pIfaceCallback>)> &method);
240 	template <class CallbackTypeDerived>
241 	void callWithEachP2pIfaceCallbackDerived(
242 	    const std::string &ifname,
243 	    const std::function<
244 		Return<void>(android::sp<CallbackTypeDerived>)> &method);
245 	void callWithEachStaIfaceCallback(
246 	    const std::string &ifname,
247 	    const std::function<android::hardware::Return<void>(
248 		android::sp<ISupplicantStaIfaceCallback>)> &method);
249 	void callWithEachStaIfaceCallback_1_1(
250 	    const std::string &ifname,
251 	    const std::function<android::hardware::Return<void>(
252 		android::sp<V1_1::ISupplicantStaIfaceCallback>)> &method);
253 	void callWithEachStaIfaceCallback_1_2(
254 	    const std::string &ifname,
255 	    const std::function<android::hardware::Return<void>(
256 	    android::sp<V1_2::ISupplicantStaIfaceCallback>)> &method);
257 	void callWithEachStaIfaceCallback_1_3(
258 	    const std::string &ifname,
259 	    const std::function<android::hardware::Return<void>(
260 	    android::sp<V1_3::ISupplicantStaIfaceCallback>)> &method);
261 	void callWithEachStaIfaceCallback_1_4(
262 	    const std::string &ifname,
263 	    const std::function<android::hardware::Return<void>(
264 	    android::sp<V1_4::ISupplicantStaIfaceCallback>)> &method);
265 	template <class CallbackTypeDerived>
266 	void callWithEachStaIfaceCallbackDerived(
267 	    const std::string &ifname,
268 	    const std::function<
269 		Return<void>(android::sp<CallbackTypeDerived>)> &method);
270 	void callWithEachP2pNetworkCallback(
271 	    const std::string &ifname, int network_id,
272 	    const std::function<android::hardware::Return<void>(
273 		android::sp<ISupplicantP2pNetworkCallback>)> &method);
274 	void callWithEachStaNetworkCallback(
275 	    const std::string &ifname, int network_id,
276 	    const std::function<android::hardware::Return<void>(
277 		android::sp<ISupplicantStaNetworkCallback>)> &method);
278 	template <class CallbackTypeDerived>
279 	void callWithEachStaNetworkCallbackDerived(
280 	    const std::string &ifname, int network_id,
281 	    const std::function<
282 		Return<void>(android::sp<CallbackTypeDerived>)> &method);
283 
284 	// Singleton instance of this class.
285 	static HidlManager *instance_;
286 	// Raw pointer to the global structure maintained by the core.
287 	struct wpa_global *wpa_global_;
288 	// Death notifier.
289 	android::sp<DeathNotifier> death_notifier_;
290 	// The main hidl service object.
291 	android::sp<Supplicant> supplicant_object_;
292 	// Map of all the P2P interface specific hidl objects controlled by
293 	// wpa_supplicant. This map is keyed in by the corresponding
294 	// |ifname|.
295 	std::map<const std::string, android::sp<P2pIface>>
296 	    p2p_iface_object_map_;
297 	// Map of all the STA interface specific hidl objects controlled by
298 	// wpa_supplicant. This map is keyed in by the corresponding
299 	// |ifname|.
300 	std::map<const std::string, android::sp<StaIface>>
301 	    sta_iface_object_map_;
302 	// Map of all the P2P network specific hidl objects controlled by
303 	// wpa_supplicant. This map is keyed in by the corresponding
304 	// |ifname| & |network_id|.
305 	std::map<const std::string, android::sp<P2pNetwork>>
306 	    p2p_network_object_map_;
307 	// Map of all the STA network specific hidl objects controlled by
308 	// wpa_supplicant. This map is keyed in by the corresponding
309 	// |ifname| & |network_id|.
310 	std::map<const std::string, android::sp<StaNetwork>>
311 	    sta_network_object_map_;
312 
313 	// Callback registered for the main hidl service object.
314 	std::vector<android::sp<ISupplicantCallback>> supplicant_callbacks_;
315 	// Map of all the callbacks registered for P2P interface specific
316 	// hidl objects controlled by wpa_supplicant.  This map is keyed in by
317 	// the corresponding |ifname|.
318 	std::map<
319 	    const std::string,
320 	    std::vector<android::sp<ISupplicantP2pIfaceCallback>>>
321 	    p2p_iface_callbacks_map_;
322 	// Map of all the callbacks registered for STA interface specific
323 	// hidl objects controlled by wpa_supplicant.  This map is keyed in by
324 	// the corresponding |ifname|.
325 	std::map<
326 	    const std::string,
327 	    std::vector<android::sp<ISupplicantStaIfaceCallback>>>
328 	    sta_iface_callbacks_map_;
329 	// Map of all the callbacks registered for P2P network specific
330 	// hidl objects controlled by wpa_supplicant.  This map is keyed in by
331 	// the corresponding |ifname| & |network_id|.
332 	std::map<
333 	    const std::string,
334 	    std::vector<android::sp<ISupplicantP2pNetworkCallback>>>
335 	    p2p_network_callbacks_map_;
336 	// Map of all the callbacks registered for STA network specific
337 	// hidl objects controlled by wpa_supplicant.  This map is keyed in by
338 	// the corresponding |ifname| & |network_id|.
339 	std::map<
340 	    const std::string,
341 	    std::vector<android::sp<ISupplicantStaNetworkCallback>>>
342 	    sta_network_callbacks_map_;
343 };
344 
345 // The hidl interface uses some values which are the same as internal ones to
346 // avoid nasty runtime conversion functions. So, adding compile time asserts
347 // to guard against any internal changes breaking the hidl interface.
348 static_assert(
349     static_cast<uint32_t>(ISupplicant::DebugLevel::EXCESSIVE) == MSG_EXCESSIVE,
350     "Debug level value mismatch");
351 static_assert(
352     static_cast<uint32_t>(ISupplicant::DebugLevel::ERROR) == MSG_ERROR,
353     "Debug level value mismatch");
354 
355 static_assert(
356     static_cast<uint32_t>(V1_0::ISupplicantStaNetwork::KeyMgmtMask::NONE) ==
357 	WPA_KEY_MGMT_NONE,
358     "KeyMgmt value mismatch");
359 static_assert(
360     static_cast<uint32_t>(V1_0::ISupplicantStaNetwork::KeyMgmtMask::WPA_PSK) ==
361 	WPA_KEY_MGMT_PSK,
362     "KeyMgmt value mismatch");
363 static_assert(
364     static_cast<uint32_t>(V1_0::ISupplicantStaNetwork::KeyMgmtMask::WPA_EAP) ==
365 	WPA_KEY_MGMT_IEEE8021X,
366     "KeyMgmt value mismatch");
367 static_assert(
368     static_cast<uint32_t>(V1_0::ISupplicantStaNetwork::KeyMgmtMask::IEEE8021X) ==
369 	WPA_KEY_MGMT_IEEE8021X_NO_WPA,
370     "KeyMgmt value mismatch");
371 static_assert(
372     static_cast<uint32_t>(V1_0::ISupplicantStaNetwork::KeyMgmtMask::FT_EAP) ==
373 	WPA_KEY_MGMT_FT_IEEE8021X,
374     "KeyMgmt value mismatch");
375 static_assert(
376     static_cast<uint32_t>(V1_0::ISupplicantStaNetwork::KeyMgmtMask::FT_PSK) ==
377 	WPA_KEY_MGMT_FT_PSK,
378     "KeyMgmt value mismatch");
379 static_assert(
380     static_cast<uint32_t>(V1_0::ISupplicantStaNetwork::KeyMgmtMask::OSEN) ==
381 	WPA_KEY_MGMT_OSEN,
382     "KeyMgmt value mismatch");
383 static_assert(
384     static_cast<uint32_t>(V1_2::ISupplicantStaNetwork::KeyMgmtMask::SAE) ==
385 	WPA_KEY_MGMT_SAE,
386     "KeyMgmt value mismatch");
387 static_assert(
388     static_cast<uint32_t>(V1_2::ISupplicantStaNetwork::KeyMgmtMask::SUITE_B_192) ==
389 	WPA_KEY_MGMT_IEEE8021X_SUITE_B_192,
390     "KeyMgmt value mismatch");
391 static_assert(
392     static_cast<uint32_t>(V1_2::ISupplicantStaNetwork::KeyMgmtMask::OWE) ==
393 	WPA_KEY_MGMT_OWE,
394     "KeyMgmt value mismatch");
395 static_assert(
396     static_cast<uint32_t>(V1_2::ISupplicantStaNetwork::KeyMgmtMask::WPA_PSK_SHA256) ==
397 	WPA_KEY_MGMT_PSK_SHA256,
398     "KeyMgmt value mismatch");
399 static_assert(
400     static_cast<uint32_t>(V1_2::ISupplicantStaNetwork::KeyMgmtMask::WPA_EAP_SHA256) ==
401 	WPA_KEY_MGMT_IEEE8021X_SHA256,
402     "KeyMgmt value mismatch");
403 static_assert(
404     static_cast<uint32_t>(V1_3::ISupplicantStaNetwork::KeyMgmtMask::WAPI_PSK) ==
405 	WPA_KEY_MGMT_WAPI_PSK,
406     "KeyMgmt value mismatch");
407 static_assert(
408     static_cast<uint32_t>(V1_3::ISupplicantStaNetwork::KeyMgmtMask::WAPI_CERT) ==
409 	WPA_KEY_MGMT_WAPI_CERT,
410     "KeyMgmt value mismatch");
411 static_assert(
412     static_cast<uint32_t>(V1_0::ISupplicantStaNetwork::ProtoMask::WPA) ==
413 	WPA_PROTO_WPA,
414     "Proto value mismatch");
415 static_assert(
416     static_cast<uint32_t>(V1_0::ISupplicantStaNetwork::ProtoMask::RSN) ==
417 	WPA_PROTO_RSN,
418     "Proto value mismatch");
419 static_assert(
420     static_cast<uint32_t>(V1_0::ISupplicantStaNetwork::ProtoMask::OSEN) ==
421 	WPA_PROTO_OSEN,
422     "Proto value mismatch");
423 static_assert(
424     static_cast<uint32_t>(V1_3::ISupplicantStaNetwork::ProtoMask::WAPI) ==
425 	WPA_PROTO_WAPI,
426     "Proto value mismatch");
427 static_assert(
428     static_cast<uint32_t>(V1_0::ISupplicantStaNetwork::AuthAlgMask::OPEN) ==
429 	WPA_AUTH_ALG_OPEN,
430     "AuthAlg value mismatch");
431 static_assert(
432     static_cast<uint32_t>(V1_0::ISupplicantStaNetwork::AuthAlgMask::SHARED) ==
433 	WPA_AUTH_ALG_SHARED,
434     "AuthAlg value mismatch");
435 static_assert(
436     static_cast<uint32_t>(V1_0::ISupplicantStaNetwork::AuthAlgMask::LEAP) ==
437 	WPA_AUTH_ALG_LEAP,
438     "AuthAlg value mismatch");
439 static_assert(
440     static_cast<uint32_t>(V1_0::ISupplicantStaNetwork::GroupCipherMask::WEP40) ==
441 	WPA_CIPHER_WEP40,
442     "GroupCipher value mismatch");
443 static_assert(
444     static_cast<uint32_t>(V1_0::ISupplicantStaNetwork::GroupCipherMask::WEP104) ==
445 	WPA_CIPHER_WEP104,
446     "GroupCipher value mismatch");
447 static_assert(
448     static_cast<uint32_t>(V1_0::ISupplicantStaNetwork::GroupCipherMask::TKIP) ==
449 	WPA_CIPHER_TKIP,
450     "GroupCipher value mismatch");
451 static_assert(
452     static_cast<uint32_t>(V1_0::ISupplicantStaNetwork::GroupCipherMask::CCMP) ==
453 	WPA_CIPHER_CCMP,
454     "GroupCipher value mismatch");
455 static_assert(
456     static_cast<uint32_t>(V1_2::ISupplicantStaNetwork::GroupCipherMask::GCMP_256) ==
457 	WPA_CIPHER_GCMP_256,
458     "GroupCipher value mismatch");
459 static_assert(
460     static_cast<uint32_t>(V1_3::ISupplicantStaNetwork::GroupCipherMask::SMS4) ==
461 	WPA_CIPHER_SMS4,
462     "GroupCipher value mismatch");
463 static_assert(
464     static_cast<uint32_t>(
465 	V1_0::ISupplicantStaNetwork::GroupCipherMask::GTK_NOT_USED) ==
466 	WPA_CIPHER_GTK_NOT_USED,
467     "GroupCipher value mismatch");
468 static_assert(
469     static_cast<uint32_t>(V1_0::ISupplicantStaNetwork::PairwiseCipherMask::NONE) ==
470 	WPA_CIPHER_NONE,
471     "PairwiseCipher value mismatch");
472 static_assert(
473     static_cast<uint32_t>(V1_0::ISupplicantStaNetwork::PairwiseCipherMask::TKIP) ==
474 	WPA_CIPHER_TKIP,
475     "PairwiseCipher value mismatch");
476 static_assert(
477     static_cast<uint32_t>(V1_0::ISupplicantStaNetwork::PairwiseCipherMask::CCMP) ==
478 	WPA_CIPHER_CCMP,
479     "PairwiseCipher value mismatch");
480 static_assert(
481     static_cast<uint32_t>(
482 	V1_2::ISupplicantStaNetwork::PairwiseCipherMask::GCMP_256) ==
483 	WPA_CIPHER_GCMP_256,
484     "PairwiseCipher value mismatch");
485 static_assert(
486     static_cast<uint32_t>(
487 	V1_3::ISupplicantStaNetwork::PairwiseCipherMask::SMS4) ==
488 	WPA_CIPHER_SMS4,
489     "PairwiseCipher value mismatch");
490 static_assert(
491     static_cast<uint32_t>(ISupplicantStaIfaceCallback::State::DISCONNECTED) ==
492 	WPA_DISCONNECTED,
493     "State value mismatch");
494 static_assert(
495     static_cast<uint32_t>(ISupplicantStaIfaceCallback::State::COMPLETED) ==
496 	WPA_COMPLETED,
497     "State value mismatch");
498 
499 static_assert(
500     static_cast<uint32_t>(ISupplicantStaIface::AnqpInfoId::VENUE_NAME) ==
501 	ANQP_VENUE_NAME,
502     "ANQP ID value mismatch");
503 static_assert(
504     static_cast<uint32_t>(
505 	ISupplicantStaIface::AnqpInfoId::ROAMING_CONSORTIUM) ==
506 	ANQP_ROAMING_CONSORTIUM,
507     "ANQP ID value mismatch");
508 static_assert(
509     static_cast<uint32_t>(ISupplicantStaIface::AnqpInfoId::NAI_REALM) ==
510 	ANQP_NAI_REALM,
511     "ANQP ID value mismatch");
512 static_assert(
513     static_cast<uint32_t>(
514 	ISupplicantStaIface::AnqpInfoId::IP_ADDR_TYPE_AVAILABILITY) ==
515 	ANQP_IP_ADDR_TYPE_AVAILABILITY,
516     "ANQP ID value mismatch");
517 static_assert(
518     static_cast<uint32_t>(
519 	ISupplicantStaIface::AnqpInfoId::ANQP_3GPP_CELLULAR_NETWORK) ==
520 	ANQP_3GPP_CELLULAR_NETWORK,
521     "ANQP ID value mismatch");
522 static_assert(
523     static_cast<uint32_t>(ISupplicantStaIface::AnqpInfoId::DOMAIN_NAME) ==
524 	ANQP_DOMAIN_NAME,
525     "ANQP ID value mismatch");
526 static_assert(
527     static_cast<uint32_t>(
528 	ISupplicantStaIface::Hs20AnqpSubtypes::OPERATOR_FRIENDLY_NAME) ==
529 	HS20_STYPE_OPERATOR_FRIENDLY_NAME,
530     "HS Subtype value mismatch");
531 static_assert(
532     static_cast<uint32_t>(ISupplicantStaIface::Hs20AnqpSubtypes::WAN_METRICS) ==
533 	HS20_STYPE_WAN_METRICS,
534     "HS Subtype value mismatch");
535 static_assert(
536     static_cast<uint32_t>(
537 	ISupplicantStaIface::Hs20AnqpSubtypes::CONNECTION_CAPABILITY) ==
538 	HS20_STYPE_CONNECTION_CAPABILITY,
539     "HS Subtype value mismatch");
540 static_assert(
541     static_cast<uint32_t>(
542 	ISupplicantStaIface::Hs20AnqpSubtypes::OSU_PROVIDERS_LIST) ==
543 	HS20_STYPE_OSU_PROVIDERS_LIST,
544     "HS Subtype value mismatch");
545 
546 static_assert(
547     static_cast<uint16_t>(
548 	ISupplicantStaIfaceCallback::WpsConfigError::NO_ERROR) ==
549 	WPS_CFG_NO_ERROR,
550     "Wps config error value mismatch");
551 static_assert(
552     static_cast<uint16_t>(ISupplicantStaIfaceCallback::WpsConfigError::
553 			      PUBLIC_KEY_HASH_MISMATCH) ==
554 	WPS_CFG_PUBLIC_KEY_HASH_MISMATCH,
555     "Wps config error value mismatch");
556 static_assert(
557     static_cast<uint16_t>(
558 	ISupplicantStaIfaceCallback::WpsErrorIndication::NO_ERROR) ==
559 	WPS_EI_NO_ERROR,
560     "Wps error indication value mismatch");
561 static_assert(
562     static_cast<uint16_t>(
563 	ISupplicantStaIfaceCallback::WpsErrorIndication::AUTH_FAILURE) ==
564 	WPS_EI_AUTH_FAILURE,
565     "Wps error indication value mismatch");
566 
567 static_assert(
568     static_cast<uint32_t>(WpsConfigMethods::USBA) == WPS_CONFIG_USBA,
569     "Wps config value mismatch");
570 static_assert(
571     static_cast<uint32_t>(WpsConfigMethods::ETHERNET) == WPS_CONFIG_ETHERNET,
572     "Wps config value mismatch");
573 static_assert(
574     static_cast<uint32_t>(WpsConfigMethods::LABEL) == WPS_CONFIG_LABEL,
575     "Wps config value mismatch");
576 static_assert(
577     static_cast<uint32_t>(WpsConfigMethods::DISPLAY) == WPS_CONFIG_DISPLAY,
578     "Wps config value mismatch");
579 static_assert(
580     static_cast<uint32_t>(WpsConfigMethods::INT_NFC_TOKEN) ==
581 	WPS_CONFIG_INT_NFC_TOKEN,
582     "Wps config value mismatch");
583 static_assert(
584     static_cast<uint32_t>(WpsConfigMethods::EXT_NFC_TOKEN) ==
585 	WPS_CONFIG_EXT_NFC_TOKEN,
586     "Wps config value mismatch");
587 static_assert(
588     static_cast<uint32_t>(WpsConfigMethods::NFC_INTERFACE) ==
589 	WPS_CONFIG_NFC_INTERFACE,
590     "Wps config value mismatch");
591 static_assert(
592     static_cast<uint32_t>(WpsConfigMethods::PUSHBUTTON) ==
593 	WPS_CONFIG_PUSHBUTTON,
594     "Wps config value mismatch");
595 static_assert(
596     static_cast<uint32_t>(WpsConfigMethods::KEYPAD) == WPS_CONFIG_KEYPAD,
597     "Wps config value mismatch");
598 static_assert(
599     static_cast<uint32_t>(WpsConfigMethods::VIRT_PUSHBUTTON) ==
600 	WPS_CONFIG_VIRT_PUSHBUTTON,
601     "Wps config value mismatch");
602 static_assert(
603     static_cast<uint32_t>(WpsConfigMethods::PHY_PUSHBUTTON) ==
604 	WPS_CONFIG_PHY_PUSHBUTTON,
605     "Wps config value mismatch");
606 static_assert(
607     static_cast<uint32_t>(WpsConfigMethods::P2PS) == WPS_CONFIG_P2PS,
608     "Wps config value mismatch");
609 static_assert(
610     static_cast<uint32_t>(WpsConfigMethods::VIRT_DISPLAY) ==
611 	WPS_CONFIG_VIRT_DISPLAY,
612     "Wps config value mismatch");
613 static_assert(
614     static_cast<uint32_t>(WpsConfigMethods::PHY_DISPLAY) ==
615 	WPS_CONFIG_PHY_DISPLAY,
616     "Wps config value mismatch");
617 
618 static_assert(
619     static_cast<uint32_t>(P2pGroupCapabilityMask::GROUP_OWNER) ==
620 	P2P_GROUP_CAPAB_GROUP_OWNER,
621     "P2P capability value mismatch");
622 static_assert(
623     static_cast<uint32_t>(P2pGroupCapabilityMask::PERSISTENT_GROUP) ==
624 	P2P_GROUP_CAPAB_PERSISTENT_GROUP,
625     "P2P capability value mismatch");
626 static_assert(
627     static_cast<uint32_t>(P2pGroupCapabilityMask::GROUP_LIMIT) ==
628 	P2P_GROUP_CAPAB_GROUP_LIMIT,
629     "P2P capability value mismatch");
630 static_assert(
631     static_cast<uint32_t>(P2pGroupCapabilityMask::INTRA_BSS_DIST) ==
632 	P2P_GROUP_CAPAB_INTRA_BSS_DIST,
633     "P2P capability value mismatch");
634 static_assert(
635     static_cast<uint32_t>(P2pGroupCapabilityMask::CROSS_CONN) ==
636 	P2P_GROUP_CAPAB_CROSS_CONN,
637     "P2P capability value mismatch");
638 static_assert(
639     static_cast<uint32_t>(P2pGroupCapabilityMask::PERSISTENT_RECONN) ==
640 	P2P_GROUP_CAPAB_PERSISTENT_RECONN,
641     "P2P capability value mismatch");
642 static_assert(
643     static_cast<uint32_t>(P2pGroupCapabilityMask::GROUP_FORMATION) ==
644 	P2P_GROUP_CAPAB_GROUP_FORMATION,
645     "P2P capability value mismatch");
646 
647 static_assert(
648     static_cast<uint16_t>(
649 	ISupplicantP2pIfaceCallback::WpsDevPasswordId::DEFAULT) ==
650 	DEV_PW_DEFAULT,
651     "Wps dev password id value mismatch");
652 static_assert(
653     static_cast<uint16_t>(
654 	ISupplicantP2pIfaceCallback::WpsDevPasswordId::USER_SPECIFIED) ==
655 	DEV_PW_USER_SPECIFIED,
656     "Wps dev password id value mismatch");
657 static_assert(
658     static_cast<uint16_t>(
659 	ISupplicantP2pIfaceCallback::WpsDevPasswordId::MACHINE_SPECIFIED) ==
660 	DEV_PW_MACHINE_SPECIFIED,
661     "Wps dev password id value mismatch");
662 static_assert(
663     static_cast<uint16_t>(
664 	ISupplicantP2pIfaceCallback::WpsDevPasswordId::REKEY) == DEV_PW_REKEY,
665     "Wps dev password id value mismatch");
666 static_assert(
667     static_cast<uint16_t>(
668 	ISupplicantP2pIfaceCallback::WpsDevPasswordId::PUSHBUTTON) ==
669 	DEV_PW_PUSHBUTTON,
670     "Wps dev password id value mismatch");
671 static_assert(
672     static_cast<uint16_t>(
673 	ISupplicantP2pIfaceCallback::WpsDevPasswordId::REGISTRAR_SPECIFIED) ==
674 	DEV_PW_REGISTRAR_SPECIFIED,
675     "Wps dev password id value mismatch");
676 static_assert(
677     static_cast<uint16_t>(ISupplicantP2pIfaceCallback::WpsDevPasswordId::
678 			      NFC_CONNECTION_HANDOVER) ==
679 	DEV_PW_NFC_CONNECTION_HANDOVER,
680     "Wps dev password id value mismatch");
681 static_assert(
682     static_cast<uint16_t>(
683 	ISupplicantP2pIfaceCallback::WpsDevPasswordId::P2PS_DEFAULT) ==
684 	DEV_PW_P2PS_DEFAULT,
685     "Wps dev password id value mismatch");
686 
687 static_assert(
688     static_cast<uint16_t>(
689 	ISupplicantP2pIfaceCallback::P2pStatusCode::SUCCESS) == P2P_SC_SUCCESS,
690     "P2P status code value mismatch");
691 static_assert(
692     static_cast<uint16_t>(ISupplicantP2pIfaceCallback::P2pStatusCode::
693 			      FAIL_INFO_CURRENTLY_UNAVAILABLE) ==
694 	P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE,
695     "P2P status code value mismatch");
696 static_assert(
697     static_cast<uint16_t>(
698 	ISupplicantP2pIfaceCallback::P2pStatusCode::FAIL_INCOMPATIBLE_PARAMS) ==
699 	P2P_SC_FAIL_INCOMPATIBLE_PARAMS,
700     "P2P status code value mismatch");
701 static_assert(
702     static_cast<uint16_t>(
703 	ISupplicantP2pIfaceCallback::P2pStatusCode::FAIL_LIMIT_REACHED) ==
704 	P2P_SC_FAIL_LIMIT_REACHED,
705     "P2P status code value mismatch");
706 static_assert(
707     static_cast<uint16_t>(
708 	ISupplicantP2pIfaceCallback::P2pStatusCode::FAIL_INVALID_PARAMS) ==
709 	P2P_SC_FAIL_INVALID_PARAMS,
710     "P2P status code value mismatch");
711 static_assert(
712     static_cast<uint16_t>(ISupplicantP2pIfaceCallback::P2pStatusCode::
713 			      FAIL_UNABLE_TO_ACCOMMODATE) ==
714 	P2P_SC_FAIL_UNABLE_TO_ACCOMMODATE,
715     "P2P status code value mismatch");
716 static_assert(
717     static_cast<uint16_t>(
718 	ISupplicantP2pIfaceCallback::P2pStatusCode::FAIL_PREV_PROTOCOL_ERROR) ==
719 	P2P_SC_FAIL_PREV_PROTOCOL_ERROR,
720     "P2P status code value mismatch");
721 static_assert(
722     static_cast<uint16_t>(
723 	ISupplicantP2pIfaceCallback::P2pStatusCode::FAIL_NO_COMMON_CHANNELS) ==
724 	P2P_SC_FAIL_NO_COMMON_CHANNELS,
725     "P2P status code value mismatch");
726 static_assert(
727     static_cast<uint16_t>(
728 	ISupplicantP2pIfaceCallback::P2pStatusCode::FAIL_UNKNOWN_GROUP) ==
729 	P2P_SC_FAIL_UNKNOWN_GROUP,
730     "P2P status code value mismatch");
731 static_assert(
732     static_cast<uint16_t>(
733 	ISupplicantP2pIfaceCallback::P2pStatusCode::FAIL_BOTH_GO_INTENT_15) ==
734 	P2P_SC_FAIL_BOTH_GO_INTENT_15,
735     "P2P status code value mismatch");
736 static_assert(
737     static_cast<uint16_t>(ISupplicantP2pIfaceCallback::P2pStatusCode::
738 			      FAIL_INCOMPATIBLE_PROV_METHOD) ==
739 	P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD,
740     "P2P status code value mismatch");
741 static_assert(
742     static_cast<uint16_t>(
743 	ISupplicantP2pIfaceCallback::P2pStatusCode::FAIL_REJECTED_BY_USER) ==
744 	P2P_SC_FAIL_REJECTED_BY_USER,
745     "P2P status code value mismatch");
746 static_assert(
747     static_cast<uint16_t>(
748 	ISupplicantP2pIfaceCallback::P2pStatusCode::SUCCESS_DEFERRED) ==
749 	P2P_SC_SUCCESS_DEFERRED,
750     "P2P status code value mismatch");
751 
752 static_assert(
753     static_cast<uint16_t>(
754 	ISupplicantP2pIfaceCallback::P2pProvDiscStatusCode::SUCCESS) ==
755 	P2P_PROV_DISC_SUCCESS,
756     "P2P status code value mismatch");
757 static_assert(
758     static_cast<uint16_t>(
759 	ISupplicantP2pIfaceCallback::P2pProvDiscStatusCode::TIMEOUT) ==
760 	P2P_PROV_DISC_TIMEOUT,
761     "P2P status code value mismatch");
762 static_assert(
763     static_cast<uint16_t>(
764 	ISupplicantP2pIfaceCallback::P2pProvDiscStatusCode::REJECTED) ==
765 	P2P_PROV_DISC_REJECTED,
766     "P2P status code value mismatch");
767 static_assert(
768     static_cast<uint16_t>(
769 	ISupplicantP2pIfaceCallback::P2pProvDiscStatusCode::TIMEOUT_JOIN) ==
770 	P2P_PROV_DISC_TIMEOUT_JOIN,
771     "P2P status code value mismatch");
772 static_assert(
773     static_cast<uint16_t>(
774 	ISupplicantP2pIfaceCallback::P2pProvDiscStatusCode::INFO_UNAVAILABLE) ==
775 	P2P_PROV_DISC_INFO_UNAVAILABLE,
776     "P2P status code value mismatch");
777 }  // namespace implementation
778 }  // namespace V1_4
779 }  // namespace supplicant
780 }  // namespace wifi
781 }  // namespace hardware
782 }  // namespace android
783 #endif  // WPA_SUPPLICANT_HIDL_HIDL_MANAGER_H
784