1*a1157835SDaniel Fojt /* 2*a1157835SDaniel Fojt * binder interface for wpa_supplicant daemon 3*a1157835SDaniel Fojt * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi> 4*a1157835SDaniel Fojt * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com> 5*a1157835SDaniel Fojt * 6*a1157835SDaniel Fojt * This software may be distributed under the terms of the BSD license. 7*a1157835SDaniel Fojt * See README for more details. 8*a1157835SDaniel Fojt */ 9*a1157835SDaniel Fojt 10*a1157835SDaniel Fojt #ifndef WPA_SUPPLICANT_BINDER_BINDER_MANAGER_H 11*a1157835SDaniel Fojt #define WPA_SUPPLICANT_BINDER_BINDER_MANAGER_H 12*a1157835SDaniel Fojt 13*a1157835SDaniel Fojt #include <map> 14*a1157835SDaniel Fojt #include <string> 15*a1157835SDaniel Fojt 16*a1157835SDaniel Fojt #include "iface.h" 17*a1157835SDaniel Fojt #include "supplicant.h" 18*a1157835SDaniel Fojt 19*a1157835SDaniel Fojt struct wpa_global; 20*a1157835SDaniel Fojt struct wpa_supplicant; 21*a1157835SDaniel Fojt 22*a1157835SDaniel Fojt namespace wpa_supplicant_binder { 23*a1157835SDaniel Fojt 24*a1157835SDaniel Fojt /** 25*a1157835SDaniel Fojt * BinderManager is responsible for managing the lifetime of all 26*a1157835SDaniel Fojt * binder objects created by wpa_supplicant. This is a singleton 27*a1157835SDaniel Fojt * class which is created by the supplicant core and can be used 28*a1157835SDaniel Fojt * to get references to the binder objects. 29*a1157835SDaniel Fojt */ 30*a1157835SDaniel Fojt class BinderManager 31*a1157835SDaniel Fojt { 32*a1157835SDaniel Fojt public: 33*a1157835SDaniel Fojt static BinderManager *getInstance(); 34*a1157835SDaniel Fojt static void destroyInstance(); 35*a1157835SDaniel Fojt int registerBinderService(struct wpa_global *global); 36*a1157835SDaniel Fojt int registerInterface(struct wpa_supplicant *wpa_s); 37*a1157835SDaniel Fojt int unregisterInterface(struct wpa_supplicant *wpa_s); 38*a1157835SDaniel Fojt int getIfaceBinderObjectByKey( 39*a1157835SDaniel Fojt const void *iface_object_key, 40*a1157835SDaniel Fojt android::sp<fi::w1::wpa_supplicant::IIface> *iface_object); 41*a1157835SDaniel Fojt 42*a1157835SDaniel Fojt private: 43*a1157835SDaniel Fojt BinderManager() = default; 44*a1157835SDaniel Fojt ~BinderManager() = default; 45*a1157835SDaniel Fojt 46*a1157835SDaniel Fojt /* Singleton instance of this class. */ 47*a1157835SDaniel Fojt static BinderManager *instance_; 48*a1157835SDaniel Fojt /* The main binder service object. */ 49*a1157835SDaniel Fojt android::sp<Supplicant> supplicant_object_; 50*a1157835SDaniel Fojt /* Map of all the interface specific binder objects controlled by 51*a1157835SDaniel Fojt * wpa_supplicant. This map is keyed in by the corresponding 52*a1157835SDaniel Fojt * wpa_supplicant structure pointer. */ 53*a1157835SDaniel Fojt std::map<const void *, android::sp<Iface>> iface_object_map_; 54*a1157835SDaniel Fojt }; 55*a1157835SDaniel Fojt 56*a1157835SDaniel Fojt } /* namespace wpa_supplicant_binder */ 57*a1157835SDaniel Fojt 58*a1157835SDaniel Fojt #endif /* WPA_SUPPLICANT_BINDER_BINDER_MANAGER_H */ 59