blob: 98052898d6c03604a4110157cb75b903afba8607 [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
Dmitry Shmidte4663042016-04-04 10:07:49 -070015#include "fi/w1/wpa_supplicant/BnSupplicant.h"
16#include "fi/w1/wpa_supplicant/IIface.h"
Roshan Pius0470cc82016-07-14 16:37:07 -070017#include "fi/w1/wpa_supplicant/ISupplicantCallback.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"
Dmitry Shmidte4663042016-04-04 10:07:49 -070022#include "../wpa_supplicant_i.h"
23}
24
Roshan Pius57ffbcf2016-09-27 09:12:46 -070025namespace wpa_supplicant_hidl {
Dmitry Shmidte4663042016-04-04 10:07:49 -070026
27/**
Roshan Pius57ffbcf2016-09-27 09:12:46 -070028 * Implementation of the supplicant hidl object. This hidl
Dmitry Shmidte4663042016-04-04 10:07:49 -070029 * object is used core for global control operations on
30 * wpa_supplicant.
31 */
32class Supplicant : public fi::w1::wpa_supplicant::BnSupplicant
33{
34public:
35 Supplicant(struct wpa_global *global);
Roshan Piusd6e37512016-07-07 13:20:46 -070036 ~Supplicant() override = default;
Dmitry Shmidte4663042016-04-04 10:07:49 -070037
Roshan Pius57ffbcf2016-09-27 09:12:46 -070038 // Hidl methods exposed in aidl.
39 android::hidl::Status CreateInterface(
Roshan Piusb01b7962016-07-11 15:25:47 -070040 const fi::w1::wpa_supplicant::ParcelableIfaceParams &params,
Roshan Piusc9422c72016-07-11 10:18:22 -070041 android::sp<fi::w1::wpa_supplicant::IIface> *iface_object_out)
42 override;
Roshan Pius57ffbcf2016-09-27 09:12:46 -070043 android::hidl::Status RemoveInterface(
Roshan Pius32f9f5f2016-08-15 14:44:22 -070044 const std::string &ifname) override;
Roshan Pius57ffbcf2016-09-27 09:12:46 -070045 android::hidl::Status GetInterface(
Dmitry Shmidt7f2c7532016-08-15 09:48:12 -070046 const std::string &ifname,
Roshan Piusc9422c72016-07-11 10:18:22 -070047 android::sp<fi::w1::wpa_supplicant::IIface> *iface_object_out)
48 override;
Roshan Pius57ffbcf2016-09-27 09:12:46 -070049 android::hidl::Status SetDebugParams(
Roshan Pius32f9f5f2016-08-15 14:44:22 -070050 int level, bool show_timestamp, bool show_keys) override;
Roshan Pius57ffbcf2016-09-27 09:12:46 -070051 android::hidl::Status GetDebugLevel(int *level_out) override;
52 android::hidl::Status GetDebugShowTimestamp(
Roshan Pius32f9f5f2016-08-15 14:44:22 -070053 bool *show_timestamp_out) override;
Roshan Pius57ffbcf2016-09-27 09:12:46 -070054 android::hidl::Status GetDebugShowKeys(bool *show_keys_out) override;
55 android::hidl::Status RegisterCallback(
Roshan Pius0470cc82016-07-14 16:37:07 -070056 const android::sp<fi::w1::wpa_supplicant::ISupplicantCallback>
57 &callback) override;
Dmitry Shmidte4663042016-04-04 10:07:49 -070058
59private:
Roshan Piusc9422c72016-07-11 10:18:22 -070060 int convertDebugLevelToInternalLevel(
61 int external_level, int *internal_level);
62 int convertDebugLevelToExternalLevel(
63 int internal_level, int *external_level);
64
Dmitry Shmidte4663042016-04-04 10:07:49 -070065 /* Raw pointer to the global structure maintained by the core. */
66 struct wpa_global *wpa_global_;
67 /* All the callback objects registered by the clients. */
Roshan Pius0470cc82016-07-14 16:37:07 -070068 std::vector<android::sp<fi::w1::wpa_supplicant::ISupplicantCallback>>
Dmitry Shmidt7f2c7532016-08-15 09:48:12 -070069 callbacks_;
Roshan Piusd6e37512016-07-07 13:20:46 -070070
71 DISALLOW_COPY_AND_ASSIGN(Supplicant);
Dmitry Shmidte4663042016-04-04 10:07:49 -070072};
73
Roshan Pius57ffbcf2016-09-27 09:12:46 -070074} /* namespace wpa_supplicant_hidl */
Dmitry Shmidte4663042016-04-04 10:07:49 -070075
Roshan Pius57ffbcf2016-09-27 09:12:46 -070076#endif /* WPA_SUPPLICANT_HIDL_SUPPLICANT_H */