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 (*add_record)(struct ldb_module *, const struct ldb_message *);
61 int (*modify_record)(struct ldb_module *, const struct ldb_message *);
62 int (*delete_record)(struct ldb_module *, const char *);
63 int (*rename_record)(struct ldb_module *, const char *, const char *);
64 int (*named_lock)(struct ldb_module *, const char *);
65 int (*named_unlock)(struct ldb_module *, const char *);
66 const char * (*errstring)(struct ldb_module *);
70 every ldb connection is started by establishing a ldb_context
73 /* the operations provided by the backend */
74 struct ldb_module *modules;
76 /* debugging operations */
77 struct ldb_debug_ops debug_ops;
80 /* the modules init function */
81 typedef struct ldb_module *(*ldb_module_init_function)(struct ldb_context *ldb, const char *options[]);
83 /* The following definitions come from lib/ldb/common/ldb_modules.c */
85 int ldb_load_modules(struct ldb_context *ldb, const char *options[]);
86 int ldb_next_search(struct ldb_module *module,
89 const char *expression,
90 const char * const *attrs, struct ldb_message ***res);
91 int ldb_next_add_record(struct ldb_module *module, const struct ldb_message *message);
92 int ldb_next_modify_record(struct ldb_module *module, const struct ldb_message *message);
93 int ldb_next_delete_record(struct ldb_module *module, const char *dn);
94 int ldb_next_rename_record(struct ldb_module *module, const char *olddn, const char *newdn);
95 int ldb_next_named_lock(struct ldb_module *module, const char *lockname);
96 int ldb_next_named_unlock(struct ldb_module *module, const char *lockname);
97 const char *ldb_next_errstring(struct ldb_module *module);
99 /* The following definitions come from lib/ldb/common/ldb_debug.c */
100 void ldb_debug(struct ldb_context *ldb, enum ldb_debug_level level, const char *fmt, ...) PRINTF_ATTRIBUTE(3, 4);
102 /* The following definitions come from lib/ldb/common/ldb_ldif.c */
103 char *ldb_base64_encode(struct ldb_context *ldb, const char *buf, int len);
104 int ldb_should_b64_encode(const struct ldb_val *val);
106 struct ldb_context *ltdb_connect(const char *url,
108 const char *options[]);
109 struct ldb_context *lldb_connect(const char *url,
111 const char *options[]);
112 struct ldb_module *timestamps_module_init(struct ldb_context *ldb, const char *options[]);
114 const char **ldb_options_parse(const char **options, int *ldbopts, const char *arg);