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