]> git.sur5r.net Git - openldap/blob - servers/slapd/back-bdb/proto-bdb.h
7e641bf9d5178fd8c0a2416d43f9f9b2465070b8
[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_fetch_key(
146         BackendDB *be,
147         DB *db,
148         DB_TXN *txn,
149         DBT *key,
150         ID *ids );
151
152 int bdb_idl_insert_key(
153         BackendDB *be,
154         DB *db,
155         DB_TXN *txn,
156         DBT *key,
157         ID id );
158
159 int bdb_idl_delete_key(
160         BackendDB *be,
161         DB *db,
162         DB_TXN *txn,
163         DBT *key,
164         ID id );
165
166 int
167 bdb_idl_notin(
168     ID  *a,
169     ID  *b,
170         ID      *ids );
171
172 int
173 bdb_idl_intersection(
174         ID *a,
175         ID *b,
176         ID *ids );
177
178 int
179 bdb_idl_union(
180         ID *a,
181         ID *b,
182         ID *ids );
183
184 ID bdb_idl_first( ID *ids, ID *cursor );
185 ID bdb_idl_next( ID *ids, ID *cursor );
186
187
188 /*
189  * index.c
190  */
191 extern int
192 bdb_index_param LDAP_P((
193         Backend *be,
194         AttributeDescription *desc,
195         int ftype,
196         char **dbname,
197         slap_mask_t *mask,
198         struct berval **prefix ));
199
200 extern int
201 bdb_index_values LDAP_P((
202         Backend *be,
203         DB_TXN *txn,
204         AttributeDescription *desc,
205         struct berval **vals,
206         ID id,
207         int op ));
208
209 int bdb_index_entry LDAP_P(( Backend *be, DB_TXN *t,
210         int r, Entry *e, Attribute *ap ));
211
212 #define bdb_index_entry_add(be,t,e,ap) \
213         bdb_index_entry((be),(t),SLAP_INDEX_ADD_OP,(e),(ap))
214 #define bdb_index_entry_del(be,t,e,ap) \
215         bdb_index_entry((be),(t),SLAP_INDEX_DELETE_OP,(e),(ap))
216
217 /*
218  * key.c
219  */
220 extern int
221 bdb_key_read(
222     Backend     *be,
223         DB *db,
224         DB_TXN *txn,
225     struct berval *k,
226         ID *ids );
227
228 extern int
229 bdb_key_change(
230     Backend      *be,
231     DB *db,
232         DB_TXN *txn,
233     struct berval *k,
234     ID id,
235     int op );
236         
237 /*
238  * nextid.c
239  */
240 int bdb_next_id( BackendDB *be, DB_TXN *tid, ID *id );
241 int bdb_last_id( BackendDB *be, DB_TXN *tid );
242
243 /*
244  * modify.c
245  */
246 int bdb_modify_internal(
247         BackendDB *be,
248         Connection *conn,
249         Operation *op,
250         DB_TXN *tid,
251         Modifications *modlist,
252         Entry *e,
253         const char **text,
254         char *textbuf,
255         size_t textlen );
256
257 /*
258  * passwd.c
259  */
260 int
261 bdb_exop_passwd(
262         Backend         *be,
263         Connection              *conn,
264         Operation               *op,
265         const char              *reqoid,
266         struct berval   *reqdata,
267         char                    **rspoid,
268         struct berval   **rspdata,
269         LDAPControl             *** rspctrls,
270         const char              **text,
271         struct berval   *** refs );
272
273 /*
274  * tools.c
275  */
276 int bdb_tool_entry_open( BackendDB *be, int mode );
277 int bdb_tool_entry_close( BackendDB *be );
278 ID bdb_tool_entry_next( BackendDB *be );
279 Entry* bdb_tool_entry_get( BackendDB *be, ID id );
280 ID bdb_tool_entry_put( BackendDB *be, Entry *e );
281 int bdb_tool_entry_reindex( BackendDB *be, ID id );
282
283
284 LDAP_END_DECL
285
286 #endif /* _PROTO_BDB_H */