blob: 4ebf59c691fb9664155cccd56246a446a5ef8d6d [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"
Dmitry Shmidte4663042016-04-04 10:07:49 -070022}
23
24namespace wpa_supplicant_binder {
25
26/**
27 * Implementation of Iface binder object. Each unique binder
28 * object is used for control operations on a specific interface
29 * controlled by wpa_supplicant.
30 */
31class Iface : public fi::w1::wpa_supplicant::BnIface
32{
33public:
Roshan Pius54e763a2016-07-06 15:41:53 -070034 Iface(struct wpa_global *wpa_global, const char ifname[]);
Roshan Piusd6e37512016-07-07 13:20:46 -070035 ~Iface() override = default;
Dmitry Shmidte4663042016-04-04 10:07:49 -070036
Roshan Pius54e763a2016-07-06 15:41:53 -070037 // Binder methods exposed in aidl.
38 android::binder::Status GetName(std::string *iface_name_out) override;
Roshan Piusd6e37512016-07-07 13:20:46 -070039 android::binder::Status AddNetwork(
40 android::sp<fi::w1::wpa_supplicant::INetwork> *network_object_out)
41 override;
42 android::binder::Status RemoveNetwork(int network_id) override;
Roshan Piusd3854452016-07-07 16:46:41 -070043 android::binder::Status GetNetwork(
44 int network_id,
45 android::sp<fi::w1::wpa_supplicant::INetwork> *network_object_out)
46 override;
Roshan Pius0470cc82016-07-14 16:37:07 -070047 android::binder::Status RegisterCallback(
48 const android::sp<fi::w1::wpa_supplicant::IIfaceCallback> &callback)
49 override;
Roshan Piusf4e46cf2016-08-09 15:42:42 -070050 android::binder::Status Reassociate() override;
51 android::binder::Status Reconnect() override;
52 android::binder::Status Disconnect() override;
Roshan Pius54e763a2016-07-06 15:41:53 -070053
Dmitry Shmidte4663042016-04-04 10:07:49 -070054private:
Roshan Piusd6e37512016-07-07 13:20:46 -070055 struct wpa_supplicant *retrieveIfacePtr();
56
Roshan Pius54e763a2016-07-06 15:41:53 -070057 // Reference to the global wpa_struct. This is assumed to be valid for
58 // the lifetime of the process.
59 const struct wpa_global *wpa_global_;
60 // Name of the iface this binder object controls
61 const std::string ifname_;
62
Roshan Piusd6e37512016-07-07 13:20:46 -070063 DISALLOW_COPY_AND_ASSIGN(Iface);
Dmitry Shmidte4663042016-04-04 10:07:49 -070064};
65
Roshan Pius32f9f5f2016-08-15 14:44:22 -070066} // namespace wpa_supplicant_binder
Dmitry Shmidte4663042016-04-04 10:07:49 -070067
Roshan Pius32f9f5f2016-08-15 14:44:22 -070068#endif // WPA_SUPPLICANT_BINDER_IFACE_H