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_IFACE_H |
| 11 | #define WPA_SUPPLICANT_BINDER_IFACE_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/BnIface.h" |
Roshan Pius | d6e3751 | 2016-07-07 13:20:46 -0700 | [diff] [blame] | 16 | #include "fi/w1/wpa_supplicant/INetwork.h" |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 17 | |
| 18 | extern "C" { |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 19 | #include "utils/common.h" |
Dmitry Shmidt | 7f2c753 | 2016-08-15 09:48:12 -0700 | [diff] [blame] | 20 | #include "utils/includes.h" |
Roshan Pius | f745df8 | 2016-07-14 16:00:23 -0700 | [diff] [blame] | 21 | #include "wpa_supplicant_i.h" |
Roshan Pius | 390ba28 | 2016-08-18 12:32:25 -0700 | [diff] [blame^] | 22 | #include "driver_i.h" |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | namespace wpa_supplicant_binder { |
| 26 | |
| 27 | /** |
| 28 | * Implementation of Iface binder object. Each unique binder |
| 29 | * object is used for control operations on a specific interface |
| 30 | * controlled by wpa_supplicant. |
| 31 | */ |
| 32 | class Iface : public fi::w1::wpa_supplicant::BnIface |
| 33 | { |
| 34 | public: |
Roshan Pius | 54e763a | 2016-07-06 15:41:53 -0700 | [diff] [blame] | 35 | Iface(struct wpa_global *wpa_global, const char ifname[]); |
Roshan Pius | d6e3751 | 2016-07-07 13:20:46 -0700 | [diff] [blame] | 36 | ~Iface() override = default; |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 37 | |
Roshan Pius | 54e763a | 2016-07-06 15:41:53 -0700 | [diff] [blame] | 38 | // Binder methods exposed in aidl. |
| 39 | android::binder::Status GetName(std::string *iface_name_out) override; |
Roshan Pius | d6e3751 | 2016-07-07 13:20:46 -0700 | [diff] [blame] | 40 | android::binder::Status AddNetwork( |
| 41 | android::sp<fi::w1::wpa_supplicant::INetwork> *network_object_out) |
| 42 | override; |
| 43 | android::binder::Status RemoveNetwork(int network_id) override; |
Roshan Pius | d385445 | 2016-07-07 16:46:41 -0700 | [diff] [blame] | 44 | android::binder::Status GetNetwork( |
| 45 | int network_id, |
| 46 | android::sp<fi::w1::wpa_supplicant::INetwork> *network_object_out) |
| 47 | override; |
Roshan Pius | 0470cc8 | 2016-07-14 16:37:07 -0700 | [diff] [blame] | 48 | android::binder::Status RegisterCallback( |
| 49 | const android::sp<fi::w1::wpa_supplicant::IIfaceCallback> &callback) |
| 50 | override; |
Roshan Pius | f4e46cf | 2016-08-09 15:42:42 -0700 | [diff] [blame] | 51 | android::binder::Status Reassociate() override; |
| 52 | android::binder::Status Reconnect() override; |
| 53 | android::binder::Status Disconnect() override; |
Roshan Pius | 390ba28 | 2016-08-18 12:32:25 -0700 | [diff] [blame^] | 54 | android::binder::Status SetPowerSave(bool enable) override; |
| 55 | android::binder::Status InitiateTDLSDiscover( |
| 56 | const std::vector<uint8_t> &mac_address) override; |
| 57 | android::binder::Status InitiateTDLSSetup( |
| 58 | const std::vector<uint8_t> &mac_address) override; |
| 59 | android::binder::Status InitiateTDLSTeardown( |
| 60 | const std::vector<uint8_t> &mac_address) override; |
Roshan Pius | 54e763a | 2016-07-06 15:41:53 -0700 | [diff] [blame] | 61 | |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 62 | private: |
Roshan Pius | d6e3751 | 2016-07-07 13:20:46 -0700 | [diff] [blame] | 63 | struct wpa_supplicant *retrieveIfacePtr(); |
| 64 | |
Roshan Pius | 54e763a | 2016-07-06 15:41:53 -0700 | [diff] [blame] | 65 | // Reference to the global wpa_struct. This is assumed to be valid for |
| 66 | // the lifetime of the process. |
| 67 | const struct wpa_global *wpa_global_; |
| 68 | // Name of the iface this binder object controls |
| 69 | const std::string ifname_; |
| 70 | |
Roshan Pius | d6e3751 | 2016-07-07 13:20:46 -0700 | [diff] [blame] | 71 | DISALLOW_COPY_AND_ASSIGN(Iface); |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 72 | }; |
| 73 | |
Roshan Pius | 32f9f5f | 2016-08-15 14:44:22 -0700 | [diff] [blame] | 74 | } // namespace wpa_supplicant_binder |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 75 | |
Roshan Pius | 32f9f5f | 2016-08-15 14:44:22 -0700 | [diff] [blame] | 76 | #endif // WPA_SUPPLICANT_BINDER_IFACE_H |