blob: ba47810ab15b02290df7269a85e6546d3fcfbbbc [file] [log] [blame]
Gabriel Biren72cf9a52021-06-25 23:29:26 +00001/*
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
19extern "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
29namespace aidl {
30namespace android {
31namespace hardware {
32namespace wifi {
33namespace 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 */
40class Hostapd : public BnHostapd
41{
42public:
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 Lee8d291ea2024-11-19 22:18:50 +000058 ::ndk::ScopedAStatus removeLinkFromMultipleLinkBridgedApIface(
59 const std::string& iface_name, const std::string& linkIdentity) override;
Gabriel Biren72cf9a52021-06-25 23:29:26 +000060private:
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 Kushwaha0316c882021-12-20 15:07:44 +053069 std::string br_name,
70 std::string owe_transition_ifname);
Gabriel Biren72cf9a52021-06-25 23:29:26 +000071 ::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 Lee8d291ea2024-11-19 22:18:50 +000082 ::ndk::ScopedAStatus removeLinkFromMultipleLinkBridgedApIfaceInternal(
83 const std::string& iface_name, const std::string& linkIdentity);
Gabriel Biren72cf9a52021-06-25 23:29:26 +000084 // 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