blob: 51d7f39512b3101e72b995f0552bd99d17670b58 [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
15#include "fi/w1/wpa_supplicant/BnIface.h"
16#include "fi/w1/wpa_supplicant/INetwork.h"
17
18extern "C" {
19#include "utils/common.h"
20#include "utils/includes.h"
21#include "wpa_supplicant_i.h"
22#include "driver_i.h"
23}
24
25namespace wpa_supplicant_hidl {
26
27/**
28 * Implementation of Iface hidl object. Each unique hidl
29 * object is used for control operations on a specific interface
30 * controlled by wpa_supplicant.
31 */
32class Iface : public fi::w1::wpa_supplicant::BnIface
33{
34public:
35 Iface(struct wpa_global *wpa_global, const char ifname[]);
36 ~Iface() override = default;
37
38 // Hidl methods exposed in aidl.
39 android::hidl::Status GetName(std::string *iface_name_out) override;
40 android::hidl::Status AddNetwork(
41 android::sp<fi::w1::wpa_supplicant::INetwork> *network_object_out)
42 override;
43 android::hidl::Status RemoveNetwork(int network_id) override;
44 android::hidl::Status GetNetwork(
45 int network_id,
46 android::sp<fi::w1::wpa_supplicant::INetwork> *network_object_out)
47 override;
48 android::hidl::Status RegisterCallback(
49 const android::sp<fi::w1::wpa_supplicant::IIfaceCallback> &callback)
50 override;
51 android::hidl::Status Reassociate() override;
52 android::hidl::Status Reconnect() override;
53 android::hidl::Status Disconnect() override;
54 android::hidl::Status SetPowerSave(bool enable) override;
55 android::hidl::Status InitiateTDLSDiscover(
56 const std::vector<uint8_t> &mac_address) override;
57 android::hidl::Status InitiateTDLSSetup(
58 const std::vector<uint8_t> &mac_address) override;
59 android::hidl::Status InitiateTDLSTeardown(
60 const std::vector<uint8_t> &mac_address) override;
61
62private:
63 struct wpa_supplicant *retrieveIfacePtr();
64
65 // Reference to the global wpa_struct. This is assumed to be valid for
66 // the lifetime of the process.
67 const struct wpa_global *wpa_global_;
68 // Name of the iface this hidl object controls
69 const std::string ifname_;
70
71 DISALLOW_COPY_AND_ASSIGN(Iface);
72};
73
74} // namespace wpa_supplicant_hidl
75
76#endif // WPA_SUPPLICANT_HIDL_IFACE_H