summaryrefslogtreecommitdiffstats
path: root/ldap/servers/plugins/replication/winsync-plugin.h
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2008-08-27 21:47:00 +0000
committerRich Megginson <rmeggins@redhat.com>2008-08-27 21:47:00 +0000
commit446134bf3bd4d85433738bb257dba18269c32980 (patch)
tree5f97325ab901d1c2af3e699b654e945597b326d3 /ldap/servers/plugins/replication/winsync-plugin.h
parent27f282f02a60818e750902ecfd748ef3521f9539 (diff)
downloadds-446134bf3bd4d85433738bb257dba18269c32980.tar.gz
ds-446134bf3bd4d85433738bb257dba18269c32980.tar.xz
ds-446134bf3bd4d85433738bb257dba18269c32980.zip
Resolves: bug 457846
Bug Description: The Windows Sync API should have plug-in points Reviewed by: nkinder (Thanks!) Fix Description: Some additional changes to the api 1) added plugin points for begin update, end update, and agreement destruction 2) added debugging code to allow a regular DS to stand in for AD 3) fixed a couple of minor memory leaks 4) added the rest of the SLAPI DSE code to the public API to allow plugins to do dynamic configuration using the SLAPI public API Platforms tested: RHEL5 Flag Day: no Doc impact: yes - plugin guide
Diffstat (limited to 'ldap/servers/plugins/replication/winsync-plugin.h')
-rw-r--r--ldap/servers/plugins/replication/winsync-plugin.h80
1 files changed, 74 insertions, 6 deletions
diff --git a/ldap/servers/plugins/replication/winsync-plugin.h b/ldap/servers/plugins/replication/winsync-plugin.h
index 882e4144..71d27819 100644
--- a/ldap/servers/plugins/replication/winsync-plugin.h
+++ b/ldap/servers/plugins/replication/winsync-plugin.h
@@ -51,11 +51,12 @@
#define WINSYNC_v1_0_GUID "CDA8F029-A3C6-4EBB-80B8-A2E183DB0481"
/*
- * The plugin will define this callback in order to initialize itself.
- * The ds subtree and the ad subtree from the sync agreement are passed in.
- * These are read only.
- * The return value is private data to the plugin that will be passed back
- * at each callback
+ * This callback is called when a winsync agreement is created.
+ * The ds_subtree and ad_subtree from the agreement are read-only.
+ * The callback can allocate some private data to return. If so
+ * the callback must define a winsync_plugin_destroy_agmt_cb so
+ * that the private data can be freed. This private data is passed
+ * to every other callback function as the void *cookie argument.
*/
typedef void * (*winsync_plugin_init_cb)(const Slapi_DN *ds_subtree, const Slapi_DN *ad_subtree);
#define WINSYNC_PLUGIN_INIT_CB 1
@@ -161,6 +162,29 @@ typedef int (*winsync_can_add_to_ad_cb)(void *cookie, const Slapi_Entry *local_e
#define WINSYNC_PLUGIN_CAN_ADD_ENTRY_TO_AD_CB 16
/*
+ * Callbacks called at begin and end of update
+ *
+ * The ds subtree and the ad subtree from the sync agreement are passed in.
+ * These are read only.
+ * is_total will be true if this is a total update, or false if this
+ * is an incremental update
+ */
+typedef void (*winsync_plugin_update_cb)(void *cookie, const Slapi_DN *ds_subtree, const Slapi_DN *ad_subtree, int is_total);
+#define WINSYNC_PLUGIN_BEGIN_UPDATE_CB 17
+#define WINSYNC_PLUGIN_END_UPDATE_CB 18
+
+/*
+ * Callbacks called when the agreement is destroyed.
+ *
+ * The ds subtree and the ad subtree from the sync agreement are passed in.
+ * These are read only.
+ * The plugin must define this function to free the cookie allocated
+ * in the init function, if any.
+ */
+typedef void (*winsync_plugin_destroy_agmt_cb)(void *cookie, const Slapi_DN *ds_subtree, const Slapi_DN *ad_subtree);
+#define WINSYNC_PLUGIN_DESTROY_AGMT_CB 19
+
+/*
The following are sample code stubs to show how to implement
a plugin which uses this api
*/
@@ -418,6 +442,47 @@ test_winsync_can_add_entry_to_ad_cb(void *cbdata, const Slapi_Entry *local_entry
return 0; /* false - do not allow entries to be added to ad */
}
+static void
+test_winsync_begin_update_cb(void *cbdata, const Slapi_DN *ds_subtree,
+ const Slapi_DN *ad_subtree, int is_total)
+{
+ slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
+ "--> test_winsync_begin_update_cb -- begin\n");
+
+ slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
+ "<-- test_winsync_begin_update_cb -- end\n");
+
+ return;
+}
+
+static void
+test_winsync_end_update_cb(void *cbdata, const Slapi_DN *ds_subtree,
+ const Slapi_DN *ad_subtree, int is_total)
+{
+ slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
+ "--> test_winsync_end_update_cb -- begin\n");
+
+ slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
+ "<-- test_winsync_end_update_cb -- end\n");
+
+ return;
+}
+
+static void
+test_winsync_destroy_agmt_cb(void *cbdata, const Slapi_DN *ds_subtree,
+ const Slapi_DN *ad_subtree)
+{
+ slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
+ "--> test_winsync_destroy_agmt_cb -- begin\n");
+
+ /* free(cbdata); */
+
+ slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
+ "<-- test_winsync_destroy_agmt_cb -- end\n");
+
+ return;
+}
+
/**
* Plugin identifiers
*/
@@ -447,7 +512,10 @@ static void *test_winsync_api[] = {
test_winsync_get_new_ds_group_dn_cb,
test_winsync_pre_ad_mod_user_mods_cb,
test_winsync_pre_ad_mod_group_mods_cb,
- test_winsync_can_add_entry_to_ad_cb
+ test_winsync_can_add_entry_to_ad_cb,
+ test_winsync_begin_update_cb,
+ test_winsync_end_update_cb,
+ test_winsync_destroy_agmt_cb
};
static int