Roshan Pius | cc81756 | 2017-12-22 14:45:05 -0800 | [diff] [blame] | 1 | /* |
| 2 | * hidl interface for wpa_hostapd daemon |
| 3 | * Copyright (c) 2004-2018, Jouni Malinen <j@w1.fi> |
| 4 | * Copyright (c) 2004-2018, 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 HOSTAPD_HIDL_SUPPLICANT_H |
| 11 | #define HOSTAPD_HIDL_SUPPLICANT_H |
| 12 | |
| 13 | #include <string> |
| 14 | |
| 15 | #include <android-base/macros.h> |
| 16 | |
Roshan Pius | e2d2101 | 2018-08-17 11:22:06 -0700 | [diff] [blame] | 17 | #include <android/hardware/wifi/hostapd/1.1/IHostapd.h> |
| 18 | #include <android/hardware/wifi/hostapd/1.1/IHostapdCallback.h> |
Roshan Pius | cc81756 | 2017-12-22 14:45:05 -0800 | [diff] [blame] | 19 | |
| 20 | extern "C" |
| 21 | { |
| 22 | #include "utils/common.h" |
| 23 | #include "utils/includes.h" |
| 24 | #include "utils/wpa_debug.h" |
| 25 | #include "ap/hostapd.h" |
| 26 | } |
| 27 | |
| 28 | namespace android { |
| 29 | namespace hardware { |
| 30 | namespace wifi { |
| 31 | namespace hostapd { |
Roshan Pius | e2d2101 | 2018-08-17 11:22:06 -0700 | [diff] [blame] | 32 | namespace V1_1 { |
Roshan Pius | cc81756 | 2017-12-22 14:45:05 -0800 | [diff] [blame] | 33 | namespace implementation { |
Roshan Pius | e2d2101 | 2018-08-17 11:22:06 -0700 | [diff] [blame] | 34 | using namespace android::hardware::wifi::hostapd::V1_0; |
Roshan Pius | cc81756 | 2017-12-22 14:45:05 -0800 | [diff] [blame] | 35 | |
| 36 | /** |
| 37 | * Implementation of the hostapd hidl object. This hidl |
| 38 | * object is used core for global control operations on |
| 39 | * hostapd. |
| 40 | */ |
Roshan Pius | e2d2101 | 2018-08-17 11:22:06 -0700 | [diff] [blame] | 41 | class Hostapd : public V1_1::IHostapd |
Roshan Pius | cc81756 | 2017-12-22 14:45:05 -0800 | [diff] [blame] | 42 | { |
| 43 | public: |
| 44 | Hostapd(hapd_interfaces* interfaces); |
| 45 | ~Hostapd() override = default; |
| 46 | |
| 47 | // Hidl methods exposed. |
| 48 | Return<void> addAccessPoint( |
| 49 | const IfaceParams& iface_params, const NetworkParams& nw_params, |
| 50 | addAccessPoint_cb _hidl_cb) override; |
| 51 | Return<void> removeAccessPoint( |
| 52 | const hidl_string& iface_name, |
| 53 | removeAccessPoint_cb _hidl_cb) override; |
Roshan Pius | 3455af4 | 2018-02-01 09:19:49 -0800 | [diff] [blame] | 54 | Return<void> terminate() override; |
Roshan Pius | e2d2101 | 2018-08-17 11:22:06 -0700 | [diff] [blame] | 55 | Return<void> registerCallback( |
| 56 | const sp<IHostapdCallback>& callback, |
| 57 | registerCallback_cb _hidl_cb) override; |
Roshan Pius | cc81756 | 2017-12-22 14:45:05 -0800 | [diff] [blame] | 58 | |
| 59 | private: |
| 60 | // Corresponding worker functions for the HIDL methods. |
| 61 | HostapdStatus addAccessPointInternal( |
| 62 | const IfaceParams& iface_params, const NetworkParams& nw_params); |
| 63 | HostapdStatus removeAccessPointInternal(const std::string& iface_name); |
Roshan Pius | e2d2101 | 2018-08-17 11:22:06 -0700 | [diff] [blame] | 64 | HostapdStatus registerCallbackInternal( |
| 65 | const sp<IHostapdCallback>& callback); |
Roshan Pius | cc81756 | 2017-12-22 14:45:05 -0800 | [diff] [blame] | 66 | |
| 67 | // Raw pointer to the global structure maintained by the core. |
| 68 | struct hapd_interfaces* interfaces_; |
Roshan Pius | e2d2101 | 2018-08-17 11:22:06 -0700 | [diff] [blame] | 69 | // Callbacks registered. |
| 70 | std::vector<sp<IHostapdCallback>> callbacks_; |
Roshan Pius | cc81756 | 2017-12-22 14:45:05 -0800 | [diff] [blame] | 71 | |
| 72 | DISALLOW_COPY_AND_ASSIGN(Hostapd); |
| 73 | }; |
| 74 | } // namespace implementation |
Roshan Pius | e2d2101 | 2018-08-17 11:22:06 -0700 | [diff] [blame] | 75 | } // namespace V1_1 |
Roshan Pius | cc81756 | 2017-12-22 14:45:05 -0800 | [diff] [blame] | 76 | } // namespace hostapd |
| 77 | } // namespace wifi |
| 78 | } // namespace hardware |
| 79 | } // namespace android |
| 80 | |
| 81 | #endif // HOSTAPD_HIDL_SUPPLICANT_H |