repl_shared.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. *
  6. * License: GPL (version 3 or any later version).
  7. * See LICENSE for details.
  8. * END COPYRIGHT BLOCK **/
  9. #ifdef HAVE_CONFIG_H
  10. # include <config.h>
  11. #endif
  12. /* repl_shared.h - definitions shared between 4.0 and 5.0 replication
  13. modules
  14. */
  15. #ifndef REPL_SHARED_H
  16. #define REPL_SHARED_H
  17. #include "slapi-private.h"
  18. #include "slapi-plugin.h"
  19. #include "ldif.h" /* GGOODREPL - is this cheating? */
  20. #define FILE_PATHSEP '/'
  21. #define CHANGELOGDB_TRIM_INTERVAL 300 /* 5 minutes */
  22. #define CHANGELOGDB_COMPACT_INTERVAL 2592000 /* 30 days */
  23. #define CONFIG_CHANGELOG_DIR_ATTRIBUTE "nsslapd-changelogdir"
  24. #define CONFIG_CHANGELOG_MAXENTRIES_ATTRIBUTE "nsslapd-changelogmaxentries"
  25. #define CONFIG_CHANGELOG_MAXAGE_ATTRIBUTE "nsslapd-changelogmaxage"
  26. #define CONFIG_CHANGELOG_COMPACTDB_ATTRIBUTE "nsslapd-changelogcompactdb-interval"
  27. #define CONFIG_CHANGELOG_TRIM_ATTRIBUTE "nsslapd-changelogtrim-interval"
  28. /* Changelog Internal Configuration Parameters -> Changelog Cache related */
  29. #define CONFIG_CHANGELOG_MAX_CONCURRENT_WRITES "nsslapd-changelogmaxconcurrentwrites"
  30. #define CONFIG_CHANGELOG_ENCRYPTION_ALGORITHM "nsslapd-encryptionalgorithm"
  31. #define CONFIG_CHANGELOG_SYMMETRIC_KEY "nsSymmetricKey"
  32. #define T_CHANGETYPESTR "changetype"
  33. #define T_CHANGETYPE 1
  34. #define T_TIMESTR "time"
  35. #define T_TIME 2
  36. #define T_DNSTR "dn"
  37. #define T_DN 3
  38. #define T_CHANGESTR "change"
  39. #define T_CHANGE 4
  40. #define T_ADDCTSTR "add"
  41. #define T_ADDCT 4
  42. #define T_MODIFYCTSTR "modify"
  43. #define T_MODIFYCT 5
  44. #define T_DELETECTSTR "delete"
  45. #define T_DELETECT 6
  46. #define T_MODRDNCTSTR "modrdn"
  47. #define T_MODRDNCT 7
  48. #define T_MODDNCTSTR "moddn"
  49. #define T_MODDNCT 8
  50. #define T_MODOPADDSTR "add"
  51. #define T_MODOPADD 9
  52. #define T_MODOPREPLACESTR "replace"
  53. #define T_MODOPREPLACE 10
  54. #define T_MODOPDELETESTR "delete"
  55. #define T_MODOPDELETE 11
  56. #define T_MODSEPSTR "-"
  57. #define T_MODSEP 12
  58. #define T_NEWRDNSTR "newrdn"
  59. #define T_NEWSUPERIORSTR ATTR_NEWSUPERIOR
  60. #define T_DRDNFLAGSTR "deleteoldrdn"
  61. #define T_ERR -1
  62. #define AWAITING_OP -1
  63. #define STATE_REFERRAL "referral"
  64. #define STATE_UPDATE_REFERRAL "referral on update"
  65. #define STATE_BACKEND "backend"
  66. #define REPL_PLUGIN_NAME "NSMMReplicationPlugin"
  67. /*
  68. * Changed version from 1.0 to 2.0 when we switched from libdb32 to libdb33
  69. * richm 20020708
  70. * also changed name from REPL_PLUGIN_VERSION to CHANGELOG_DB_VERSION since we use
  71. * a different version for the plugin itself and this particular version is only
  72. * used for the changelog database
  73. */
  74. /* the current CHANGELOG_DB_VERSION: DB_VERSION_MAJOR"."DB_VERSION_MINOR" */
  75. /* this string is left for the backward compatibility */
  76. #define CHANGELOG_DB_VERSION "4.0"
  77. extern char *repl_plugin_name;
  78. extern char *windows_repl_plugin_name;
  79. extern char *repl_plugin_name_cl;
  80. /* repl_monitor.c */
  81. int repl_monitor_init();
  82. /* In replutil.c */
  83. char ** get_cleattrs();
  84. unsigned long strntoul( char *from, size_t len, int base );
  85. void freepmods( LDAPMod **pmods );
  86. char *copy_berval (struct berval* from);
  87. void entry_print(Slapi_Entry *e);
  88. int copyfile(char* source, char *destination, int overwrite, int mode);
  89. time_t age_str2time (const char *age);
  90. const char* changeType2Str (int type);
  91. int str2ChangeType (const char *str);
  92. lenstr *make_changes_string(LDAPMod **ldm, char **includeattrs);
  93. Slapi_Mods* parse_changes_string(char *str);
  94. PRBool IsValidOperation (const slapi_operation_parameters *op);
  95. const char *map_repl_root_to_dbid(Slapi_DN *repl_root);
  96. PRBool is_ruv_tombstone_entry (Slapi_Entry *e);
  97. /* replication plugins */
  98. enum {
  99. PLUGIN_LEGACY_REPLICATION,
  100. PLUGIN_MULTIMASTER_REPLICATION,
  101. PLUGIN_MAX
  102. };
  103. void* repl_get_plugin_identity (int pluginID);
  104. void repl_set_plugin_identity (int pluginID, void *identity);
  105. #endif