repl_shared.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /** BEGIN COPYRIGHT BLOCK
  2. * This Program is free software; you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation; version 2 of the License.
  5. *
  6. * This Program is distributed in the hope that it will be useful, but WITHOUT
  7. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  9. *
  10. * You should have received a copy of the GNU General Public License along with
  11. * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
  12. * Place, Suite 330, Boston, MA 02111-1307 USA.
  13. *
  14. * In addition, as a special exception, Red Hat, Inc. gives You the additional
  15. * right to link the code of this Program with code not covered under the GNU
  16. * General Public License ("Non-GPL Code") and to distribute linked combinations
  17. * including the two, subject to the limitations in this paragraph. Non-GPL Code
  18. * permitted under this exception must only link to the code of this Program
  19. * through those well defined interfaces identified in the file named EXCEPTION
  20. * found in the source code files (the "Approved Interfaces"). The files of
  21. * Non-GPL Code may instantiate templates or use macros or inline functions from
  22. * the Approved Interfaces without causing the resulting work to be covered by
  23. * the GNU General Public License. Only Red Hat, Inc. may make changes or
  24. * additions to the list of Approved Interfaces. You must obey the GNU General
  25. * Public License in all respects for all of the Program code and other code used
  26. * in conjunction with the Program except the Non-GPL Code covered by this
  27. * exception. If you modify this file, you may extend this exception to your
  28. * version of the file, but you are not obligated to do so. If you do not wish to
  29. * provide this exception without modification, you must delete this exception
  30. * statement from your version and license this file solely under the GPL without
  31. * exception.
  32. *
  33. *
  34. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  35. * Copyright (C) 2005 Red Hat, Inc.
  36. * All rights reserved.
  37. * END COPYRIGHT BLOCK **/
  38. #ifdef HAVE_CONFIG_H
  39. # include <config.h>
  40. #endif
  41. /* repl_shared.h - definitions shared between 4.0 and 5.0 replication
  42. modules
  43. */
  44. #ifndef REPL_SHARED_H
  45. #define REPL_SHARED_H
  46. #include "slapi-private.h"
  47. #include "slapi-plugin.h"
  48. #include "ldif.h" /* GGOODREPL - is this cheating? */
  49. #ifdef _WIN32
  50. #define FILE_PATHSEP '\\'
  51. #else
  52. #define FILE_PATHSEP '/'
  53. #endif
  54. #define CHANGELOGDB_TRIM_INTERVAL 300 /* 5 minutes */
  55. #define CONFIG_CHANGELOG_DIR_ATTRIBUTE "nsslapd-changelogdir"
  56. #define CONFIG_CHANGELOG_MAXENTRIES_ATTRIBUTE "nsslapd-changelogmaxentries"
  57. #define CONFIG_CHANGELOG_MAXAGE_ATTRIBUTE "nsslapd-changelogmaxage"
  58. /* Changelog Internal Configuration Parameters -> DB related */
  59. #define CONFIG_CHANGELOG_DB_DBCACHESIZE "nsslapd-dbcachesize"
  60. #define CONFIG_CHANGELOG_DB_DURABLE_TRANSACTIONS "nsslapd-db-durable-transaction"
  61. #define CONFIG_CHANGELOG_DB_CHECKPOINT_INTERVAL "nsslapd-db-checkpoint-interval"
  62. #define CONFIG_CHANGELOG_DB_CIRCULAR_LOGGING "nsslapd-db-circular-logging"
  63. #define CONFIG_CHANGELOG_DB_PAGE_SIZE "nsslapd-db-page-size"
  64. #define CONFIG_CHANGELOG_DB_LOGFILE_SIZE "nsslapd-db-logfile-size"
  65. #define CONFIG_CHANGELOG_DB_MAXTXN_SIZE "nsslapd-db-max-txn"
  66. #define CONFIG_CHANGELOG_DB_VERBOSE "nsslapd-db-verbose"
  67. #define CONFIG_CHANGELOG_DB_DEBUG "nsslapd-db-debug"
  68. #define CONFIG_CHANGELOG_DB_TRICKLE_PERCENTAGE "nsslapd-db-trickle-percentage"
  69. #define CONFIG_CHANGELOG_DB_SPINCOUNT "nsslapd-db-spin-count"
  70. /* Changelog Internal Configuration Parameters -> Changelog Cache related */
  71. #define CONFIG_CHANGELOG_CACHESIZE "nsslapd-cachesize"
  72. #define CONFIG_CHANGELOG_CACHEMEMSIZE "nsslapd-cachememsize"
  73. #define CONFIG_CHANGELOG_NB_LOCK "nsslapd-db-locks"
  74. #define CONFIG_CHANGELOG_MAX_CONCURRENT_WRITES "nsslapd-changelogmaxconcurrentwrites"
  75. #define T_CHANGETYPESTR "changetype"
  76. #define T_CHANGETYPE 1
  77. #define T_TIMESTR "time"
  78. #define T_TIME 2
  79. #define T_DNSTR "dn"
  80. #define T_DN 3
  81. #define T_CHANGESTR "change"
  82. #define T_CHANGE 4
  83. #define T_ADDCTSTR "add"
  84. #define T_ADDCT 4
  85. #define T_MODIFYCTSTR "modify"
  86. #define T_MODIFYCT 5
  87. #define T_DELETECTSTR "delete"
  88. #define T_DELETECT 6
  89. #define T_MODRDNCTSTR "modrdn"
  90. #define T_MODRDNCT 7
  91. #define T_MODDNCTSTR "moddn"
  92. #define T_MODDNCT 8
  93. #define T_MODOPADDSTR "add"
  94. #define T_MODOPADD 9
  95. #define T_MODOPREPLACESTR "replace"
  96. #define T_MODOPREPLACE 10
  97. #define T_MODOPDELETESTR "delete"
  98. #define T_MODOPDELETE 11
  99. #define T_MODSEPSTR "-"
  100. #define T_MODSEP 12
  101. #define T_NEWRDNSTR "newrdn"
  102. #define T_NEWSUPERIORSTR ATTR_NEWSUPERIOR
  103. #define T_DRDNFLAGSTR "deleteoldrdn"
  104. #define T_ERR -1
  105. #define AWAITING_OP -1
  106. #define STATE_REFERRAL "referral"
  107. #define STATE_UPDATE_REFERRAL "referral on update"
  108. #define STATE_BACKEND "backend"
  109. #define REPL_PLUGIN_NAME "NSMMReplicationPlugin"
  110. /*
  111. * Changed version from 1.0 to 2.0 when we switched from libdb32 to libdb33
  112. * richm 20020708
  113. * also changed name from REPL_PLUGIN_VERSION to CHANGELOG_DB_VERSION since we use
  114. * a different version for the plugin itself and this particular version is only
  115. * used for the changelog database
  116. */
  117. /* the current CHANGELOG_DB_VERSION: DB_VERSION_MAJOR"."DB_VERSION_MINOR" */
  118. /* this string is left for the backward compatibility */
  119. #define CHANGELOG_DB_VERSION "4.0"
  120. extern char *repl_plugin_name;
  121. extern char *windows_repl_plugin_name;
  122. extern char *repl_plugin_name_cl;
  123. /* repl_monitor.c */
  124. int repl_monitor_init();
  125. /* In replutil.c */
  126. char ** get_cleattrs();
  127. unsigned long strntoul( char *from, size_t len, int base );
  128. void freepmods( LDAPMod **pmods );
  129. char *copy_berval (struct berval* from);
  130. void entry_print(Slapi_Entry *e);
  131. int copyfile(char* source, char *destination, int overwrite, int mode);
  132. time_t age_str2time (const char *age);
  133. const char* changeType2Str (int type);
  134. int str2ChangeType (const char *str);
  135. lenstr *make_changes_string(LDAPMod **ldm, char **includeattrs);
  136. Slapi_Mods* parse_changes_string(char *str);
  137. PRBool IsValidOperation (const slapi_operation_parameters *op);
  138. const char *map_repl_root_to_dbid(Slapi_DN *repl_root);
  139. PRBool is_ruv_tombstone_entry (Slapi_Entry *e);
  140. /* replication plugins */
  141. enum {
  142. PLUGIN_LEGACY_REPLICATION,
  143. PLUGIN_MULTIMASTER_REPLICATION,
  144. PLUGIN_MAX
  145. };
  146. void* repl_get_plugin_identity (int pluginID);
  147. void repl_set_plugin_identity (int pluginID, void *identity);
  148. #endif