binder_manager.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. #ifndef BINDER_MANAGER_H
  10. #define BINDER_MANAGER_H
  11. #include <map>
  12. #include <string>
  13. #include "supplicant.h"
  14. #include "iface.h"
  15. struct wpa_global;
  16. struct wpa_supplicant;
  17. namespace wpa_supplicant_binder {
  18. /**
  19. * BinderManager is responsible for managing the lifetime of all
  20. * binder objects created by wpa_supplicant. This is a singleton
  21. * class which is created by the supplicant core and can be used
  22. * to get references to the binder objects.
  23. */
  24. class BinderManager {
  25. public:
  26. static const char kBinderServiceName[];
  27. static BinderManager * getInstance();
  28. static void destroyInstance();
  29. int registerBinderService(struct wpa_global *global);
  30. private:
  31. BinderManager() = default;
  32. ~BinderManager() = default;
  33. /* Singleton instance of this class. */
  34. static BinderManager *instance_;
  35. /* The main binder service object. */
  36. android::sp<Supplicant> supplicant_object_;
  37. /* Map of all the interface specific binder objects controlled by
  38. * wpa_supplicant. This map is keyed in by the corresponding
  39. * wpa_supplicant structure pointer. */
  40. std::map<const void *, android::sp<Iface>> iface_object_map_;
  41. };
  42. } /* namespace wpa_supplicant_binder */
  43. #endif /* BINDER_MANAGER_H */