b96f4e6a019b97bc60ff0f5f67b3fb168cec591c
[mech_eap.git] / wpa_supplicant / binder / supplicant.h
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 SUPPLICANT_H
11 #define 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
17 extern "C" {
18 #include "utils/includes.h"
19 #include "utils/common.h"
20 #include "../wpa_supplicant_i.h"
21 }
22
23 namespace 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  */
30 class Supplicant : public fi::w1::wpa_supplicant::BnSupplicant
31 {
32 public:
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)
39                 override;
40         android::binder::Status RemoveInterface(
41                 const std::string &ifname) override;
42         android::binder::Status GetInterface(
43                 const std::string &ifname,
44                 android::sp<fi::w1::wpa_supplicant::IIface> *aidl_return)
45                 override;
46
47 private:
48         /* Raw pointer to the global structure maintained by the core. */
49         struct wpa_global *wpa_global_;
50         /* All the callback objects registered by the clients. */
51         std::vector<android::sp<fi::w1::wpa_supplicant::ISupplicantCallbacks>>
52                 callbacks_;
53 };
54
55 } /* namespace wpa_supplicant_binder */
56
57 #endif /* SUPPLICANT_H */