linked_attrs.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /** BEGIN COPYRIGHT BLOCK
  2. * Copyright (C) 2009 Red Hat, Inc.
  3. * All rights reserved.
  4. *
  5. * License: GPL (version 3 or any later version).
  6. * See LICENSE for details.
  7. * END COPYRIGHT BLOCK **/
  8. #ifdef HAVE_CONFIG_H
  9. # include <config.h>
  10. #endif
  11. /*
  12. * Linked attributes plug-in header file
  13. */
  14. #include <stdio.h>
  15. #include <ctype.h>
  16. #include <string.h>
  17. #include <errno.h>
  18. #include "portable.h"
  19. #include "nspr.h"
  20. #include "slapi-plugin.h"
  21. #include "slapi-private.h"
  22. #include "prclist.h"
  23. #include "ldif.h"
  24. /*
  25. * Plug-in defines
  26. */
  27. #define LINK_PLUGIN_SUBSYSTEM "linkedattrs-plugin"
  28. #define LINK_FEATURE_DESC "Linked Attributes"
  29. #define LINK_PLUGIN_DESC "Linked Attributes plugin"
  30. #define LINK_INT_POSTOP_DESC "Linked Attributes internal postop plugin"
  31. #define LINK_POSTOP_DESC "Linked Attributes postop plugin"
  32. /*
  33. * Config type defines
  34. */
  35. #define LINK_LINK_TYPE "linkType"
  36. #define LINK_MANAGED_TYPE "managedType"
  37. #define LINK_SCOPE "linkScope"
  38. /*
  39. * Other defines
  40. */
  41. #define DN_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.12"
  42. /*
  43. * Linked list of config entries.
  44. */
  45. struct configEntry {
  46. PRCList list;
  47. char *dn;
  48. char *linktype;
  49. char *managedtype;
  50. char *scope;
  51. Slapi_DN *suffix;
  52. Slapi_Mutex *lock;
  53. };
  54. /*
  55. * Linked list used for indexing config entries
  56. * by managed type.
  57. */
  58. struct configIndex {
  59. PRCList list;
  60. struct configEntry *config;
  61. };
  62. /*
  63. * Fixup task private data.
  64. */
  65. typedef struct _task_data
  66. {
  67. char *linkdn;
  68. char *bind_dn;
  69. } task_data;
  70. /*
  71. * Debug functions - global, for the debugger
  72. */
  73. void linked_attrs_dump_config(void);
  74. void linked_attrs_dump_config_index(void);
  75. void linked_attrs_dump_config_entry(struct configEntry *);
  76. /*
  77. * Config fetch function
  78. */
  79. PRCList *linked_attrs_get_config(void);
  80. /*
  81. * Config cache locking functions
  82. */
  83. void linked_attrs_read_lock(void);
  84. void linked_attrs_write_lock(void);
  85. void linked_attrs_unlock(void);
  86. /*
  87. * Plugin identity functions
  88. */
  89. void linked_attrs_set_plugin_id(void *pluginID);
  90. void *linked_attrs_get_plugin_id(void);
  91. void linked_attrs_set_plugin_dn(const char *pluginDN);
  92. char *linked_attrs_get_plugin_dn(void);
  93. /*
  94. * Fixup task callback
  95. */
  96. int linked_attrs_fixup_task_add(Slapi_PBlock *pb, Slapi_Entry *e,
  97. Slapi_Entry *eAfter, int *returncode,
  98. char *returntext, void *arg);
  99. extern int plugin_is_betxn;