ECDefs.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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. #include <kopano/platform.h>
  18. #ifndef ECDEFS_H
  19. #define ECDEFS_H
  20. namespace KC {
  21. // Get permission type
  22. #define ACCESS_TYPE_DENIED 1
  23. #define ACCESS_TYPE_GRANT 2
  24. #define ACCESS_TYPE_BOTH 3
  25. #define ecRightsNone 0x00000000L
  26. #define ecRightsReadAny 0x00000001L
  27. #define ecRightsCreate 0x00000002L
  28. #define ecRightsEditOwned 0x00000008L
  29. #define ecRightsDeleteOwned 0x00000010L
  30. #define ecRightsEditAny 0x00000020L
  31. #define ecRightsDeleteAny 0x00000040L
  32. #define ecRightsCreateSubfolder 0x00000080L
  33. #define ecRightsFolderAccess 0x00000100L
  34. //#define ecrightsContact 0x00000200L
  35. #define ecRightsFolderVisible 0x00000400L
  36. #define ecRightsTemplateNoRights ecRightsFolderVisible
  37. #define ecRightsTemplateReadOnly ecRightsTemplateNoRights | ecRightsReadAny
  38. #define ecRightsTemplateSecretary ecRightsTemplateReadOnly | ecRightsCreate | ecRightsEditOwned | ecRightsDeleteOwned | ecRightsEditAny | ecRightsDeleteAny
  39. #define ecRightsTemplateOwner ecRightsTemplateSecretary | ecRightsCreateSubfolder | ecRightsFolderAccess
  40. /* #define ecRightsTemplateReviewer ecRightsTemplateReadOnly */
  41. /* #define ecRightsTemplateAuthor ecRightsTemplateReadOnly | ecRightsCreate | ecRightsEditOwned | ecRightsDeleteOwned */
  42. /* #define ecRightsTemplateEditor ecRightsTemplateReadOnly | ecRightsCreate | ecRightsEditAny | ecRightsDeleteAny */
  43. #define ecRightsAll 0x000005FBL
  44. #define ecRightsFullControl 0x000004FBL
  45. #define ecRightsDefault ecRightsNone | ecRightsFolderVisible
  46. #define ecRightsDefaultPublic ecRightsReadAny | ecRightsFolderVisible
  47. #define ecRightsAdmin 0x00001000L
  48. #define ecRightsAllMask 0x000015FBL
  49. // Right change indication (state field in struct)
  50. #define RIGHT_NORMAL 0x00
  51. #define RIGHT_NEW 0x01
  52. #define RIGHT_MODIFY 0x02
  53. #define RIGHT_DELETED 0x04
  54. #define RIGHT_AUTOUPDATE_DENIED 0x08
  55. #define OBJECTCLASS(__type, __class) \
  56. ( (((__type) << 16) | ((__class) & 0xffff)) )
  57. #define OBJECTCLASS_CLASSTYPE(__class) \
  58. ( ((__class) & 0xffff0000) )
  59. #define OBJECTCLASS_TYPE(__class) \
  60. ( (objecttype_t)(((__class) >> 16) & 0xffff) )
  61. #define OBJECTCLASS_ISTYPE(__class) \
  62. ( ((__class) & 0xffff) == 0 && ((__class) >> 16) != 0)
  63. #define OBJECTCLASS_FIELD_COMPARE(__left, __right) \
  64. ( !(__left) || !(__right) || (__left) == (__right) )
  65. #define OBJECTCLASS_COMPARE(__left, __right) \
  66. ( OBJECTCLASS_FIELD_COMPARE(OBJECTCLASS_TYPE(__left), OBJECTCLASS_TYPE(__right)) && \
  67. OBJECTCLASS_FIELD_COMPARE((__left) & 0xffff, (__right) & 0xffff) )
  68. #define OBJECTCLASS_COMPARE_SQL(__column, __objclass) \
  69. string(((__objclass) == 0) ? \
  70. "TRUE" : \
  71. ((__objclass) & 0xffff) ? \
  72. __column " = " + stringify(__objclass) : \
  73. "(" __column " & 0xffff0000) = " + stringify((__objclass) & 0xffff0000))
  74. enum objecttype_t {
  75. OBJECTTYPE_UNKNOWN = 0,
  76. OBJECTTYPE_MAILUSER = 1,
  77. OBJECTTYPE_DISTLIST = 3,
  78. OBJECTTYPE_CONTAINER = 4
  79. };
  80. enum objectclass_t {
  81. OBJECTCLASS_UNKNOWN = OBJECTCLASS(OBJECTTYPE_UNKNOWN, 0),
  82. /* All User (active and nonactive) objectclasses */
  83. OBJECTCLASS_USER = OBJECTCLASS(OBJECTTYPE_MAILUSER, 0),
  84. ACTIVE_USER = OBJECTCLASS(OBJECTTYPE_MAILUSER, 1),
  85. NONACTIVE_USER = OBJECTCLASS(OBJECTTYPE_MAILUSER, 2),
  86. NONACTIVE_ROOM = OBJECTCLASS(OBJECTTYPE_MAILUSER, 3),
  87. NONACTIVE_EQUIPMENT = OBJECTCLASS(OBJECTTYPE_MAILUSER, 4),
  88. NONACTIVE_CONTACT = OBJECTCLASS(OBJECTTYPE_MAILUSER, 5),
  89. /* All distribution lists */
  90. OBJECTCLASS_DISTLIST = OBJECTCLASS(OBJECTTYPE_DISTLIST, 0),
  91. DISTLIST_GROUP = OBJECTCLASS(OBJECTTYPE_DISTLIST, 1),
  92. DISTLIST_SECURITY = OBJECTCLASS(OBJECTTYPE_DISTLIST, 2),
  93. DISTLIST_DYNAMIC = OBJECTCLASS(OBJECTTYPE_DISTLIST, 3),
  94. /* All container objects */
  95. OBJECTCLASS_CONTAINER = OBJECTCLASS(OBJECTTYPE_CONTAINER, 0),
  96. CONTAINER_COMPANY = OBJECTCLASS(OBJECTTYPE_CONTAINER, 1),
  97. CONTAINER_ADDRESSLIST = OBJECTCLASS(OBJECTTYPE_CONTAINER, 2)
  98. };
  99. enum userobject_relation_t {
  100. OBJECTRELATION_GROUP_MEMBER = 1,
  101. OBJECTRELATION_COMPANY_VIEW = 2,
  102. OBJECTRELATION_COMPANY_ADMIN = 3,
  103. OBJECTRELATION_QUOTA_USERRECIPIENT = 4,
  104. OBJECTRELATION_QUOTA_COMPANYRECIPIENT = 5,
  105. OBJECTRELATION_USER_SENDAS = 6,
  106. OBJECTRELATION_ADDRESSLIST_MEMBER = 7
  107. };
  108. // Warning, those values are the same as ECSecurity::eQuotaStatus
  109. enum eQuotaStatus{ QUOTA_OK, QUOTA_WARN, QUOTA_SOFTLIMIT, QUOTA_HARDLIMIT};
  110. enum userobject_admin_level_t {
  111. ADMIN_LEVEL_ADMIN = 1, /* Administrator over user's own company. */
  112. ADMIN_LEVEL_SYSADMIN = 2 /* System administrator (same rights as SYSTEM). */
  113. };
  114. struct ECENTRYID {
  115. unsigned int cb;
  116. unsigned char* lpb;
  117. };
  118. struct ECSVRNAMELIST {
  119. unsigned int cServers;
  120. LPTSTR* lpszaServer;
  121. };
  122. struct SPROPMAPENTRY {
  123. unsigned int ulPropId;
  124. LPTSTR lpszValue;
  125. };
  126. typedef struct SPROPMAPENTRY *LPSPROPMAPENTRY;
  127. struct SPROPMAP {
  128. unsigned int cEntries;
  129. LPSPROPMAPENTRY lpEntries;
  130. };
  131. typedef struct SPROPMAP *LPSPROPMAP;
  132. struct MVPROPMAPENTRY {
  133. unsigned int ulPropId;
  134. int cValues;
  135. LPTSTR* lpszValues;
  136. };
  137. typedef struct MVPROPMAPENTRY *LPMVPROPMAPENTRY;
  138. struct MVPROPMAP {
  139. unsigned int cEntries;
  140. LPMVPROPMAPENTRY lpEntries;
  141. };
  142. typedef struct MVPROPMAP *LPMVPROPMAP;
  143. struct ECUSER {
  144. LPTSTR lpszUsername; // username@companyname
  145. LPTSTR lpszPassword;
  146. LPTSTR lpszMailAddress;
  147. LPTSTR lpszFullName;
  148. LPTSTR lpszServername;
  149. objectclass_t ulObjClass;
  150. unsigned int ulIsAdmin; // See userobject_admin_level_t
  151. unsigned int ulIsABHidden; // Is user hidden from address book
  152. unsigned int ulCapacity; // Resource capacity
  153. SPROPMAP sPropmap; // Extra anonymous properties for addressbook
  154. MVPROPMAP sMVPropmap; // Extra anonymous MV properties for addressbook
  155. ECENTRYID sUserId;
  156. };
  157. struct ECGROUP {
  158. LPTSTR lpszGroupname; // groupname@companyname
  159. LPTSTR lpszFullname;
  160. LPTSTR lpszFullEmail;
  161. ECENTRYID sGroupId;
  162. unsigned int ulIsABHidden; // Is group hidden from address book
  163. SPROPMAP sPropmap; // Extra anonymous properties for addressbook
  164. MVPROPMAP sMVPropmap; // Extra anonymous MV properties for addressbook
  165. };
  166. struct ECCOMPANY {
  167. ECENTRYID sAdministrator; // userid of the administrator
  168. LPTSTR lpszCompanyname;
  169. LPTSTR lpszServername;
  170. ECENTRYID sCompanyId;
  171. unsigned int ulIsABHidden; // Is company hidden from address book
  172. SPROPMAP sPropmap; // Extra anonymous properties for addressbook
  173. MVPROPMAP sMVPropmap; // Extra anonymous MV properties for addressbook
  174. };
  175. struct ECUSERCLIENTUPDATESTATUS {
  176. unsigned int ulTrackId;
  177. time_t tUpdatetime;
  178. LPTSTR lpszCurrentversion;
  179. LPTSTR lpszLatestversion;
  180. LPTSTR lpszComputername;
  181. unsigned int ulStatus;
  182. };
  183. #define UPDATE_STATUS_UNKNOWN 0
  184. #define UPDATE_STATUS_SUCCESS 1
  185. #define UPDATE_STATUS_PENDING 2
  186. #define UPDATE_STATUS_FAILED 3
  187. struct ECPERMISSION {
  188. unsigned int ulType;
  189. unsigned int ulRights;
  190. unsigned int ulState;
  191. ECENTRYID sUserId;
  192. };
  193. struct ECQUOTA {
  194. bool bUseDefaultQuota;
  195. bool bIsUserDefaultQuota; // Default quota for users within company
  196. int64_t llWarnSize;
  197. int64_t llSoftSize;
  198. int64_t llHardSize;
  199. };
  200. struct ECQUOTASTATUS {
  201. int64_t llStoreSize;
  202. eQuotaStatus quotaStatus;
  203. };
  204. struct ECSERVER {
  205. LPTSTR lpszName;
  206. LPTSTR lpszFilePath;
  207. LPTSTR lpszHttpPath;
  208. LPTSTR lpszSslPath;
  209. LPTSTR lpszPreferedPath;
  210. ULONG ulFlags;
  211. };
  212. struct ECSERVERLIST {
  213. unsigned int cServers;
  214. ECSERVER *lpsaServer;
  215. };
  216. // Flags for ns__submitMessage
  217. #define EC_SUBMIT_LOCAL 0x00000000
  218. #define EC_SUBMIT_MASTER 0x00000001
  219. #define EC_SUBMIT_DOSENTMAIL 0x00000002
  220. // GetServerDetails
  221. #define EC_SERVERDETAIL_NO_NAME 0x00000001
  222. #define EC_SERVERDETAIL_FILEPATH 0x00000002
  223. #define EC_SERVERDETAIL_HTTPPATH 0x00000004
  224. #define EC_SERVERDETAIL_SSLPATH 0x00000008
  225. #define EC_SERVERDETAIL_PREFEREDPATH 0x00000010
  226. #define EC_SDFLAG_IS_PEER 0x00000001
  227. #define EC_SDFLAG_HAS_PUBLIC 0x00000002
  228. // CreateStore flag(s)
  229. #define EC_OVERRIDE_HOMESERVER 0x00000001
  230. } /* namespace */
  231. #endif