1/*
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
10#ifndef WPA_SUPPLICANT_BINDER_SUPPLICANT_H
11#define WPA_SUPPLICANT_BINDER_SUPPLICANT_H
12
13#include "fi/w1/wpa_supplicant/BnSupplicant.h"
14#include "fi/w1/wpa_supplicant/IIface.h"
15#include "fi/w1/wpa_supplicant/ISupplicantCallbacks.h"
16
17extern "C" {
18#include "utils/common.h"
19#include "utils/includes.h"
20#include "../wpa_supplicant_i.h"
21}
22
23namespace wpa_supplicant_binder {
24
25/**
26 * Implementation of the supplicant binder object. This binder
27 * object is used core for global control operations on
28 * wpa_supplicant.
29 */
30class Supplicant : public fi::w1::wpa_supplicant::BnSupplicant
31{
32public:
33	Supplicant(struct wpa_global *global);
34	virtual ~Supplicant() = default;
35
36	android::binder::Status CreateInterface(
37	    const android::os::PersistableBundle &params,
38	    android::sp<fi::w1::wpa_supplicant::IIface> *aidl_return) override;
39	android::binder::Status
40	RemoveInterface(const std::string &ifname) override;
41	android::binder::Status GetInterface(
42	    const std::string &ifname,
43	    android::sp<fi::w1::wpa_supplicant::IIface> *aidl_return) override;
44
45private:
46	/* Raw pointer to the global structure maintained by the core. */
47	struct wpa_global *wpa_global_;
48	/* All the callback objects registered by the clients. */
49	std::vector<android::sp<fi::w1::wpa_supplicant::ISupplicantCallbacks>>
50	    callbacks_;
51};
52
53} /* namespace wpa_supplicant_binder */
54
55#endif /* WPA_SUPPLICANT_BINDER_SUPPLICANT_H */
56