]> git.sur5r.net Git - openldap/blob - servers/slapd/back-ldbm/proto-back-ldbm.h
New indexer/filter codes (test suite works) with cheats
[openldap] / servers / slapd / back-ldbm / proto-back-ldbm.h
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
4  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5  */
6
7 #ifndef _PROTO_BACK_LDBM
8 #define _PROTO_BACK_LDBM
9
10 #include <ldap_cdefs.h>
11
12 #include "external.h"
13
14 LDAP_BEGIN_DECL
15
16 /*
17  * alias.c
18  */
19 Entry *deref_internal_r LDAP_P((
20         Backend *be,
21         Entry *e,
22         const char *dn,
23         int *err,
24         Entry **matched,
25         const char **text ));
26
27 #define deref_entry_r( be, e, err, matched, text ) \
28         deref_internal_r( be, e, NULL, err, matched, text )
29 #define deref_dn_r( be, dn, err, matched, text ) \
30         deref_internal_r( be, NULL, dn, err, matched, text)
31
32 /*
33  * attr.c
34  */
35
36 void attr_mask LDAP_P(( struct ldbminfo *li,
37         const char *desc,
38         slap_index *indexmask ));
39
40 int attr_index_config LDAP_P(( struct ldbminfo *li,
41         const char *fname, int lineno,
42         int argc, char **argv, int init ));
43 void attr_index_destroy LDAP_P(( Avlnode *tree ));
44
45 /*
46  * cache.c
47  */
48
49 int cache_add_entry_rw LDAP_P(( Cache *cache, Entry *e, int rw ));
50 int cache_update_entry LDAP_P(( Cache *cache, Entry *e ));
51 void cache_return_entry_rw LDAP_P(( Cache *cache, Entry *e, int rw ));
52 #define cache_return_entry_r(c, e) cache_return_entry_rw((c), (e), 0)
53 #define cache_return_entry_w(c, e) cache_return_entry_rw((c), (e), 1)
54
55 ID cache_find_entry_dn2id LDAP_P(( Backend *be, Cache *cache, const char *dn ));
56 Entry * cache_find_entry_id LDAP_P(( Cache *cache, ID id, int rw ));
57 int cache_delete_entry LDAP_P(( Cache *cache, Entry *e ));
58 void cache_release_all LDAP_P(( Cache *cache ));
59
60 /*
61  * dbcache.c
62  */
63
64 DBCache * ldbm_cache_open LDAP_P(( Backend *be,
65         const char *name, const char *suffix, int flags ));
66 void ldbm_cache_close LDAP_P(( Backend *be, DBCache *db ));
67 void ldbm_cache_really_close LDAP_P(( Backend *be, DBCache *db ));
68 void ldbm_cache_flush_all LDAP_P(( Backend *be ));
69 Datum ldbm_cache_fetch LDAP_P(( DBCache *db, Datum key ));
70 int ldbm_cache_store LDAP_P(( DBCache *db, Datum key, Datum data, int flags ));
71 int ldbm_cache_delete LDAP_P(( DBCache *db, Datum key ));
72
73 /*
74  * dn2id.c
75  */
76
77 int dn2id_add LDAP_P(( Backend *be, const char *dn, ID id ));
78 ID dn2id LDAP_P(( Backend *be, const char *dn ));
79 ID_BLOCK *dn2idl LDAP_P(( Backend *be, const char *dn, int prefix ));
80 int dn2id_delete LDAP_P(( Backend *be, const char *dn, ID id ));
81
82 Entry * dn2entry_rw LDAP_P(( Backend *be, const char *dn, Entry **matched, int rw ));
83 #define dn2entry_r(be, dn, m) dn2entry_rw((be), (dn), (m), 0)
84 #define dn2entry_w(be, dn, m) dn2entry_rw((be), (dn), (m), 1)
85
86 /*
87  * entry.c
88  */
89 int ldbm_back_entry_release_rw LDAP_P(( Backend *be, Entry *e, int rw ));
90
91 /*
92  * filterindex.c
93  */
94
95 ID_BLOCK * filter_candidates LDAP_P(( Backend *be, Filter *f ));
96
97 /*
98  * id2children.c
99  */
100
101 int id2children_add LDAP_P(( Backend *be, Entry *p, Entry *e ));
102 int id2children_remove LDAP_P(( Backend *be, Entry *p, Entry *e ));
103 int has_children LDAP_P(( Backend *be, Entry *p ));
104
105 /*
106  * id2entry.c
107  */
108
109 int id2entry_add LDAP_P(( Backend *be, Entry *e ));
110 int id2entry_delete LDAP_P(( Backend *be, Entry *e ));
111
112 Entry * id2entry_rw LDAP_P(( Backend *be, ID id, int rw )); 
113 #define id2entry_r(be, id)      id2entry_rw((be), (id), 0)
114 #define id2entry_w(be, id)      id2entry_rw((be), (id), 1)
115
116 /*
117  * idl.c
118  */
119
120 ID_BLOCK * idl_alloc LDAP_P(( unsigned int nids ));
121 ID_BLOCK * idl_allids LDAP_P(( Backend *be ));
122 void idl_free LDAP_P(( ID_BLOCK *idl ));
123 ID_BLOCK * idl_fetch LDAP_P(( Backend *be, DBCache *db, Datum key ));
124 int idl_insert_key LDAP_P(( Backend *be, DBCache *db, Datum key, ID id ));
125 int idl_insert LDAP_P(( ID_BLOCK **idl, ID id, unsigned int maxids ));
126 int idl_delete_key LDAP_P(( Backend *be, DBCache *db, Datum key, ID id ));
127 ID_BLOCK * idl_intersection LDAP_P(( Backend *be, ID_BLOCK *a, ID_BLOCK *b ));
128 ID_BLOCK * idl_union LDAP_P(( Backend *be, ID_BLOCK *a, ID_BLOCK *b ));
129 ID_BLOCK * idl_notin LDAP_P(( Backend *be, ID_BLOCK *a, ID_BLOCK *b ));
130 ID idl_firstid LDAP_P(( ID_BLOCK *idl, ID *cursor ));
131 ID idl_nextid LDAP_P(( ID_BLOCK *idl, ID *cursor ));
132
133 /*
134  * index.c
135  */
136 #ifdef SLAPD_SCHEMA_NOT_COMPAT
137 extern int
138 index_param LDAP_P((
139         Backend *be,
140         AttributeDescription *desc,
141         int ftype,
142         char **dbname,
143         slap_index *mask,
144         struct berval **prefix ));
145
146 extern int
147 index_values LDAP_P((
148         Backend *be,
149         AttributeDescription *desc,
150         struct berval **vals,
151         ID id,
152         int op ));
153 #endif
154
155 int index_entry LDAP_P(( Backend *be, int r, Entry *e, Attribute *ap ));
156 #define index_entry_add(be,e,ap) index_entry((be),SLAP_INDEX_ADD_OP,(e),(ap))
157 #define index_entry_del(be,e,ap) index_entry((be),SLAP_INDEX_DELETE_OP,(e),(ap))
158
159 #ifndef SLAPD_SCHEMA_NOT_COMPAT
160 int index_change_values LDAP_P((
161     Backend             *be,
162     char                *desc,
163     struct berval       **vals,
164     ID                  id,
165     unsigned int        op
166 ));
167 ID_BLOCK * index_read LDAP_P(( Backend *be,
168         char *desc, int indextype, char *val ));
169 #endif
170
171 /*
172  * key.c
173  */
174 extern int
175 key_change LDAP_P((
176     Backend             *be,
177     DBCache     *db,
178     struct berval *k,
179     ID                  id,
180     int                 op ));
181 extern int
182 key_read LDAP_P((
183     Backend     *be,
184         DBCache *db,
185     struct berval *k,
186         ID_BLOCK **idout ));
187
188 /*
189  * passwd.c
190  */
191 extern int ldbm_back_exop_passwd LDAP_P(( BackendDB *bd,
192         Connection *conn, Operation *op,
193         const char *reqoid,
194         struct berval *reqdata,
195         char **rspoid,
196         struct berval **rspdata,
197         LDAPControl ***rspctrls,
198         const char **text,
199         struct berval *** refs ));
200  
201
202 /*
203  * modify.c
204  * These prototypes are placed here because they are used by modify and
205  * modify rdn which are implemented in different files. 
206  *
207  * We need ldbm_internal_modify here because of LDAP modrdn & modify use 
208  * it. If we do not add this, there would be a bunch of code replication 
209  * here and there and of course the likelihood of bugs increases.
210  * Juan C. Gomez (gomez@engr.sgi.com) 05/18/99
211  * 
212  */
213
214 /* returns LDAP error code indicating error OR SLAPD_ABANDON */
215 int ldbm_modify_internal LDAP_P((Backend *be,
216         Connection *conn, Operation *op,
217         const char *dn, Modifications *mods, Entry *e,
218         const char ** ));
219
220 #ifdef HAVE_CYRUS_SASL
221 /*
222  * sasl.c
223  */
224 int ldbm_sasl_authorize LDAP_P((
225         BackendDB *be,
226         const char *auth_identity,
227         const char *requested_user,
228         const char **user,
229         const char **errstring ));
230 int ldbm_sasl_getsecret LDAP_P((
231         Backend *be,
232         const char *mechanism,
233         const char *auth_identity,
234         const char *realm,
235         sasl_secret_t **secret ));
236 int ldbm_sasl_putsecret LDAP_P((
237         Backend *be,
238         const char *mechanism,
239         const char *auth_identity,
240         const char *realm,
241         const sasl_secret_t *secret ));
242 #endif /* HAVE_CYRUS_SASL */
243
244 /*
245  * nextid.c
246  */
247
248 ID next_id LDAP_P(( Backend *be ));
249 ID next_id_get LDAP_P(( Backend *be ));
250 ID next_id_write LDAP_P(( Backend *be, ID id ));
251
252 LDAP_END_DECL
253 #endif