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