blob: 96d52ce33dfae0251bcea81447d9fd7f90f6bb70 [file] [log] [blame]
Dmitry Shmidte4663042016-04-04 10:07:49 -07001/*
2 * binder 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
Dmitry Shmidt7f2c7532016-08-15 09:48:12 -070010#ifndef WPA_SUPPLICANT_BINDER_IFACE_H
11#define WPA_SUPPLICANT_BINDER_IFACE_H
Dmitry Shmidte4663042016-04-04 10:07:49 -070012
Roshan Piusd6e37512016-07-07 13:20:46 -070013#include <android-base/macros.h>
14
Dmitry Shmidte4663042016-04-04 10:07:49 -070015#include "fi/w1/wpa_supplicant/BnIface.h"
Roshan Piusd6e37512016-07-07 13:20:46 -070016#include "fi/w1/wpa_supplicant/INetwork.h"
Dmitry Shmidte4663042016-04-04 10:07:49 -070017
18extern "C" {
Dmitry Shmidte4663042016-04-04 10:07:49 -070019#include "utils/common.h"
Dmitry Shmidt7f2c7532016-08-15 09:48:12 -070020#include "utils/includes.h"
Roshan Piusf745df82016-07-14 16:00:23 -070021#include "wpa_supplicant_i.h"
Roshan Pius390ba282016-08-18 12:32:25 -070022#include "driver_i.h"
Dmitry Shmidte4663042016-04-04 10:07:49 -070023}
24
25namespace wpa_supplicant_binder {
26
27/**
28 * Implementation of Iface binder object. Each unique binder
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:
Roshan Pius54e763a2016-07-06 15:41:53 -070035 Iface(struct wpa_global *wpa_global, const char ifname[]);
Roshan Piusd6e37512016-07-07 13:20:46 -070036 ~Iface() override = default;
Dmitry Shmidte4663042016-04-04 10:07:49 -070037
Roshan Pius54e763a2016-07-06 15:41:53 -070038 // Binder methods exposed in aidl.
39 android::binder::Status GetName(std::string *iface_name_out) override;
Roshan Piusd6e37512016-07-07 13:20:46 -070040 android::binder::Status AddNetwork(
41 android::sp<fi::w1::wpa_supplicant::INetwork> *network_object_out)
42 override;
43 android::binder::Status RemoveNetwork(int network_id) override;
Roshan Piusd3854452016-07-07 16:46:41 -070044 android::binder::Status GetNetwork(
45 int network_id,
46 android::sp<fi::w1::wpa_supplicant::INetwork> *network_object_out)
47 override;
Roshan Pius0470cc82016-07-14 16:37:07 -070048 android::binder::Status RegisterCallback(
49 const android::sp<fi::w1::wpa_supplicant::IIfaceCallback> &callback)
50 override;
Roshan Piusf4e46cf2016-08-09 15:42:42 -070051 android::binder::Status Reassociate() override;
52 android::binder::Status Reconnect() override;
53 android::binder::Status Disconnect() override;
Roshan Pius390ba282016-08-18 12:32:25 -070054 android::binder::Status SetPowerSave(bool enable) override;
55 android::binder::Status InitiateTDLSDiscover(
56 const std::vector<uint8_t> &mac_address) override;
57 android::binder::Status InitiateTDLSSetup(
58 const std::vector<uint8_t> &mac_address) override;
59 android::binder::Status InitiateTDLSTeardown(
60 const std::vector<uint8_t> &mac_address) override;
Roshan Pius54e763a2016-07-06 15:41:53 -070061
Dmitry Shmidte4663042016-04-04 10:07:49 -070062private:
Roshan Piusd6e37512016-07-07 13:20:46 -070063 struct wpa_supplicant *retrieveIfacePtr();
64
Roshan Pius54e763a2016-07-06 15:41:53 -070065 // 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 binder object controls
69 const std::string ifname_;
70
Roshan Piusd6e37512016-07-07 13:20:46 -070071 DISALLOW_COPY_AND_ASSIGN(Iface);
Dmitry Shmidte4663042016-04-04 10:07:49 -070072};
73
Roshan Pius32f9f5f2016-08-15 14:44:22 -070074} // namespace wpa_supplicant_binder
Dmitry Shmidte4663042016-04-04 10:07:49 -070075
Roshan Pius32f9f5f2016-08-15 14:44:22 -070076#endif // WPA_SUPPLICANT_BINDER_IFACE_H