blob: 13dd4b01d0e5a76e836ade065079c2f7f6346a0e [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 Piusd3854452016-07-07 16:46:41 -070021#include "../config.h"
22#include "../notify.h"
Dmitry Shmidte4663042016-04-04 10:07:49 -070023#include "../wpa_supplicant_i.h"
24}
25
26namespace wpa_supplicant_binder {
27
28/**
29 * Implementation of Iface binder object. Each unique binder
30 * object is used for control operations on a specific interface
31 * controlled by wpa_supplicant.
32 */
33class Iface : public fi::w1::wpa_supplicant::BnIface
34{
35public:
Roshan Pius54e763a2016-07-06 15:41:53 -070036 Iface(struct wpa_global *wpa_global, const char ifname[]);
Roshan Piusd6e37512016-07-07 13:20:46 -070037 ~Iface() override = default;
Dmitry Shmidte4663042016-04-04 10:07:49 -070038
Roshan Pius54e763a2016-07-06 15:41:53 -070039 // Binder methods exposed in aidl.
40 android::binder::Status GetName(std::string *iface_name_out) override;
Roshan Piusd6e37512016-07-07 13:20:46 -070041 android::binder::Status AddNetwork(
42 android::sp<fi::w1::wpa_supplicant::INetwork> *network_object_out)
43 override;
44 android::binder::Status RemoveNetwork(int network_id) override;
Roshan Piusd3854452016-07-07 16:46:41 -070045 android::binder::Status GetNetwork(
46 int network_id,
47 android::sp<fi::w1::wpa_supplicant::INetwork> *network_object_out)
48 override;
Roshan Pius54e763a2016-07-06 15:41:53 -070049
Dmitry Shmidte4663042016-04-04 10:07:49 -070050private:
Roshan Piusd6e37512016-07-07 13:20:46 -070051 struct wpa_supplicant *retrieveIfacePtr();
52
Roshan Pius54e763a2016-07-06 15:41:53 -070053 // Reference to the global wpa_struct. This is assumed to be valid for
54 // the lifetime of the process.
55 const struct wpa_global *wpa_global_;
56 // Name of the iface this binder object controls
57 const std::string ifname_;
58
Roshan Piusd6e37512016-07-07 13:20:46 -070059 DISALLOW_COPY_AND_ASSIGN(Iface);
Dmitry Shmidte4663042016-04-04 10:07:49 -070060};
61
Roshan Pius54e763a2016-07-06 15:41:53 -070062} // namespace wpa_supplicant_binder
Dmitry Shmidte4663042016-04-04 10:07:49 -070063
Roshan Pius54e763a2016-07-06 15:41:53 -070064#endif // WPA_SUPPLICANT_BINDER_IFACE_H