Roshan Pius | 57ffbcf | 2016-09-27 09:12:46 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * hidl 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 | |
| 10 | #ifndef WPA_SUPPLICANT_HIDL_IFACE_H |
| 11 | #define WPA_SUPPLICANT_HIDL_IFACE_H |
| 12 | |
| 13 | #include <android-base/macros.h> |
| 14 | |
| 15 | #include "fi/w1/wpa_supplicant/BnIface.h" |
| 16 | #include "fi/w1/wpa_supplicant/INetwork.h" |
| 17 | |
| 18 | extern "C" { |
| 19 | #include "utils/common.h" |
| 20 | #include "utils/includes.h" |
| 21 | #include "wpa_supplicant_i.h" |
| 22 | #include "driver_i.h" |
| 23 | } |
| 24 | |
| 25 | namespace wpa_supplicant_hidl { |
| 26 | |
| 27 | /** |
| 28 | * Implementation of Iface hidl object. Each unique hidl |
| 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: |
| 35 | Iface(struct wpa_global *wpa_global, const char ifname[]); |
| 36 | ~Iface() override = default; |
| 37 | |
| 38 | // Hidl methods exposed in aidl. |
| 39 | android::hidl::Status GetName(std::string *iface_name_out) override; |
| 40 | android::hidl::Status AddNetwork( |
| 41 | android::sp<fi::w1::wpa_supplicant::INetwork> *network_object_out) |
| 42 | override; |
| 43 | android::hidl::Status RemoveNetwork(int network_id) override; |
| 44 | android::hidl::Status GetNetwork( |
| 45 | int network_id, |
| 46 | android::sp<fi::w1::wpa_supplicant::INetwork> *network_object_out) |
| 47 | override; |
| 48 | android::hidl::Status RegisterCallback( |
| 49 | const android::sp<fi::w1::wpa_supplicant::IIfaceCallback> &callback) |
| 50 | override; |
| 51 | android::hidl::Status Reassociate() override; |
| 52 | android::hidl::Status Reconnect() override; |
| 53 | android::hidl::Status Disconnect() override; |
| 54 | android::hidl::Status SetPowerSave(bool enable) override; |
| 55 | android::hidl::Status InitiateTDLSDiscover( |
| 56 | const std::vector<uint8_t> &mac_address) override; |
| 57 | android::hidl::Status InitiateTDLSSetup( |
| 58 | const std::vector<uint8_t> &mac_address) override; |
| 59 | android::hidl::Status InitiateTDLSTeardown( |
| 60 | const std::vector<uint8_t> &mac_address) override; |
| 61 | |
| 62 | private: |
| 63 | struct wpa_supplicant *retrieveIfacePtr(); |
| 64 | |
| 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 hidl object controls |
| 69 | const std::string ifname_; |
| 70 | |
| 71 | DISALLOW_COPY_AND_ASSIGN(Iface); |
| 72 | }; |
| 73 | |
| 74 | } // namespace wpa_supplicant_hidl |
| 75 | |
| 76 | #endif // WPA_SUPPLICANT_HIDL_IFACE_H |