blob: 059e24a242b06a9cc00d372e9c8c598854fd4444 [file] [log] [blame]
Roshan Piuscc817562017-12-22 14:45:05 -08001/*
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
leslf8b1b402020-08-04 17:09:39 +080017#include <android/hardware/wifi/hostapd/1.3/IHostapd.h>
18#include <android/hardware/wifi/hostapd/1.3/IHostapdCallback.h>
Roshan Piuscc817562017-12-22 14:45:05 -080019
20extern "C"
21{
22#include "utils/common.h"
23#include "utils/includes.h"
24#include "utils/wpa_debug.h"
25#include "ap/hostapd.h"
lesl1a842e62019-12-02 19:00:37 +080026#include "ap/sta_info.h"
Roshan Piuscc817562017-12-22 14:45:05 -080027}
28
29namespace android {
30namespace hardware {
31namespace wifi {
32namespace hostapd {
leslf8b1b402020-08-04 17:09:39 +080033namespace V1_3 {
Roshan Piuscc817562017-12-22 14:45:05 -080034namespace implementation {
Roshan Piuse2d21012018-08-17 11:22:06 -070035using namespace android::hardware::wifi::hostapd::V1_0;
Roshan Piuscc817562017-12-22 14:45:05 -080036
37/**
38 * Implementation of the hostapd hidl object. This hidl
39 * object is used core for global control operations on
40 * hostapd.
41 */
leslf8b1b402020-08-04 17:09:39 +080042class Hostapd : public V1_3::IHostapd
Roshan Piuscc817562017-12-22 14:45:05 -080043{
44public:
45 Hostapd(hapd_interfaces* interfaces);
46 ~Hostapd() override = default;
47
48 // Hidl methods exposed.
49 Return<void> addAccessPoint(
Daisuke Niwac1bd20f2019-01-09 13:51:02 +090050 const V1_0::IHostapd::IfaceParams& iface_params,
Ahmed ElArabawy34982672019-12-06 10:10:17 -080051 const V1_0::IHostapd::NetworkParams& nw_params, addAccessPoint_cb _hidl_cb) override;
Daisuke Niwac1bd20f2019-01-09 13:51:02 +090052 Return<void> addAccessPoint_1_1(
Ahmed ElArabawy34982672019-12-06 10:10:17 -080053 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(
leslb0f4d542020-09-16 23:06:03 +080056 const V1_2::IHostapd::IfaceParams& iface_params,
57 const V1_2::IHostapd::NetworkParams& nw_params,
Ahmed ElArabawy34982672019-12-06 10:10:17 -080058 addAccessPoint_1_2_cb _hidl_cb) override;
leslb0f4d542020-09-16 23:06:03 +080059 Return<void> addAccessPoint_1_3(
60 const V1_2::IHostapd::IfaceParams& iface_params,
61 const V1_3::IHostapd::NetworkParams& nw_params,
62 addAccessPoint_1_3_cb _hidl_cb) override;
Roshan Piuscc817562017-12-22 14:45:05 -080063 Return<void> removeAccessPoint(
64 const hidl_string& iface_name,
65 removeAccessPoint_cb _hidl_cb) override;
Roshan Pius3455af42018-02-01 09:19:49 -080066 Return<void> terminate() override;
Roshan Piuse2d21012018-08-17 11:22:06 -070067 Return<void> registerCallback(
lesl1a842e62019-12-02 19:00:37 +080068 const sp<V1_1::IHostapdCallback>& callback,
Roshan Piuse2d21012018-08-17 11:22:06 -070069 registerCallback_cb _hidl_cb) override;
leslf8b1b402020-08-04 17:09:39 +080070 Return<void> registerCallback_1_3(
71 const sp<V1_3::IHostapdCallback>& callback,
72 registerCallback_1_3_cb _hidl_cb) override;
lesl1a842e62019-12-02 19:00:37 +080073 Return<void>forceClientDisconnect(
74 const hidl_string& iface_name,
75 const hidl_array<uint8_t, 6>& client_address,
76 V1_2::Ieee80211ReasonCode reason_code, forceClientDisconnect_cb _hidl_cb) override;
Roger Wangcede5062019-12-30 12:56:28 +080077 Return<void> setDebugParams(
leslf8b1b402020-08-04 17:09:39 +080078 V1_2::DebugLevel level, setDebugParams_cb _hidl_cb) override;
Roshan Piuscc817562017-12-22 14:45:05 -080079private:
80 // Corresponding worker functions for the HIDL methods.
lesl1a842e62019-12-02 19:00:37 +080081 V1_0::HostapdStatus addAccessPointInternal(
Daisuke Niwac1bd20f2019-01-09 13:51:02 +090082 const V1_0::IHostapd::IfaceParams& iface_params,
Ahmed ElArabawy34982672019-12-06 10:10:17 -080083 const V1_0::IHostapd::NetworkParams& nw_params);
lesl1a842e62019-12-02 19:00:37 +080084 V1_0::HostapdStatus addAccessPointInternal_1_1(
Ahmed ElArabawy34982672019-12-06 10:10:17 -080085 const V1_1::IHostapd::IfaceParams& IfaceParams,
86 const V1_0::IHostapd::NetworkParams& nw_params);
87 V1_2::HostapdStatus addAccessPointInternal_1_2(
88 const V1_2::IHostapd::IfaceParams& IfaceParams,
lesldd48efd2019-12-26 15:13:51 +080089 const V1_2::IHostapd::NetworkParams& nw_params);
leslb0f4d542020-09-16 23:06:03 +080090 V1_2::HostapdStatus addAccessPointInternal_1_3(
91 const V1_2::IHostapd::IfaceParams& IfaceParams,
92 const V1_3::IHostapd::NetworkParams& nw_params);
lesl1a842e62019-12-02 19:00:37 +080093 V1_0::HostapdStatus removeAccessPointInternal(const std::string& iface_name);
94 V1_0::HostapdStatus registerCallbackInternal(
95 const sp<V1_1::IHostapdCallback>& callback);
leslf8b1b402020-08-04 17:09:39 +080096 V1_2::HostapdStatus registerCallbackInternal_1_3(
97 const sp<V1_3::IHostapdCallback>& callback);
lesl1a842e62019-12-02 19:00:37 +080098 V1_2::HostapdStatus forceClientDisconnectInternal(
99 const std::string& iface_name,
100 const std::array<uint8_t, 6>& client_address,
101 V1_2::Ieee80211ReasonCode reason_code);
leslf8b1b402020-08-04 17:09:39 +0800102 V1_2::HostapdStatus setDebugParamsInternal(V1_2::DebugLevel level);
Roshan Piuscc817562017-12-22 14:45:05 -0800103 // Raw pointer to the global structure maintained by the core.
104 struct hapd_interfaces* interfaces_;
Roshan Piuse2d21012018-08-17 11:22:06 -0700105 // Callbacks registered.
leslf8b1b402020-08-04 17:09:39 +0800106 std::vector<sp<V1_3::IHostapdCallback>> callbacks_;
Roshan Piuscc817562017-12-22 14:45:05 -0800107 DISALLOW_COPY_AND_ASSIGN(Hostapd);
108};
109} // namespace implementation
leslf8b1b402020-08-04 17:09:39 +0800110} // namespace V1_3
Roshan Piuscc817562017-12-22 14:45:05 -0800111} // namespace hostapd
112} // namespace wifi
113} // namespace hardware
114} // namespace android
115
116#endif // HOSTAPD_HIDL_SUPPLICANT_H