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 | |
Roshan Pius | 7c0ebf2 | 2016-09-20 15:11:56 -0700 | [diff] [blame] | 15 | #include <android/hardware/wifi/supplicant/1.0/ISupplicantIface.h> |
| 16 | #include <android/hardware/wifi/supplicant/1.0/ISupplicantIfaceCallback.h> |
| 17 | #include <android/hardware/wifi/supplicant/1.0/ISupplicantNetwork.h> |
Roshan Pius | 57ffbcf | 2016-09-27 09:12:46 -0700 | [diff] [blame] | 18 | |
| 19 | extern "C" { |
| 20 | #include "utils/common.h" |
| 21 | #include "utils/includes.h" |
| 22 | #include "wpa_supplicant_i.h" |
| 23 | #include "driver_i.h" |
| 24 | } |
| 25 | |
Roshan Pius | 7c0ebf2 | 2016-09-20 15:11:56 -0700 | [diff] [blame] | 26 | namespace android { |
| 27 | namespace hardware { |
| 28 | namespace wifi { |
| 29 | namespace supplicant { |
| 30 | namespace V1_0 { |
| 31 | namespace implementation { |
Roshan Pius | 57ffbcf | 2016-09-27 09:12:46 -0700 | [diff] [blame] | 32 | |
| 33 | /** |
| 34 | * Implementation of Iface hidl object. Each unique hidl |
| 35 | * object is used for control operations on a specific interface |
| 36 | * controlled by wpa_supplicant. |
| 37 | */ |
Roshan Pius | 7c0ebf2 | 2016-09-20 15:11:56 -0700 | [diff] [blame] | 38 | class Iface : public android::hardware::wifi::supplicant::V1_0::ISupplicantIface |
Roshan Pius | 57ffbcf | 2016-09-27 09:12:46 -0700 | [diff] [blame] | 39 | { |
| 40 | public: |
Roshan Pius | 7c0ebf2 | 2016-09-20 15:11:56 -0700 | [diff] [blame] | 41 | Iface(struct wpa_global* wpa_global, const char ifname[]); |
Roshan Pius | 57ffbcf | 2016-09-27 09:12:46 -0700 | [diff] [blame] | 42 | ~Iface() override = default; |
| 43 | |
Roshan Pius | 7c0ebf2 | 2016-09-20 15:11:56 -0700 | [diff] [blame] | 44 | // Hidl methods exposed. |
| 45 | Return<void> getName(getName_cb _hidl_cb) override; |
| 46 | Return<void> addNetwork(addNetwork_cb _hidl_cb) override; |
| 47 | Return<void> removeNetwork( |
| 48 | uint32_t id, removeNetwork_cb _hidl_cb) override; |
| 49 | Return<void> getNetwork(uint32_t id, getNetwork_cb _hidl_cb) override; |
| 50 | Return<void> listNetworks(listNetworks_cb _hidl_cb) override; |
| 51 | Return<void> registerCallback( |
| 52 | const sp<ISupplicantIfaceCallback>& callback, |
| 53 | registerCallback_cb _hidl_cb) override; |
| 54 | Return<void> reassociate(reassociate_cb _hidl_cb) override; |
| 55 | Return<void> reconnect(reconnect_cb _hidl_cb) override; |
| 56 | Return<void> disconnect(disconnect_cb _hidl_cb) override; |
| 57 | Return<void> setPowerSave( |
| 58 | bool enable, setPowerSave_cb _hidl_cb) override; |
| 59 | Return<void> initiateTdlsDiscover( |
| 60 | const hidl_array<uint8_t, 6 /* 6 */>& mac_address, |
| 61 | initiateTdlsDiscover_cb _hidl_cb) override; |
| 62 | Return<void> initiateTdlsSetup( |
| 63 | const hidl_array<uint8_t, 6 /* 6 */>& mac_address, |
| 64 | initiateTdlsSetup_cb _hidl_cb) override; |
| 65 | Return<void> initiateTdlsTeardown( |
| 66 | const hidl_array<uint8_t, 6 /* 6 */>& mac_address, |
| 67 | initiateTdlsTeardown_cb _hidl_cb) override; |
Roshan Pius | 57ffbcf | 2016-09-27 09:12:46 -0700 | [diff] [blame] | 68 | |
| 69 | private: |
Roshan Pius | 7c0ebf2 | 2016-09-20 15:11:56 -0700 | [diff] [blame] | 70 | struct wpa_supplicant* retrieveIfacePtr(); |
Roshan Pius | 57ffbcf | 2016-09-27 09:12:46 -0700 | [diff] [blame] | 71 | |
| 72 | // Reference to the global wpa_struct. This is assumed to be valid for |
| 73 | // the lifetime of the process. |
Roshan Pius | 7c0ebf2 | 2016-09-20 15:11:56 -0700 | [diff] [blame] | 74 | const struct wpa_global* wpa_global_; |
Roshan Pius | 57ffbcf | 2016-09-27 09:12:46 -0700 | [diff] [blame] | 75 | // Name of the iface this hidl object controls |
| 76 | const std::string ifname_; |
| 77 | |
| 78 | DISALLOW_COPY_AND_ASSIGN(Iface); |
| 79 | }; |
| 80 | |
Roshan Pius | 7c0ebf2 | 2016-09-20 15:11:56 -0700 | [diff] [blame] | 81 | } // namespace implementation |
| 82 | } // namespace V1_0 |
| 83 | } // namespace wifi |
| 84 | } // namespace supplicant |
| 85 | } // namespace hardware |
| 86 | } // namespace android |
Roshan Pius | 57ffbcf | 2016-09-27 09:12:46 -0700 | [diff] [blame] | 87 | |
| 88 | #endif // WPA_SUPPLICANT_HIDL_IFACE_H |