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 | |
lesl | 1a842e6 | 2019-12-02 19:00:37 +0800 | [diff] [blame] | 17 | #include <android/hardware/wifi/hostapd/1.2/IHostapd.h> |
Roshan Pius | e2d2101 | 2018-08-17 11:22:06 -0700 | [diff] [blame] | 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" |
lesl | 1a842e6 | 2019-12-02 19:00:37 +0800 | [diff] [blame] | 26 | #include "ap/sta_info.h" |
Roshan Pius | cc81756 | 2017-12-22 14:45:05 -0800 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | namespace android { |
| 30 | namespace hardware { |
| 31 | namespace wifi { |
| 32 | namespace hostapd { |
lesl | 1a842e6 | 2019-12-02 19:00:37 +0800 | [diff] [blame] | 33 | namespace V1_2 { |
Roshan Pius | cc81756 | 2017-12-22 14:45:05 -0800 | [diff] [blame] | 34 | namespace implementation { |
Roshan Pius | e2d2101 | 2018-08-17 11:22:06 -0700 | [diff] [blame] | 35 | using namespace android::hardware::wifi::hostapd::V1_0; |
Roshan Pius | cc81756 | 2017-12-22 14:45:05 -0800 | [diff] [blame] | 36 | |
| 37 | /** |
| 38 | * Implementation of the hostapd hidl object. This hidl |
| 39 | * object is used core for global control operations on |
| 40 | * hostapd. |
| 41 | */ |
lesl | 1a842e6 | 2019-12-02 19:00:37 +0800 | [diff] [blame] | 42 | class Hostapd : public V1_2::IHostapd |
Roshan Pius | cc81756 | 2017-12-22 14:45:05 -0800 | [diff] [blame] | 43 | { |
| 44 | public: |
| 45 | Hostapd(hapd_interfaces* interfaces); |
| 46 | ~Hostapd() override = default; |
| 47 | |
| 48 | // Hidl methods exposed. |
| 49 | Return<void> addAccessPoint( |
Daisuke Niwa | c1bd20f | 2019-01-09 13:51:02 +0900 | [diff] [blame] | 50 | const V1_0::IHostapd::IfaceParams& iface_params, |
Ahmed ElArabawy | 3498267 | 2019-12-06 10:10:17 -0800 | [diff] [blame] | 51 | const V1_0::IHostapd::NetworkParams& nw_params, addAccessPoint_cb _hidl_cb) override; |
Daisuke Niwa | c1bd20f | 2019-01-09 13:51:02 +0900 | [diff] [blame] | 52 | Return<void> addAccessPoint_1_1( |
Ahmed ElArabawy | 3498267 | 2019-12-06 10:10:17 -0800 | [diff] [blame] | 53 | const V1_1::IHostapd::IfaceParams& iface_params, |
| 54 | const V1_0::IHostapd::NetworkParams& nw_params, addAccessPoint_cb _hidl_cb) override; |
| 55 | Return<void> addAccessPoint_1_2( |
| 56 | const V1_2::IHostapd::IfaceParams& iface_params, const NetworkParams& nw_params, |
| 57 | addAccessPoint_1_2_cb _hidl_cb) override; |
Roshan Pius | cc81756 | 2017-12-22 14:45:05 -0800 | [diff] [blame] | 58 | Return<void> removeAccessPoint( |
| 59 | const hidl_string& iface_name, |
| 60 | removeAccessPoint_cb _hidl_cb) override; |
Roshan Pius | 3455af4 | 2018-02-01 09:19:49 -0800 | [diff] [blame] | 61 | Return<void> terminate() override; |
Roshan Pius | e2d2101 | 2018-08-17 11:22:06 -0700 | [diff] [blame] | 62 | Return<void> registerCallback( |
lesl | 1a842e6 | 2019-12-02 19:00:37 +0800 | [diff] [blame] | 63 | const sp<V1_1::IHostapdCallback>& callback, |
Roshan Pius | e2d2101 | 2018-08-17 11:22:06 -0700 | [diff] [blame] | 64 | registerCallback_cb _hidl_cb) override; |
lesl | 1a842e6 | 2019-12-02 19:00:37 +0800 | [diff] [blame] | 65 | Return<void>forceClientDisconnect( |
| 66 | const hidl_string& iface_name, |
| 67 | const hidl_array<uint8_t, 6>& client_address, |
| 68 | V1_2::Ieee80211ReasonCode reason_code, forceClientDisconnect_cb _hidl_cb) override; |
Roger Wang | cede506 | 2019-12-30 12:56:28 +0800 | [diff] [blame^] | 69 | Return<void> setDebugParams( |
| 70 | DebugLevel level, setDebugParams_cb _hidl_cb) override; |
Roshan Pius | cc81756 | 2017-12-22 14:45:05 -0800 | [diff] [blame] | 71 | private: |
| 72 | // Corresponding worker functions for the HIDL methods. |
lesl | 1a842e6 | 2019-12-02 19:00:37 +0800 | [diff] [blame] | 73 | V1_0::HostapdStatus addAccessPointInternal( |
Daisuke Niwa | c1bd20f | 2019-01-09 13:51:02 +0900 | [diff] [blame] | 74 | const V1_0::IHostapd::IfaceParams& iface_params, |
Ahmed ElArabawy | 3498267 | 2019-12-06 10:10:17 -0800 | [diff] [blame] | 75 | const V1_0::IHostapd::NetworkParams& nw_params); |
lesl | 1a842e6 | 2019-12-02 19:00:37 +0800 | [diff] [blame] | 76 | V1_0::HostapdStatus addAccessPointInternal_1_1( |
Ahmed ElArabawy | 3498267 | 2019-12-06 10:10:17 -0800 | [diff] [blame] | 77 | const V1_1::IHostapd::IfaceParams& IfaceParams, |
| 78 | const V1_0::IHostapd::NetworkParams& nw_params); |
| 79 | V1_2::HostapdStatus addAccessPointInternal_1_2( |
| 80 | const V1_2::IHostapd::IfaceParams& IfaceParams, |
| 81 | const V1_0::IHostapd::NetworkParams& nw_params); |
lesl | 1a842e6 | 2019-12-02 19:00:37 +0800 | [diff] [blame] | 82 | V1_0::HostapdStatus removeAccessPointInternal(const std::string& iface_name); |
| 83 | V1_0::HostapdStatus registerCallbackInternal( |
| 84 | const sp<V1_1::IHostapdCallback>& callback); |
| 85 | V1_2::HostapdStatus forceClientDisconnectInternal( |
| 86 | const std::string& iface_name, |
| 87 | const std::array<uint8_t, 6>& client_address, |
| 88 | V1_2::Ieee80211ReasonCode reason_code); |
Roger Wang | cede506 | 2019-12-30 12:56:28 +0800 | [diff] [blame^] | 89 | V1_2::HostapdStatus setDebugParamsInternal(DebugLevel level); |
Roshan Pius | cc81756 | 2017-12-22 14:45:05 -0800 | [diff] [blame] | 90 | // Raw pointer to the global structure maintained by the core. |
| 91 | struct hapd_interfaces* interfaces_; |
Roshan Pius | e2d2101 | 2018-08-17 11:22:06 -0700 | [diff] [blame] | 92 | // Callbacks registered. |
lesl | 1a842e6 | 2019-12-02 19:00:37 +0800 | [diff] [blame] | 93 | std::vector<sp<V1_1::IHostapdCallback>> callbacks_; |
Roshan Pius | cc81756 | 2017-12-22 14:45:05 -0800 | [diff] [blame] | 94 | DISALLOW_COPY_AND_ASSIGN(Hostapd); |
| 95 | }; |
| 96 | } // namespace implementation |
lesl | 1a842e6 | 2019-12-02 19:00:37 +0800 | [diff] [blame] | 97 | } // namespace V1_2 |
Roshan Pius | cc81756 | 2017-12-22 14:45:05 -0800 | [diff] [blame] | 98 | } // namespace hostapd |
| 99 | } // namespace wifi |
| 100 | } // namespace hardware |
| 101 | } // namespace android |
| 102 | |
| 103 | #endif // HOSTAPD_HIDL_SUPPLICANT_H |