ECServerEntrypoint.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. #ifndef ECECSERVERENTRYPOINT_H
  18. #define ECECSERVERENTRYPOINT_H
  19. #include <kopano/zcdefs.h>
  20. #include <kopano/ECLogger.h>
  21. #include <kopano/ECConfig.h>
  22. #include "ECDatabase.h"
  23. #include "pcutil.hpp"
  24. #define KOPANO_SERVER_INIT_SERVER 0
  25. #define KOPANO_SERVER_INIT_OFFLINE 1
  26. static inline bool SOAP_CONNECTION_TYPE_NAMED_PIPE(struct soap *soap)
  27. {
  28. if (soap == nullptr || soap->user == nullptr)
  29. return false;
  30. auto si = soap_info(soap);
  31. return si->ulConnectionType == CONNECTION_TYPE_NAMED_PIPE ||
  32. si->ulConnectionType == CONNECTION_TYPE_NAMED_PIPE_PRIORITY;
  33. }
  34. #define SOAP_CONNECTION_TYPE(s) (soap_info(s)->ulConnectionType)
  35. struct soap;
  36. namespace KC {
  37. extern _kc_export ECRESULT kopano_init(ECConfig *, ECLogger *audit, bool hosted_kopano, bool distr_kopano);
  38. extern _kc_export ECRESULT kopano_exit(void);
  39. extern _kc_export void kopano_removeallsessions(void);
  40. //Internal used functions
  41. void AddDatabaseObject(ECDatabase* lpDatabase);
  42. // server init function
  43. extern _kc_export ECRESULT kopano_initlibrary(const char *dbdir, const char *config_file); // Init mysql library
  44. extern _kc_export ECRESULT kopano_unloadlibrary(void); // Unload mysql library
  45. // Exported functions
  46. extern _kc_export ECRESULT GetDatabaseObject(ECDatabase **);
  47. // SOAP connection management
  48. extern _kc_export void kopano_new_soap_connection(CONNECTION_TYPE, struct soap *);
  49. extern _kc_export void kopano_end_soap_connection(struct soap *);
  50. extern _kc_export void kopano_new_soap_listener(CONNECTION_TYPE, struct soap *);
  51. extern _kc_export void kopano_end_soap_listener(struct soap *);
  52. void kopano_disconnect_soap_connection(struct soap *soap);
  53. } /* namespace */
  54. #endif //ECECSERVERENTRYPOINT_H