repl5_prot_private.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. #ifndef _REPL5_PROT_PRIVATE_H_
  13. #define _REPL5_PROT_PRIVATE_H_
  14. #define ACQUIRE_SUCCESS 101
  15. #define ACQUIRE_REPLICA_BUSY 102
  16. #define ACQUIRE_FATAL_ERROR 103
  17. #define ACQUIRE_CONSUMER_WAS_UPTODATE 104
  18. #define ACQUIRE_TRANSIENT_ERROR 105
  19. typedef struct private_repl_protocol
  20. {
  21. void (*delete)(struct private_repl_protocol **);
  22. void (*run)(struct private_repl_protocol *);
  23. int (*stop)(struct private_repl_protocol *);
  24. int (*status)(struct private_repl_protocol *);
  25. void (*notify_update)(struct private_repl_protocol *);
  26. void (*notify_agmt_changed)(struct private_repl_protocol *);
  27. void (*notify_window_opened)(struct private_repl_protocol *);
  28. void (*notify_window_closed)(struct private_repl_protocol *);
  29. void (*update_now)(struct private_repl_protocol *);
  30. PRLock *lock;
  31. PRCondVar *cvar;
  32. int stopped;
  33. int terminate;
  34. PRUint32 eventbits;
  35. Repl_Connection *conn;
  36. int last_acquire_response_code;
  37. Repl_Agmt *agmt;
  38. Object *replica_object;
  39. void *private;
  40. PRBool replica_acquired;
  41. int repl50consumer; /* Flag to tell us if this is a 5.0-style consumer we're talking to */
  42. int repl71consumer; /* Flag to tell us if this is a 7.1-style consumer we're talking to */
  43. int repl90consumer; /* Flag to tell us if this is a 9.0-style consumer we're talking to */
  44. } Private_Repl_Protocol;
  45. extern Private_Repl_Protocol *Repl_5_Inc_Protocol_new(Repl_Protocol *rp);
  46. extern Private_Repl_Protocol *Repl_5_Tot_Protocol_new(Repl_Protocol *rp);
  47. extern int repl5_tot_last_rcv_msgid(Repl_Connection *conn);
  48. extern int repl5_tot_flowcontrol_detection(Repl_Connection *conn, int increment);
  49. extern Private_Repl_Protocol *Windows_Inc_Protocol_new(Repl_Protocol *rp);
  50. extern Private_Repl_Protocol *Windows_Tot_Protocol_new(Repl_Protocol *rp);
  51. #define PROTOCOL_TERMINATION_NORMAL 301
  52. #define PROTOCOL_TERMINATION_ABNORMAL 302
  53. #define PROTOCOL_TERMINATION_NEEDS_TOTAL_UPDATE 303
  54. #define RESUME_DO_TOTAL_UPDATE 401
  55. #define RESUME_DO_INCREMENTAL_UPDATE 402
  56. #define RESUME_TERMINATE 403
  57. #define RESUME_SUSPEND 404
  58. /* Backoff timer settings for reconnect */
  59. #define PROTOCOL_BACKOFF_MINIMUM 3 /* 3 seconds */
  60. #define PROTOCOL_BACKOFF_MAXIMUM (60 * 5) /* 5 minutes */
  61. /* Backoff timer settings for replica busy reconnect */
  62. #define PROTOCOL_BUSY_BACKOFF_MINIMUM PROTOCOL_BACKOFF_MINIMUM
  63. #define PROTOCOL_BUSY_BACKOFF_MAXIMUM PROTOCOL_BUSY_BACKOFF_MINIMUM
  64. /* protocol related functions */
  65. void release_replica(Private_Repl_Protocol *prp);
  66. int acquire_replica(Private_Repl_Protocol *prp, char *prot_oid, RUV **ruv);
  67. BerElement *entry2bere(const Slapi_Entry *e, char **excluded_attrs);
  68. CSN *get_current_csn(Slapi_DN *replarea_sdn);
  69. char* protocol_response2string (int response);
  70. int repl5_strip_fractional_mods(Repl_Agmt *agmt, LDAPMod **);
  71. void windows_release_replica(Private_Repl_Protocol *prp);
  72. int windows_acquire_replica(Private_Repl_Protocol *prp, RUV **ruv, int check_ruv);
  73. void repl5_set_backoff_min(Private_Repl_Protocol *prp, int min);
  74. void repl5_set_backoff_max(Private_Repl_Protocol *prp, int max);
  75. int repl5_get_backoff_min(Private_Repl_Protocol *prp);
  76. int repl5_get_backoff_max(Private_Repl_Protocol *prp);
  77. #endif /* _REPL5_PROT_PRIVATE_H_ */