• 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-base/macros.h>
14 
15 #include <android/hardware/wifi/supplicant/1.0/ISupplicant.h>
16 #include <android/hardware/wifi/supplicant/1.0/ISupplicantCallback.h>
17 #include <android/hardware/wifi/supplicant/1.0/ISupplicantIface.h>
18 
19 extern "C" {
20 #include "utils/common.h"
21 #include "utils/includes.h"
22 #include "utils/wpa_debug.h"
23 #include "wpa_supplicant_i.h"
24 }
25 
26 namespace android {
27 namespace hardware {
28 namespace wifi {
29 namespace supplicant {
30 namespace V1_0 {
31 namespace implementation {
32 /**
33  * Implementation of the supplicant hidl object. This hidl
34  * object is used core for global control operations on
35  * wpa_supplicant.
36  */
37 class Supplicant : public android::hardware::wifi::supplicant::V1_0::ISupplicant
38 {
39 public:
40 	Supplicant(struct wpa_global* global);
41 	~Supplicant() override = default;
42 	bool isValid();
43 
44 	// Hidl methods exposed.
45 	Return<void> getInterface(
46 	    const IfaceInfo& iface_info, getInterface_cb _hidl_cb) override;
47 	Return<void> listInterfaces(listInterfaces_cb _hidl_cb) override;
48 	Return<void> registerCallback(
49 	    const sp<ISupplicantCallback>& callback,
50 	    registerCallback_cb _hidl_cb) override;
51 	Return<void> setDebugParams(
52 	    ISupplicant::DebugLevel level, bool show_timestamp, bool show_keys,
53 	    setDebugParams_cb _hidl_cb) override;
54 	Return<ISupplicant::DebugLevel> getDebugLevel() override;
55 	Return<bool> isDebugShowTimestampEnabled() override;
56 	Return<bool> isDebugShowKeysEnabled() override;
57 	Return<void> setConcurrencyPriority(
58 	    IfaceType type, setConcurrencyPriority_cb _hidl_cb) override;
59 
60 private:
61 	// Corresponding worker functions for the HIDL methods.
62 	std::pair<SupplicantStatus, sp<ISupplicantIface>> getInterfaceInternal(
63 	    const IfaceInfo& iface_info);
64 	std::pair<SupplicantStatus, std::vector<ISupplicant::IfaceInfo>>
65 	listInterfacesInternal();
66 	SupplicantStatus registerCallbackInternal(
67 	    const sp<ISupplicantCallback>& callback);
68 	SupplicantStatus setDebugParamsInternal(
69 	    ISupplicant::DebugLevel level, bool show_timestamp, bool show_keys);
70 	SupplicantStatus setConcurrencyPriorityInternal(IfaceType type);
71 
72 	// Raw pointer to the global structure maintained by the core.
73 	struct wpa_global* wpa_global_;
74 	// Driver name to be used for creating interfaces.
75 	static const char kDriverName[];
76 	// wpa_supplicant.conf file location on the device.
77 	static const char kConfigFilePath[];
78 
79 	DISALLOW_COPY_AND_ASSIGN(Supplicant);
80 };
81 
82 }  // namespace implementation
83 }  // namespace V1_0
84 }  // namespace wifi
85 }  // namespace supplicant
86 }  // namespace hardware
87 }  // namespace android
88 
89 #endif  // WPA_SUPPLICANT_HIDL_SUPPLICANT_H
90