]> git.sur5r.net Git - openldap/blob - servers/slapd/back-ldbm/proto-back-ldbm.h
cleanup
[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-2004 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 #include "external.h"
22
23 LDAP_BEGIN_DECL
24
25 /*
26  * alias.c
27  */
28 Entry *deref_internal_r LDAP_P((
29         Backend *be,
30         Entry *e,
31         struct berval *dn,
32         int *err,
33         Entry **matched,
34         const char **text ));
35
36 #define deref_entry_r( be, e, err, matched, text ) \
37         deref_internal_r( be, e, NULL, err, matched, text )
38 #define deref_dn_r( be, dn, err, matched, text ) \
39         deref_internal_r( be, NULL, dn, err, matched, text)
40
41 /*
42  * attr.c
43  */
44
45 void attr_mask LDAP_P(( struct ldbminfo *li,
46         AttributeDescription *desc,
47         slap_mask_t *indexmask ));
48
49 int attr_index_config LDAP_P(( struct ldbminfo *li,
50         const char *fname, int lineno,
51         int argc, char **argv ));
52 void attr_index_destroy LDAP_P(( Avlnode *tree ));
53
54 /*
55  * cache.c
56  */
57
58 int cache_add_entry_rw LDAP_P(( Cache *cache, Entry *e, int rw ));
59 int cache_update_entry LDAP_P(( Cache *cache, Entry *e ));
60 void cache_return_entry_rw LDAP_P(( Cache *cache, Entry *e, int rw ));
61 #define cache_return_entry_r(c, e) cache_return_entry_rw((c), (e), 0)
62 #define cache_return_entry_w(c, e) cache_return_entry_rw((c), (e), 1)
63 void cache_entry_commit LDAP_P(( Entry *e ));
64
65 ID cache_find_entry_ndn2id LDAP_P(( Backend *be, Cache *cache, struct berval *ndn ));
66 Entry * cache_find_entry_id LDAP_P(( Cache *cache, ID id, int rw ));
67 int cache_delete_entry LDAP_P(( Cache *cache, Entry *e ));
68 void cache_release_all LDAP_P(( Cache *cache ));
69
70 /*
71  * dbcache.c
72  */
73
74 DBCache * ldbm_cache_open LDAP_P(( Backend *be,
75         const char *name, const char *suffix, int flags ));
76 void ldbm_cache_close LDAP_P(( Backend *be, DBCache *db ));
77 void ldbm_cache_really_close LDAP_P(( Backend *be, DBCache *db ));
78 void ldbm_cache_flush_all LDAP_P(( Backend *be ));
79 void ldbm_cache_sync LDAP_P(( Backend *be ));
80 #if 0 /* replaced by macro */
81 Datum ldbm_cache_fetch LDAP_P(( DBCache *db, Datum key ));
82 #else /* 1 */
83 #define ldbm_cache_fetch( db, key )     ldbm_fetch( (db)->dbc_db, (key) )
84 #endif /* 1 */
85 int ldbm_cache_store LDAP_P(( DBCache *db, Datum key, Datum data, int flags ));
86 int ldbm_cache_delete LDAP_P(( DBCache *db, Datum key ));
87 void *ldbm_cache_sync_daemon LDAP_P(( void *));
88
89 /*
90  * dn2id.c
91  */
92
93 int dn2id_add LDAP_P(( Backend *be, struct berval *dn, ID id ));
94 int dn2id LDAP_P(( Backend *be, struct berval *dn, ID *idp ));
95 int dn2idl LDAP_P(( Backend *be, struct berval *dn, int prefix, ID_BLOCK **idlp ));
96 int dn2id_delete LDAP_P(( Backend *be, struct berval *dn, ID id ));
97
98 Entry * dn2entry_rw LDAP_P(( Backend *be, struct berval *dn, Entry **matched, int rw ));
99 #define dn2entry_r(be, dn, m) dn2entry_rw((be), (dn), (m), 0)
100 #define dn2entry_w(be, dn, m) dn2entry_rw((be), (dn), (m), 1)
101
102 /*
103  * entry.c
104  */
105 BI_entry_release_rw ldbm_back_entry_release_rw;
106 BI_entry_get_rw ldbm_back_entry_get;
107
108 /*
109  * filterindex.c
110  */
111
112 ID_BLOCK * filter_candidates LDAP_P(( Operation *op, Filter *f ));
113
114 /*
115  * id2children.c
116  */
117
118 int id2children_add LDAP_P(( Backend *be, Entry *p, Entry *e ));
119 int id2children_remove LDAP_P(( Backend *be, Entry *p, Entry *e ));
120 int has_children LDAP_P(( Backend *be, Entry *p ));
121
122 /*
123  * id2entry.c
124  */
125
126 int id2entry_add LDAP_P(( Backend *be, Entry *e ));
127 int id2entry_delete LDAP_P(( Backend *be, Entry *e ));
128
129 Entry * id2entry_rw LDAP_P(( Backend *be, ID id, int rw )); 
130 #define id2entry_r(be, id)      id2entry_rw((be), (id), 0)
131 #define id2entry_w(be, id)      id2entry_rw((be), (id), 1)
132
133 /*
134  * idl.c
135  */
136
137 ID_BLOCK * idl_alloc LDAP_P(( unsigned int nids ));
138 ID_BLOCK * idl_allids LDAP_P(( Backend *be ));
139 void idl_free LDAP_P(( ID_BLOCK *idl ));
140 ID_BLOCK * idl_fetch LDAP_P(( Backend *be, DBCache *db, Datum key ));
141 int idl_insert_key LDAP_P(( Backend *be, DBCache *db, Datum key, ID id ));
142 int idl_insert LDAP_P(( ID_BLOCK **idl, ID id, unsigned int maxids ));
143 int idl_delete_key LDAP_P(( Backend *be, DBCache *db, Datum key, ID id ));
144 ID_BLOCK * idl_intersection LDAP_P(( Backend *be, ID_BLOCK *a, ID_BLOCK *b ));
145 ID_BLOCK * idl_union LDAP_P(( Backend *be, ID_BLOCK *a, ID_BLOCK *b ));
146 ID_BLOCK * idl_notin LDAP_P(( Backend *be, ID_BLOCK *a, ID_BLOCK *b ));
147 ID idl_firstid LDAP_P(( ID_BLOCK *idl, ID *cursor ));
148 ID idl_nextid LDAP_P(( ID_BLOCK *idl, ID *cursor ));
149
150 /*
151  * index.c
152  */
153 extern int
154 index_is_indexed LDAP_P((
155         Backend *be,
156         AttributeDescription *desc ));
157
158 extern int
159 index_param LDAP_P((
160         Backend *be,
161         AttributeDescription *desc,
162         int ftype,
163         char **dbname,
164         slap_mask_t *mask,
165         struct berval *prefix ));
166
167 extern int
168 index_values LDAP_P((
169         Operation *op,
170         AttributeDescription *desc,
171         BerVarray vals,
172         ID id,
173         int opid ));
174
175 int index_entry LDAP_P(( Operation *op, int r, Entry *e ));
176 #define index_entry_add(be,e) index_entry((be),SLAP_INDEX_ADD_OP,(e))
177 #define index_entry_del(be,e) index_entry((be),SLAP_INDEX_DELETE_OP,(e))
178
179
180 /*
181  * key.c
182  */
183 extern int
184 key_change LDAP_P((
185     Backend             *be,
186     DBCache     *db,
187     struct berval *k,
188     ID                  id,
189     int                 op ));
190 extern int
191 key_read LDAP_P((
192     Backend     *be,
193         DBCache *db,
194     struct berval *k,
195         ID_BLOCK **idout ));
196
197 /*
198  * modify.c
199  * These prototypes are placed here because they are used by modify and
200  * modify rdn which are implemented in different files. 
201  *
202  * We need ldbm_internal_modify here because of LDAP modrdn & modify use 
203  * it. If we do not add this, there would be a bunch of code replication 
204  * here and there and of course the likelihood of bugs increases.
205  * Juan C. Gomez (gomez@engr.sgi.com) 05/18/99
206  * 
207  */
208
209 /* returns LDAP error code indicating error OR SLAPD_ABANDON */
210 int ldbm_modify_internal LDAP_P(( Operation *op,
211         Modifications *mods, Entry *e,
212         const char **text, char *textbuf, size_t textlen ));
213
214 /*
215  * nextid.c
216  */
217
218 int next_id LDAP_P(( Backend *be, ID *idp ));
219 int next_id_get LDAP_P(( Backend *be, ID *idp ));
220 int next_id_write LDAP_P(( Backend *be, ID id ));
221
222 LDAP_END_DECL
223 #endif