blob: e2b4ba8bccb5c793645e37ad144b1f037d87ef70 [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
Roshan Piuse2d21012018-08-17 11:22:06 -070017#include <android/hardware/wifi/hostapd/1.1/IHostapd.h>
18#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"
26}
27
28namespace android {
29namespace hardware {
30namespace wifi {
31namespace hostapd {
Roshan Piuse2d21012018-08-17 11:22:06 -070032namespace V1_1 {
Roshan Piuscc817562017-12-22 14:45:05 -080033namespace implementation {
Roshan Piuse2d21012018-08-17 11:22:06 -070034using namespace android::hardware::wifi::hostapd::V1_0;
Roshan Piuscc817562017-12-22 14:45:05 -080035
36/**
37 * Implementation of the hostapd hidl object. This hidl
38 * object is used core for global control operations on
39 * hostapd.
40 */
Roshan Piuse2d21012018-08-17 11:22:06 -070041class Hostapd : public V1_1::IHostapd
Roshan Piuscc817562017-12-22 14:45:05 -080042{
43public:
44 Hostapd(hapd_interfaces* interfaces);
45 ~Hostapd() override = default;
46
47 // Hidl methods exposed.
48 Return<void> addAccessPoint(
Daisuke Niwac1bd20f2019-01-09 13:51:02 +090049 const V1_0::IHostapd::IfaceParams& iface_params,
50 const NetworkParams& nw_params, addAccessPoint_cb _hidl_cb) override;
51 Return<void> addAccessPoint_1_1(
Roshan Piuscc817562017-12-22 14:45:05 -080052 const IfaceParams& iface_params, const NetworkParams& nw_params,
53 addAccessPoint_cb _hidl_cb) override;
54 Return<void> removeAccessPoint(
55 const hidl_string& iface_name,
56 removeAccessPoint_cb _hidl_cb) override;
Roshan Pius3455af42018-02-01 09:19:49 -080057 Return<void> terminate() override;
Roshan Piuse2d21012018-08-17 11:22:06 -070058 Return<void> registerCallback(
59 const sp<IHostapdCallback>& callback,
60 registerCallback_cb _hidl_cb) override;
Roshan Piuscc817562017-12-22 14:45:05 -080061
62private:
63 // Corresponding worker functions for the HIDL methods.
64 HostapdStatus addAccessPointInternal(
Daisuke Niwac1bd20f2019-01-09 13:51:02 +090065 const V1_0::IHostapd::IfaceParams& iface_params,
66 const NetworkParams& nw_params);
67 HostapdStatus addAccessPointInternal_1_1(
68 const IfaceParams& IfaceParams, const NetworkParams& nw_params);
Roshan Piuscc817562017-12-22 14:45:05 -080069 HostapdStatus removeAccessPointInternal(const std::string& iface_name);
Roshan Piuse2d21012018-08-17 11:22:06 -070070 HostapdStatus registerCallbackInternal(
71 const sp<IHostapdCallback>& callback);
Roshan Piuscc817562017-12-22 14:45:05 -080072
73 // Raw pointer to the global structure maintained by the core.
74 struct hapd_interfaces* interfaces_;
Roshan Piuse2d21012018-08-17 11:22:06 -070075 // Callbacks registered.
76 std::vector<sp<IHostapdCallback>> callbacks_;
Roshan Piuscc817562017-12-22 14:45:05 -080077
78 DISALLOW_COPY_AND_ASSIGN(Hostapd);
79};
80} // namespace implementation
Roshan Piuse2d21012018-08-17 11:22:06 -070081} // namespace V1_1
Roshan Piuscc817562017-12-22 14:45:05 -080082} // namespace hostapd
83} // namespace wifi
84} // namespace hardware
85} // namespace android
86
87#endif // HOSTAPD_HIDL_SUPPLICANT_H