Fix all other modules to use ldb_module.h instead of ldb_private.h
[ira/wip.git] / source4 / lib / ldb / include / ldb_private.h
1 /* 
2    ldb database library
3
4    Copyright (C) Andrew Tridgell    2004
5    Copyright (C) Stefan Metzmacher  2004
6    Copyright (C) Simo Sorce         2004-2005
7
8      ** NOTE! The following LGPL license applies to the ldb
9      ** library. This does NOT imply that all of Samba is released
10      ** under the LGPL
11    
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.
16
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.
21
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/>.
24 */
25
26 /*
27  *  Name: ldb
28  *
29  *  Component: ldb private header
30  *
31  *  Description: defines internal ldb structures used by the subsystem and modules
32  *
33  *  Author: Andrew Tridgell
34  *  Author: Stefan Metzmacher
35  */
36
37 #ifndef _LDB_PRIVATE_H_
38 #define _LDB_PRIVATE_H_ 1
39
40 #include "ldb.h"
41 #include "ldb_module.h"
42
43 struct ldb_context;
44
45 struct ldb_module_ops;
46
47 struct ldb_backend_ops;
48
49 struct ldb_handle {
50         int status;
51         enum ldb_state state;
52         struct ldb_context *ldb;
53 };
54
55 /* basic module structure */
56 struct ldb_module {
57         struct ldb_module *prev, *next;
58         struct ldb_context *ldb;
59         void *private_data;
60         const struct ldb_module_ops *ops;
61 };
62
63 /*
64   schema related information needed for matching rules
65 */
66 struct ldb_schema {
67         /* attribute handling table */
68         unsigned num_attributes;
69         struct ldb_schema_attribute *attributes;
70
71         unsigned num_dn_extended_syntax;
72         struct ldb_dn_extended_syntax *dn_extended_syntax;
73 };
74
75 /*
76   every ldb connection is started by establishing a ldb_context
77 */
78 struct ldb_context {
79         /* the operations provided by the backend */
80         struct ldb_module *modules;
81
82         /* debugging operations */
83         struct ldb_debug_ops debug_ops;
84
85         /* custom utf8 functions */
86         struct ldb_utf8_fns utf8_fns;
87
88         /* backend specific opaque parameters */
89         struct ldb_opaque {
90                 struct ldb_opaque *next;
91                 const char *name;
92                 void *value;
93         } *opaque;
94
95         struct ldb_schema schema;
96
97         char *err_string;
98
99         int transaction_active;
100
101         int default_timeout;
102
103         unsigned int flags;
104
105         unsigned int create_perms;
106
107         char *modules_dir;
108
109         struct tevent_context *ev_ctx;
110 };
111
112 #ifndef ARRAY_SIZE
113 #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
114 #endif
115
116 /* The following definitions come from lib/ldb/common/ldb.c  */
117
118 int ldb_connect_backend(struct ldb_context *ldb, const char *url, const char *options[],
119                         struct ldb_module **backend_module);
120 void ldb_set_default_dns(struct ldb_context *ldb);
121
122
123 extern const struct ldb_module_ops ldb_objectclass_module_ops;
124 extern const struct ldb_module_ops ldb_operational_module_ops;
125 extern const struct ldb_module_ops ldb_paged_results_module_ops;
126 extern const struct ldb_module_ops ldb_rdn_name_module_ops;
127 extern const struct ldb_module_ops ldb_schema_module_ops;
128 extern const struct ldb_module_ops ldb_asq_module_ops;
129 extern const struct ldb_module_ops ldb_server_sort_module_ops;
130 extern const struct ldb_module_ops ldb_ldap_module_ops;
131 extern const struct ldb_module_ops ldb_ildap_module_ops;
132 extern const struct ldb_module_ops ldb_paged_searches_module_ops;
133 extern const struct ldb_module_ops ldb_tdb_module_ops;
134 extern const struct ldb_module_ops ldb_skel_module_ops;
135 extern const struct ldb_module_ops ldb_subtree_rename_module_ops;
136 extern const struct ldb_module_ops ldb_subtree_delete_module_ops;
137 extern const struct ldb_module_ops ldb_sqlite3_module_ops;
138 extern const struct ldb_module_ops ldb_wins_ldb_module_ops;
139 extern const struct ldb_module_ops ldb_ranged_results_module_ops;
140
141 extern const struct ldb_backend_ops ldb_tdb_backend_ops;
142 extern const struct ldb_backend_ops ldb_sqlite3_backend_ops;
143 extern const struct ldb_backend_ops ldb_ldap_backend_ops;
144 extern const struct ldb_backend_ops ldb_ldapi_backend_ops;
145 extern const struct ldb_backend_ops ldb_ldaps_backend_ops;
146
147 int ldb_setup_wellknown_attributes(struct ldb_context *ldb);
148
149 const char **ldb_subclass_list(struct ldb_context *ldb, const char *classname);
150 void ldb_subclass_remove(struct ldb_context *ldb, const char *classname);
151 int ldb_subclass_add(struct ldb_context *ldb, const char *classname, const char *subclass);
152
153 int ldb_handler_copy(struct ldb_context *ldb, void *mem_ctx,
154                      const struct ldb_val *in, struct ldb_val *out);
155 int ldb_comparison_binary(struct ldb_context *ldb, void *mem_ctx,
156                           const struct ldb_val *v1, const struct ldb_val *v2);
157
158 /* The following definitions come from lib/ldb/common/ldb_utf8.c */
159 char *ldb_casefold_default(void *context, void *mem_ctx, const char *s, size_t n);
160
161 void ldb_dump_results(struct ldb_context *ldb, struct ldb_result *result, FILE *f);
162
163
164 /* The following definitions come from lib/ldb/common/ldb_modules.c  */
165
166 const char **ldb_modules_list_from_string(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, const char *string);
167 int ldb_load_modules_list(struct ldb_context *ldb, const char **module_list, struct ldb_module *backend, struct ldb_module **out);
168 int ldb_load_modules(struct ldb_context *ldb, const char *options[]);
169 int ldb_init_module_chain(struct ldb_context *ldb, struct ldb_module *module);
170
171 struct ldb_val ldb_binary_decode(void *mem_ctx, const char *str);
172
173 #endif