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_STA_NETWORK_H
11 #define WPA_SUPPLICANT_HIDL_STA_NETWORK_H
12 
13 #include <array>
14 #include <vector>
15 
16 #include <android-base/macros.h>
17 
18 #include <android/hardware/wifi/supplicant/1.4/ISupplicantStaNetwork.h>
19 #include <android/hardware/wifi/supplicant/1.0/ISupplicantStaNetworkCallback.h>
20 
21 extern "C"
22 {
23 #include "utils/common.h"
24 #include "utils/includes.h"
25 #include "config.h"
26 #include "wpa_supplicant_i.h"
27 #include "notify.h"
28 #include "eapol_supp/eapol_supp_sm.h"
29 #include "eap_peer/eap.h"
30 #include "rsn_supp/wpa.h"
31 }
32 
33 namespace android {
34 namespace hardware {
35 namespace wifi {
36 namespace supplicant {
37 namespace V1_4 {
38 namespace implementation {
39 using V1_0::ISupplicantStaNetworkCallback;
40 using V1_2::DppFailureCode;
41 using V1_2::DppProgressCode;
42 
43 /**
44  * Implementation of StaNetwork hidl object. Each unique hidl
45  * object is used for control operations on a specific network
46  * controlled by wpa_supplicant.
47  */
48 class StaNetwork : public V1_4::ISupplicantStaNetwork
49 {
50 public:
51 	StaNetwork(
52 	    struct wpa_global* wpa_global, const char ifname[], int network_id);
53 	~StaNetwork() override = default;
54 	// Refer to |StaIface::invalidate()|.
55 	void invalidate();
56 	bool isValid();
57 
58 	// Hidl methods exposed.
59 	Return<void> getId(getId_cb _hidl_cb) override;
60 	Return<void> getInterfaceName(getInterfaceName_cb _hidl_cb) override;
61 	Return<void> getType(getType_cb _hidl_cb) override;
62 	Return<void> registerCallback(
63 	    const sp<ISupplicantStaNetworkCallback>& callback,
64 	    registerCallback_cb _hidl_cb) override;
65 	Return<void> registerCallback_1_4(
66 	    const sp<V1_4::ISupplicantStaNetworkCallback>& callback,
67 	    registerCallback_1_4_cb _hidl_cb) override;
68 	Return<void> setSsid(
69 	    const hidl_vec<uint8_t>& ssid, setSsid_cb _hidl_cb) override;
70 	Return<void> setBssid(
71 	    const hidl_array<uint8_t, 6>& bssid, setBssid_cb _hidl_cb) override;
72 	Return<void> setScanSsid(bool enable, setScanSsid_cb _hidl_cb) override;
73 	Return<void> setKeyMgmt(
74 	    uint32_t key_mgmt_mask, setKeyMgmt_cb _hidl_cb) override;
75 	Return<void> setProto(
76 	    uint32_t proto_mask, setProto_cb _hidl_cb) override;
77 	Return<void> setAuthAlg(
78 	    uint32_t auth_alg_mask, setAuthAlg_cb _hidl_cb) override;
79 	Return<void> setGroupCipher(
80 	    uint32_t group_cipher_mask, setGroupCipher_cb _hidl_cb) override;
81 	Return<void> setPairwiseCipher(
82 	    uint32_t pairwise_cipher_mask,
83 	    setPairwiseCipher_cb _hidl_cb) override;
84 	Return<void> setPskPassphrase(
85 	    const hidl_string& psk, setPskPassphrase_cb _hidl_cb) override;
86 	Return<void> setPsk(
87 	    const hidl_array<uint8_t, 32>& psk, setPsk_cb _hidl_cb) override;
88 	Return<void> setWepKey(
89 	    uint32_t key_idx, const hidl_vec<uint8_t>& wep_key,
90 	    setWepKey_cb _hidl_cb) override;
91 	Return<void> setWepTxKeyIdx(
92 	    uint32_t key_idx, setWepTxKeyIdx_cb _hidl_cb) override;
93 	Return<void> setRequirePmf(
94 	    bool enable, setRequirePmf_cb _hidl_cb) override;
95 	Return<void> setEapMethod(
96 	    ISupplicantStaNetwork::EapMethod method,
97 	    setEapMethod_cb _hidl_cb) override;
98 	Return<void> setEapPhase2Method(
99 	    ISupplicantStaNetwork::EapPhase2Method method,
100 	    setEapPhase2Method_cb _hidl_cb) override;
101 	Return<void> setEapIdentity(
102 	    const hidl_vec<uint8_t>& identity,
103 	    setEapIdentity_cb _hidl_cb) override;
104 	Return<void> setEapAnonymousIdentity(
105 	    const hidl_vec<uint8_t>& identity,
106 	    setEapAnonymousIdentity_cb _hidl_cb) override;
107 	Return<void> setEapPassword(
108 	    const hidl_vec<uint8_t>& password,
109 	    setEapPassword_cb _hidl_cb) override;
110 	Return<void> setEapCACert(
111 	    const hidl_string& path, setEapCACert_cb _hidl_cb) override;
112 	Return<void> setEapCAPath(
113 	    const hidl_string& path, setEapCAPath_cb _hidl_cb) override;
114 	Return<void> setEapClientCert(
115 	    const hidl_string& path, setEapClientCert_cb _hidl_cb) override;
116 	Return<void> setEapPrivateKeyId(
117 	    const hidl_string& id, setEapPrivateKeyId_cb _hidl_cb) override;
118 	Return<void> setEapEncryptedImsiIdentity(
119 	    const EapSimEncryptedIdentity& identity,
120 	    setEapEncryptedImsiIdentity_cb _hidl_cb) override;
121 	Return<void> setEapSubjectMatch(
122 	    const hidl_string& match, setEapSubjectMatch_cb _hidl_cb) override;
123 	Return<void> setEapAltSubjectMatch(
124 	    const hidl_string& match,
125 	    setEapAltSubjectMatch_cb _hidl_cb) override;
126 	Return<void> setEapEngine(
127 	    bool enable, setEapEngine_cb _hidl_cb) override;
128 	Return<void> setEapEngineID(
129 	    const hidl_string& id, setEapEngineID_cb _hidl_cb) override;
130 	Return<void> setEapDomainSuffixMatch(
131 	    const hidl_string& match,
132 	    setEapDomainSuffixMatch_cb _hidl_cb) override;
133 	Return<void> setProactiveKeyCaching(
134 	    bool enable, setProactiveKeyCaching_cb _hidl_cb) override;
135 	Return<void> setIdStr(
136 	    const hidl_string& id_str, setIdStr_cb _hidl_cb) override;
137 	Return<void> setUpdateIdentifier(
138 	    uint32_t id, setUpdateIdentifier_cb _hidl_cb) override;
139 	Return<void> setEdmg(bool enable, setEdmg_cb _hidl_cb) override;
140 	Return<void> getSsid(getSsid_cb _hidl_cb) override;
141 	Return<void> getBssid(getBssid_cb _hidl_cb) override;
142 	Return<void> getScanSsid(getScanSsid_cb _hidl_cb) override;
143 	Return<void> getKeyMgmt(getKeyMgmt_cb _hidl_cb) override;
144 	Return<void> getProto(getProto_cb _hidl_cb) override;
145 	Return<void> getAuthAlg(getAuthAlg_cb _hidl_cb) override;
146 	Return<void> getGroupCipher(getGroupCipher_cb _hidl_cb) override;
147 	Return<void> getPairwiseCipher(getPairwiseCipher_cb _hidl_cb) override;
148 	Return<void> getPskPassphrase(getPskPassphrase_cb _hidl_cb) override;
149 	Return<void> getPsk(getPsk_cb _hidl_cb) override;
150 	Return<void> getSaePassword(getSaePassword_cb _hidl_cb) override;
151 	Return<void> getSaePasswordId(getSaePasswordId_cb _hidl_cb) override;
152 	Return<void> getWepKey(
153 	    uint32_t key_idx, getWepKey_cb _hidl_cb) override;
154 	Return<void> getWepTxKeyIdx(getWepTxKeyIdx_cb _hidl_cb) override;
155 	Return<void> getRequirePmf(getRequirePmf_cb _hidl_cb) override;
156 	Return<void> getEapMethod(getEapMethod_cb _hidl_cb) override;
157 	Return<void> getEapPhase2Method(
158 	    getEapPhase2Method_cb _hidl_cb) override;
159 	Return<void> getEapIdentity(getEapIdentity_cb _hidl_cb) override;
160 	Return<void> getEapAnonymousIdentity(
161 	    getEapAnonymousIdentity_cb _hidl_cb) override;
162 	Return<void> getEapPassword(getEapPassword_cb _hidl_cb) override;
163 	Return<void> getEapCACert(getEapCACert_cb _hidl_cb) override;
164 	Return<void> getEapCAPath(getEapCAPath_cb _hidl_cb) override;
165 	Return<void> getEapClientCert(getEapClientCert_cb _hidl_cb) override;
166 	Return<void> getEapPrivateKeyId(
167 	    getEapPrivateKeyId_cb _hidl_cb) override;
168 	Return<void> getEapSubjectMatch(
169 	    getEapSubjectMatch_cb _hidl_cb) override;
170 	Return<void> getEapAltSubjectMatch(
171 	    getEapAltSubjectMatch_cb _hidl_cb) override;
172 	Return<void> getEapEngine(getEapEngine_cb _hidl_cb) override;
173 	Return<void> getEapEngineID(getEapEngineID_cb _hidl_cb) override;
174 	Return<void> getEapDomainSuffixMatch(
175 	    getEapDomainSuffixMatch_cb _hidl_cb) override;
176 	Return<void> getIdStr(getIdStr_cb _hidl_cb) override;
177 	Return<void> getWpsNfcConfigurationToken(
178 	    getWpsNfcConfigurationToken_cb _hidl_cb) override;
179 	Return<void> getEdmg(getEdmg_cb _hidl_cb) override;
180 	Return<void> enable(bool no_connect, enable_cb _hidl_cb) override;
181 	Return<void> disable(disable_cb _hidl_cb) override;
182 	Return<void> select(select_cb _hidl_cb) override;
183 	Return<void> sendNetworkEapSimGsmAuthResponse(
184 	    const hidl_vec<
185 		ISupplicantStaNetwork::NetworkResponseEapSimGsmAuthParams>&
186 		vec_params,
187 	    sendNetworkEapSimGsmAuthResponse_cb _hidl_cb) override;
188 	Return<void> sendNetworkEapSimGsmAuthFailure(
189 	    sendNetworkEapSimGsmAuthFailure_cb _hidl_cb) override;
190 	Return<void> sendNetworkEapSimUmtsAuthResponse(
191 	    const ISupplicantStaNetwork::NetworkResponseEapSimUmtsAuthParams&
192 		params,
193 	    sendNetworkEapSimUmtsAuthResponse_cb _hidl_cb) override;
194 	Return<void> sendNetworkEapSimUmtsAutsResponse(
195 	    const hidl_array<uint8_t, 14>& auts,
196 	    sendNetworkEapSimUmtsAutsResponse_cb _hidl_cb) override;
197 	Return<void> sendNetworkEapSimUmtsAuthFailure(
198 	    sendNetworkEapSimUmtsAuthFailure_cb _hidl_cb) override;
199 	Return<void> sendNetworkEapIdentityResponse(
200 	    const hidl_vec<uint8_t>& identity,
201 	    sendNetworkEapIdentityResponse_cb _hidl_cb) override;
202 	Return<void> sendNetworkEapIdentityResponse_1_1(
203 	    const EapSimIdentity& identity,
204 	    const EapSimEncryptedIdentity& imsiIdentity,
205 	    sendNetworkEapIdentityResponse_1_1_cb _hidl_cb) override;
206 	Return<void> setKeyMgmt_1_2(
207 	    uint32_t key_mgmt_mask, setKeyMgmt_1_2_cb _hidl_cb) override;
208 	Return<void> getKeyMgmt_1_2(getKeyMgmt_1_2_cb _hidl_cb) override;
209 	Return<void> setPairwiseCipher_1_2(
210 	    uint32_t pairwise_cipher_mask,
211 	    setPairwiseCipher_1_2_cb _hidl_cb) override;
212 	Return<void> getPairwiseCipher_1_2(
213 	    getPairwiseCipher_1_2_cb _hidl_cb) override;
214 	Return<void> setGroupCipher_1_2(
215 	    uint32_t group_cipher_mask,
216 	    setGroupCipher_1_2_cb _hidl_cb) override;
217 	Return<void> getGroupCipher_1_2(
218 	    getGroupCipher_1_2_cb _hidl_cb) override;
219 	Return<void> setGroupMgmtCipher(
220 	    uint32_t group_mgmt_cipher_mask,
221 	    setGroupMgmtCipher_cb _hidl_cb) override;
222 	Return<void> getGroupMgmtCipher(
223 	    getGroupMgmtCipher_cb _hidl_cb) override;
224 	Return<void> enableTlsSuiteBEapPhase1Param(
225 	    bool enable, enableTlsSuiteBEapPhase1Param_cb _hidl_cb) override;
226 	Return<void> enableSuiteBEapOpenSslCiphers(
227 	    enableSuiteBEapOpenSslCiphers_cb _hidl_cb) override;
228 	Return<void> setSaePassword(
229 	    const hidl_string& sae_password,
230 	    setSaePassword_cb _hidl_cb) override;
231 	Return<void> setSaePasswordId(
232 	    const hidl_string& sae_password_id,
233 	    setSaePasswordId_cb _hidl_cb) override;
234 	Return<void> setOcsp(
235 	    V1_3::OcspType ocspType, setOcsp_cb _hidl_cb) override;
236 	Return<void> getOcsp(
237 	    getOcsp_cb _hidl_cb) override;
238 	Return<void> setPmkCache(const hidl_vec<uint8_t>& serializedEntry,
239 			setPmkCache_cb _hidl_cb) override;
240 	Return<void> setKeyMgmt_1_3(
241 	    uint32_t key_mgmt_mask, setKeyMgmt_1_3_cb _hidl_cb) override;
242 	Return<void> getKeyMgmt_1_3(getKeyMgmt_1_3_cb _hidl_cb) override;
243 	Return<void> setProto_1_3(
244 	    uint32_t proto_mask, setProto_cb _hidl_cb) override;
245 	Return<void> getProto_1_3(getProto_cb _hidl_cb) override;
246 	Return<void> setPairwiseCipher_1_3(
247 	    uint32_t pairwise_cipher_mask,
248 	    setPairwiseCipher_1_3_cb _hidl_cb) override;
249 	Return<void> getPairwiseCipher_1_3(
250 	    getPairwiseCipher_1_3_cb _hidl_cb) override;
251 	Return<void> setGroupCipher_1_3(
252 	    uint32_t group_cipher_mask,
253 	    setGroupCipher_1_3_cb _hidl_cb) override;
254 	Return<void> getGroupCipher_1_3(
255 	    getGroupCipher_1_3_cb _hidl_cb) override;
256 	Return<void> setWapiCertSuite(
257 	    const hidl_string& suite, setWapiCertSuite_cb _hidl_cb) override;
258 	Return<void> getWapiCertSuite(getWapiCertSuite_cb _hidl_cb) override;
259 	Return<void> getAuthAlg_1_3(getAuthAlg_cb _hidl_cb) override;
260 	Return<void> setAuthAlg_1_3(uint32_t auth_alg_mask,
261 			std::function<void(const SupplicantStatus &status)> _hidl_cb)
262 					override;
263 	Return<void> setEapErp(bool enable, setEapErp_cb _hidl_cb) override;
264 	Return<void> setPairwiseCipher_1_4(
265 	    uint32_t pairwise_cipher_mask,
266 	    setPairwiseCipher_1_4_cb _hidl_cb) override;
267 	Return<void> getPairwiseCipher_1_4(
268 	    getPairwiseCipher_1_4_cb _hidl_cb) override;
269 	Return<void> setGroupCipher_1_4(
270 	    uint32_t group_cipher_mask,
271 	    setGroupCipher_1_4_cb _hidl_cb) override;
272 	Return<void> getGroupCipher_1_4(
273 	    getGroupCipher_1_4_cb _hidl_cb) override;
274 	Return<void> setSaeH2eMode(V1_4::ISupplicantStaNetwork::SaeH2eMode mode,
275 	    setSaeH2eMode_cb _hidl_cb) override;
276 	Return<void> enableSaePkOnlyMode(bool enable, enableSaePkOnlyMode_cb _hidl_cb) override;
277 
278 private:
279 	// Corresponding worker functions for the HIDL methods.
280 	std::pair<SupplicantStatus, uint32_t> getIdInternal();
281 	std::pair<SupplicantStatus, std::string> getInterfaceNameInternal();
282 	std::pair<SupplicantStatus, IfaceType> getTypeInternal();
283 	SupplicantStatus registerCallbackInternal(
284 	    const sp<ISupplicantStaNetworkCallback>& callback);
285 	V1_4::SupplicantStatus registerCallback_1_4Internal(
286 	    const sp<V1_4::ISupplicantStaNetworkCallback>& callback);
287 	SupplicantStatus setSsidInternal(const std::vector<uint8_t>& ssid);
288 	SupplicantStatus setBssidInternal(const std::array<uint8_t, 6>& bssid);
289 	SupplicantStatus setScanSsidInternal(bool enable);
290 	SupplicantStatus setKeyMgmtInternal(uint32_t key_mgmt_mask);
291 	SupplicantStatus setProtoInternal(uint32_t proto_mask);
292 	SupplicantStatus setAuthAlgInternal(uint32_t auth_alg_mask);
293 	SupplicantStatus setGroupCipherInternal(uint32_t group_cipher_mask);
294 	SupplicantStatus setPairwiseCipherInternal(
295 	    uint32_t pairwise_cipher_mask);
296 	SupplicantStatus setPskPassphraseInternal(const std::string& psk);
297 	SupplicantStatus setPskInternal(const std::array<uint8_t, 32>& psk);
298 	SupplicantStatus setWepKeyInternal(
299 	    uint32_t key_idx, const std::vector<uint8_t>& wep_key);
300 	SupplicantStatus setWepTxKeyIdxInternal(uint32_t key_idx);
301 	SupplicantStatus setRequirePmfInternal(bool enable);
302 	SupplicantStatus setEapMethodInternal(
303 	    ISupplicantStaNetwork::EapMethod method);
304 	SupplicantStatus setEapPhase2MethodInternal(
305 	    ISupplicantStaNetwork::EapPhase2Method method);
306 	SupplicantStatus setEapIdentityInternal(
307 	    const std::vector<uint8_t>& identity);
308 	SupplicantStatus setEapEncryptedImsiIdentityInternal(
309 	    const std::vector<uint8_t>& identity);
310 	SupplicantStatus setEapAnonymousIdentityInternal(
311 	    const std::vector<uint8_t>& identity);
312 	SupplicantStatus setEapPasswordInternal(
313 	    const std::vector<uint8_t>& password);
314 	SupplicantStatus setEapCACertInternal(const std::string& path);
315 	SupplicantStatus setEapCAPathInternal(const std::string& path);
316 	SupplicantStatus setEapClientCertInternal(const std::string& path);
317 	SupplicantStatus setEapPrivateKeyIdInternal(const std::string& id);
318 	SupplicantStatus setEapSubjectMatchInternal(const std::string& match);
319 	SupplicantStatus setEapAltSubjectMatchInternal(
320 	    const std::string& match);
321 	SupplicantStatus setEapEngineInternal(bool enable);
322 	SupplicantStatus setEapEngineIDInternal(const std::string& id);
323 	SupplicantStatus setEapDomainSuffixMatchInternal(
324 	    const std::string& match);
325 	SupplicantStatus setProactiveKeyCachingInternal(bool enable);
326 	SupplicantStatus setIdStrInternal(const std::string& id_str);
327 	SupplicantStatus setUpdateIdentifierInternal(uint32_t id);
328 	V1_4::SupplicantStatus setEdmgInternal(bool enable);
329 	std::pair<SupplicantStatus, std::vector<uint8_t>> getSsidInternal();
330 	std::pair<SupplicantStatus, std::array<uint8_t, 6>> getBssidInternal();
331 	std::pair<SupplicantStatus, bool> getScanSsidInternal();
332 	std::pair<SupplicantStatus, uint32_t> getKeyMgmtInternal();
333 	std::pair<SupplicantStatus, uint32_t> getProtoInternal();
334 	std::pair<SupplicantStatus, uint32_t> getAuthAlgInternal();
335 	std::pair<SupplicantStatus, uint32_t> getGroupCipherInternal();
336 	std::pair<SupplicantStatus, uint32_t> getPairwiseCipherInternal();
337 	std::pair<SupplicantStatus, std::string> getPskPassphraseInternal();
338 	std::pair<SupplicantStatus, std::array<uint8_t, 32>> getPskInternal();
339 	std::pair<SupplicantStatus, std::string> getSaePasswordInternal();
340 	std::pair<SupplicantStatus, std::string> getSaePasswordIdInternal();
341 	std::pair<SupplicantStatus, std::vector<uint8_t>> getWepKeyInternal(
342 	    uint32_t key_idx);
343 	std::pair<SupplicantStatus, uint32_t> getWepTxKeyIdxInternal();
344 	std::pair<SupplicantStatus, bool> getRequirePmfInternal();
345 	std::pair<SupplicantStatus, ISupplicantStaNetwork::EapMethod>
346 	getEapMethodInternal();
347 	std::pair<SupplicantStatus, ISupplicantStaNetwork::EapPhase2Method>
348 	getEapPhase2MethodInternal();
349 	std::pair<SupplicantStatus, std::vector<uint8_t>>
350 	getEapIdentityInternal();
351 	std::pair<SupplicantStatus, std::vector<uint8_t>>
352 	getEapAnonymousIdentityInternal();
353 	std::pair<SupplicantStatus, std::vector<uint8_t>>
354 	getEapPasswordInternal();
355 	std::pair<SupplicantStatus, std::string> getEapCACertInternal();
356 	std::pair<SupplicantStatus, std::string> getEapCAPathInternal();
357 	std::pair<SupplicantStatus, std::string> getEapClientCertInternal();
358 	std::pair<SupplicantStatus, std::string> getEapPrivateKeyIdInternal();
359 	std::pair<SupplicantStatus, std::string> getEapSubjectMatchInternal();
360 	std::pair<SupplicantStatus, std::string>
361 	getEapAltSubjectMatchInternal();
362 	std::pair<SupplicantStatus, bool> getEapEngineInternal();
363 	std::pair<SupplicantStatus, std::string> getEapEngineIDInternal();
364 	std::pair<SupplicantStatus, std::string>
365 	getEapDomainSuffixMatchInternal();
366 	std::pair<SupplicantStatus, std::string> getIdStrInternal();
367 	std::pair<SupplicantStatus, std::vector<uint8_t>>
368 	getWpsNfcConfigurationTokenInternal();
369 	std::pair<V1_4::SupplicantStatus, bool> getEdmgInternal();
370 	SupplicantStatus enableInternal(bool no_connect);
371 	SupplicantStatus disableInternal();
372 	SupplicantStatus selectInternal();
373 	SupplicantStatus sendNetworkEapSimGsmAuthResponseInternal(
374 	    const std::vector<
375 		ISupplicantStaNetwork::NetworkResponseEapSimGsmAuthParams>&
376 		vec_params);
377 	SupplicantStatus sendNetworkEapSimGsmAuthFailureInternal();
378 	SupplicantStatus sendNetworkEapSimUmtsAuthResponseInternal(
379 	    const ISupplicantStaNetwork::NetworkResponseEapSimUmtsAuthParams&
380 		params);
381 	SupplicantStatus sendNetworkEapSimUmtsAutsResponseInternal(
382 	    const std::array<uint8_t, 14>& auts);
383 	SupplicantStatus sendNetworkEapSimUmtsAuthFailureInternal();
384 	SupplicantStatus sendNetworkEapIdentityResponseInternal(
385 	    const std::vector<uint8_t>& identity);
386 	SupplicantStatus sendNetworkEapIdentityResponseInternal_1_1(
387 	    const std::vector<uint8_t>& identity,
388 	    const std::vector<uint8_t>& imsi_identity);
389 	SupplicantStatus enableTlsSuiteBEapPhase1ParamInternal(bool enable);
390 	SupplicantStatus enableSuiteBEapOpenSslCiphersInternal();
391 	SupplicantStatus setSaePasswordInternal(
392 	    const std::string& sae_password);
393 	SupplicantStatus setSaePasswordIdInternal(
394 	    const std::string& sae_password_id);
395 	SupplicantStatus setGroupMgmtCipherInternal(uint32_t group_mgmt_cipher_mask);
396 	std::pair<SupplicantStatus, uint32_t> getGroupMgmtCipherInternal();
397 	SupplicantStatus setOcspInternal(V1_3::OcspType ocspType);
398 	std::pair<SupplicantStatus, V1_3::OcspType> getOcspInternal();
399 	SupplicantStatus setPmkCacheInternal(const std::vector<uint8_t>& serialziedEntry);
400 	SupplicantStatus setWapiCertSuiteInternal(const std::string& suite);
401 	std::pair<SupplicantStatus, std::string> getWapiCertSuiteInternal();
402 	SupplicantStatus setKeyMgmt_1_3Internal(uint32_t key_mgmt_mask);
403 	std::pair<SupplicantStatus, uint32_t> getKeyMgmt_1_3Internal();
404 	SupplicantStatus setProto_1_3Internal(uint32_t proto_mask);
405 	std::pair<SupplicantStatus, uint32_t> getProto_1_3Internal();
406 	std::pair<SupplicantStatus, uint32_t> getGroupCipher_1_3Internal();
407 	SupplicantStatus setGroupCipher_1_3Internal(uint32_t group_cipher_mask);
408 	std::pair<SupplicantStatus, uint32_t> getPairwiseCipher_1_3Internal();
409 	SupplicantStatus setPairwiseCipher_1_3Internal(
410 	    uint32_t pairwise_cipher_mask);
411 	SupplicantStatus setWapiPskInternal(const std::vector<uint8_t>& psk);
412 	std::pair<SupplicantStatus, std::vector<uint8_t>> getWapiPskInternal();
413 	std::pair<V1_4::SupplicantStatus, uint32_t> getGroupCipher_1_4Internal();
414 	V1_4::SupplicantStatus setGroupCipher_1_4Internal(uint32_t group_cipher_mask);
415 	std::pair<V1_4::SupplicantStatus, uint32_t> getPairwiseCipher_1_4Internal();
416 	V1_4::SupplicantStatus setPairwiseCipher_1_4Internal(
417 	    uint32_t pairwise_cipher_mask);
418 	V1_4::SupplicantStatus setSaeH2eModeInternal(V1_4::ISupplicantStaNetwork::SaeH2eMode mode);
419 	V1_4::SupplicantStatus enableSaePkOnlyModeInternal(bool enable);
420 
421 	struct wpa_ssid* retrieveNetworkPtr();
422 	struct wpa_supplicant* retrieveIfacePtr();
423 	int isPskPassphraseValid(const std::string& psk);
424 	void resetInternalStateAfterParamsUpdate();
425 	int setStringFieldAndResetState(
426 	    const char* value, uint8_t** to_update_field,
427 	    const char* hexdump_prefix);
428 	int setStringFieldAndResetState(
429 	    const char* value, char** to_update_field,
430 	    const char* hexdump_prefix);
431 	int setStringKeyFieldAndResetState(
432 	    const char* value, char** to_update_field,
433 	    const char* hexdump_prefix);
434 	int setByteArrayFieldAndResetState(
435 	    const uint8_t* value, const size_t value_len,
436 	    uint8_t** to_update_field, size_t* to_update_field_len,
437 	    const char* hexdump_prefix);
438 	int setByteArrayKeyFieldAndResetState(
439 	    const uint8_t* value, const size_t value_len,
440 	    uint8_t** to_update_field, size_t* to_update_field_len,
441 	    const char* hexdump_prefix);
442 	void setFastTransitionKeyMgmt(uint32_t &key_mgmt_mask);
443 	void resetFastTransitionKeyMgmt(uint32_t &key_mgmt_mask);
444 	SupplicantStatus setEapErpInternal(bool enable);
445 
446 	// Reference to the global wpa_struct. This is assumed to be valid
447 	// for the lifetime of the process.
448 	struct wpa_global* wpa_global_;
449 	// Name of the iface this network belongs to.
450 	const std::string ifname_;
451 	// Id of the network this hidl object controls.
452 	const int network_id_;
453 	bool is_valid_;
454 
455 	DISALLOW_COPY_AND_ASSIGN(StaNetwork);
456 };
457 
458 }  // namespace implementation
459 }  // namespace V1_4
460 }  // namespace supplicant
461 }  // namespace wifi
462 }  // namespace hardware
463 }  // namespace android
464 
465 #endif  // WPA_SUPPLICANT_HIDL_STA_NETWORK_H
466