mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-02-17 17:43:06 -05:00
Create the skeletal binder interface for wpa_supplicant. The interface hierarchy is based off the existing dbus interface(https://w1.fi/wpa_supplicant/devel/dbus.html). Since we use libbinder, the binder interface codebase needs to be written in C++ and can only be compiled on Android platform for now. The aidl files define binder RPC interfaces. The Android build system generates the corresponding C++ interface classes which needs to be implemented by the server process. The clients can obtain a reference to the binder service (root object) using: android::String16 service_name("fi.w1.wpa_supplicant"); android::sp<android::IBinder> binder = android::defaultServiceManager()->getService(service_name); Once a reference to the root object is retrieved, the clients can obtain references to other RPC objects using that root object methods. Signed-off-by: Roshan Pius <rpius@google.com>
55 lines
1.4 KiB
C++
55 lines
1.4 KiB
C++
/*
|
|
* binder interface for wpa_supplicant daemon
|
|
* Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
|
|
* Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
|
|
*
|
|
* This software may be distributed under the terms of the BSD license.
|
|
* See README for more details.
|
|
*/
|
|
|
|
#ifndef BINDER_MANAGER_H
|
|
#define BINDER_MANAGER_H
|
|
|
|
#include <map>
|
|
#include <string>
|
|
|
|
#include "supplicant.h"
|
|
#include "iface.h"
|
|
|
|
struct wpa_global;
|
|
struct wpa_supplicant;
|
|
|
|
namespace wpa_supplicant_binder {
|
|
|
|
/**
|
|
* BinderManager is responsible for managing the lifetime of all
|
|
* binder objects created by wpa_supplicant. This is a singleton
|
|
* class which is created by the supplicant core and can be used
|
|
* to get references to the binder objects.
|
|
*/
|
|
class BinderManager {
|
|
public:
|
|
static const char kBinderServiceName[];
|
|
|
|
static BinderManager * getInstance();
|
|
static void destroyInstance();
|
|
int registerBinderService(struct wpa_global *global);
|
|
|
|
private:
|
|
BinderManager() = default;
|
|
~BinderManager() = default;
|
|
|
|
/* Singleton instance of this class. */
|
|
static BinderManager *instance_;
|
|
/* The main binder service object. */
|
|
android::sp<Supplicant> supplicant_object_;
|
|
/* Map of all the interface specific binder objects controlled by
|
|
* wpa_supplicant. This map is keyed in by the corresponding
|
|
* wpa_supplicant structure pointer. */
|
|
std::map<const void *, android::sp<Iface>> iface_object_map_;
|
|
};
|
|
|
|
} /* namespace wpa_supplicant_binder */
|
|
|
|
#endif /* BINDER_MANAGER_H */
|