kcodes.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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 KC_KCODES_HPP
  18. #define KC_KCODES_HPP 1
  19. #include <kopano/zcdefs.h>
  20. #include <kopano/platform.h>
  21. namespace KC {
  22. #define MAKE_KSCODE(sev,code) ( (((unsigned int)(sev)<<31) | ((unsigned int)(code))) )
  23. #define MAKE_KCERR( err ) (MAKE_KSCODE( 1, err ))
  24. #define MAKE_KCWARN( warn ) (MAKE_KSCODE( 1, warn )) // This macro is broken, should be 0
  25. #define KCERR_NONE 0
  26. #define KCERR_UNKNOWN MAKE_KCERR( 1 )
  27. #define KCERR_NOT_FOUND MAKE_KCERR( 2 )
  28. #define KCERR_NO_ACCESS MAKE_KCERR( 3 )
  29. #define KCERR_NETWORK_ERROR MAKE_KCERR( 4 )
  30. #define KCERR_SERVER_NOT_RESPONDING MAKE_KCERR( 5 )
  31. #define KCERR_INVALID_TYPE MAKE_KCERR( 6 )
  32. #define KCERR_DATABASE_ERROR MAKE_KCERR( 7 )
  33. #define KCERR_COLLISION MAKE_KCERR( 8 )
  34. #define KCERR_LOGON_FAILED MAKE_KCERR( 9 )
  35. #define KCERR_HAS_MESSAGES MAKE_KCERR( 10 )
  36. #define KCERR_HAS_FOLDERS MAKE_KCERR( 11 )
  37. #define KCERR_HAS_RECIPIENTS MAKE_KCERR( 12 )
  38. #define KCERR_HAS_ATTACHMENTS MAKE_KCERR( 13 )
  39. #define KCERR_NOT_ENOUGH_MEMORY MAKE_KCERR( 14 )
  40. #define KCERR_TOO_COMPLEX MAKE_KCERR( 15 )
  41. #define KCERR_END_OF_SESSION MAKE_KCERR( 16 )
  42. #define KCWARN_CALL_KEEPALIVE MAKE_KCWARN( 17 )
  43. #define KCERR_UNABLE_TO_ABORT MAKE_KCERR( 18 )
  44. #define KCERR_NOT_IN_QUEUE MAKE_KCERR( 19 )
  45. #define KCERR_INVALID_PARAMETER MAKE_KCERR( 20 )
  46. #define KCWARN_PARTIAL_COMPLETION MAKE_KCWARN( 21 )
  47. #define KCERR_INVALID_ENTRYID MAKE_KCERR( 22 )
  48. #define KCERR_BAD_VALUE MAKE_KCERR( 23 )
  49. #define KCERR_NO_SUPPORT MAKE_KCERR( 24 )
  50. #define KCERR_TOO_BIG MAKE_KCERR( 25 )
  51. #define KCWARN_POSITION_CHANGED MAKE_KCWARN( 26 )
  52. #define KCERR_FOLDER_CYCLE MAKE_KCERR( 27 )
  53. #define KCERR_STORE_FULL MAKE_KCERR( 28 )
  54. #define KCERR_PLUGIN_ERROR MAKE_KCERR( 29 )
  55. #define KCERR_UNKNOWN_OBJECT MAKE_KCERR( 30 )
  56. #define KCERR_NOT_IMPLEMENTED MAKE_KCERR( 31 )
  57. #define KCERR_DATABASE_NOT_FOUND MAKE_KCERR( 32 )
  58. #define KCERR_INVALID_VERSION MAKE_KCERR( 33 )
  59. #define KCERR_UNKNOWN_DATABASE MAKE_KCERR( 34 )
  60. #define KCERR_NOT_INITIALIZED MAKE_KCERR( 35 )
  61. #define KCERR_CALL_FAILED MAKE_KCERR( 36 )
  62. #define KCERR_SSO_CONTINUE MAKE_KCERR( 37 )
  63. #define KCERR_TIMEOUT MAKE_KCERR( 38 )
  64. #define KCERR_INVALID_BOOKMARK MAKE_KCERR( 39 )
  65. #define KCERR_UNABLE_TO_COMPLETE MAKE_KCERR( 40 )
  66. #define KCERR_UNKNOWN_INSTANCE_ID MAKE_KCERR( 41 )
  67. #define KCERR_IGNORE_ME MAKE_KCERR( 42 )
  68. #define KCERR_BUSY MAKE_KCERR( 43 )
  69. #define KCERR_OBJECT_DELETED MAKE_KCERR( 44 )
  70. #define KCERR_USER_CANCEL MAKE_KCERR( 45 )
  71. #define KCERR_UNKNOWN_FLAGS MAKE_KCERR( 46 )
  72. #define KCERR_SUBMITTED MAKE_KCERR( 47 )
  73. #define erSuccess KCERR_NONE
  74. typedef unsigned int ECRESULT;
  75. // FIXME which of these numbers are mapped 1-to-1 with actual
  76. // MAPI values ? Move all fixed values to ECMAPI.h
  77. #define KOPANO_TAG_DISPLAY_NAME 0x3001
  78. // These must match MAPI types !
  79. #define KOPANO_OBJTYPE_FOLDER 3
  80. #define KOPANO_OBJTYPE_MESSAGE 5
  81. // Sessions
  82. typedef uint64_t ECSESSIONID;
  83. typedef uint64_t ECSESSIONGROUPID;
  84. #define EC_NOTIFICATION_CHECK_FREQUENTY (1000*2)
  85. #define EC_NOTIFICATION_CLOSE_TIMEOUT (1000)
  86. #define EC_SESSION_TIMEOUT (60*5) // In seconds
  87. #define EC_SESSION_KEEPALIVE_TIME (60) // In seconds
  88. #define EC_SESSION_TIMEOUT_CHECK (1000*60*5) // In microsecconds
  89. /* the same definetions as MAPI */
  90. #define EC_ACCESS_MODIFY ((unsigned int) 0x00000001)
  91. #define EC_ACCESS_READ ((unsigned int) 0x00000002)
  92. #define EC_ACCESS_DELETE ((unsigned int) 0x00000004)
  93. #define EC_ACCESS_CREATE_HIERARCHY ((unsigned int) 0x00000008)
  94. #define EC_ACCESS_CREATE_CONTENTS ((unsigned int) 0x00000010)
  95. #define EC_ACCESS_CREATE_ASSOCIATED ((unsigned int) 0x00000020)
  96. #define EC_ACCESS_OWNER ((unsigned int) 0x0000003F)
  97. #define ecSecurityRead 1
  98. #define ecSecurityCreate 2
  99. #define ecSecurityEdit 3
  100. #define ecSecurityDelete 4
  101. #define ecSecurityCreateFolder 5
  102. #define ecSecurityFolderVisible 6
  103. #define ecSecurityFolderAccess 7
  104. #define ecSecurityOwner 8
  105. #define ecSecurityAdmin 9
  106. // Property under which to store the search criteria for search folders
  107. #define PR_EC_SEARCHCRIT PROP_TAG(PT_STRING8, 0x6706)
  108. #define PR_EC_SUGGESTION PROP_TAG(PT_UNICODE, 0x6707)
  109. // create 200 directories for non-database attachments
  110. #define ATTACH_PATHDEPTH_LEVEL1 10
  111. #define ATTACH_PATHDEPTH_LEVEL2 20
  112. enum CONNECTION_TYPE {
  113. CONNECTION_TYPE_TCP,
  114. CONNECTION_TYPE_SSL,
  115. CONNECTION_TYPE_NAMED_PIPE,
  116. CONNECTION_TYPE_NAMED_PIPE_PRIORITY,
  117. };
  118. //Functions
  119. extern _kc_export HRESULT kcerr_to_mapierr(ECRESULT, HRESULT hrDefault = 0x80070005 /* MAPI_E_NO_ACCESS */);
  120. } /* namespace */
  121. #endif /* KC_KCODES_HPP */