4 Copyright (C) Andrew Tridgell 2004
5 Copyright (C) Stefan Metzmacher 2004
6 Copyright (C) Simo Sorce 2004-2005
8 ** NOTE! The following LGPL license applies to the ldb
9 ** library. This does NOT imply that all of Samba is released
12 This library is free software; you can redistribute it and/or
13 modify it under the terms of the GNU Lesser General Public
14 License as published by the Free Software Foundation; either
15 version 3 of the License, or (at your option) any later version.
17 This library is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Lesser General Public License for more details.
22 You should have received a copy of the GNU Lesser General Public
23 License along with this library; if not, see <http://www.gnu.org/licenses/>.
29 * Component: ldb private header
31 * Description: defines internal ldb structures used by the subsystem and modules
33 * Author: Andrew Tridgell
34 * Author: Stefan Metzmacher
37 #ifndef _LDB_PRIVATE_H_
38 #define _LDB_PRIVATE_H_ 1
40 #include "ldb_includes.h"
42 #include "ldb_module.h"
46 struct ldb_module_ops;
48 struct ldb_backend_ops;
50 #define LDB_HANDLE_FLAG_DONE_CALLED 1
51 /* call is from an untrusted source - eg. over ldap:// */
52 #define LDB_HANDLE_FLAG_UNTRUSTED 2
57 struct ldb_context *ldb;
61 /* used for debugging */
62 struct ldb_request *parent;
66 /* basic module structure */
68 struct ldb_module *prev, *next;
69 struct ldb_context *ldb;
71 const struct ldb_module_ops *ops;
75 schema related information needed for matching rules
78 void *attribute_handler_override_private;
79 ldb_attribute_handler_override_fn_t attribute_handler_override;
81 /* attribute handling table */
82 unsigned num_attributes;
83 struct ldb_schema_attribute *attributes;
85 unsigned num_dn_extended_syntax;
86 struct ldb_dn_extended_syntax *dn_extended_syntax;
90 every ldb connection is started by establishing a ldb_context
93 /* the operations provided by the backend */
94 struct ldb_module *modules;
96 /* debugging operations */
97 struct ldb_debug_ops debug_ops;
99 /* custom utf8 functions */
100 struct ldb_utf8_fns utf8_fns;
102 /* backend specific opaque parameters */
104 struct ldb_opaque *next;
109 struct ldb_schema schema;
113 int transaction_active;
119 unsigned int create_perms;
121 struct tevent_context *ev_ctx;
123 bool prepare_commit_done;
127 struct poptOption *popt_options;
130 /* The following definitions come from lib/ldb/common/ldb.c */
132 int ldb_connect_backend(struct ldb_context *ldb, const char *url, const char *options[],
133 struct ldb_module **backend_module);
136 extern const struct ldb_module_ops ldb_objectclass_module_ops;
137 extern const struct ldb_module_ops ldb_paged_results_module_ops;
138 extern const struct ldb_module_ops ldb_rdn_name_module_ops;
139 extern const struct ldb_module_ops ldb_schema_module_ops;
140 extern const struct ldb_module_ops ldb_asq_module_ops;
141 extern const struct ldb_module_ops ldb_server_sort_module_ops;
142 extern const struct ldb_module_ops ldb_ldap_module_ops;
143 extern const struct ldb_module_ops ldb_ildap_module_ops;
144 extern const struct ldb_module_ops ldb_paged_searches_module_ops;
145 extern const struct ldb_module_ops ldb_tdb_module_ops;
146 extern const struct ldb_module_ops ldb_skel_module_ops;
147 extern const struct ldb_module_ops ldb_subtree_rename_module_ops;
148 extern const struct ldb_module_ops ldb_subtree_delete_module_ops;
149 extern const struct ldb_module_ops ldb_sqlite3_module_ops;
150 extern const struct ldb_module_ops ldb_wins_ldb_module_ops;
151 extern const struct ldb_module_ops ldb_ranged_results_module_ops;
153 extern const struct ldb_backend_ops ldb_tdb_backend_ops;
154 extern const struct ldb_backend_ops ldb_sqlite3_backend_ops;
155 extern const struct ldb_backend_ops ldb_ldap_backend_ops;
156 extern const struct ldb_backend_ops ldb_ldapi_backend_ops;
157 extern const struct ldb_backend_ops ldb_ldaps_backend_ops;
159 int ldb_setup_wellknown_attributes(struct ldb_context *ldb);
161 const char **ldb_subclass_list(struct ldb_context *ldb, const char *classname);
162 void ldb_subclass_remove(struct ldb_context *ldb, const char *classname);
163 int ldb_subclass_add(struct ldb_context *ldb, const char *classname, const char *subclass);
165 /* The following definitions come from lib/ldb/common/ldb_utf8.c */
166 char *ldb_casefold_default(void *context, TALLOC_CTX *mem_ctx, const char *s, size_t n);
168 void ldb_dump_results(struct ldb_context *ldb, struct ldb_result *result, FILE *f);
171 /* The following definitions come from lib/ldb/common/ldb_modules.c */
173 const char **ldb_modules_list_from_string(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, const char *string);
174 int ldb_load_modules_list(struct ldb_context *ldb, const char **module_list, struct ldb_module *backend, struct ldb_module **out);
175 int ldb_load_modules(struct ldb_context *ldb, const char *options[]);
176 int ldb_init_module_chain(struct ldb_context *ldb, struct ldb_module *module);
178 struct ldb_val ldb_binary_decode(TALLOC_CTX *mem_ctx, const char *str);
181 /* The following definitions come from lib/ldb/common/ldb_options.c */
183 const char *ldb_options_find(struct ldb_context *ldb, const char *options[],
184 const char *option_name);