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" |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 21 | #include "../wpa_supplicant_i.h" |
| 22 | } |
| 23 | |
| 24 | namespace wpa_supplicant_binder { |
| 25 | |
| 26 | /** |
| 27 | * Implementation of Iface binder object. Each unique binder |
| 28 | * object is used for control operations on a specific interface |
| 29 | * controlled by wpa_supplicant. |
| 30 | */ |
| 31 | class Iface : public fi::w1::wpa_supplicant::BnIface |
| 32 | { |
| 33 | public: |
Roshan Pius | 54e763a | 2016-07-06 15:41:53 -0700 | [diff] [blame] | 34 | Iface(struct wpa_global *wpa_global, const char ifname[]); |
Roshan Pius | d6e3751 | 2016-07-07 13:20:46 -0700 | [diff] [blame^] | 35 | ~Iface() override = default; |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 36 | |
Roshan Pius | 54e763a | 2016-07-06 15:41:53 -0700 | [diff] [blame] | 37 | // Binder methods exposed in aidl. |
| 38 | android::binder::Status GetName(std::string *iface_name_out) override; |
Roshan Pius | d6e3751 | 2016-07-07 13:20:46 -0700 | [diff] [blame^] | 39 | android::binder::Status AddNetwork( |
| 40 | android::sp<fi::w1::wpa_supplicant::INetwork> *network_object_out) |
| 41 | override; |
| 42 | android::binder::Status RemoveNetwork(int network_id) override; |
Roshan Pius | 54e763a | 2016-07-06 15:41:53 -0700 | [diff] [blame] | 43 | |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 44 | private: |
Roshan Pius | d6e3751 | 2016-07-07 13:20:46 -0700 | [diff] [blame^] | 45 | struct wpa_supplicant *retrieveIfacePtr(); |
| 46 | |
Roshan Pius | 54e763a | 2016-07-06 15:41:53 -0700 | [diff] [blame] | 47 | // Reference to the global wpa_struct. This is assumed to be valid for |
| 48 | // the lifetime of the process. |
| 49 | const struct wpa_global *wpa_global_; |
| 50 | // Name of the iface this binder object controls |
| 51 | const std::string ifname_; |
| 52 | |
Roshan Pius | d6e3751 | 2016-07-07 13:20:46 -0700 | [diff] [blame^] | 53 | DISALLOW_COPY_AND_ASSIGN(Iface); |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 54 | }; |
| 55 | |
Roshan Pius | 54e763a | 2016-07-06 15:41:53 -0700 | [diff] [blame] | 56 | } // namespace wpa_supplicant_binder |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 57 | |
Roshan Pius | 54e763a | 2016-07-06 15:41:53 -0700 | [diff] [blame] | 58 | #endif // WPA_SUPPLICANT_BINDER_IFACE_H |