blob: bf8c6f086847ea1c5f7ed835f0cea731069f81ae [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"
Dmitry Shmidte4663042016-04-04 10:07:49 -070021#include "../wpa_supplicant_i.h"
22}
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 Pius54e763a2016-07-06 15:41:53 -070043
Dmitry Shmidte4663042016-04-04 10:07:49 -070044private:
Roshan Piusd6e37512016-07-07 13:20:46 -070045 struct wpa_supplicant *retrieveIfacePtr();
46
Roshan Pius54e763a2016-07-06 15:41:53 -070047 // Reference to the global wpa_struct. This is assumed to be valid for
48 // the lifetime of the process.
49 const struct wpa_global *wpa_global_;
50 // Name of the iface this binder object controls
51 const std::string ifname_;
52
Roshan Piusd6e37512016-07-07 13:20:46 -070053 DISALLOW_COPY_AND_ASSIGN(Iface);
Dmitry Shmidte4663042016-04-04 10:07:49 -070054};
55
Roshan Pius54e763a2016-07-06 15:41:53 -070056} // namespace wpa_supplicant_binder
Dmitry Shmidte4663042016-04-04 10:07:49 -070057
Roshan Pius54e763a2016-07-06 15:41:53 -070058#endif // WPA_SUPPLICANT_BINDER_IFACE_H