summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/include
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-03-02 16:32:53 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:52:11 -0500
commit26af14c39b88b0e7eb53657b89be65d865804688 (patch)
treeac73da63e8b053514ff8ecf465027d02227feea1 /source4/lib/ldb/include
parent0efc7293181dc06d79c0edc21677f900597fc760 (diff)
downloadsamba-26af14c39b88b0e7eb53657b89be65d865804688.tar.gz
samba-26af14c39b88b0e7eb53657b89be65d865804688.tar.bz2
samba-26af14c39b88b0e7eb53657b89be65d865804688.zip
r13786: [merge] Add registration functions for LDB modules
Applications that use LDB modules will now have to run ldb_global_init() before they can use LDB. The next step will be adding support for loading LDB modules from .so files. This will also allow us to use one LDB without difference between the standalone and the Samba-specific build (This used to be commit 52a235650514039bf8ffee99a784bbc1b6ae6b92)
Diffstat (limited to 'source4/lib/ldb/include')
-rw-r--r--source4/lib/ldb/include/includes.h2
-rw-r--r--source4/lib/ldb/include/ldb.h9
-rw-r--r--source4/lib/ldb/include/ldb_private.h25
3 files changed, 21 insertions, 15 deletions
diff --git a/source4/lib/ldb/include/includes.h b/source4/lib/ldb/include/includes.h
index 15eb18a5e8..b10f329a2d 100644
--- a/source4/lib/ldb/include/includes.h
+++ b/source4/lib/ldb/include/includes.h
@@ -10,6 +10,8 @@
#include "system/iconv.h"
#include "system/time.h"
+#include "build.h"
+
#else /*_SAMBA_BUILD_*/
#ifndef _GNU_SOURCE
diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h
index f5bca965ad..13e69282ca 100644
--- a/source4/lib/ldb/include/ldb.h
+++ b/source4/lib/ldb/include/ldb.h
@@ -666,6 +666,15 @@ int ldb_request(struct ldb_context *ldb, struct ldb_request *request);
int ldb_async_wait(struct ldb_context *ldb, struct ldb_async_handle *handle, enum ldb_async_wait_type type);
/**
+ Initialise ldbs' global information
+
+ This is required before any other LDB call
+
+ \return 0 if initialisation succeeded, -1 otherwise
+*/
+int ldb_global_init(void);
+
+/**
Initialise an ldb context
This is required before any other LDB call.
diff --git a/source4/lib/ldb/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h
index 3f9be357a7..d4cba9797c 100644
--- a/source4/lib/ldb/include/ldb_private.h
+++ b/source4/lib/ldb/include/ldb_private.h
@@ -56,11 +56,11 @@ struct ldb_module {
*/
struct ldb_module_ops {
const char *name;
+ int (*init_context) (struct ldb_module *);
int (*request)(struct ldb_module *, struct ldb_request *);
int (*start_transaction)(struct ldb_module *);
int (*end_transaction)(struct ldb_module *);
int (*del_transaction)(struct ldb_module *);
- int (*second_stage_init)(struct ldb_module *);
};
@@ -112,9 +112,6 @@ struct ldb_context {
uint64_t (*sequence_number)(struct ldb_context *);
};
-/* the modules init function */
-typedef struct ldb_module *(*ldb_module_init_t)(struct ldb_context *, const char **);
-
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
#endif
@@ -124,9 +121,6 @@ typedef struct ldb_module *(*ldb_module_init_t)(struct ldb_context *, const char
*/
#define ldb_oom(ldb) ldb_debug_set(ldb, LDB_DEBUG_FATAL, "ldb out of memory at %s:%d\n", __FILE__, __LINE__)
-/* The following definitions come from lib/ldb/common/ldb.c */
-int ldb_second_stage_init(struct ldb_context *ldb);
-
/* The following definitions come from lib/ldb/common/ldb_modules.c */
int ldb_load_modules(struct ldb_context *ldb, const char *options[]);
@@ -134,11 +128,13 @@ int ldb_next_request(struct ldb_module *module, struct ldb_request *request);
int ldb_next_start_trans(struct ldb_module *module);
int ldb_next_end_trans(struct ldb_module *module);
int ldb_next_del_trans(struct ldb_module *module);
-int ldb_next_second_stage_init(struct ldb_module *module);
+int ldb_next_init(struct ldb_module *module);
void ldb_set_errstring(struct ldb_context *ldb, char *err_string);
void ldb_reset_err_string(struct ldb_context *ldb);
+int ldb_register_module(const struct ldb_module_ops *);
+
/* The following definitions come from lib/ldb/common/ldb_debug.c */
void ldb_debug(struct ldb_context *ldb, enum ldb_debug_level level, const char *fmt, ...) PRINTF_ATTRIBUTE(3, 4);
void ldb_debug_set(struct ldb_context *ldb, enum ldb_debug_level level,
@@ -161,14 +157,13 @@ int lsqlite3_connect(struct ldb_context *ldb,
const char *url,
unsigned int flags,
const char *options[]);
-struct ldb_module *objectclass_module_init(struct ldb_context *ldb, const char *options[]);
-struct ldb_module *operational_module_init(struct ldb_context *ldb, const char *options[]);
-struct ldb_module *paged_results_module_init(struct ldb_context *ldb, const char *options[]);
-struct ldb_module *rdn_name_module_init(struct ldb_context *ldb, const char *options[]);
-struct ldb_module *schema_module_init(struct ldb_context *ldb, const char *options[]);
-struct ldb_module *server_sort_module_init(struct ldb_context *ldb, const char *options[]);
-struct ldb_module *asq_module_init(struct ldb_context *ldb, const char *options[]);
+int ldb_objectclass_init(void);
+int ldb_operational_init(void);
+int ldb_paged_results_init(void);
+int ldb_rdn_name_init(void);
+int ldb_schema_init(void);
+int ldb_sort_init(void);
int ldb_match_msg(struct ldb_context *ldb,
struct ldb_message *msg,