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