ECStatsTables.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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 EC_STATS_TABLES_H
  18. #define EC_STATS_TABLES_H
  19. #include <kopano/zcdefs.h>
  20. #include "ECGenericObjectTable.h"
  21. #include "ECSession.h"
  22. #include <string>
  23. #include <list>
  24. #include <map>
  25. namespace KC {
  26. struct statstrings {
  27. std::string name;
  28. std::string description;
  29. std::string value;
  30. };
  31. class ECSystemStatsTable _kc_final : public ECGenericObjectTable {
  32. protected:
  33. ECSystemStatsTable(ECSession *lpSession, unsigned int ulFlags, const ECLocale &locale);
  34. public:
  35. static ECRESULT Create(ECSession *, unsigned int flags, const ECLocale &, ECGenericObjectTable **);
  36. virtual ECRESULT Load();
  37. void load_tcmalloc(void);
  38. static ECRESULT QueryRowData(ECGenericObjectTable *lpThis, struct soap *soap, ECSession *lpSession, ECObjectTableList* lpRowList, struct propTagArray *lpsPropTagArray, void* lpObjectData, struct rowSet **lppRowSet, bool bCacheTableData, bool bTableLimit);
  39. private:
  40. static void GetStatsCollectorData(const std::string &name, const std::string &description, const std::string &value, void *obj);
  41. std::map<unsigned int, statstrings> m_mapStatData;
  42. unsigned int id;
  43. };
  44. struct sessiondata {
  45. ECSESSIONID sessionid;
  46. ECSESSIONGROUPID sessiongroupid;
  47. std::string srcaddress;
  48. unsigned int port;
  49. unsigned int idletime;
  50. unsigned int capability;
  51. bool locked;
  52. int peerpid;
  53. std::string username;
  54. std::list<BUSYSTATE> busystates;
  55. double dblUser, dblSystem, dblReal;
  56. std::string version;
  57. std::string clientapp;
  58. unsigned int requests;
  59. std::string url;
  60. std::string proxyhost;
  61. std::string client_application_version, client_application_misc;
  62. };
  63. class ECSessionStatsTable _kc_final : public ECGenericObjectTable {
  64. protected:
  65. ECSessionStatsTable(ECSession *lpSession, unsigned int ulFlags, const ECLocale &locale);
  66. public:
  67. static ECRESULT Create(ECSession *, unsigned int flags, const ECLocale &, ECGenericObjectTable **);
  68. virtual ECRESULT Load();
  69. static ECRESULT QueryRowData(ECGenericObjectTable *lpThis, struct soap *soap, ECSession *lpSession, ECObjectTableList* lpRowList, struct propTagArray *lpsPropTagArray, void* lpObjectData, struct rowSet **lppRowSet, bool bCacheTableData, bool bTableLimit);
  70. private:
  71. static void GetSessionData(ECSession *lpSession, void *obj);
  72. std::map<unsigned int, sessiondata> m_mapSessionData;
  73. unsigned int id;
  74. };
  75. class ECUserStatsTable _kc_final : public ECGenericObjectTable {
  76. protected:
  77. ECUserStatsTable(ECSession *lpSession, unsigned int ulFlags, const ECLocale &locale);
  78. public:
  79. static ECRESULT Create(ECSession *, unsigned int flags, const ECLocale &, ECGenericObjectTable **);
  80. virtual ECRESULT Load();
  81. static ECRESULT QueryRowData(ECGenericObjectTable *lpThis, struct soap *soap, ECSession *lpSession, ECObjectTableList* lpRowList, struct propTagArray *lpsPropTagArray, void* lpObjectData, struct rowSet **lppRowSet, bool bCacheTableData, bool bTableLimit);
  82. private:
  83. ECRESULT LoadCompanyUsers(ULONG ulCompanyId);
  84. };
  85. class ECCompanyStatsTable _kc_final : public ECGenericObjectTable {
  86. protected:
  87. ECCompanyStatsTable(ECSession *lpSession, unsigned int ulFlags, const ECLocale &locale);
  88. public:
  89. static ECRESULT Create(ECSession *, unsigned int flags, const ECLocale &, ECGenericObjectTable **);
  90. virtual ECRESULT Load();
  91. static ECRESULT QueryRowData(ECGenericObjectTable *lpThis, struct soap *soap, ECSession *lpSession, ECObjectTableList* lpRowList, struct propTagArray *lpsPropTagArray, void* lpObjectData, struct rowSet **lppRowSet, bool bCacheTableData, bool bTableLimit);
  92. private:
  93. };
  94. class ECServerStatsTable _kc_final : public ECGenericObjectTable {
  95. protected:
  96. ECServerStatsTable(ECSession *lpSession, unsigned int ulFlags, const ECLocale &locale);
  97. public:
  98. static ECRESULT Create(ECSession *, unsigned int flags, const ECLocale &, ECGenericObjectTable **);
  99. virtual ECRESULT Load();
  100. static ECRESULT QueryRowData(ECGenericObjectTable *lpThis, struct soap *soap, ECSession *lpSession, ECObjectTableList* lpRowList, struct propTagArray *lpsPropTagArray, void* lpObjectData, struct rowSet **lppRowSet, bool bCacheTableData, bool bTableLimit);
  101. private:
  102. std::map<unsigned int, std::string> m_mapServers;
  103. };
  104. // Link to provider/server
  105. extern _kc_export void (*kopano_get_server_stats)(unsigned int *qlen, double *qage, unsigned int *nthr, unsigned int *nidlethr);
  106. } /* namespace */
  107. #endif