4 Copyright (C) Andrew Tridgell 2004
5 Copyright (C) Stefan Metzmacher 2004
7 ** NOTE! The following LGPL license applies to the ldb
8 ** library. This does NOT imply that all of Samba is released
11 This library is free software; you can redistribute it and/or
12 modify it under the terms of the GNU Lesser General Public
13 License as published by the Free Software Foundation; either
14 version 2 of the License, or (at your option) any later version.
16 This library is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License for more details.
21 You should have received a copy of the GNU Lesser General Public
22 License along with this library; if not, write to the Free Software
23 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 * Component: ldb private header
31 * Description: defines internal ldb structures used by th esubsystem and modules
33 * Author: Andrew Tridgell
34 * Author: Stefan Metzmacher
37 #ifndef _LDB_PRIVATE_H_
38 #define _LDB_PRIVATE_H_ 1
42 struct ldb_module_ops;
44 /* basic module structure */
46 struct ldb_module *prev, *next;
47 struct ldb_context *ldb;
49 const struct ldb_module_ops *ops;
53 these function pointers define the operations that a ldb module must perform
54 they correspond exactly to the ldb_*() interface
56 struct ldb_module_ops {
58 int (*search)(struct ldb_module *, const char *, enum ldb_scope,
59 const char *, const char * const [], struct ldb_message ***);
60 int (*search_bytree)(struct ldb_module *, const char *, enum ldb_scope,
61 struct ldb_parse_tree *, const char * const [], struct ldb_message ***);
62 int (*add_record)(struct ldb_module *, const struct ldb_message *);
63 int (*modify_record)(struct ldb_module *, const struct ldb_message *);
64 int (*delete_record)(struct ldb_module *, const char *);
65 int (*rename_record)(struct ldb_module *, const char *, const char *);
66 int (*named_lock)(struct ldb_module *, const char *);
67 int (*named_unlock)(struct ldb_module *, const char *);
68 const char * (*errstring)(struct ldb_module *);
72 every ldb connection is started by establishing a ldb_context
75 /* the operations provided by the backend */
76 struct ldb_module *modules;
78 /* debugging operations */
79 struct ldb_debug_ops debug_ops;
82 /* the modules init function */
83 typedef struct ldb_module *(*ldb_module_init_function)(struct ldb_context *ldb, const char *options[]);
85 /* The following definitions come from lib/ldb/common/ldb_modules.c */
87 int ldb_load_modules(struct ldb_context *ldb, const char *options[]);
88 int ldb_next_search(struct ldb_module *module,
91 const char *expression,
92 const char * const *attrs, struct ldb_message ***res);
93 int ldb_next_search_bytree(struct ldb_module *module,
96 struct ldb_parse_tree *tree,
97 const char * const *attrs, struct ldb_message ***res);
98 int ldb_next_add_record(struct ldb_module *module, const struct ldb_message *message);
99 int ldb_next_modify_record(struct ldb_module *module, const struct ldb_message *message);
100 int ldb_next_delete_record(struct ldb_module *module, const char *dn);
101 int ldb_next_rename_record(struct ldb_module *module, const char *olddn, const char *newdn);
102 int ldb_next_named_lock(struct ldb_module *module, const char *lockname);
103 int ldb_next_named_unlock(struct ldb_module *module, const char *lockname);
104 const char *ldb_next_errstring(struct ldb_module *module);
106 /* The following definitions come from lib/ldb/common/ldb_debug.c */
107 void ldb_debug(struct ldb_context *ldb, enum ldb_debug_level level, const char *fmt, ...) PRINTF_ATTRIBUTE(3, 4);
109 /* The following definitions come from lib/ldb/common/ldb_ldif.c */
110 char *ldb_base64_encode(struct ldb_context *ldb, const char *buf, int len);
111 int ldb_should_b64_encode(const struct ldb_val *val);
113 struct ldb_context *ltdb_connect(const char *url,
115 const char *options[]);
116 struct ldb_context *lldb_connect(const char *url,
118 const char *options[]);
119 struct ldb_context *lsqlite3_connect(const char *url,
121 const char *options[]);
122 struct ldb_module *timestamps_module_init(struct ldb_context *ldb, const char *options[]);
123 struct ldb_module *schema_module_init(struct ldb_context *ldb, const char *options[]);
125 const char **ldb_options_parse(const char **options, int *ldbopts, const char *arg);