Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 1 | /* |
| 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 Shmidt | 7f2c753 | 2016-08-15 09:48:12 -0700 | [diff] [blame] | 10 | #ifndef WPA_SUPPLICANT_BINDER_SUPPLICANT_H |
| 11 | #define WPA_SUPPLICANT_BINDER_SUPPLICANT_H |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 12 | |
Roshan Pius | d6e3751 | 2016-07-07 13:20:46 -0700 | [diff] [blame] | 13 | #include <android-base/macros.h> |
| 14 | |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 15 | #include "fi/w1/wpa_supplicant/BnSupplicant.h" |
| 16 | #include "fi/w1/wpa_supplicant/IIface.h" |
| 17 | #include "fi/w1/wpa_supplicant/ISupplicantCallbacks.h" |
| 18 | |
| 19 | extern "C" { |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 20 | #include "utils/common.h" |
Dmitry Shmidt | 7f2c753 | 2016-08-15 09:48:12 -0700 | [diff] [blame] | 21 | #include "utils/includes.h" |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 22 | #include "../wpa_supplicant_i.h" |
| 23 | } |
| 24 | |
| 25 | namespace 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 | */ |
| 32 | class Supplicant : public fi::w1::wpa_supplicant::BnSupplicant |
| 33 | { |
| 34 | public: |
| 35 | Supplicant(struct wpa_global *global); |
Roshan Pius | d6e3751 | 2016-07-07 13:20:46 -0700 | [diff] [blame] | 36 | ~Supplicant() override = default; |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 37 | |
Roshan Pius | c9422c7 | 2016-07-11 10:18:22 -0700 | [diff] [blame] | 38 | // Binder methods exposed in aidl. |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 39 | android::binder::Status CreateInterface( |
Roshan Pius | b01b796 | 2016-07-11 15:25:47 -0700 | [diff] [blame^] | 40 | const fi::w1::wpa_supplicant::ParcelableIfaceParams ¶ms, |
Roshan Pius | c9422c7 | 2016-07-11 10:18:22 -0700 | [diff] [blame] | 41 | android::sp<fi::w1::wpa_supplicant::IIface> *iface_object_out) |
| 42 | override; |
Dmitry Shmidt | 7f2c753 | 2016-08-15 09:48:12 -0700 | [diff] [blame] | 43 | android::binder::Status |
| 44 | RemoveInterface(const std::string &ifname) override; |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 45 | android::binder::Status GetInterface( |
Dmitry Shmidt | 7f2c753 | 2016-08-15 09:48:12 -0700 | [diff] [blame] | 46 | const std::string &ifname, |
Roshan Pius | c9422c7 | 2016-07-11 10:18:22 -0700 | [diff] [blame] | 47 | 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 Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 55 | |
| 56 | private: |
Roshan Pius | c9422c7 | 2016-07-11 10:18:22 -0700 | [diff] [blame] | 57 | int convertDebugLevelToInternalLevel( |
| 58 | int external_level, int *internal_level); |
| 59 | int convertDebugLevelToExternalLevel( |
| 60 | int internal_level, int *external_level); |
| 61 | |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 62 | /* 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 Shmidt | 7f2c753 | 2016-08-15 09:48:12 -0700 | [diff] [blame] | 66 | callbacks_; |
Roshan Pius | d6e3751 | 2016-07-07 13:20:46 -0700 | [diff] [blame] | 67 | |
| 68 | DISALLOW_COPY_AND_ASSIGN(Supplicant); |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 69 | }; |
| 70 | |
| 71 | } /* namespace wpa_supplicant_binder */ |
| 72 | |
Dmitry Shmidt | 7f2c753 | 2016-08-15 09:48:12 -0700 | [diff] [blame] | 73 | #endif /* WPA_SUPPLICANT_BINDER_SUPPLICANT_H */ |