• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * hidl interface for wpa_supplicant daemon
3  * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
4  * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
5  *
6  * This software may be distributed under the terms of the BSD license.
7  * See README for more details.
8  */
9 
10 #ifndef WPA_SUPPLICANT_HIDL_SUPPLICANT_H
11 #define WPA_SUPPLICANT_HIDL_SUPPLICANT_H
12 
13 #include <android/hardware/wifi/supplicant/1.0/ISupplicantCallback.h>
14 #include <android/hardware/wifi/supplicant/1.0/ISupplicantIface.h>
15 #include <android/hardware/wifi/supplicant/1.0/types.h>
16 #include <android/hardware/wifi/supplicant/1.4/ISupplicant.h>
17 #include <android-base/macros.h>
18 #include <hidl/Status.h>
19 
20 extern "C"
21 {
22 #include "utils/common.h"
23 #include "utils/includes.h"
24 #include "utils/wpa_debug.h"
25 #include "wpa_supplicant_i.h"
26 }
27 
28 namespace android {
29 namespace hardware {
30 namespace wifi {
31 namespace supplicant {
32 namespace V1_4 {
33 namespace implementation {
34 using V1_0::ISupplicantCallback;
35 using V1_0::ISupplicantIface;
36 
37 /**
38  * Implementation of the supplicant hidl object. This hidl
39  * object is used core for global control operations on
40  * wpa_supplicant.
41  */
42 class Supplicant : public V1_4::ISupplicant
43 {
44 public:
45 	Supplicant(struct wpa_global* global);
46 	~Supplicant() override = default;
47 	bool isValid();
48 
49 	// Hidl methods exposed.
50 	Return<void> addInterface(
51 	    const IfaceInfo& iface_info, addInterface_cb _hidl_cb) override;
52 	Return<void> removeInterface(
53 	    const IfaceInfo& iface_info, removeInterface_cb _hidl_cb) override;
54 	Return<void> getInterface(
55 	    const IfaceInfo& iface_info, getInterface_cb _hidl_cb) override;
56 	Return<void> listInterfaces(listInterfaces_cb _hidl_cb) override;
57 	Return<void> registerCallback(
58 	    const sp<ISupplicantCallback>& callback,
59 	    registerCallback_cb _hidl_cb) override;
60 	Return<void> setDebugParams(
61 	    ISupplicant::DebugLevel level, bool show_timestamp, bool show_keys,
62 	    setDebugParams_cb _hidl_cb) override;
63 	Return<ISupplicant::DebugLevel> getDebugLevel() override;
64 	Return<bool> isDebugShowTimestampEnabled() override;
65 	Return<bool> isDebugShowKeysEnabled() override;
66 	Return<void> setConcurrencyPriority(
67 	    IfaceType type, setConcurrencyPriority_cb _hidl_cb) override;
68 	Return<void> terminate() override;
69 
70 private:
71 	// Corresponding worker functions for the HIDL methods.
72 	std::pair<SupplicantStatus, sp<ISupplicantIface>> getInterfaceInternal(
73 	    const IfaceInfo& iface_info);
74 	std::pair<SupplicantStatus, sp<ISupplicantIface>> addInterfaceInternal(
75 	    const IfaceInfo& iface_info);
76 	SupplicantStatus removeInterfaceInternal(const IfaceInfo& iface_info);
77 	std::pair<SupplicantStatus, std::vector<ISupplicant::IfaceInfo>>
78 	listInterfacesInternal();
79 	SupplicantStatus registerCallbackInternal(
80 	    const sp<ISupplicantCallback>& callback);
81 	SupplicantStatus setDebugParamsInternal(
82 	    ISupplicant::DebugLevel level, bool show_timestamp, bool show_keys);
83 	SupplicantStatus setConcurrencyPriorityInternal(IfaceType type);
84 	std::pair<SupplicantStatus, sp<ISupplicantIface>> addP2pDevInterface(
85 	    struct wpa_interface iface_params);
86 
87 	// Raw pointer to the global structure maintained by the core.
88 	struct wpa_global* wpa_global_;
89 	// Driver name to be used for creating interfaces.
90 	static const char kDriverName[];
91 	// wpa_supplicant.conf file location on the device.
92 	static const char kConfigFilePath[];
93 
94 	DISALLOW_COPY_AND_ASSIGN(Supplicant);
95 };
96 
97 }  // namespace implementation
98 }  // namespace V1_4
99 }  // namespace supplicant
100 }  // namespace wifi
101 }  // namespace hardware
102 }  // namespace android
103 
104 #endif  // WPA_SUPPLICANT_HIDL_SUPPLICANT_H
105