From d103f2d346d721de6975f32649a8c75d5230dc5b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 1 Nov 2010 18:41:32 +1100 Subject: s4-ldb: added support for general ldb hooks in modules this allows a ldb module to register a hook function called at various stages of processing. It will be initially used for ldb command line hooks, but should work generally. Pair-Programmed-With: Andrew Bartlett --- source4/lib/ldb/include/ldb_module.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'source4/lib/ldb/include/ldb_module.h') diff --git a/source4/lib/ldb/include/ldb_module.h b/source4/lib/ldb/include/ldb_module.h index 71c3cd8f7b..800bf72e44 100644 --- a/source4/lib/ldb/include/ldb_module.h +++ b/source4/lib/ldb/include/ldb_module.h @@ -185,7 +185,7 @@ struct ldb_backend_ops { const char *ldb_default_modules_dir(void); -int ldb_register_backend(const char *url_prefix, ldb_connect_fn); +int ldb_register_backend(const char *url_prefix, ldb_connect_fn, bool); struct ldb_handle *ldb_handle_new(TALLOC_CTX *mem_ctx, struct ldb_context *ldb); @@ -233,4 +233,23 @@ int ldb_modules_load(const char *modules_path, const char *version); /* init functions prototype */ typedef int (*ldb_module_init_fn)(const char *); +/* + general ldb hook function + */ +enum ldb_module_hook_type { LDB_MODULE_HOOK_CMDLINE_OPTIONS = 1, + LDB_MODULE_HOOK_CMDLINE_PRECONNECT = 2, + LDB_MODULE_HOOK_CMDLINE_POSTCONNECT = 3 }; + +typedef int (*ldb_hook_fn)(struct ldb_context *, enum ldb_module_hook_type ); + +/* + register a ldb hook function + */ +int ldb_register_hook(ldb_hook_fn hook_fn); + +/* + call ldb hooks of a given type + */ +int ldb_modules_hook(struct ldb_context *ldb, enum ldb_module_hook_type t); + #endif -- cgit