]> git.sur5r.net Git - openldap/blob - servers/slapd/back-ldbm/proto-back-ldbm.h
c170b2a91fd1d0fe7083b03a85e01dfdf62b6388
[openldap] / servers / slapd / back-ldbm / proto-back-ldbm.h
1 /* $OpenLDAP$ */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3  *
4  * Copyright 1998-2007 The OpenLDAP Foundation.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted only as authorized by the OpenLDAP
9  * Public License.
10  *
11  * A copy of this license is available in the file LICENSE in the
12  * top-level directory of the distribution or, alternatively, at
13  * <http://www.OpenLDAP.org/license.html>.
14  */
15
16 #ifndef _PROTO_BACK_LDBM
17 #define _PROTO_BACK_LDBM
18
19 #include <ldap_cdefs.h>
20
21 LDAP_BEGIN_DECL
22
23 /*
24  * alias.c
25  */
26 Entry *deref_internal_r LDAP_P((
27         Backend *be,
28         Entry *e,
29         struct berval *dn,
30         int *err,
31         Entry **matched,
32         const char **text ));
33
34 #define deref_entry_r( be, e, err, matched, text ) \
35         deref_internal_r( be, e, NULL, err, matched, text )
36 #define deref_dn_r( be, dn, err, matched, text ) \
37         deref_internal_r( be, NULL, dn, err, matched, text)
38
39 /*
40  * attr.c
41  */
42
43 void attr_mask LDAP_P(( struct ldbminfo *li,
44         AttributeDescription *desc,
45         slap_mask_t *indexmask ));
46
47 int attr_index_config LDAP_P(( struct ldbminfo *li,
48         const char *fname, int lineno,
49         int argc, char **argv ));
50 void attr_index_destroy LDAP_P(( Avlnode *tree ));
51
52 /*
53  * cache.c
54  */
55
56 int cache_add_entry_rw LDAP_P(( Cache *cache, Entry *e, int rw ));
57 int cache_update_entry LDAP_P(( Cache *cache, Entry *e ));
58 void cache_return_entry_rw LDAP_P(( Cache *cache, Entry *e, int rw ));
59 #define cache_return_entry_r(c, e) cache_return_entry_rw((c), (e), 0)
60 #define cache_return_entry_w(c, e) cache_return_entry_rw((c), (e), 1)
61 void cache_entry_commit LDAP_P(( Entry *e ));
62
63 ID cache_find_entry_ndn2id LDAP_P(( Backend *be, Cache *cache, struct berval *ndn ));
64 Entry * cache_find_entry_id LDAP_P(( Cache *cache, ID id, int rw ));
65 int cache_delete_entry LDAP_P(( Cache *cache, Entry *e ));
66 void cache_release_all LDAP_P(( Cache *cache ));
67
68 /*
69  * dbcache.c
70  */
71
72 DBCache * ldbm_cache_open LDAP_P(( Backend *be,
73         const char *name, const char *suffix, int flags ));
74 void ldbm_cache_close LDAP_P(( Backend *be, DBCache *db ));
75 void ldbm_cache_really_close LDAP_P(( Backend *be, DBCache *db ));
76 void ldbm_cache_flush_all LDAP_P(( Backend *be ));
77 void ldbm_cache_sync LDAP_P(( Backend *be ));
78 #if 0 /* replaced by macro */
79 Datum ldbm_cache_fetch LDAP_P(( DBCache *db, Datum key ));
80 #else /* 1 */
81 #define ldbm_cache_fetch( db, key )     ldbm_fetch( (db)->dbc_db, (key) )
82 #endif /* 1 */
83 int ldbm_cache_store LDAP_P(( DBCache *db, Datum key, Datum data, int flags ));
84 int ldbm_cache_delete LDAP_P(( DBCache *db, Datum key ));
85 void *ldbm_cache_sync_daemon LDAP_P(( void *ctx, void *arg ));
86
87 /*
88  * dn2id.c
89  */
90
91 int dn2id_add LDAP_P(( Backend *be, struct berval *dn, ID id ));
92 int dn2id LDAP_P(( Backend *be, struct berval *dn, ID *idp ));
93 int dn2idl LDAP_P(( Backend *be, struct berval *dn, int prefix, ID_BLOCK **idlp ));
94 int dn2id_delete LDAP_P(( Backend *be, struct berval *dn, ID id ));
95
96 Entry * dn2entry_rw LDAP_P(( Backend *be, struct berval *dn, Entry **matched, int rw ));
97 #define dn2entry_r(be, dn, m) dn2entry_rw((be), (dn), (m), 0)
98 #define dn2entry_w(be, dn, m) dn2entry_rw((be), (dn), (m), 1)
99
100 /*
101  * entry.c
102  */
103 BI_entry_release_rw ldbm_back_entry_release_rw;
104 BI_entry_get_rw ldbm_back_entry_get;
105
106 /*
107  * filterindex.c
108  */
109
110 ID_BLOCK * filter_candidates LDAP_P(( Operation *op, Filter *f ));
111
112 /*
113  * id2children.c
114  */
115
116 int id2children_add LDAP_P(( Backend *be, Entry *p, Entry *e ));
117 int id2children_remove LDAP_P(( Backend *be, Entry *p, Entry *e ));
118 int has_children LDAP_P(( Backend *be, Entry *p ));
119
120 /*
121  * id2entry.c
122  */
123
124 int id2entry_add LDAP_P(( Backend *be, Entry *e ));
125 int id2entry_delete LDAP_P(( Backend *be, Entry *e ));
126
127 Entry * id2entry_rw LDAP_P(( Backend *be, ID id, int rw )); 
128 #define id2entry_r(be, id)      id2entry_rw((be), (id), 0)
129 #define id2entry_w(be, id)      id2entry_rw((be), (id), 1)
130
131 /*
132  * idl.c
133  */
134
135 ID_BLOCK * idl_alloc LDAP_P(( unsigned int nids ));
136 ID_BLOCK * idl_allids LDAP_P(( Backend *be ));
137 void idl_free LDAP_P(( ID_BLOCK *idl ));
138 ID_BLOCK * idl_fetch LDAP_P(( Backend *be, DBCache *db, Datum key ));
139 int idl_insert_key LDAP_P(( Backend *be, DBCache *db, Datum key, ID id ));
140 int idl_insert LDAP_P(( ID_BLOCK **idl, ID id, unsigned int maxids ));
141 int idl_delete_key LDAP_P(( Backend *be, DBCache *db, Datum key, ID id ));
142 ID_BLOCK * idl_intersection LDAP_P(( Backend *be, ID_BLOCK *a, ID_BLOCK *b ));
143 ID_BLOCK * idl_union LDAP_P(( Backend *be, ID_BLOCK *a, ID_BLOCK *b ));
144 ID_BLOCK * idl_notin LDAP_P(( Backend *be, ID_BLOCK *a, ID_BLOCK *b ));
145 ID idl_firstid LDAP_P(( ID_BLOCK *idl, ID *cursor ));
146 ID idl_nextid LDAP_P(( ID_BLOCK *idl, ID *cursor ));
147
148 /*
149  * index.c
150  */
151 extern int
152 index_is_indexed LDAP_P((
153         Backend *be,
154         AttributeDescription *desc ));
155
156 extern int
157 index_param LDAP_P((
158         Backend *be,
159         AttributeDescription *desc,
160         int ftype,
161         char **dbname,
162         slap_mask_t *mask,
163         struct berval *prefix ));
164
165 extern int
166 index_values LDAP_P((
167         Operation *op,
168         AttributeDescription *desc,
169         BerVarray vals,
170         ID id,
171         int opid ));
172
173 int index_entry LDAP_P(( Operation *op, int r, Entry *e ));
174 #define index_entry_add(be,e) index_entry((be),SLAP_INDEX_ADD_OP,(e))
175 #define index_entry_del(be,e) index_entry((be),SLAP_INDEX_DELETE_OP,(e))
176
177
178 /*
179  * key.c
180  */
181 extern int
182 key_change LDAP_P((
183     Backend             *be,
184     DBCache     *db,
185     struct berval *k,
186     ID                  id,
187     int                 op ));
188 extern int
189 key_read LDAP_P((
190     Backend     *be,
191         DBCache *db,
192     struct berval *k,
193         ID_BLOCK **idout ));
194
195 /*
196  * modify.c
197  * These prototypes are placed here because they are used by modify and
198  * modify rdn which are implemented in different files. 
199  *
200  * We need ldbm_internal_modify here because of LDAP modrdn & modify use 
201  * it. If we do not add this, there would be a bunch of code replication 
202  * here and there and of course the likelihood of bugs increases.
203  * Juan C. Gomez (gomez@engr.sgi.com) 05/18/99
204  * 
205  */
206
207 /* returns LDAP error code indicating error OR SLAPD_ABANDON */
208 int ldbm_modify_internal LDAP_P(( Operation *op,
209         Modifications *mods, Entry *e,
210         const char **text, char *textbuf, size_t textlen ));
211
212 /*
213  * nextid.c
214  */
215
216 int next_id LDAP_P(( Backend *be, ID *idp ));
217 int next_id_get LDAP_P(( Backend *be, ID *idp ));
218 int next_id_write LDAP_P(( Backend *be, ID id ));
219
220 /*
221  * former external.h
222  */
223
224 extern BI_init                  ldbm_back_initialize;
225
226 extern BI_open                  ldbm_back_open;
227 extern BI_close                 ldbm_back_close;
228 extern BI_destroy               ldbm_back_destroy;
229
230 extern BI_db_init               ldbm_back_db_init;
231 extern BI_db_open               ldbm_back_db_open;
232 extern BI_db_close              ldbm_back_db_close;
233 extern BI_db_destroy            ldbm_back_db_destroy;
234 extern BI_db_config             ldbm_back_db_config;
235
236 extern BI_op_extended           ldbm_back_extended;
237 extern BI_op_bind               ldbm_back_bind;
238 extern BI_op_search             ldbm_back_search;
239 extern BI_op_compare            ldbm_back_compare;
240 extern BI_op_modify             ldbm_back_modify;
241 extern BI_op_modrdn             ldbm_back_modrdn;
242 extern BI_op_add                ldbm_back_add;
243 extern BI_op_delete             ldbm_back_delete;
244
245 extern BI_operational           ldbm_back_operational;
246 extern BI_has_subordinates      ldbm_back_hasSubordinates;
247
248 /* hooks for slap tools */
249 extern BI_tool_entry_open       ldbm_tool_entry_open;
250 extern BI_tool_entry_close      ldbm_tool_entry_close;
251 extern BI_tool_entry_first      ldbm_tool_entry_first;
252 extern BI_tool_entry_next       ldbm_tool_entry_next;
253 extern BI_tool_entry_get        ldbm_tool_entry_get;
254 extern BI_tool_entry_put        ldbm_tool_entry_put;
255
256 extern BI_tool_entry_reindex    ldbm_tool_entry_reindex;
257 extern BI_tool_sync             ldbm_tool_sync;
258
259 extern BI_chk_referrals         ldbm_back_referrals;
260
261 LDAP_END_DECL
262
263 #endif /* _PROTO_BACK_LDBM */