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