blob: 50d7d801ab14ff234c046dc1142fd686c830339a [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 Pius54e763a2016-07-06 15:41:53 -070050
Dmitry Shmidte4663042016-04-04 10:07:49 -070051private:
Roshan Piusd6e37512016-07-07 13:20:46 -070052 struct wpa_supplicant *retrieveIfacePtr();
53
Roshan Pius54e763a2016-07-06 15:41:53 -070054 // Reference to the global wpa_struct. This is assumed to be valid for
55 // the lifetime of the process.
56 const struct wpa_global *wpa_global_;
57 // Name of the iface this binder object controls
58 const std::string ifname_;
59
Roshan Piusd6e37512016-07-07 13:20:46 -070060 DISALLOW_COPY_AND_ASSIGN(Iface);
Dmitry Shmidte4663042016-04-04 10:07:49 -070061};
62
Roshan Pius54e763a2016-07-06 15:41:53 -070063} // namespace wpa_supplicant_binder
Dmitry Shmidte4663042016-04-04 10:07:49 -070064
Roshan Pius54e763a2016-07-06 15:41:53 -070065#endif // WPA_SUPPLICANT_BINDER_IFACE_H