blob: ffdbd8e9c6bf3bf84625f20f3a051ed328b1296c [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;
58private:
59 // Corresponding worker functions for the AIDL methods.
60 ::ndk::ScopedAStatus addAccessPointInternal(
61 const IfaceParams& iface_params,
62 const NetworkParams& nw_params);
63 ::ndk::ScopedAStatus addSingleAccessPoint(
64 const IfaceParams& IfaceParams,
65 const ChannelParams& channelParams,
66 const NetworkParams& nw_params,
Purushottam Kushwaha0316c882021-12-20 15:07:44 +053067 std::string br_name,
68 std::string owe_transition_ifname);
Gabriel Biren72cf9a52021-06-25 23:29:26 +000069 ::ndk::ScopedAStatus addConcurrentAccessPoints(
70 const IfaceParams& IfaceParams,
71 const NetworkParams& nw_params);
72 ::ndk::ScopedAStatus removeAccessPointInternal(const std::string& iface_name);
73 ::ndk::ScopedAStatus registerCallbackInternal(
74 const std::shared_ptr<IHostapdCallback>& callback);
75 ::ndk::ScopedAStatus forceClientDisconnectInternal(
76 const std::string& iface_name,
77 const std::vector<uint8_t>& client_address,
78 Ieee80211ReasonCode reason_code);
79 ::ndk::ScopedAStatus setDebugParamsInternal(DebugLevel level);
80
81 // Raw pointer to the global structure maintained by the core.
82 struct hapd_interfaces* interfaces_;
83 // Callbacks registered.
84 std::vector<std::shared_ptr<IHostapdCallback>> callbacks_;
85 // Death notifier.
86 AIBinder_DeathRecipient* death_notifier_;
87 // Bridge and its managed interfaces.
88 std::map<std::string, std::vector<std::string>> br_interfaces_;
89 DISALLOW_COPY_AND_ASSIGN(Hostapd);
90};
91} // namespace hostapd
92} // namespace wifi
93} // namespace hardware
94} // namespace android
95} // namespace aidl