blob: 3be2675b87f522a3c7fb214946663fd4d6167b84 [file] [log] [blame]
Roshan Pius57ffbcf2016-09-27 09:12:46 -07001/*
2 * hidl interface for wpa_supplicant daemon
3 * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
4 * Copyright (c) 2004-2016, 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 WPA_SUPPLICANT_HIDL_IFACE_H
11#define WPA_SUPPLICANT_HIDL_IFACE_H
12
13#include <android-base/macros.h>
14
Roshan Pius7c0ebf22016-09-20 15:11:56 -070015#include <android/hardware/wifi/supplicant/1.0/ISupplicantIface.h>
16#include <android/hardware/wifi/supplicant/1.0/ISupplicantIfaceCallback.h>
17#include <android/hardware/wifi/supplicant/1.0/ISupplicantNetwork.h>
Roshan Pius57ffbcf2016-09-27 09:12:46 -070018
19extern "C" {
20#include "utils/common.h"
21#include "utils/includes.h"
22#include "wpa_supplicant_i.h"
23#include "driver_i.h"
24}
25
Roshan Pius7c0ebf22016-09-20 15:11:56 -070026namespace android {
27namespace hardware {
28namespace wifi {
29namespace supplicant {
30namespace V1_0 {
31namespace implementation {
Roshan Pius57ffbcf2016-09-27 09:12:46 -070032
33/**
34 * Implementation of Iface hidl object. Each unique hidl
35 * object is used for control operations on a specific interface
36 * controlled by wpa_supplicant.
37 */
Roshan Pius7c0ebf22016-09-20 15:11:56 -070038class Iface : public android::hardware::wifi::supplicant::V1_0::ISupplicantIface
Roshan Pius57ffbcf2016-09-27 09:12:46 -070039{
40public:
Roshan Pius7c0ebf22016-09-20 15:11:56 -070041 Iface(struct wpa_global* wpa_global, const char ifname[]);
Roshan Pius57ffbcf2016-09-27 09:12:46 -070042 ~Iface() override = default;
43
Roshan Pius7c0ebf22016-09-20 15:11:56 -070044 // Hidl methods exposed.
45 Return<void> getName(getName_cb _hidl_cb) override;
46 Return<void> addNetwork(addNetwork_cb _hidl_cb) override;
47 Return<void> removeNetwork(
48 uint32_t id, removeNetwork_cb _hidl_cb) override;
49 Return<void> getNetwork(uint32_t id, getNetwork_cb _hidl_cb) override;
50 Return<void> listNetworks(listNetworks_cb _hidl_cb) override;
51 Return<void> registerCallback(
52 const sp<ISupplicantIfaceCallback>& callback,
53 registerCallback_cb _hidl_cb) override;
54 Return<void> reassociate(reassociate_cb _hidl_cb) override;
55 Return<void> reconnect(reconnect_cb _hidl_cb) override;
56 Return<void> disconnect(disconnect_cb _hidl_cb) override;
57 Return<void> setPowerSave(
58 bool enable, setPowerSave_cb _hidl_cb) override;
59 Return<void> initiateTdlsDiscover(
60 const hidl_array<uint8_t, 6 /* 6 */>& mac_address,
61 initiateTdlsDiscover_cb _hidl_cb) override;
62 Return<void> initiateTdlsSetup(
63 const hidl_array<uint8_t, 6 /* 6 */>& mac_address,
64 initiateTdlsSetup_cb _hidl_cb) override;
65 Return<void> initiateTdlsTeardown(
66 const hidl_array<uint8_t, 6 /* 6 */>& mac_address,
67 initiateTdlsTeardown_cb _hidl_cb) override;
Roshan Pius57ffbcf2016-09-27 09:12:46 -070068
69private:
Roshan Pius7c0ebf22016-09-20 15:11:56 -070070 struct wpa_supplicant* retrieveIfacePtr();
Roshan Pius57ffbcf2016-09-27 09:12:46 -070071
72 // Reference to the global wpa_struct. This is assumed to be valid for
73 // the lifetime of the process.
Roshan Pius7c0ebf22016-09-20 15:11:56 -070074 const struct wpa_global* wpa_global_;
Roshan Pius57ffbcf2016-09-27 09:12:46 -070075 // Name of the iface this hidl object controls
76 const std::string ifname_;
77
78 DISALLOW_COPY_AND_ASSIGN(Iface);
79};
80
Roshan Pius7c0ebf22016-09-20 15:11:56 -070081} // namespace implementation
82} // namespace V1_0
83} // namespace wifi
84} // namespace supplicant
85} // namespace hardware
86} // namespace android
Roshan Pius57ffbcf2016-09-27 09:12:46 -070087
88#endif // WPA_SUPPLICANT_HIDL_IFACE_H