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