Gabriel Biren | 72cf9a5 | 2021-06-25 23:29:26 +0000 | [diff] [blame] | 1 | /* |
| 2 | * aidl 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 | #pragma once |
| 11 | |
| 12 | #include <map> |
| 13 | #include <string> |
| 14 | |
| 15 | #include <android-base/macros.h> |
| 16 | |
| 17 | #include <aidl/android/hardware/wifi/hostapd/BnHostapd.h> |
| 18 | |
| 19 | extern "C" |
| 20 | { |
| 21 | #include "utils/common.h" |
| 22 | #include "utils/eloop.h" |
| 23 | #include "utils/includes.h" |
| 24 | #include "utils/wpa_debug.h" |
| 25 | #include "ap/hostapd.h" |
| 26 | #include "ap/sta_info.h" |
| 27 | } |
| 28 | |
| 29 | namespace aidl { |
| 30 | namespace android { |
| 31 | namespace hardware { |
| 32 | namespace wifi { |
| 33 | namespace hostapd { |
| 34 | |
| 35 | /** |
| 36 | * Implementation of the hostapd aidl object. This aidl |
| 37 | * object is used core for global control operations on |
| 38 | * hostapd. |
| 39 | */ |
| 40 | class Hostapd : public BnHostapd |
| 41 | { |
| 42 | public: |
| 43 | Hostapd(hapd_interfaces* interfaces); |
| 44 | ~Hostapd() override = default; |
| 45 | |
| 46 | // Aidl methods exposed. |
| 47 | ::ndk::ScopedAStatus addAccessPoint( |
| 48 | const IfaceParams& iface_params, const NetworkParams& nw_params) override; |
| 49 | ::ndk::ScopedAStatus removeAccessPoint(const std::string& iface_name) override; |
| 50 | ::ndk::ScopedAStatus terminate() override; |
| 51 | ::ndk::ScopedAStatus registerCallback( |
| 52 | const std::shared_ptr<IHostapdCallback>& callback) override; |
| 53 | ::ndk::ScopedAStatus forceClientDisconnect( |
| 54 | const std::string& iface_name, |
| 55 | const std::vector<uint8_t>& client_address, |
| 56 | Ieee80211ReasonCode reason_code) override; |
| 57 | ::ndk::ScopedAStatus setDebugParams(DebugLevel level) override; |
Les Lee | 8d291ea | 2024-11-19 22:18:50 +0000 | [diff] [blame] | 58 | ::ndk::ScopedAStatus removeLinkFromMultipleLinkBridgedApIface( |
| 59 | const std::string& iface_name, const std::string& linkIdentity) override; |
Gabriel Biren | 72cf9a5 | 2021-06-25 23:29:26 +0000 | [diff] [blame] | 60 | private: |
| 61 | // Corresponding worker functions for the AIDL methods. |
| 62 | ::ndk::ScopedAStatus addAccessPointInternal( |
| 63 | const IfaceParams& iface_params, |
| 64 | const NetworkParams& nw_params); |
| 65 | ::ndk::ScopedAStatus addSingleAccessPoint( |
| 66 | const IfaceParams& IfaceParams, |
| 67 | const ChannelParams& channelParams, |
| 68 | const NetworkParams& nw_params, |
Purushottam Kushwaha | 0316c88 | 2021-12-20 15:07:44 +0530 | [diff] [blame] | 69 | std::string br_name, |
| 70 | std::string owe_transition_ifname); |
Gabriel Biren | 72cf9a5 | 2021-06-25 23:29:26 +0000 | [diff] [blame] | 71 | ::ndk::ScopedAStatus addConcurrentAccessPoints( |
| 72 | const IfaceParams& IfaceParams, |
| 73 | const NetworkParams& nw_params); |
| 74 | ::ndk::ScopedAStatus removeAccessPointInternal(const std::string& iface_name); |
| 75 | ::ndk::ScopedAStatus registerCallbackInternal( |
| 76 | const std::shared_ptr<IHostapdCallback>& callback); |
| 77 | ::ndk::ScopedAStatus forceClientDisconnectInternal( |
| 78 | const std::string& iface_name, |
| 79 | const std::vector<uint8_t>& client_address, |
| 80 | Ieee80211ReasonCode reason_code); |
| 81 | ::ndk::ScopedAStatus setDebugParamsInternal(DebugLevel level); |
Les Lee | 8d291ea | 2024-11-19 22:18:50 +0000 | [diff] [blame] | 82 | ::ndk::ScopedAStatus removeLinkFromMultipleLinkBridgedApIfaceInternal( |
| 83 | const std::string& iface_name, const std::string& linkIdentity); |
Gabriel Biren | 72cf9a5 | 2021-06-25 23:29:26 +0000 | [diff] [blame] | 84 | // Raw pointer to the global structure maintained by the core. |
| 85 | struct hapd_interfaces* interfaces_; |
| 86 | // Callbacks registered. |
| 87 | std::vector<std::shared_ptr<IHostapdCallback>> callbacks_; |
| 88 | // Death notifier. |
| 89 | AIBinder_DeathRecipient* death_notifier_; |
| 90 | // Bridge and its managed interfaces. |
| 91 | std::map<std::string, std::vector<std::string>> br_interfaces_; |
| 92 | DISALLOW_COPY_AND_ASSIGN(Hostapd); |
| 93 | }; |
| 94 | } // namespace hostapd |
| 95 | } // namespace wifi |
| 96 | } // namespace hardware |
| 97 | } // namespace android |
| 98 | } // namespace aidl |