2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 1998-2005 The OpenLDAP Foundation.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted only as authorized by the OpenLDAP
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>.
16 #ifndef _PROTO_BACK_LDBM
17 #define _PROTO_BACK_LDBM
19 #include <ldap_cdefs.h>
26 Entry *deref_internal_r LDAP_P((
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)
43 void attr_mask LDAP_P(( struct ldbminfo *li,
44 AttributeDescription *desc,
45 slap_mask_t *indexmask ));
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 ));
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 ));
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 ));
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 ));
81 #define ldbm_cache_fetch( db, key ) ldbm_fetch( (db)->dbc_db, (key) )
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 *));
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 ));
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)
103 BI_entry_release_rw ldbm_back_entry_release_rw;
104 BI_entry_get_rw ldbm_back_entry_get;
110 ID_BLOCK * filter_candidates LDAP_P(( Operation *op, Filter *f ));
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 ));
124 int id2entry_add LDAP_P(( Backend *be, Entry *e ));
125 int id2entry_delete LDAP_P(( Backend *be, Entry *e ));
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)
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 ));
152 index_is_indexed LDAP_P((
154 AttributeDescription *desc ));
159 AttributeDescription *desc,
163 struct berval *prefix ));
166 index_values LDAP_P((
168 AttributeDescription *desc,
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))
197 * These prototypes are placed here because they are used by modify and
198 * modify rdn which are implemented in different files.
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
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 ));
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 ));
224 extern BI_init ldbm_back_initialize;
226 extern BI_open ldbm_back_open;
227 extern BI_close ldbm_back_close;
228 extern BI_destroy ldbm_back_destroy;
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;
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;
245 extern BI_operational ldbm_back_operational;
246 extern BI_has_subordinates ldbm_back_hasSubordinates;
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;
256 extern BI_tool_entry_reindex ldbm_tool_entry_reindex;
257 extern BI_tool_sync ldbm_tool_sync;
259 extern BI_chk_referrals ldbm_back_referrals;
263 #endif /* _PROTO_BACK_LDBM */