ECPluginFactory.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright 2005 - 2016 Zarafa and its licensors
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Affero General Public License, version 3,
  6. * as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU Affero General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Affero General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. *
  16. */
  17. // -*- Mode: c++ -*-
  18. #ifndef ECPLUGINFACTORY_H
  19. #define ECPLUGINFACTORY_H
  20. #include <kopano/zcdefs.h>
  21. #include <mutex>
  22. #include <kopano/kcodes.h>
  23. #include "plugin.h"
  24. namespace KC {
  25. class ECConfig;
  26. class ECPluginSharedData;
  27. class ECStatsCollector;
  28. class _kc_export ECPluginFactory _kc_final {
  29. public:
  30. _kc_hidden ECPluginFactory(ECConfig *, ECStatsCollector *, bool hosted, bool distributed);
  31. _kc_hidden ~ECPluginFactory(void);
  32. _kc_hidden ECRESULT CreateUserPlugin(UserPlugin **ret);
  33. void SignalPlugins(int signal);
  34. private:
  35. UserPlugin *(*m_getUserPluginInstance)(std::mutex &, ECPluginSharedData *) = nullptr;
  36. void (*m_deleteUserPluginInstance)(UserPlugin *) = nullptr;
  37. ECPluginSharedData *m_shareddata;
  38. ECConfig *m_config;
  39. std::mutex m_plugin_lock;
  40. DLIB m_dl = nullptr;
  41. };
  42. extern ECRESULT GetThreadLocalPlugin(ECPluginFactory *lpPluginFactory, UserPlugin **lppPlugin);
  43. } /* namespace */
  44. #endif