blob: 80db4e9446bcc80e7c96748d75b05c44b70a4e80 [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
lesl1a842e62019-12-02 19:00:37 +080017#include <android/hardware/wifi/hostapd/1.2/IHostapd.h>
Roshan Piuse2d21012018-08-17 11:22:06 -070018#include <android/hardware/wifi/hostapd/1.1/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 {
lesl1a842e62019-12-02 19:00:37 +080033namespace V1_2 {
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 */
lesl1a842e62019-12-02 19:00:37 +080042class Hostapd : public V1_2::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,
51 const NetworkParams& nw_params, addAccessPoint_cb _hidl_cb) override;
52 Return<void> addAccessPoint_1_1(
Roshan Piuscc817562017-12-22 14:45:05 -080053 const IfaceParams& iface_params, const NetworkParams& nw_params,
54 addAccessPoint_cb _hidl_cb) override;
55 Return<void> removeAccessPoint(
56 const hidl_string& iface_name,
57 removeAccessPoint_cb _hidl_cb) override;
Roshan Pius3455af42018-02-01 09:19:49 -080058 Return<void> terminate() override;
Roshan Piuse2d21012018-08-17 11:22:06 -070059 Return<void> registerCallback(
lesl1a842e62019-12-02 19:00:37 +080060 const sp<V1_1::IHostapdCallback>& callback,
Roshan Piuse2d21012018-08-17 11:22:06 -070061 registerCallback_cb _hidl_cb) override;
lesl1a842e62019-12-02 19:00:37 +080062 Return<void>forceClientDisconnect(
63 const hidl_string& iface_name,
64 const hidl_array<uint8_t, 6>& client_address,
65 V1_2::Ieee80211ReasonCode reason_code, forceClientDisconnect_cb _hidl_cb) override;
Roshan Piuscc817562017-12-22 14:45:05 -080066private:
67 // Corresponding worker functions for the HIDL methods.
lesl1a842e62019-12-02 19:00:37 +080068 V1_0::HostapdStatus addAccessPointInternal(
Daisuke Niwac1bd20f2019-01-09 13:51:02 +090069 const V1_0::IHostapd::IfaceParams& iface_params,
70 const NetworkParams& nw_params);
lesl1a842e62019-12-02 19:00:37 +080071 V1_0::HostapdStatus addAccessPointInternal_1_1(
Daisuke Niwac1bd20f2019-01-09 13:51:02 +090072 const IfaceParams& IfaceParams, const NetworkParams& nw_params);
lesl1a842e62019-12-02 19:00:37 +080073 V1_0::HostapdStatus removeAccessPointInternal(const std::string& iface_name);
74 V1_0::HostapdStatus registerCallbackInternal(
75 const sp<V1_1::IHostapdCallback>& callback);
76 V1_2::HostapdStatus forceClientDisconnectInternal(
77 const std::string& iface_name,
78 const std::array<uint8_t, 6>& client_address,
79 V1_2::Ieee80211ReasonCode reason_code);
Roshan Piuscc817562017-12-22 14:45:05 -080080 // Raw pointer to the global structure maintained by the core.
81 struct hapd_interfaces* interfaces_;
Roshan Piuse2d21012018-08-17 11:22:06 -070082 // Callbacks registered.
lesl1a842e62019-12-02 19:00:37 +080083 std::vector<sp<V1_1::IHostapdCallback>> callbacks_;
Roshan Piuscc817562017-12-22 14:45:05 -080084 DISALLOW_COPY_AND_ASSIGN(Hostapd);
85};
86} // namespace implementation
lesl1a842e62019-12-02 19:00:37 +080087} // namespace V1_2
Roshan Piuscc817562017-12-22 14:45:05 -080088} // namespace hostapd
89} // namespace wifi
90} // namespace hardware
91} // namespace android
92
93#endif // HOSTAPD_HIDL_SUPPLICANT_H