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