]> git.sur5r.net Git - openldap/blob - servers/slapd/back-bdb/proto-bdb.h
BDB_INDEX code does no harm (but no good yet, not used by filters yet).
[openldap] / servers / slapd / back-bdb / proto-bdb.h
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 2000 The OpenLDAP Foundation, All Rights Reserved.
4  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5  */
6
7 #ifndef _PROTO_BDB_H
8 #define _PROTO_BDB_H
9
10 LDAP_BEGIN_DECL
11
12 /*
13  * alias.c
14  */
15 Entry *bdb_deref_internal_r LDAP_P((
16         BackendDB *be,
17         Entry *e,
18         const char *dn,
19         int *err,
20         Entry **matched,
21         const char **text ));
22
23 #define deref_entry_r( be, e, err, matched, text ) \
24         bdb_deref_internal_r( be, e, NULL, err, matched, text )
25 #define deref_dn_r( be, dn, err, matched, text ) \
26         bdb_deref_internal_r( be, NULL, dn, err, matched, text)
27
28 /*
29  * attr.c
30  */
31
32 void bdb_attr_mask( struct bdb_info *bdb,
33 #ifdef SLAPD_USE_AD
34         AttributeDescription *desc,
35 #else
36     const char *desc,
37 #endif
38         slap_mask_t *indexmask );
39
40 int bdb_attr_index_config LDAP_P(( struct bdb_info *bdb,
41         const char *fname, int lineno,
42         int argc, char **argv ));
43
44 void bdb_attr_index_destroy LDAP_P(( Avlnode *tree ));
45
46 /*
47  * dbcache.c
48  */
49 int
50 bdb_db_cache(
51     Backend     *be,
52     const char *name,
53         DB **db );
54
55 /*
56  * dn2entry.c
57  */
58 int bdb_dn2entry LDAP_P(( BackendDB *be, DB_TXN *tid,
59         const char *dn, Entry **e, Entry **matched, int flags ));
60
61 /*
62  * dn2id.c
63  */
64 int bdb_dn2id(
65         BackendDB *be,
66         DB_TXN *tid,
67         const char *dn,
68         ID *id );
69
70 int bdb_dn2id_matched(
71         BackendDB *be,
72         DB_TXN *tid,
73         const char *dn,
74         ID *id,
75         char **matchedDN );
76
77 int bdb_dn2id_add(
78         BackendDB *be,
79         DB_TXN *tid,
80         const char *dn,
81         ID id );
82
83 int bdb_dn2id_delete(
84         BackendDB *be,
85         DB_TXN *tid,
86         const char *dn,
87         ID id );
88
89 int bdb_dn2id_children(
90         BackendDB *be,
91         DB_TXN *tid,
92         const char *dn );
93
94 int
95 bdb_dn2idl(
96         BackendDB       *be,
97         const char      *dn,
98         int prefix,
99         ID *ids );
100
101 /*
102  * entry.c
103  */
104 int bdb_entry_return( BackendDB *be, Entry *e );
105
106 /*
107  * error.c
108  */
109 void bdb_errcall( const char *pfx, char * msg );
110
111 /*
112  * filterentry.c
113  */
114 int bdb_filter_candidates(
115         Backend *be,
116         ID *range,
117         Filter  *f,
118         ID *ids );
119
120 /*
121  * id2entry
122  */
123 int bdb_id2entry_add(
124         BackendDB *be,
125         DB_TXN *tid,
126         Entry *e );
127
128 int bdb_id2entry_update(
129         BackendDB *be,
130         DB_TXN *tid,
131         Entry *e );
132
133 int bdb_id2entry_delete(
134         BackendDB *be,
135         DB_TXN *tid,
136         ID id );
137
138 int bdb_id2entry(
139         BackendDB *be,
140         DB_TXN *tid,
141         ID id,
142         Entry **e );
143
144 /*
145  * idl.c
146  */
147 unsigned bdb_idl_search( ID *ids, ID id );
148
149 int bdb_idl_fetch_key(
150         BackendDB *be,
151         DB *db,
152         DB_TXN *txn,
153         DBT *key,
154         ID *ids );
155
156 int bdb_idl_insert_key(
157         BackendDB *be,
158         DB *db,
159         DB_TXN *txn,
160         DBT *key,
161         ID id );
162
163 int bdb_idl_delete_key(
164         BackendDB *be,
165         DB *db,
166         DB_TXN *txn,
167         DBT *key,
168         ID id );
169
170 int
171 bdb_idl_notin(
172     ID  *a,
173     ID  *b,
174         ID      *ids );
175
176 int
177 bdb_idl_intersection(
178         ID *a,
179         ID *b,
180         ID *ids );
181
182 int
183 bdb_idl_union(
184         ID *a,
185         ID *b,
186         ID *ids );
187
188 ID bdb_idl_first( ID *ids, ID *cursor );
189 ID bdb_idl_next( ID *ids, ID *cursor );
190
191
192 /*
193  * index.c
194  */
195 extern int
196 bdb_index_param LDAP_P((
197         Backend *be,
198         AttributeDescription *desc,
199         int ftype,
200         char **dbname,
201         slap_mask_t *mask,
202         struct berval **prefix ));
203
204 extern int
205 bdb_index_values LDAP_P((
206         Backend *be,
207         DB_TXN *txn,
208         AttributeDescription *desc,
209         struct berval **vals,
210         ID id,
211         int op ));
212
213 int bdb_index_entry LDAP_P(( Backend *be, DB_TXN *t,
214         int r, Entry *e, Attribute *ap ));
215
216 #define bdb_index_entry_add(be,t,e,ap) \
217         bdb_index_entry((be),(t),SLAP_INDEX_ADD_OP,(e),(ap))
218 #define bdb_index_entry_del(be,t,e,ap) \
219         bdb_index_entry((be),(t),SLAP_INDEX_DELETE_OP,(e),(ap))
220
221 /*
222  * key.c
223  */
224 extern int
225 bdb_key_read(
226     Backend     *be,
227         DB *db,
228         DB_TXN *txn,
229     struct berval *k,
230         ID *ids );
231
232 extern int
233 bdb_key_change(
234     Backend      *be,
235     DB *db,
236         DB_TXN *txn,
237     struct berval *k,
238     ID id,
239     int op );
240         
241 /*
242  * nextid.c
243  */
244 int bdb_next_id( BackendDB *be, DB_TXN *tid, ID *id );
245 int bdb_last_id( BackendDB *be, DB_TXN *tid );
246
247 /*
248  * modify.c
249  */
250 int bdb_modify_internal(
251         BackendDB *be,
252         Connection *conn,
253         Operation *op,
254         DB_TXN *tid,
255         Modifications *modlist,
256         Entry *e,
257         const char **text,
258         char *textbuf,
259         size_t textlen );
260
261 /*
262  * passwd.c
263  */
264 int
265 bdb_exop_passwd(
266         Backend         *be,
267         Connection              *conn,
268         Operation               *op,
269         const char              *reqoid,
270         struct berval   *reqdata,
271         char                    **rspoid,
272         struct berval   **rspdata,
273         LDAPControl             *** rspctrls,
274         const char              **text,
275         struct berval   *** refs );
276
277 /*
278  * tools.c
279  */
280 int bdb_tool_entry_open( BackendDB *be, int mode );
281 int bdb_tool_entry_close( BackendDB *be );
282 ID bdb_tool_entry_next( BackendDB *be );
283 Entry* bdb_tool_entry_get( BackendDB *be, ID id );
284 ID bdb_tool_entry_put( BackendDB *be, Entry *e );
285 int bdb_tool_entry_reindex( BackendDB *be, ID id );
286
287
288 LDAP_END_DECL
289
290 #endif /* _PROTO_BDB_H */