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