blob: 673b9f5122142f97dfd145df6621506046486e58 [file] [log] [blame]
Dmitry Shmidte4663042016-04-04 10:07:49 -07001/*
Roshan Pius57ffbcf2016-09-27 09:12:46 -07002 * hidl interface for wpa_supplicant daemon
Dmitry Shmidte4663042016-04-04 10:07:49 -07003 * 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
Roshan Pius57ffbcf2016-09-27 09:12:46 -070010#ifndef WPA_SUPPLICANT_HIDL_SUPPLICANT_H
11#define WPA_SUPPLICANT_HIDL_SUPPLICANT_H
Dmitry Shmidte4663042016-04-04 10:07:49 -070012
Roshan Piusd6e37512016-07-07 13:20:46 -070013#include <android-base/macros.h>
14
Roshan Pius7c0ebf22016-09-20 15:11:56 -070015#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>
Dmitry Shmidte4663042016-04-04 10:07:49 -070018
19extern "C" {
Dmitry Shmidte4663042016-04-04 10:07:49 -070020#include "utils/common.h"
Dmitry Shmidt7f2c7532016-08-15 09:48:12 -070021#include "utils/includes.h"
Roshan Pius7c0ebf22016-09-20 15:11:56 -070022#include "utils/wpa_debug.h"
23#include "wpa_supplicant_i.h"
Dmitry Shmidte4663042016-04-04 10:07:49 -070024}
25
Roshan Pius7c0ebf22016-09-20 15:11:56 -070026namespace android {
27namespace hardware {
28namespace wifi {
29namespace supplicant {
30namespace V1_0 {
31namespace implementation {
Dmitry Shmidte4663042016-04-04 10:07:49 -070032/**
Roshan Pius57ffbcf2016-09-27 09:12:46 -070033 * Implementation of the supplicant hidl object. This hidl
Dmitry Shmidte4663042016-04-04 10:07:49 -070034 * object is used core for global control operations on
35 * wpa_supplicant.
36 */
Roshan Pius7c0ebf22016-09-20 15:11:56 -070037class Supplicant : public android::hardware::wifi::supplicant::V1_0::ISupplicant
Dmitry Shmidte4663042016-04-04 10:07:49 -070038{
39public:
Roshan Pius7c0ebf22016-09-20 15:11:56 -070040 Supplicant(struct wpa_global* global);
Roshan Piusd6e37512016-07-07 13:20:46 -070041 ~Supplicant() override = default;
Roshan Piusbded3202016-11-15 10:34:04 -080042 bool isValid();
Dmitry Shmidte4663042016-04-04 10:07:49 -070043
Roshan Pius7c0ebf22016-09-20 15:11:56 -070044 // Hidl methods exposed.
Roshan Pius7c0ebf22016-09-20 15:11:56 -070045 Return<void> getInterface(
Roshan Piuse286edf2016-11-01 16:56:42 -070046 const IfaceInfo& iface_info, getInterface_cb _hidl_cb) override;
Roshan Pius7c0ebf22016-09-20 15:11:56 -070047 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;
Dmitry Shmidte4663042016-04-04 10:07:49 -070057
58private:
Roshan Piusbded3202016-11-15 10:34:04 -080059 // Corresponding worker functions for the HIDL methods.
60 std::pair<SupplicantStatus, sp<ISupplicantIface>> getInterfaceInternal(
61 const IfaceInfo& iface_info);
62 std::pair<SupplicantStatus, std::vector<ISupplicant::IfaceInfo>>
63 listInterfacesInternal();
64 SupplicantStatus registerCallbackInternal(
65 const sp<ISupplicantCallback>& callback);
66 SupplicantStatus setDebugParamsInternal(
67 ISupplicant::DebugLevel level, bool show_timestamp, bool show_keys);
68
Roshan Pius7c0ebf22016-09-20 15:11:56 -070069 // Raw pointer to the global structure maintained by the core.
70 struct wpa_global* wpa_global_;
71 // Driver name to be used for creating interfaces.
72 static const char kDriverName[];
73 // wpa_supplicant.conf file location on the device.
74 static const char kConfigFilePath[];
Roshan Piusd6e37512016-07-07 13:20:46 -070075
76 DISALLOW_COPY_AND_ASSIGN(Supplicant);
Dmitry Shmidte4663042016-04-04 10:07:49 -070077};
78
Roshan Pius7c0ebf22016-09-20 15:11:56 -070079} // namespace implementation
80} // namespace V1_0
81} // namespace wifi
82} // namespace supplicant
83} // namespace hardware
84} // namespace android
Dmitry Shmidte4663042016-04-04 10:07:49 -070085
Roshan Pius7c0ebf22016-09-20 15:11:56 -070086#endif // WPA_SUPPLICANT_HIDL_SUPPLICANT_H