]> git.sur5r.net Git - openldap/blob - servers/slapd/back-bdb/proto-bdb.h
Rewrote entry_encode/entry_decode again, uses 50% less disk space.
[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         AttributeDescription *desc,
34         slap_mask_t *indexmask );
35
36 int bdb_attr_index_config LDAP_P(( struct bdb_info *bdb,
37         const char *fname, int lineno,
38         int argc, char **argv ));
39
40 void bdb_attr_index_destroy LDAP_P(( Avlnode *tree ));
41
42 /*
43  * attribute.c
44  */
45
46 int
47 bdb_attribute LDAP_P(( Backend *be, Connection *conn, Operation *op,
48         Entry *target, const char *e_ndn, AttributeDescription *entry_at,
49         struct berval ***vals ));
50
51 /*
52  * dbcache.c
53  */
54 int
55 bdb_db_cache(
56     Backend     *be,
57     const char *name,
58         DB **db );
59
60 /*
61  * dn2entry.c
62  */
63 int bdb_dn2entry LDAP_P(( BackendDB *be, DB_TXN *tid,
64         const char *dn, Entry **e, Entry **matched, int flags ));
65
66 /*
67  * dn2id.c
68  */
69 int bdb_dn2id(
70         BackendDB *be,
71         DB_TXN *tid,
72         const char *dn,
73         ID *id );
74
75 int bdb_dn2id_matched(
76         BackendDB *be,
77         DB_TXN *tid,
78         const char *dn,
79         ID *id,
80         char **matchedDN );
81
82 int bdb_dn2id_add(
83         BackendDB *be,
84         DB_TXN *tid,
85         const char *dn,
86         ID id );
87
88 int bdb_dn2id_delete(
89         BackendDB *be,
90         DB_TXN *tid,
91         const char *dn,
92         ID id );
93
94 int bdb_dn2id_children(
95         BackendDB *be,
96         DB_TXN *tid,
97         const char *dn );
98
99 int
100 bdb_dn2idl(
101         BackendDB       *be,
102         const char      *dn,
103         int prefix,
104         ID *ids );
105
106 /*
107  * entry.c
108  */
109 int bdb_entry_return( BackendDB *be, Entry *e );
110 int bdb_entry_release( BackendDB *, Connection *, Operation *, Entry *, int );
111
112 /*
113  * error.c
114  */
115 void bdb_errcall( const char *pfx, char * msg );
116
117 /*
118  * filterentry.c
119  */
120 int bdb_filter_candidates(
121         Backend *be,
122         Filter  *f,
123         ID *ids,
124         ID *tmp );
125
126 /*
127  * group.c
128  */
129
130 int bdb_group(
131         Backend *be,
132         Connection *conn,
133         Operation *op,
134         Entry   *target,
135         const char      *gr_ndn,
136         const char      *op_ndn,
137         ObjectClass *group_oc,
138         AttributeDescription *group_at);
139
140 /*
141  * id2entry
142  */
143 int bdb_id2entry_add(
144         BackendDB *be,
145         DB_TXN *tid,
146         Entry *e );
147
148 int bdb_id2entry_update(
149         BackendDB *be,
150         DB_TXN *tid,
151         Entry *e );
152
153 int bdb_id2entry_delete(
154         BackendDB *be,
155         DB_TXN *tid,
156         ID id );
157
158 int bdb_id2entry(
159         BackendDB *be,
160         DB_TXN *tid,
161         ID id,
162         Entry **e );
163
164 /*
165  * idl.c
166  */
167 unsigned bdb_idl_search( ID *ids, ID id );
168
169 int bdb_idl_fetch_key(
170         BackendDB *be,
171         DB *db,
172         DB_TXN *txn,
173         DBT *key,
174         ID *ids );
175
176 int bdb_idl_insert_key(
177         BackendDB *be,
178         DB *db,
179         DB_TXN *txn,
180         DBT *key,
181         ID id );
182
183 int bdb_idl_delete_key(
184         BackendDB *be,
185         DB *db,
186         DB_TXN *txn,
187         DBT *key,
188         ID id );
189
190 #if 0
191 int
192 bdb_idl_notin(
193     ID  *a,
194     ID  *b,
195         ID      *ids );
196 #endif
197
198 int
199 bdb_idl_intersection(
200         ID *a,
201         ID *b );
202
203 int
204 bdb_idl_union(
205         ID *a,
206         ID *b );
207
208 ID bdb_idl_first( ID *ids, ID *cursor );
209 ID bdb_idl_next( ID *ids, ID *cursor );
210
211
212 /*
213  * index.c
214  */
215 extern int
216 bdb_index_param LDAP_P((
217         Backend *be,
218         AttributeDescription *desc,
219         int ftype,
220         DB **db,
221         slap_mask_t *mask,
222         struct berval *prefix ));
223
224 extern int
225 bdb_index_values LDAP_P((
226         Backend *be,
227         DB_TXN *txn,
228         AttributeDescription *desc,
229         struct berval **vals,
230         ID id,
231         int op ));
232
233 int bdb_index_entry LDAP_P(( Backend *be, DB_TXN *t,
234         int r, Entry *e, Attribute *ap ));
235
236 #define bdb_index_entry_add(be,t,e,ap) \
237         bdb_index_entry((be),(t),SLAP_INDEX_ADD_OP,(e),(ap))
238 #define bdb_index_entry_del(be,t,e,ap) \
239         bdb_index_entry((be),(t),SLAP_INDEX_DELETE_OP,(e),(ap))
240
241 /*
242  * key.c
243  */
244 extern int
245 bdb_key_read(
246     Backend     *be,
247         DB *db,
248         DB_TXN *txn,
249     struct berval *k,
250         ID *ids );
251
252 extern int
253 bdb_key_change(
254     Backend      *be,
255     DB *db,
256         DB_TXN *txn,
257     struct berval *k,
258     ID id,
259     int op );
260         
261 /*
262  * nextid.c
263  */
264 int bdb_next_id( BackendDB *be, DB_TXN *tid, ID *id );
265 int bdb_last_id( BackendDB *be, DB_TXN *tid );
266
267 /*
268  * modify.c
269  */
270 int bdb_modify_internal(
271         BackendDB *be,
272         Connection *conn,
273         Operation *op,
274         DB_TXN *tid,
275         Modifications *modlist,
276         Entry *e,
277         const char **text,
278         char *textbuf,
279         size_t textlen );
280
281 /*
282  * passwd.c
283  */
284 int
285 bdb_exop_passwd(
286         Backend         *be,
287         Connection              *conn,
288         Operation               *op,
289         const char              *reqoid,
290         struct berval   *reqdata,
291         char                    **rspoid,
292         struct berval   **rspdata,
293         LDAPControl             *** rspctrls,
294         const char              **text,
295         struct berval   *** refs );
296
297 /*
298  * tools.c
299  */
300 int bdb_tool_entry_open( BackendDB *be, int mode );
301 int bdb_tool_entry_close( BackendDB *be );
302 ID bdb_tool_entry_next( BackendDB *be );
303 Entry* bdb_tool_entry_get( BackendDB *be, ID id );
304 ID bdb_tool_entry_put( BackendDB *be, Entry *e );
305 int bdb_tool_entry_reindex( BackendDB *be, ID id );
306
307
308 LDAP_END_DECL
309
310 #endif /* _PROTO_BDB_H */