repl_shared.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /** BEGIN COPYRIGHT BLOCK
  2. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  3. * Copyright (C) 2005 Red Hat, Inc.
  4. * All rights reserved.
  5. * END COPYRIGHT BLOCK **/
  6. /* repl_shared.h - definitions shared between 4.0 and 5.0 replication
  7. modules
  8. */
  9. #ifndef REPL_SHARED_H
  10. #define REPL_SHARED_H
  11. #include "slapi-private.h"
  12. #include "slapi-plugin.h"
  13. #include "ldif.h" /* GGOODREPL - is this cheating? */
  14. #ifdef _WIN32
  15. #define FILE_PATHSEP '\\'
  16. #else
  17. #define FILE_PATHSEP '/'
  18. #endif
  19. #define CHANGELOGDB_TRIM_INTERVAL 300 /* 5 minutes */
  20. #define CONFIG_CHANGELOG_DIR_ATTRIBUTE "nsslapd-changelogdir"
  21. #define CONFIG_CHANGELOG_MAXENTRIES_ATTRIBUTE "nsslapd-changelogmaxentries"
  22. #define CONFIG_CHANGELOG_MAXAGE_ATTRIBUTE "nsslapd-changelogmaxage"
  23. /* Changelog Internal Configuration Parameters -> DB related */
  24. #define CONFIG_CHANGELOG_DB_DBCACHESIZE "nsslapd-dbcachesize"
  25. #define CONFIG_CHANGELOG_DB_DURABLE_TRANSACTIONS "nsslapd-db-durable-transaction"
  26. #define CONFIG_CHANGELOG_DB_CHECKPOINT_INTERVAL "nsslapd-db-checkpoint-interval"
  27. #define CONFIG_CHANGELOG_DB_CIRCULAR_LOGGING "nsslapd-db-circular-logging"
  28. #define CONFIG_CHANGELOG_DB_PAGE_SIZE "nsslapd-db-page-size"
  29. #define CONFIG_CHANGELOG_DB_LOGFILE_SIZE "nsslapd-db-logfile-size"
  30. #define CONFIG_CHANGELOG_DB_MAXTXN_SIZE "nsslapd-db-max-txn"
  31. #define CONFIG_CHANGELOG_DB_VERBOSE "nsslapd-db-verbose"
  32. #define CONFIG_CHANGELOG_DB_DEBUG "nsslapd-db-debug"
  33. #define CONFIG_CHANGELOG_DB_TRICKLE_PERCENTAGE "nsslapd-db-trickle-percentage"
  34. #define CONFIG_CHANGELOG_DB_SPINCOUNT "nsslapd-db-spin-count"
  35. /* Changelog Internal Configuration Parameters -> Changelog Cache related */
  36. #define CONFIG_CHANGELOG_CACHESIZE "nsslapd-cachesize"
  37. #define CONFIG_CHANGELOG_CACHEMEMSIZE "nsslapd-cachememsize"
  38. #define CONFIG_CHANGELOG_NB_LOCK "nsslapd-db-locks"
  39. #define CONFIG_CHANGELOG_MAX_CONCURRENT_WRITES "nsslapd-changelogmaxconcurrentwrites"
  40. #define T_CHANGETYPESTR "changetype"
  41. #define T_CHANGETYPE 1
  42. #define T_TIMESTR "time"
  43. #define T_TIME 2
  44. #define T_DNSTR "dn"
  45. #define T_DN 3
  46. #define T_CHANGESTR "change"
  47. #define T_CHANGE 4
  48. #define T_ADDCTSTR "add"
  49. #define T_ADDCT 4
  50. #define T_MODIFYCTSTR "modify"
  51. #define T_MODIFYCT 5
  52. #define T_DELETECTSTR "delete"
  53. #define T_DELETECT 6
  54. #define T_MODRDNCTSTR "modrdn"
  55. #define T_MODRDNCT 7
  56. #define T_MODDNCTSTR "moddn"
  57. #define T_MODDNCT 8
  58. #define T_MODOPADDSTR "add"
  59. #define T_MODOPADD 9
  60. #define T_MODOPREPLACESTR "replace"
  61. #define T_MODOPREPLACE 10
  62. #define T_MODOPDELETESTR "delete"
  63. #define T_MODOPDELETE 11
  64. #define T_MODSEPSTR "-"
  65. #define T_MODSEP 12
  66. #define T_NEWRDNSTR "newrdn"
  67. #define T_NEWSUPERIORSTR ATTR_NEWSUPERIOR
  68. #define T_DRDNFLAGSTR "deleteoldrdn"
  69. #define T_ERR -1
  70. #define AWAITING_OP -1
  71. #define STATE_REFERRAL "referral"
  72. #define STATE_UPDATE_REFERRAL "referral on update"
  73. #define STATE_BACKEND "backend"
  74. #define REPL_PLUGIN_NAME "NSMMReplicationPlugin"
  75. /*
  76. * Changed version from 1.0 to 2.0 when we switched from libdb32 to libdb33
  77. * richm 20020708
  78. * also changed name from REPL_PLUGIN_VERSION to CHANGELOG_DB_VERSION since we use
  79. * a different version for the plugin itself and this particular version is only
  80. * used for the changelog database
  81. */
  82. /*
  83. * Changed version from 2.0 to 3.0 when we switched from libdb33 to libdb41
  84. * noriko 20021203
  85. */
  86. #define CHANGELOG_DB_VERSION_PREV "3.0"
  87. #define CHANGELOG_DB_VERSION "4.0"
  88. extern char *repl_plugin_name;
  89. extern char *windows_repl_plugin_name;
  90. extern char *repl_plugin_name_cl;
  91. /* repl_monitor.c */
  92. int repl_monitor_init();
  93. /* In replutil.c */
  94. char ** get_cleattrs();
  95. unsigned long strntoul( char *from, size_t len, int base );
  96. void freepmods( LDAPMod **pmods );
  97. char *copy_berval (struct berval* from);
  98. void entry_print(Slapi_Entry *e);
  99. int copyfile(char* source, char *destination, int overwrite, int mode);
  100. time_t age_str2time (const char *age);
  101. const char* changeType2Str (int type);
  102. int str2ChangeType (const char *str);
  103. lenstr *make_changes_string(LDAPMod **ldm, char **includeattrs);
  104. Slapi_Mods* parse_changes_string(char *str);
  105. PRBool IsValidOperation (const slapi_operation_parameters *op);
  106. const char *map_repl_root_to_dbid(Slapi_DN *repl_root);
  107. PRBool is_ruv_tombstone_entry (Slapi_Entry *e);
  108. /* replication plugins */
  109. enum {
  110. PLUGIN_LEGACY_REPLICATION,
  111. PLUGIN_MULTIMASTER_REPLICATION,
  112. PLUGIN_MAX
  113. };
  114. void* repl_get_plugin_identity (int pluginID);
  115. void repl_set_plugin_identity (int pluginID, void *identity);
  116. #endif