blob: de855949d1da7484a8c68830699145fc69d51747 [file] [log] [blame]
Dmitry Shmidte4663042016-04-04 10:07:49 -07001/*
2 * binder 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
Dmitry Shmidt7f2c7532016-08-15 09:48:12 -070010#ifndef WPA_SUPPLICANT_BINDER_SUPPLICANT_H
11#define WPA_SUPPLICANT_BINDER_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"
17#include "fi/w1/wpa_supplicant/ISupplicantCallbacks.h"
18
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
25namespace wpa_supplicant_binder {
26
27/**
28 * Implementation of the supplicant binder object. This binder
29 * 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 Piusc9422c72016-07-11 10:18:22 -070038 // Binder methods exposed in aidl.
Dmitry Shmidte4663042016-04-04 10:07:49 -070039 android::binder::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;
Dmitry Shmidt7f2c7532016-08-15 09:48:12 -070043 android::binder::Status
44 RemoveInterface(const std::string &ifname) override;
Dmitry Shmidte4663042016-04-04 10:07:49 -070045 android::binder::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;
49 android::binder::Status
50 SetDebugParams(int level, bool show_timestamp, bool show_keys) override;
51 android::binder::Status GetDebugLevel(int *level_out) override;
52 android::binder::Status
53 GetDebugShowTimestamp(bool *show_timestamp_out) override;
54 android::binder::Status GetDebugShowKeys(bool *show_keys_out) override;
Dmitry Shmidte4663042016-04-04 10:07:49 -070055
56private:
Roshan Piusc9422c72016-07-11 10:18:22 -070057 int convertDebugLevelToInternalLevel(
58 int external_level, int *internal_level);
59 int convertDebugLevelToExternalLevel(
60 int internal_level, int *external_level);
61
Dmitry Shmidte4663042016-04-04 10:07:49 -070062 /* Raw pointer to the global structure maintained by the core. */
63 struct wpa_global *wpa_global_;
64 /* All the callback objects registered by the clients. */
65 std::vector<android::sp<fi::w1::wpa_supplicant::ISupplicantCallbacks>>
Dmitry Shmidt7f2c7532016-08-15 09:48:12 -070066 callbacks_;
Roshan Piusd6e37512016-07-07 13:20:46 -070067
68 DISALLOW_COPY_AND_ASSIGN(Supplicant);
Dmitry Shmidte4663042016-04-04 10:07:49 -070069};
70
71} /* namespace wpa_supplicant_binder */
72
Dmitry Shmidt7f2c7532016-08-15 09:48:12 -070073#endif /* WPA_SUPPLICANT_BINDER_SUPPLICANT_H */