blob: 3438d8b2c7c1c72ed0910f782325c0fd20bf9a7f [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(
49 const IfaceParams& iface_params, const NetworkParams& nw_params,
50 addAccessPoint_cb _hidl_cb) override;
51 Return<void> removeAccessPoint(
52 const hidl_string& iface_name,
53 removeAccessPoint_cb _hidl_cb) override;
Roshan Pius3455af42018-02-01 09:19:49 -080054 Return<void> terminate() override;
Roshan Piuse2d21012018-08-17 11:22:06 -070055 Return<void> registerCallback(
56 const sp<IHostapdCallback>& callback,
57 registerCallback_cb _hidl_cb) override;
Roshan Piuscc817562017-12-22 14:45:05 -080058
59private:
60 // Corresponding worker functions for the HIDL methods.
61 HostapdStatus addAccessPointInternal(
62 const IfaceParams& iface_params, const NetworkParams& nw_params);
63 HostapdStatus removeAccessPointInternal(const std::string& iface_name);
Roshan Piuse2d21012018-08-17 11:22:06 -070064 HostapdStatus registerCallbackInternal(
65 const sp<IHostapdCallback>& callback);
Roshan Piuscc817562017-12-22 14:45:05 -080066
67 // Raw pointer to the global structure maintained by the core.
68 struct hapd_interfaces* interfaces_;
Roshan Piuse2d21012018-08-17 11:22:06 -070069 // Callbacks registered.
70 std::vector<sp<IHostapdCallback>> callbacks_;
Roshan Piuscc817562017-12-22 14:45:05 -080071
72 DISALLOW_COPY_AND_ASSIGN(Hostapd);
73};
74} // namespace implementation
Roshan Piuse2d21012018-08-17 11:22:06 -070075} // namespace V1_1
Roshan Piuscc817562017-12-22 14:45:05 -080076} // namespace hostapd
77} // namespace wifi
78} // namespace hardware
79} // namespace android
80
81#endif // HOSTAPD_HIDL_SUPPLICANT_H