]> git.sur5r.net Git - openldap/blob - servers/slapd/proto-slap.h
Sync with HEAD (need to update CHANGES)
[openldap] / servers / slapd / proto-slap.h
1 /* $OpenLDAP$ */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3  *
4  * Copyright 1998-2005 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 /* Portions Copyright (c) 1995 Regents of the University of Michigan.
16  * All rights reserved.
17  *
18  * Redistribution and use in source and binary forms are permitted
19  * provided that this notice is preserved and that due credit is given
20  * to the University of Michigan at Ann Arbor. The name of the University
21  * may not be used to endorse or promote products derived from this
22  * software without specific prior written permission. This software
23  * is provided ``as is'' without express or implied warranty.
24  */
25
26 #ifndef PROTO_SLAP_H
27 #define PROTO_SLAP_H
28
29 #include <ldap_cdefs.h>
30 #include "ldap_pvt.h"
31
32 LDAP_BEGIN_DECL
33
34 /*
35  * aci.c
36  */
37 #ifdef SLAPD_ACI_ENABLED
38 LDAP_SLAPD_F (int) aci_mask LDAP_P((
39         Operation *op, Entry *e,
40         AttributeDescription *desc,
41         struct berval *val,
42         struct berval *aci,
43         int nmatch,
44         regmatch_t *matches,
45         slap_access_t *grant,
46         slap_access_t *deny,
47         slap_aci_scope_t scope));
48 #ifdef SLAP_DYNACL
49 LDAP_SLAPD_F (int) dynacl_aci_init LDAP_P(( void ));
50 #else /* !SLAP_DYNACL */
51 LDAP_SLAPD_F (int) aci_init LDAP_P(( void ));
52 LDAP_SLAPD_V (AttributeDescription *) slap_ad_aci;
53 #endif /* !SLAP_DYNACL */
54 #endif /* SLAPD_ACI_ENABLED */
55
56 /*
57  * acl.c
58  */
59 LDAP_SLAPD_F (int) access_allowed_mask LDAP_P((
60         Operation *op,
61         Entry *e, AttributeDescription *desc, struct berval *val,
62         slap_access_t access,
63         AccessControlState *state,
64         slap_mask_t *mask ));
65 #define access_allowed(op,e,desc,val,access,state) access_allowed_mask(op,e,desc,val,access,state,NULL)
66 #ifdef SLAP_OVERLAY_ACCESS
67 LDAP_SLAPD_F (int) slap_access_allowed LDAP_P((
68         Operation               *op,
69         Entry                   *e,
70         AttributeDescription    *desc,
71         struct berval           *val,
72         slap_access_t           access,
73         AccessControlState      *state,
74         slap_mask_t             *maskp ));
75 LDAP_SLAPD_F (int) slap_access_always_allowed LDAP_P((
76         Operation               *op,
77         Entry                   *e,
78         AttributeDescription    *desc,
79         struct berval           *val,
80         slap_access_t           access,
81         AccessControlState      *state,
82         slap_mask_t             *maskp ));
83 #endif /* SLAP_OVERLAY_ACCESS */
84
85 LDAP_SLAPD_F (int) acl_check_modlist LDAP_P((
86         Operation *op, Entry *e, Modifications *ml ));
87
88 LDAP_SLAPD_F (void) acl_append( AccessControl **l, AccessControl *a, int pos );
89
90 #ifdef SLAP_DYNACL
91 LDAP_SLAPD_F (int) slap_dynacl_register LDAP_P(( slap_dynacl_t *da ));
92 LDAP_SLAPD_F (slap_dynacl_t *) slap_dynacl_get LDAP_P(( const char *name ));
93 #endif /* SLAP_DYNACL */
94 LDAP_SLAPD_F (int) acl_init LDAP_P(( void ));
95
96 LDAP_SLAPD_V (const struct berval) aci_bv[];
97
98 LDAP_SLAPD_F (int) acl_get_part LDAP_P((
99         struct berval   *list,
100         int             ix,
101         char            sep,
102         struct berval   *bv ));
103 LDAP_SLAPD_F (int) acl_match_set LDAP_P((
104         struct berval *subj,
105         Operation *op,
106         Entry *e,
107         int setref ));
108 LDAP_SLAPD_F (int) acl_string_expand LDAP_P((
109         struct berval *newbuf, struct berval *pattern,
110         char *match, int nmatch, regmatch_t *matches ));
111
112 /*
113  * aclparse.c
114  */
115 LDAP_SLAPD_V (char *) style_strings[];
116
117 LDAP_SLAPD_F (void) parse_acl LDAP_P(( Backend *be,
118         const char *fname, int lineno,
119         int argc, char **argv, int pos ));
120
121 LDAP_SLAPD_F (char *) access2str LDAP_P(( slap_access_t access ));
122 LDAP_SLAPD_F (slap_access_t) str2access LDAP_P(( const char *str ));
123
124 #define ACCESSMASK_MAXLEN       sizeof("unknown (+wrscan)")
125 LDAP_SLAPD_F (char *) accessmask2str LDAP_P(( slap_mask_t mask, char*, int debug ));
126 LDAP_SLAPD_F (slap_mask_t) str2accessmask LDAP_P(( const char *str ));
127 LDAP_SLAPD_F (void) acl_unparse LDAP_P(( AccessControl*, struct berval* ));
128 LDAP_SLAPD_F (void) acl_destroy LDAP_P(( AccessControl*, AccessControl* ));
129 LDAP_SLAPD_F (void) acl_free LDAP_P(( AccessControl *a ));
130
131
132 /*
133  * ad.c
134  */
135 LDAP_SLAPD_F (int) slap_str2ad LDAP_P((
136         const char *,
137         AttributeDescription **ad,
138         const char **text ));
139
140 LDAP_SLAPD_F (int) slap_bv2ad LDAP_P((
141         struct berval *bv,
142         AttributeDescription **ad,
143         const char **text ));
144
145 LDAP_SLAPD_F (void) ad_destroy LDAP_P(( AttributeDescription * ));
146
147 #define ad_cmp(l,r)     (((l)->ad_cname.bv_len < (r)->ad_cname.bv_len) \
148         ? -1 : (((l)->ad_cname.bv_len > (r)->ad_cname.bv_len) \
149                 ? 1 : strcasecmp((l)->ad_cname.bv_val, (r)->ad_cname.bv_val )))
150
151 LDAP_SLAPD_F (int) is_ad_subtype LDAP_P((
152         AttributeDescription *sub,
153         AttributeDescription *super ));
154
155 LDAP_SLAPD_F (int) ad_inlist LDAP_P((
156         AttributeDescription *desc,
157         AttributeName *attrs ));
158
159 LDAP_SLAPD_F (int) slap_str2undef_ad LDAP_P((
160         const char *,
161         AttributeDescription **ad,
162         const char **text ));
163
164 LDAP_SLAPD_F (int) slap_bv2undef_ad LDAP_P((
165         struct berval *bv,
166         AttributeDescription **ad,
167         const char **text ));
168
169 LDAP_SLAPD_F (AttributeDescription *) ad_find_tags LDAP_P((
170         AttributeType *type,
171         struct berval *tags ));
172
173 LDAP_SLAPD_F (AttributeName *) str2anlist LDAP_P(( AttributeName *an,
174         char *str, const char *brkstr ));
175 LDAP_SLAPD_F (char **) anlist2charray_x LDAP_P((
176                                                                         AttributeName *an, int dup, void *ctx ));
177 LDAP_SLAPD_F (char **) anlist2charray LDAP_P(( AttributeName *an, int dup ));
178 LDAP_SLAPD_F (char **) anlist2attrs LDAP_P(( AttributeName *anlist ));
179 LDAP_SLAPD_F (AttributeName *) file2anlist LDAP_P((
180                         AttributeName *, const char *, const char * ));
181 LDAP_SLAPD_F (int) an_find LDAP_P(( AttributeName *a, struct berval *s ));
182 LDAP_SLAPD_F (int) ad_define_option LDAP_P(( const char *name,
183         const char *fname, int lineno ));
184
185 LDAP_SLAPD_F (MatchingRule *) ad_mr(
186         AttributeDescription *ad,
187         unsigned usage );
188
189 LDAP_SLAPD_V( AttributeName * ) slap_anlist_no_attrs;
190 LDAP_SLAPD_V( AttributeName * ) slap_anlist_all_user_attributes;
191 LDAP_SLAPD_V( AttributeName * ) slap_anlist_all_operational_attributes;
192 LDAP_SLAPD_V( AttributeName * ) slap_anlist_all_attributes;
193
194 /*
195  * add.c
196  */
197 LDAP_SLAPD_F (int) slap_mods2entry LDAP_P(( Modifications *mods, Entry **e,
198         int initial, int dup, const char **text, char *textbuf, size_t textlen ));
199
200 LDAP_SLAPD_F (int) slap_entry2mods LDAP_P(( Entry *e,
201                                                 Modifications **mods, const char **text,
202                                                 char *textbuf, size_t textlen ));
203
204 /*
205  * at.c
206  */
207 LDAP_SLAPD_V(int) at_oc_cache;
208 LDAP_SLAPD_F (void) at_config LDAP_P((
209         const char *fname, int lineno,
210         int argc, char **argv ));
211 LDAP_SLAPD_F (AttributeType *) at_find LDAP_P((
212         const char *name ));
213 LDAP_SLAPD_F (AttributeType *) at_bvfind LDAP_P((
214         struct berval *name ));
215 LDAP_SLAPD_F (int) at_find_in_list LDAP_P((
216         AttributeType *sat, AttributeType **list ));
217 LDAP_SLAPD_F (int) at_append_to_list LDAP_P((
218         AttributeType *sat, AttributeType ***listp ));
219 LDAP_SLAPD_F (int) at_delete_from_list LDAP_P((
220         int pos, AttributeType ***listp ));
221 LDAP_SLAPD_F (int) at_schema_info LDAP_P(( Entry *e ));
222 LDAP_SLAPD_F (int) at_add LDAP_P((
223         LDAPAttributeType *at, int user,
224         AttributeType **sat, const char **err ));
225 LDAP_SLAPD_F (void) at_destroy LDAP_P(( void ));
226
227 LDAP_SLAPD_F (int) is_at_subtype LDAP_P((
228         AttributeType *sub,
229         AttributeType *super ));
230
231 LDAP_SLAPD_F (int) is_at_syntax LDAP_P((
232         AttributeType *at,
233         const char *oid ));
234
235 LDAP_SLAPD_F (int) at_start LDAP_P(( AttributeType **at ));
236 LDAP_SLAPD_F (int) at_next LDAP_P(( AttributeType **at ));
237
238 LDAP_SLAPD_F (void) at_unparse LDAP_P((
239         BerVarray *bva, AttributeType *start, AttributeType *end, int system ));
240
241 /*
242  * attr.c
243  */
244 LDAP_SLAPD_F (void) attr_free LDAP_P(( Attribute *a ));
245 LDAP_SLAPD_F (Attribute *) attr_dup LDAP_P(( Attribute *a ));
246
247 #ifdef LDAP_COMP_MATCH
248 LDAP_SLAPD_F (void) comp_tree_free LDAP_P(( Attribute *a ));
249 #endif
250
251 #define attr_mergeit( e, d, v ) attr_merge( e, d, v, NULL /* FIXME */ )
252 #define attr_mergeit_one( e, d, v ) attr_merge_one( e, d, v, NULL /* FIXME */ )
253
254 LDAP_SLAPD_F (Attribute *) attr_alloc LDAP_P(( AttributeDescription *ad ));
255 LDAP_SLAPD_F (int) attr_merge LDAP_P(( Entry *e,
256         AttributeDescription *desc,
257         BerVarray vals,
258         BerVarray nvals ));
259 LDAP_SLAPD_F (int) attr_merge_one LDAP_P(( Entry *e,
260         AttributeDescription *desc,
261         struct berval *val,
262         struct berval *nval ));
263 LDAP_SLAPD_F (int) attr_merge_normalize LDAP_P(( Entry *e,
264         AttributeDescription *desc,
265         BerVarray vals, void *memctx ));
266 LDAP_SLAPD_F (int) attr_merge_normalize_one LDAP_P(( Entry *e,
267         AttributeDescription *desc,
268         struct berval *val, void *memctx ));
269 LDAP_SLAPD_F (Attribute *) attrs_find LDAP_P((
270         Attribute *a, AttributeDescription *desc ));
271 LDAP_SLAPD_F (Attribute *) attr_find LDAP_P((
272         Attribute *a, AttributeDescription *desc ));
273 LDAP_SLAPD_F (int) attr_delete LDAP_P((
274         Attribute **attrs, AttributeDescription *desc ));
275
276 LDAP_SLAPD_F (void) attrs_free LDAP_P(( Attribute *a ));
277 LDAP_SLAPD_F (Attribute *) attrs_dup LDAP_P(( Attribute *a ));
278
279
280 /*
281  * ava.c
282  */
283 LDAP_SLAPD_F (int) get_ava LDAP_P((
284         Operation *op,
285         BerElement *ber,
286         AttributeAssertion **ava,
287         unsigned usage,
288         const char **text ));
289 LDAP_SLAPD_F (void) ava_free LDAP_P((
290         Operation *op,
291         AttributeAssertion *ava,
292         int freeit ));
293
294 /*
295  * backend.c
296  */
297
298 #define be_match( be1, be2 )    ( (be1) == (be2) || \
299                                   ( (be1) && (be2) && (be1)->be_nsuffix == (be2)->be_nsuffix ) )
300
301 LDAP_SLAPD_F (int) backend_init LDAP_P((void));
302 LDAP_SLAPD_F (int) backend_add LDAP_P((BackendInfo *aBackendInfo));
303 LDAP_SLAPD_F (int) backend_num LDAP_P((Backend *be));
304 LDAP_SLAPD_F (int) backend_startup LDAP_P((Backend *be));
305 LDAP_SLAPD_F (int) backend_startup_one LDAP_P((Backend *be));
306 LDAP_SLAPD_F (int) backend_sync LDAP_P((Backend *be));
307 LDAP_SLAPD_F (int) backend_shutdown LDAP_P((Backend *be));
308 LDAP_SLAPD_F (int) backend_destroy LDAP_P((void));
309 LDAP_SLAPD_F (void) backend_destroy_one LDAP_P((BackendDB *bd, int dynamic));
310
311 LDAP_SLAPD_F (BackendInfo *) backend_info LDAP_P(( const char *type ));
312 LDAP_SLAPD_F (BackendDB *) backend_db_init LDAP_P(( const char *type ));
313
314 LDAP_SLAPD_F (BackendDB *) select_backend LDAP_P((
315         struct berval * dn,
316         int manageDSAit,
317         int noSubordinates ));
318
319 LDAP_SLAPD_F (int) be_issuffix LDAP_P(( Backend *be,
320         struct berval *suffix ));
321 LDAP_SLAPD_F (int) be_isroot LDAP_P(( Operation *op ));
322 LDAP_SLAPD_F (int) be_isroot_dn LDAP_P(( Backend *be, struct berval *ndn ));
323 LDAP_SLAPD_F (int) be_isroot_pw LDAP_P(( Operation *op ));
324 LDAP_SLAPD_F (int) be_slurp_update LDAP_P(( Operation *op ));
325 #define be_isupdate( op ) be_slurp_update( (op) )
326 LDAP_SLAPD_F (int) be_shadow_update LDAP_P(( Operation *op ));
327 LDAP_SLAPD_F (int) be_isupdate_dn LDAP_P(( Backend *be, struct berval *ndn ));
328 LDAP_SLAPD_F (struct berval *) be_root_dn LDAP_P(( Backend *be ));
329 LDAP_SLAPD_F (int) be_entry_get_rw LDAP_P(( struct slap_op *o,
330                 struct berval *ndn, ObjectClass *oc,
331                 AttributeDescription *at, int rw, Entry **e ));
332 LDAP_SLAPD_F (int) be_entry_release_rw LDAP_P((
333         Operation *o, Entry *e, int rw ));
334 #define be_entry_release_r( o, e ) be_entry_release_rw( o, e, 0 )
335 #define be_entry_release_w( o, e ) be_entry_release_rw( o, e, 1 )
336
337 LDAP_SLAPD_F (int) backend_unbind LDAP_P((Operation *op, SlapReply *rs));
338 LDAP_SLAPD_F (int) backend_connection_init LDAP_P((Connection *conn));
339 LDAP_SLAPD_F (int) backend_connection_destroy LDAP_P((Connection *conn));
340
341 LDAP_SLAPD_F( int ) backend_check_controls LDAP_P((
342         Operation *op,
343         SlapReply *rs ));
344 LDAP_SLAPD_F( int )     backend_check_restrictions LDAP_P((
345         Operation *op,
346         SlapReply *rs,
347         struct berval *opdata ));
348
349 LDAP_SLAPD_F( int )     backend_check_referrals LDAP_P((
350         Operation *op,
351         SlapReply *rs ));
352
353 LDAP_SLAPD_F (int) backend_group LDAP_P((
354         Operation *op,
355         Entry *target,
356         struct berval *gr_ndn,
357         struct berval *op_ndn,
358         ObjectClass *group_oc,
359         AttributeDescription *group_at
360 ));
361
362 LDAP_SLAPD_F (int) backend_attribute LDAP_P((
363         Operation *op,
364         Entry *target,
365         struct berval *entry_ndn,
366         AttributeDescription *entry_at,
367         BerVarray *vals,
368         slap_access_t access
369 ));
370
371 LDAP_SLAPD_F (int) backend_access LDAP_P((
372         Operation               *op,
373         Entry                   *target,
374         struct berval           *edn,
375         AttributeDescription    *entry_at,
376         struct berval           *nval,
377         slap_access_t           access,
378         slap_mask_t             *mask ));
379
380 LDAP_SLAPD_F (int) backend_operational LDAP_P((
381         Operation *op,
382         SlapReply *rs 
383 ));
384
385 LDAP_SLAPD_V(BackendInfo) slap_binfo[]; 
386
387 /*
388  * backover.c
389  */
390 LDAP_SLAPD_F (int) overlay_register LDAP_P(( slap_overinst *on ));
391 LDAP_SLAPD_F (int) overlay_config LDAP_P(( BackendDB *be, const char *ov ));
392 LDAP_SLAPD_F (void) overlay_destroy_one LDAP_P((
393         BackendDB *be,
394         slap_overinst *on ));
395 LDAP_SLAPD_F (slap_overinst *) overlay_next LDAP_P(( slap_overinst *on ));
396 LDAP_SLAPD_F (slap_overinst *) overlay_find LDAP_P(( const char *name ));
397 LDAP_SLAPD_F (int) overlay_is_over LDAP_P(( BackendDB *be ));
398 LDAP_SLAPD_F (int) overlay_is_inst LDAP_P(( BackendDB *be, const char *name ));
399 LDAP_SLAPD_F (int) overlay_register_control LDAP_P((
400         BackendDB *be,
401         const char *oid ));
402 LDAP_SLAPD_F (int) overlay_op_walk LDAP_P((
403         Operation *op,
404         SlapReply *rs,
405         slap_operation_t which,
406         slap_overinfo *oi,
407         slap_overinst *on ));
408
409 /*
410  * bconfig.c
411  */
412 LDAP_SLAPD_F (int) slap_loglevel_register LDAP_P (( slap_mask_t m, struct berval *s ));
413 LDAP_SLAPD_F (int) str2loglevel LDAP_P(( const char *s, int *l ));
414
415 /*
416  * ch_malloc.c
417  */
418 LDAP_SLAPD_V (BerMemoryFunctions) ch_mfuncs;
419 LDAP_SLAPD_F (void *) ch_malloc LDAP_P(( ber_len_t size ));
420 LDAP_SLAPD_F (void *) ch_realloc LDAP_P(( void *block, ber_len_t size ));
421 LDAP_SLAPD_F (void *) ch_calloc LDAP_P(( ber_len_t nelem, ber_len_t size ));
422 LDAP_SLAPD_F (char *) ch_strdup LDAP_P(( const char *string ));
423 LDAP_SLAPD_F (void) ch_free LDAP_P(( void * ));
424
425 #ifndef CH_FREE
426 #undef free
427 #define free ch_free
428 #endif
429
430 /*
431  * component.c
432  */
433 #ifdef LDAP_COMP_MATCH
434 struct comp_attribute_aliasing;
435
436 LDAP_SLAPD_F (int) test_comp_filter_entry LDAP_P((
437         Operation* op,
438         Entry* e,
439         MatchingRuleAssertion* mr));
440
441 LDAP_SLAPD_F (int) dup_comp_filter LDAP_P((
442         Operation* op,
443         struct berval *bv,
444         ComponentFilter *in_f,
445         ComponentFilter **out_f ));
446
447 LDAP_SLAPD_F (int) get_aliased_filter_aa LDAP_P((
448         Operation* op,
449         AttributeAssertion* a_assert,
450         struct comp_attribute_aliasing* aa,
451         const char** text ));
452
453 LDAP_SLAPD_F (int) get_aliased_filter LDAP_P((
454         Operation* op,
455         MatchingRuleAssertion* ma,
456         struct comp_attribute_aliasing* aa,
457         const char** text ));
458
459 LDAP_SLAPD_F (int) get_comp_filter LDAP_P((
460         Operation* op,
461         BerValue* bv,
462         ComponentFilter** filt,
463         const char **text ));
464
465 LDAP_SLAPD_F (int) insert_component_reference LDAP_P((
466         ComponentReference *cr,
467         ComponentReference** cr_list ));
468
469 LDAP_SLAPD_F (int) is_component_reference LDAP_P((
470         char *attr ));
471
472 LDAP_SLAPD_F (int) extract_component_reference LDAP_P((
473         char* attr,
474         ComponentReference** cr ));
475
476 LDAP_SLAPD_F (int) componentFilterMatch LDAP_P(( 
477         int *matchp, 
478         slap_mask_t flags, 
479         Syntax *syntax, 
480         MatchingRule *mr,
481         struct berval *value, 
482         void *assertedValue ));
483
484 LDAP_SLAPD_F (int) directoryComponentsMatch LDAP_P((
485         int *matchp,
486         slap_mask_t flags,
487         Syntax *syntax,
488         MatchingRule *mr,
489         struct berval *value,
490         void *assertedValue ));
491
492 LDAP_SLAPD_F (int) allComponentsMatch LDAP_P((
493         int *matchp,
494         slap_mask_t flags,
495         Syntax *syntax,
496         MatchingRule *mr,
497         struct berval *value,
498         void *assertedValue ));
499
500 LDAP_SLAPD_F (ComponentReference*) dup_comp_ref LDAP_P((
501         Operation *op,
502         ComponentReference *cr ));
503                                                                           
504 LDAP_SLAPD_F (int) componentFilterValidate LDAP_P(( 
505         Syntax *syntax,
506         struct berval* bv ));
507
508 LDAP_SLAPD_F (int) allComponentsValidate LDAP_P((
509         Syntax *syntax,
510         struct berval* bv ));
511
512 LDAP_SLAPD_F (void) component_free LDAP_P((
513         ComponentFilter *f ));
514
515 LDAP_SLAPD_F (void) free_ComponentData LDAP_P((
516         Attribute *a ));
517
518 LDAP_SLAPD_V (test_membership_func*) is_aliased_attribute;
519
520 LDAP_SLAPD_V (free_component_func*) component_destructor;
521
522 LDAP_SLAPD_V (get_component_info_func*) get_component_description;
523
524 LDAP_SLAPD_V (component_encoder_func*) component_encoder;
525
526 LDAP_SLAPD_V (convert_attr_to_comp_func*) attr_converter;
527
528 LDAP_SLAPD_V (alloc_nibble_func*) nibble_mem_allocator;
529
530 LDAP_SLAPD_V (free_nibble_func*) nibble_mem_free;
531 #endif
532
533 /*
534  * controls.c
535  */
536 LDAP_SLAPD_V( struct slap_control_ids ) slap_cids;
537 LDAP_SLAPD_F (void) slap_free_ctrls LDAP_P((
538         Operation *op,
539         LDAPControl **ctrls ));
540 LDAP_SLAPD_F (int) slap_parse_ctrl LDAP_P((
541         Operation *op,
542         SlapReply *rs,
543         LDAPControl *control,
544         const char **text ));
545 LDAP_SLAPD_F (int) get_ctrls LDAP_P((
546         Operation *op,
547         SlapReply *rs,
548         int senderrors ));
549 LDAP_SLAPD_F (int) register_supported_control LDAP_P((
550         const char *controloid,
551         slap_mask_t controlmask,
552         char **controlexops,
553         SLAP_CTRL_PARSE_FN *controlparsefn,
554         int *controlcid ));
555 LDAP_SLAPD_F (int) slap_controls_init LDAP_P ((void));
556 LDAP_SLAPD_F (void) controls_destroy LDAP_P ((void));
557 LDAP_SLAPD_F (int) controls_root_dse_info LDAP_P ((Entry *e));
558 LDAP_SLAPD_F (int) get_supported_controls LDAP_P ((
559         char ***ctrloidsp, slap_mask_t **ctrlmasks ));
560 LDAP_SLAPD_F (int) slap_find_control_id LDAP_P ((
561         const char *oid, int *cid ));
562 LDAP_SLAPD_F (int) slap_global_control LDAP_P ((
563         Operation *op, const char *oid, int *cid ));
564
565 /*
566  * config.c
567  */
568 LDAP_SLAPD_F (int) read_config LDAP_P(( const char *fname, const char *dir ));
569 LDAP_SLAPD_F (void) config_destroy LDAP_P ((void));
570 LDAP_SLAPD_F (char **) slap_str2clist LDAP_P((
571         char ***, char *, const char * ));
572 LDAP_SLAPD_F (int) verb_to_mask LDAP_P((
573         const char *word,  slap_verbmasks *v ));
574 LDAP_SLAPD_F (int) verbs_to_mask LDAP_P((
575         int argc, char *argv[], slap_verbmasks *v, slap_mask_t *m ));
576 LDAP_SLAPD_F (int) mask_to_verbs LDAP_P((
577         slap_verbmasks *v, slap_mask_t m, BerVarray *bva ));
578 LDAP_SLAPD_F (int) enum_to_verb LDAP_P((
579         slap_verbmasks *v, slap_mask_t m, struct berval *bv ));
580 LDAP_SLAPD_F (int) slap_verbmasks_init LDAP_P(( slap_verbmasks **vp, slap_verbmasks *v ));
581 LDAP_SLAPD_F (int) slap_verbmasks_destroy LDAP_P(( slap_verbmasks *v ));
582 LDAP_SLAPD_F (int) slap_verbmasks_append LDAP_P(( slap_verbmasks **vp,
583         slap_mask_t m, struct berval *v, slap_mask_t *ignore ));
584 LDAP_SLAPD_F (int) bindconf_parse LDAP_P((
585         const char *word,  slap_bindconf *bc ));
586 LDAP_SLAPD_F (int) bindconf_unparse LDAP_P((
587         slap_bindconf *bc, struct berval *bv ));
588 LDAP_SLAPD_F (void) bindconf_free LDAP_P(( slap_bindconf *bc ));
589 LDAP_SLAPD_F (int) config_generic_wrapper LDAP_P(( Backend *be,
590         const char *fname, int lineno, int argc, char **argv ));
591 LDAP_SLAPD_F (char *) anlist_unparse LDAP_P(( AttributeName *, char * ));
592
593 #ifdef LDAP_SLAPI
594 LDAP_SLAPD_V (int) slapi_plugins_used;
595 #endif
596
597 /*
598  * connection.c
599  */
600 LDAP_SLAPD_F (int) connections_init LDAP_P((void));
601 LDAP_SLAPD_F (int) connections_shutdown LDAP_P((void));
602 LDAP_SLAPD_F (int) connections_destroy LDAP_P((void));
603 LDAP_SLAPD_F (int) connections_timeout_idle LDAP_P((time_t));
604
605 LDAP_SLAPD_F (int) connection_client_setup LDAP_P((
606         ber_socket_t s,
607         ldap_pvt_thread_start_t *func,
608         void *arg ));
609 LDAP_SLAPD_F (void) connection_client_enable LDAP_P(( ber_socket_t s ));
610 LDAP_SLAPD_F (void) connection_client_stop LDAP_P(( ber_socket_t s ));
611
612
613 LDAP_SLAPD_F (long) connection_init LDAP_P((
614         ber_socket_t s,
615         Listener* url,
616         const char* dnsname,
617         const char* peername,
618         int use_tls,
619         slap_ssf_t ssf,
620         struct berval *id ));
621
622 LDAP_SLAPD_F (void) connection_closing LDAP_P((
623         Connection *c, const char *why ));
624 LDAP_SLAPD_F (int) connection_state_closing LDAP_P(( Connection *c ));
625 LDAP_SLAPD_F (const char *) connection_state2str LDAP_P(( int state ))
626         LDAP_GCCATTR((const));
627
628 LDAP_SLAPD_F (int) connection_write LDAP_P((ber_socket_t s));
629 LDAP_SLAPD_F (int) connection_read LDAP_P((ber_socket_t s));
630
631 LDAP_SLAPD_F (unsigned long) connections_nextid(void);
632
633 LDAP_SLAPD_F (Connection *) connection_first LDAP_P(( ber_socket_t * ));
634 LDAP_SLAPD_F (Connection *) connection_next LDAP_P((
635         Connection *, ber_socket_t *));
636 LDAP_SLAPD_F (void) connection_done LDAP_P((Connection *));
637
638 LDAP_SLAPD_F (void) connection2anonymous LDAP_P((Connection *));
639 LDAP_SLAPD_F (void) connection_fake_init LDAP_P((
640         Connection *conn,
641         Operation *op,
642         void *threadctx ));
643 LDAP_SLAPD_F (void) connection_assign_nextid LDAP_P((Connection *));
644
645 /*
646  * cr.c
647  */
648 LDAP_SLAPD_F (int) cr_schema_info( Entry *e );
649 LDAP_SLAPD_F (void) cr_unparse LDAP_P((
650         BerVarray *bva, ContentRule *start, ContentRule *end, int system ));
651
652 LDAP_SLAPD_F (int) cr_add LDAP_P((
653         LDAPContentRule *oc,
654         int user,
655         ContentRule **scr,
656         const char **err));
657
658 LDAP_SLAPD_F (void) cr_destroy LDAP_P(( void ));
659
660 LDAP_SLAPD_F (ContentRule *) cr_find LDAP_P((
661         const char *crname));
662 LDAP_SLAPD_F (ContentRule *) cr_bvfind LDAP_P((
663         struct berval *crname));
664
665 /*
666  * ctxcsn.c
667  */
668
669 LDAP_SLAPD_V( const struct berval ) slap_ldapsync_bv;
670 LDAP_SLAPD_V( const struct berval ) slap_ldapsync_cn_bv;
671 LDAP_SLAPD_F (void) slap_get_commit_csn LDAP_P((
672         Operation *, struct berval *maxcsn, struct berval *curcsn ));
673 LDAP_SLAPD_F (void) slap_rewind_commit_csn LDAP_P(( Operation * ));
674 LDAP_SLAPD_F (void) slap_graduate_commit_csn LDAP_P(( Operation * ));
675 LDAP_SLAPD_F (Entry *) slap_create_context_csn_entry LDAP_P(( Backend *, struct berval *));
676 LDAP_SLAPD_F (int) slap_get_csn LDAP_P(( Operation *, char *, int, struct berval *, int ));
677 LDAP_SLAPD_F (void) slap_queue_csn LDAP_P(( Operation *, struct berval * ));
678
679 /*
680  * daemon.c
681  */
682 LDAP_SLAPD_F (void) slapd_add_internal(ber_socket_t s, int isactive);
683 LDAP_SLAPD_F (int) slapd_daemon_init( const char *urls );
684 LDAP_SLAPD_F (int) slapd_daemon_destroy(void);
685 LDAP_SLAPD_F (int) slapd_daemon(void);
686 LDAP_SLAPD_F (Listener **)      slapd_get_listeners LDAP_P((void));
687 LDAP_SLAPD_F (void) slapd_remove LDAP_P((ber_socket_t s, int wasactive, int wake));
688
689 LDAP_SLAPD_F (RETSIGTYPE) slap_sig_shutdown LDAP_P((int sig));
690 LDAP_SLAPD_F (RETSIGTYPE) slap_sig_wake LDAP_P((int sig));
691 LDAP_SLAPD_F (void) slap_wake_listener LDAP_P((void));
692
693 LDAP_SLAPD_F (void) slapd_set_write LDAP_P((ber_socket_t s, int wake));
694 LDAP_SLAPD_F (void) slapd_clr_write LDAP_P((ber_socket_t s, int wake));
695 LDAP_SLAPD_F (void) slapd_set_read LDAP_P((ber_socket_t s, int wake));
696 LDAP_SLAPD_F (void) slapd_clr_read LDAP_P((ber_socket_t s, int wake));
697
698 LDAP_SLAPD_V (volatile sig_atomic_t) slapd_abrupt_shutdown;
699 LDAP_SLAPD_V (volatile sig_atomic_t) slapd_shutdown;
700 LDAP_SLAPD_V (int) slapd_register_slp;
701 LDAP_SLAPD_V (slap_ssf_t) local_ssf;
702 LDAP_SLAPD_V (struct runqueue_s) slapd_rq;
703
704 /*
705  * dn.c
706  */
707
708 #define dn_match(dn1, dn2)      ( ber_bvcmp((dn1), (dn2)) == 0 )
709 #define bvmatch(bv1, bv2)       ( ((bv1)->bv_len == (bv2)->bv_len) && (memcmp((bv1)->bv_val, (bv2)->bv_val, (bv1)->bv_len) == 0) )
710
711 LDAP_SLAPD_F (int) dnValidate LDAP_P((
712         Syntax *syntax, 
713         struct berval *val ));
714 LDAP_SLAPD_F (int) rdnValidate LDAP_P((
715         Syntax *syntax, 
716         struct berval *val ));
717
718 LDAP_SLAPD_F (slap_mr_normalize_func) dnNormalize;
719
720 LDAP_SLAPD_F (slap_mr_normalize_func) rdnNormalize;
721
722 LDAP_SLAPD_F (slap_syntax_transform_func) dnPretty;
723
724 LDAP_SLAPD_F (slap_syntax_transform_func) rdnPretty;
725
726 LDAP_SLAPD_F (int) dnPrettyNormal LDAP_P(( 
727         Syntax *syntax, 
728         struct berval *val, 
729         struct berval *pretty,
730         struct berval *normal,
731         void *ctx ));
732
733 LDAP_SLAPD_F (int) dnMatch LDAP_P(( 
734         int *matchp, 
735         slap_mask_t flags, 
736         Syntax *syntax, 
737         MatchingRule *mr,
738         struct berval *value, 
739         void *assertedValue ));
740
741 LDAP_SLAPD_F (int) dnRelativeMatch LDAP_P(( 
742         int *matchp, 
743         slap_mask_t flags, 
744         Syntax *syntax, 
745         MatchingRule *mr,
746         struct berval *value, 
747         void *assertedValue ));
748
749 LDAP_SLAPD_F (int) rdnMatch LDAP_P(( 
750         int *matchp, 
751         slap_mask_t flags, 
752         Syntax *syntax, 
753         MatchingRule *mr,
754         struct berval *value, 
755         void *assertedValue ));
756
757
758 LDAP_SLAPD_F (int) dnIsSuffix LDAP_P((
759         const struct berval *dn, const struct berval *suffix ));
760
761 LDAP_SLAPD_F (int) dnIsOneLevelRDN LDAP_P(( struct berval *rdn ));
762
763 LDAP_SLAPD_F (int) dnExtractRdn LDAP_P((
764         struct berval *dn, struct berval *rdn, void *ctx ));
765
766 LDAP_SLAPD_F (int) rdn_validate LDAP_P(( struct berval * rdn ));
767
768 LDAP_SLAPD_F (int) dn_rdnlen LDAP_P(( Backend *be, struct berval *dn ));
769
770 LDAP_SLAPD_F (void) build_new_dn LDAP_P((
771         struct berval * new_dn,
772         struct berval * parent_dn,
773         struct berval * newrdn,
774         void *memctx ));
775
776 LDAP_SLAPD_F (void) dnParent LDAP_P(( struct berval *dn, struct berval *pdn ));
777 LDAP_SLAPD_F (void) dnRdn LDAP_P(( struct berval *dn, struct berval *rdn ));
778
779 LDAP_SLAPD_F (int) dnX509normalize LDAP_P(( void *x509_name, struct berval *out ));
780
781 LDAP_SLAPD_F (int) dnX509peerNormalize LDAP_P(( void *ssl, struct berval *dn ));
782
783 LDAP_SLAPD_F (int) dnPrettyNormalDN LDAP_P(( Syntax *syntax, struct berval *val, LDAPDN *dn, int flags, void *ctx ));
784 #define dnPrettyDN(syntax, val, dn, ctx) \
785         dnPrettyNormalDN((syntax),(val),(dn), SLAP_LDAPDN_PRETTY, ctx)
786 #define dnNormalDN(syntax, val, dn, ctx) \
787         dnPrettyNormalDN((syntax),(val),(dn), 0, ctx)
788
789 typedef int (SLAP_CERT_MAP_FN) LDAP_P(( void *ssl, struct berval *dn ));
790 LDAP_SLAPD_F (int) register_certificate_map_function LDAP_P(( SLAP_CERT_MAP_FN *fn ));
791
792 /*
793  * entry.c
794  */
795 LDAP_SLAPD_V (const Entry) slap_entry_root;
796
797 LDAP_SLAPD_F (int) entry_destroy LDAP_P((void));
798
799 LDAP_SLAPD_F (Entry *) str2entry LDAP_P(( char  *s ));
800 LDAP_SLAPD_F (Entry *) str2entry2 LDAP_P(( char *s, int checkvals ));
801 LDAP_SLAPD_F (char *) entry2str LDAP_P(( Entry *e, int *len ));
802
803 LDAP_SLAPD_F (ber_len_t) entry_flatsize LDAP_P(( Entry *e, int norm ));
804 LDAP_SLAPD_F (void) entry_partsize LDAP_P(( Entry *e, ber_len_t *len,
805         int *nattrs, int *nvals, int norm ));
806
807 #ifdef SLAP_ZONE_ALLOC
808 LDAP_SLAPD_F (int) entry_decode LDAP_P((
809                                                 struct berval *bv, Entry **e, void *ctx ));
810 #else
811 LDAP_SLAPD_F (int) entry_decode LDAP_P((
812                                                 struct berval *bv, Entry **e ));
813 #endif
814 LDAP_SLAPD_F (int) entry_encode LDAP_P(( Entry *e, struct berval *bv ));
815
816 LDAP_SLAPD_F (void) entry_clean LDAP_P(( Entry *e ));
817 LDAP_SLAPD_F (void) entry_free LDAP_P(( Entry *e ));
818 LDAP_SLAPD_F (int) entry_cmp LDAP_P(( Entry *a, Entry *b ));
819 LDAP_SLAPD_F (int) entry_dn_cmp LDAP_P(( const void *v_a, const void *v_b ));
820 LDAP_SLAPD_F (int) entry_id_cmp LDAP_P(( const void *v_a, const void *v_b ));
821 LDAP_SLAPD_F (Entry *) entry_dup LDAP_P(( Entry *e ));
822
823 /*
824  * extended.c
825  */
826 LDAP_SLAPD_F (int) exop_root_dse_info LDAP_P ((Entry *e));
827
828 #define exop_is_write( op )     ((op->ore_flags & SLAP_EXOP_WRITES) != 0)
829
830 LDAP_SLAPD_V( const struct berval ) slap_EXOP_CANCEL;
831 LDAP_SLAPD_V( const struct berval ) slap_EXOP_WHOAMI;
832 LDAP_SLAPD_V( const struct berval ) slap_EXOP_MODIFY_PASSWD;
833 LDAP_SLAPD_V( const struct berval ) slap_EXOP_START_TLS;
834
835 typedef int (SLAP_EXTOP_MAIN_FN) LDAP_P(( Operation *op, SlapReply *rs ));
836
837 typedef int (SLAP_EXTOP_GETOID_FN) LDAP_P((
838         int index, struct berval *oid, int blen ));
839
840 LDAP_SLAPD_F (int) load_extop LDAP_P((
841         struct berval *ext_oid,
842         slap_mask_t flags,
843         SLAP_EXTOP_MAIN_FN *ext_main ));
844
845 LDAP_SLAPD_F (int) extops_init LDAP_P(( void ));
846
847 LDAP_SLAPD_F (int) extops_kill LDAP_P(( void ));
848
849 LDAP_SLAPD_F (struct berval *) get_supported_extop LDAP_P((int index));
850
851 /*
852  * cancel.c
853  */
854 LDAP_SLAPD_F ( SLAP_EXTOP_MAIN_FN ) cancel_extop;
855
856 /*
857  * filter.c
858  */
859 LDAP_SLAPD_F (int) get_filter LDAP_P((
860         Operation *op,
861         BerElement *ber,
862         Filter **filt,
863         const char **text ));
864
865 LDAP_SLAPD_F (void) filter_free LDAP_P(( Filter *f ));
866 LDAP_SLAPD_F (void) filter_free_x LDAP_P(( Operation *op, Filter *f ));
867 LDAP_SLAPD_F (void) filter2bv LDAP_P(( Filter *f, struct berval *bv ));
868 LDAP_SLAPD_F (void) filter2bv_x LDAP_P(( Operation *op, Filter *f, struct berval *bv ));
869
870 LDAP_SLAPD_F (int) get_vrFilter LDAP_P(( Operation *op, BerElement *ber,
871         ValuesReturnFilter **f,
872         const char **text ));
873
874 LDAP_SLAPD_F (void) vrFilter_free LDAP_P(( Operation *op, ValuesReturnFilter *f ));
875 LDAP_SLAPD_F (void) vrFilter2bv LDAP_P(( Operation *op, ValuesReturnFilter *f, struct berval *fstr ));
876
877 LDAP_SLAPD_F (int) filter_has_subordinates LDAP_P(( Filter *filter ));
878 LDAP_SLAPD_F (int) filter_escape_value LDAP_P(( struct berval *in, 
879         struct berval *out ));
880
881 /*
882  * filterentry.c
883  */
884
885 LDAP_SLAPD_F (int) test_filter LDAP_P(( Operation *op, Entry *e, Filter *f ));
886
887 /*
888  * frontend.c
889  */
890 LDAP_SLAPD_F (int) frontend_init LDAP_P(( void ));
891
892 /*
893  * globals.c
894  */
895
896 LDAP_SLAPD_V( const struct berval ) slap_empty_bv;
897 LDAP_SLAPD_V( const struct berval ) slap_unknown_bv;
898 LDAP_SLAPD_V( const struct berval ) slap_true_bv;
899 LDAP_SLAPD_V( const struct berval ) slap_false_bv;
900 LDAP_SLAPD_V( struct slap_sync_cookie_s ) slap_sync_cookie;
901 LDAP_SLAPD_V( void * ) slap_tls_ctx;
902
903 /*
904  * index.c
905  */
906 LDAP_SLAPD_F (int) slap_str2index LDAP_P(( const char *str, slap_mask_t *idx ));
907 LDAP_SLAPD_F (void) slap_index2bvlen LDAP_P(( slap_mask_t idx, struct berval *bv ));
908 LDAP_SLAPD_F (void) slap_index2bv LDAP_P(( slap_mask_t idx, struct berval *bv ));
909
910 /*
911  * init.c
912  */
913 LDAP_SLAPD_F (int)      slap_init LDAP_P((int mode, const char* name));
914 LDAP_SLAPD_F (int)      slap_startup LDAP_P(( Backend *be ));
915 LDAP_SLAPD_F (int)      slap_shutdown LDAP_P(( Backend *be ));
916 LDAP_SLAPD_F (int)      slap_destroy LDAP_P((void));
917
918 LDAP_SLAPD_V (char *)   slap_known_controls[];
919
920 /*
921  * kerberos.c
922  */
923 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
924 LDAP_SLAPD_V (char *)   ldap_srvtab;
925 LDAP_SLAPD_V (int)      krbv4_ldap_auth();
926 #endif
927
928 /*
929  * ldapsync.c
930  */
931 LDAP_SLAPD_F (void) slap_compose_sync_cookie LDAP_P((
932                                 Operation *, struct berval *, struct berval *, int ));
933 LDAP_SLAPD_F (void) slap_sync_cookie_free LDAP_P((
934                                 struct sync_cookie *, int free_cookie ));
935 LDAP_SLAPD_F (int) slap_parse_sync_cookie LDAP_P((
936                                 struct sync_cookie *, void *memctx ));
937 LDAP_SLAPD_F (int) slap_init_sync_cookie_ctxcsn LDAP_P((
938                                 struct sync_cookie * ));
939 LDAP_SLAPD_F (struct sync_cookie *) slap_dup_sync_cookie LDAP_P((
940                                 struct sync_cookie *, struct sync_cookie * ));
941 LDAP_SLAPD_F (int) slap_build_syncUUID_set LDAP_P((
942                                 Operation *, BerVarray *, Entry * ));
943
944 /*
945  * limits.c
946  */
947 LDAP_SLAPD_F (int) limits_get LDAP_P((
948         Operation *op, struct berval *ndn,
949         struct slap_limits_set **limit ));
950 LDAP_SLAPD_F (int) limits_parse LDAP_P((
951         Backend *be, const char *fname, int lineno,
952         int argc, char **argv ));
953 LDAP_SLAPD_F (int) limits_parse_one LDAP_P(( const char *arg, 
954         struct slap_limits_set *limit ));
955 LDAP_SLAPD_F (int) limits_check LDAP_P((
956         Operation *op, SlapReply *rs ));
957 LDAP_SLAPD_F (void) limits_unparse_one LDAP_P(( 
958         struct slap_limits_set *limit, int which, struct berval *bv ));
959 LDAP_SLAPD_F (void) limits_unparse LDAP_P(( 
960         struct slap_limits *limit, struct berval *bv ));
961 LDAP_SLAPD_F (void) limits_destroy LDAP_P(( struct slap_limits **lm ));
962
963 /*
964  * lock.c
965  */
966 LDAP_SLAPD_F (FILE *) lock_fopen LDAP_P(( const char *fname,
967         const char *type, FILE **lfp ));
968 LDAP_SLAPD_F (int) lock_fclose LDAP_P(( FILE *fp, FILE *lfp ));
969
970 /*
971  * matchedValues.c
972  */
973 LDAP_SLAPD_F (int) filter_matched_values( 
974         Operation       *op,
975         Attribute       *a,
976         char            ***e_flags );
977
978 /*
979  * modrdn.c
980  */
981 LDAP_SLAPD_F (int) slap_modrdn2mods(
982         Operation       *op,
983         SlapReply       *rs,
984         Entry           *e,
985         LDAPRDN         oldrdn,
986         LDAPRDN         newrdn,
987         Modifications   **pmod );
988
989 /*
990  * modify.c
991  */
992 LDAP_SLAPD_F( int ) slap_mods_obsolete_check(
993         Operation *op,
994         Modifications *ml,
995         const char **text,
996         char *textbuf, size_t textlen );
997
998 LDAP_SLAPD_F( int ) slap_mods_no_user_mod_check(
999         Operation *op,
1000         Modifications *ml,
1001         const char **text,
1002         char *textbuf, size_t textlen );
1003
1004 LDAP_SLAPD_F ( int ) slap_mods_no_repl_user_mod_check(
1005         Operation *op,
1006         Modifications *ml,
1007         const char **text,
1008         char *textbuf,
1009         size_t textlen );
1010
1011 LDAP_SLAPD_F( int ) slap_mods_check(
1012         Modifications *ml,
1013         const char **text,
1014         char *textbuf, size_t textlen, void *ctx );
1015
1016 LDAP_SLAPD_F( void ) slap_timestamp(
1017         time_t *tm,
1018         struct berval *bv );
1019
1020 LDAP_SLAPD_F( int ) slap_mods_opattrs(
1021         Operation *op,
1022         Modifications *mods,
1023         Modifications **modlist,
1024         const char **text,
1025         char *textbuf, size_t textlen,
1026         int manage_ctxcsn );
1027
1028 /*
1029  * mods.c
1030  */
1031 LDAP_SLAPD_F( int ) modify_add_values( Entry *e,
1032         Modification *mod,
1033         int permissive,
1034         const char **text, char *textbuf, size_t textlen );
1035 LDAP_SLAPD_F( int ) modify_delete_values( Entry *e,
1036         Modification *mod,
1037         int permissive,
1038         const char **text, char *textbuf, size_t textlen );
1039 LDAP_SLAPD_F( int ) modify_delete_vindex( Entry *e,
1040         Modification *mod,
1041         int permissive,
1042         const char **text, char *textbuf, size_t textlen, int *idx );
1043 LDAP_SLAPD_F( int ) modify_replace_values( Entry *e,
1044         Modification *mod,
1045         int permissive,
1046         const char **text, char *textbuf, size_t textlen );
1047 LDAP_SLAPD_F( int ) modify_increment_values( Entry *e,
1048         Modification *mod,
1049         int permissive,
1050         const char **text, char *textbuf, size_t textlen );
1051
1052 LDAP_SLAPD_F( void ) slap_mod_free( Modification *mod, int freeit );
1053 LDAP_SLAPD_F( void ) slap_mods_free( Modifications *mods, int freevals );
1054 LDAP_SLAPD_F( void ) slap_modlist_free( LDAPModList *ml );
1055
1056 /*
1057  * module.c
1058  */
1059 #ifdef SLAPD_MODULES
1060
1061 LDAP_SLAPD_F (int) module_init LDAP_P(( void ));
1062 LDAP_SLAPD_F (int) module_kill LDAP_P(( void ));
1063
1064 LDAP_SLAPD_F (int) load_null_module(
1065         const void *module, const char *file_name);
1066 LDAP_SLAPD_F (int) load_extop_module(
1067         const void *module, const char *file_name);
1068
1069 LDAP_SLAPD_F (int) module_load LDAP_P((
1070         const char* file_name,
1071         int argc, char *argv[] ));
1072 LDAP_SLAPD_F (int) module_path LDAP_P(( const char* path ));
1073
1074 LDAP_SLAPD_F (void) *module_resolve LDAP_P((
1075         const void *module, const char *name));
1076
1077 #endif /* SLAPD_MODULES */
1078
1079 /* mr.c */
1080 LDAP_SLAPD_F (MatchingRule *) mr_bvfind LDAP_P((struct berval *mrname));
1081 LDAP_SLAPD_F (MatchingRule *) mr_find LDAP_P((const char *mrname));
1082 LDAP_SLAPD_F (int) mr_add LDAP_P(( LDAPMatchingRule *mr,
1083         slap_mrule_defs_rec *def,
1084         MatchingRule * associated,
1085         const char **err ));
1086 LDAP_SLAPD_F (void) mr_destroy LDAP_P(( void ));
1087
1088 LDAP_SLAPD_F (int) register_matching_rule LDAP_P((
1089         slap_mrule_defs_rec *def ));
1090
1091 LDAP_SLAPD_F (void) mru_destroy LDAP_P(( void ));
1092 LDAP_SLAPD_F (int) matching_rule_use_init LDAP_P(( void ));
1093
1094 LDAP_SLAPD_F (int) mr_schema_info( Entry *e );
1095 LDAP_SLAPD_F (int) mru_schema_info( Entry *e );
1096
1097 LDAP_SLAPD_F (int) mr_usable_with_at( MatchingRule *mr,
1098         AttributeType *at );
1099
1100 /*
1101  * mra.c
1102  */
1103 LDAP_SLAPD_F (int) get_mra LDAP_P((
1104         Operation *op,
1105         BerElement *ber,
1106         MatchingRuleAssertion **mra,
1107         const char **text ));
1108 LDAP_SLAPD_F (void) mra_free LDAP_P((
1109         Operation *op,
1110         MatchingRuleAssertion *mra,
1111         int freeit ));
1112
1113 /* oc.c */
1114 LDAP_SLAPD_F (int) oc_add LDAP_P((
1115         LDAPObjectClass *oc,
1116         int user,
1117         ObjectClass **soc,
1118         const char **err));
1119 LDAP_SLAPD_F (void) oc_destroy LDAP_P(( void ));
1120
1121 LDAP_SLAPD_F (ObjectClass *) oc_find LDAP_P((
1122         const char *ocname));
1123 LDAP_SLAPD_F (ObjectClass *) oc_bvfind LDAP_P((
1124         struct berval *ocname));
1125 LDAP_SLAPD_F (ObjectClass *) oc_bvfind_undef LDAP_P((
1126         struct berval *ocname));
1127 LDAP_SLAPD_F (int) is_object_subclass LDAP_P((
1128         ObjectClass *sup,
1129         ObjectClass *sub ));
1130
1131 LDAP_SLAPD_F (int) is_entry_objectclass LDAP_P((
1132         Entry *, ObjectClass *oc, unsigned flags ));
1133 #define is_entry_objectclass_or_sub(e,oc) \
1134         (is_entry_objectclass((e),(oc),SLAP_OCF_CHECK_SUP))
1135 #define is_entry_alias(e)               \
1136         (((e)->e_ocflags & SLAP_OC__END) \
1137          ? (((e)->e_ocflags & SLAP_OC_ALIAS) != 0) \
1138          : is_entry_objectclass((e), slap_schema.si_oc_alias, SLAP_OCF_SET_FLAGS))
1139 #define is_entry_referral(e)    \
1140         (((e)->e_ocflags & SLAP_OC__END) \
1141          ? (((e)->e_ocflags & SLAP_OC_REFERRAL) != 0) \
1142          : is_entry_objectclass((e), slap_schema.si_oc_referral, SLAP_OCF_SET_FLAGS))
1143 #define is_entry_subentry(e)    \
1144         (((e)->e_ocflags & SLAP_OC__END) \
1145          ? (((e)->e_ocflags & SLAP_OC_SUBENTRY) != 0) \
1146          : is_entry_objectclass((e), slap_schema.si_oc_subentry, SLAP_OCF_SET_FLAGS))
1147 #define is_entry_collectiveAttributeSubentry(e) \
1148         (((e)->e_ocflags & SLAP_OC__END) \
1149          ? (((e)->e_ocflags & SLAP_OC_COLLECTIVEATTRIBUTESUBENTRY) != 0) \
1150          : is_entry_objectclass((e), slap_schema.si_oc_collectiveAttributeSubentry, SLAP_OCF_SET_FLAGS))
1151 #define is_entry_dynamicObject(e)       \
1152         (((e)->e_ocflags & SLAP_OC__END) \
1153          ? (((e)->e_ocflags & SLAP_OC_DYNAMICOBJECT) != 0) \
1154          : is_entry_objectclass((e), slap_schema.si_oc_dynamicObject, SLAP_OCF_SET_FLAGS))
1155 #define is_entry_glue(e)        \
1156         (((e)->e_ocflags & SLAP_OC__END) \
1157          ? (((e)->e_ocflags & SLAP_OC_GLUE) != 0) \
1158          : is_entry_objectclass((e), slap_schema.si_oc_glue, SLAP_OCF_SET_FLAGS))
1159 #define is_entry_syncProviderSubentry(e)        \
1160         (((e)->e_ocflags & SLAP_OC__END) \
1161          ? (((e)->e_ocflags & SLAP_OC_SYNCPROVIDERSUBENTRY) != 0) \
1162          : is_entry_objectclass((e), slap_schema.si_oc_syncProviderSubentry, SLAP_OCF_SET_FLAGS))
1163 #define is_entry_syncConsumerSubentry(e)        \
1164         (((e)->e_ocflags & SLAP_OC__END) \
1165          ? (((e)->e_ocflags & SLAP_OC_SYNCCONSUMERSUBENTRY) != 0) \
1166          : is_entry_objectclass((e), slap_schema.si_oc_syncConsumerSubentry, SLAP_OCF_SET_FLAGS))
1167
1168 LDAP_SLAPD_F (int) oc_schema_info( Entry *e );
1169 LDAP_SLAPD_F (void) oc_unparse LDAP_P((
1170         BerVarray *bva, ObjectClass *start, ObjectClass *end, int system ));
1171
1172 /*
1173  * oidm.c
1174  */
1175 LDAP_SLAPD_F(char *) oidm_find(char *oid);
1176 LDAP_SLAPD_F (void) oidm_destroy LDAP_P(( void ));
1177 LDAP_SLAPD_F (void) oidm_unparse LDAP_P((
1178         BerVarray *bva, OidMacro *start, OidMacro *end, int system ));
1179 LDAP_SLAPD_F (int) parse_oidm LDAP_P((
1180         const char *fname, int lineno, int argc, char **argv, int user,
1181         OidMacro **om ));
1182
1183 /*
1184  * operation.c
1185  */
1186 LDAP_SLAPD_F (void) slap_op_init LDAP_P(( void ));
1187 LDAP_SLAPD_F (void) slap_op_destroy LDAP_P(( void ));
1188 LDAP_SLAPD_F (void) slap_op_free LDAP_P(( Operation *op ));
1189 LDAP_SLAPD_F (Operation *) slap_op_alloc LDAP_P((
1190         BerElement *ber, ber_int_t msgid,
1191         ber_tag_t tag, ber_int_t id ));
1192
1193 LDAP_SLAPD_F (int) slap_op_add LDAP_P(( Operation **olist, Operation *op ));
1194 LDAP_SLAPD_F (int) slap_op_remove LDAP_P(( Operation **olist, Operation *op ));
1195 LDAP_SLAPD_F (Operation *) slap_op_pop LDAP_P(( Operation **olist ));
1196
1197 /*
1198  * operational.c
1199  */
1200 LDAP_SLAPD_F (Attribute *) slap_operational_subschemaSubentry( Backend *be );
1201 LDAP_SLAPD_F (Attribute *) slap_operational_entryDN( Entry *e );
1202 LDAP_SLAPD_F (Attribute *) slap_operational_hasSubordinate( int has );
1203
1204 /*
1205  * overlays.c
1206  */
1207 LDAP_SLAPD_F (int) overlay_init( void );
1208
1209 /*
1210  * passwd.c
1211  */
1212 LDAP_SLAPD_F (SLAP_EXTOP_MAIN_FN) passwd_extop;
1213
1214 LDAP_SLAPD_F (int) slap_passwd_check(
1215         Operation               *op,
1216         Entry                   *e,
1217         Attribute               *a,
1218         struct berval           *cred,
1219         const char              **text );
1220
1221 LDAP_SLAPD_F (void) slap_passwd_generate( struct berval * );
1222
1223 LDAP_SLAPD_F (void) slap_passwd_hash(
1224         struct berval           *cred,
1225         struct berval           *hash,
1226         const char              **text );
1227
1228 LDAP_SLAPD_F (void) slap_passwd_hash_type(
1229         struct berval           *cred,
1230         struct berval           *hash,
1231         char                    *htype,
1232         const char              **text );
1233
1234 LDAP_SLAPD_F (struct berval *) slap_passwd_return(
1235         struct berval           *cred );
1236
1237 LDAP_SLAPD_F (int) slap_passwd_parse(
1238         struct berval           *reqdata,
1239         struct berval           *id,
1240         struct berval           *oldpass,
1241         struct berval           *newpass,
1242         const char              **text );
1243
1244 LDAP_SLAPD_F (void) slap_passwd_init (void);
1245
1246 /*
1247  * phonetic.c
1248  */
1249 LDAP_SLAPD_F (char *) phonetic LDAP_P(( char *s ));
1250
1251 /*
1252  * referral.c
1253  */
1254 LDAP_SLAPD_F (int) validate_global_referral LDAP_P((
1255         const char *url ));
1256
1257 LDAP_SLAPD_F (BerVarray) get_entry_referrals LDAP_P((
1258         Operation *op, Entry *e ));
1259
1260 LDAP_SLAPD_F (BerVarray) referral_rewrite LDAP_P((
1261         BerVarray refs,
1262         struct berval *base,
1263         struct berval *target,
1264         int scope ));
1265
1266 LDAP_SLAPD_F (int) get_alias_dn LDAP_P((
1267         Entry *e,
1268         struct berval *ndn,
1269         int *err,
1270         const char **text ));
1271
1272 /*
1273  * repl.c
1274  */
1275 LDAP_SLAPD_F (int) add_replica_info LDAP_P(( Backend *be,
1276         const char *uri, const char *host ));
1277 LDAP_SLAPD_F (int) destroy_replica_info LDAP_P (( Backend *be ));
1278 LDAP_SLAPD_F (int) add_replica_suffix LDAP_P(( Backend *be,
1279         int nr, const char *suffix ));
1280 LDAP_SLAPD_F (int) add_replica_attrs LDAP_P(( Backend *be,
1281         int nr, char *attrs, int exclude ));
1282 LDAP_SLAPD_F (void) replog LDAP_P(( Operation *op ));
1283
1284 /*
1285  * result.c
1286  */
1287 LDAP_SLAPD_F (void) slap_send_ldap_result LDAP_P(( Operation *op, SlapReply *rs ));
1288 LDAP_SLAPD_F (void) send_ldap_sasl LDAP_P(( Operation *op, SlapReply *rs ));
1289 LDAP_SLAPD_F (void) send_ldap_disconnect LDAP_P(( Operation *op, SlapReply *rs ));
1290 LDAP_SLAPD_F (void) slap_send_ldap_extended LDAP_P(( Operation *op, SlapReply *rs ));
1291 LDAP_SLAPD_F (void) slap_send_ldap_intermediate LDAP_P(( Operation *op, SlapReply *rs ));
1292 LDAP_SLAPD_F (void) slap_send_search_result LDAP_P(( Operation *op, SlapReply *rs ));
1293 LDAP_SLAPD_F (int) slap_send_search_reference LDAP_P(( Operation *op, SlapReply *rs ));
1294 LDAP_SLAPD_F (int) slap_send_search_entry LDAP_P(( Operation *op, SlapReply *rs ));
1295 LDAP_SLAPD_F (int) slap_null_cb LDAP_P(( Operation *op, SlapReply *rs ));
1296 LDAP_SLAPD_F (int) slap_freeself_cb LDAP_P(( Operation *op, SlapReply *rs ));
1297 LDAP_SLAPD_F (int) slap_replog_cb LDAP_P(( Operation *op, SlapReply *rs ));
1298
1299 LDAP_SLAPD_V( const struct berval ) slap_pre_read_bv;
1300 LDAP_SLAPD_V( const struct berval ) slap_post_read_bv;
1301 LDAP_SLAPD_F (int) slap_read_controls LDAP_P(( Operation *op, SlapReply *rs,
1302         Entry *e, const struct berval *oid, LDAPControl **ctrl ));
1303
1304 LDAP_SLAPD_F (int) str2result LDAP_P(( char *s,
1305         int *code, char **matched, char **info ));
1306 LDAP_SLAPD_F (int) slap_map_api2result LDAP_P(( SlapReply *rs ));
1307 LDAP_SLAPD_F (slap_mask_t) slap_attr_flags LDAP_P(( AttributeName *an ));
1308
1309 LDAP_SLAPD_V( const struct berval ) slap_dummy_bv;
1310
1311 /*
1312  * root_dse.c
1313  */
1314 LDAP_SLAPD_F (int) root_dse_info LDAP_P((
1315         Connection *conn,
1316         Entry **e,
1317         const char **text ));
1318
1319 LDAP_SLAPD_F (int) read_root_dse_file LDAP_P((
1320         const char *file));
1321
1322 LDAP_SLAPD_F (int) slap_discover_feature LDAP_P((
1323         const char      *uri,
1324         int             version,
1325         const char      *attr,
1326         const char      *val ));
1327
1328 /*
1329  * sasl.c
1330  */
1331 LDAP_SLAPD_F (int) slap_sasl_init(void);
1332 LDAP_SLAPD_F (char *) slap_sasl_secprops( const char * );
1333 LDAP_SLAPD_F (void) slap_sasl_secprops_unparse( struct berval * );
1334 LDAP_SLAPD_F (int) slap_sasl_destroy(void);
1335
1336 LDAP_SLAPD_F (int) slap_sasl_open( Connection *c, int reopen );
1337 LDAP_SLAPD_F (char **) slap_sasl_mechs( Connection *c );
1338
1339 LDAP_SLAPD_F (int) slap_sasl_external( Connection *c,
1340         slap_ssf_t ssf, /* relative strength of external security */
1341         struct berval *authid );        /* asserted authenication id */
1342
1343 LDAP_SLAPD_F (int) slap_sasl_reset( Connection *c );
1344 LDAP_SLAPD_F (int) slap_sasl_close( Connection *c );
1345
1346 LDAP_SLAPD_F (int) slap_sasl_bind LDAP_P(( Operation *op, SlapReply *rs ));
1347
1348 LDAP_SLAPD_F (int) slap_sasl_setpass(
1349         Operation       *op,
1350         SlapReply       *rs );
1351
1352 LDAP_SLAPD_F (int) slap_sasl_getdn( Connection *conn, Operation *op,
1353         struct berval *id, char *user_realm, struct berval *dn, int flags );
1354
1355 /*
1356  * saslauthz.c
1357  */
1358 LDAP_SLAPD_F (int) slap_parse_user LDAP_P((
1359         struct berval *id, struct berval *user,
1360         struct berval *realm, struct berval *mech ));
1361 LDAP_SLAPD_F (int) slap_sasl_matches LDAP_P((
1362         Operation *op, BerVarray rules,
1363         struct berval *assertDN, struct berval *authc ));
1364 LDAP_SLAPD_F (void) slap_sasl2dn LDAP_P((
1365         Operation *op,
1366         struct berval *saslname,
1367         struct berval *dn,
1368         int flags ));
1369 LDAP_SLAPD_F (int) slap_sasl_authorized LDAP_P((
1370         Operation *op,
1371         struct berval *authcid,
1372         struct berval *authzid ));
1373 LDAP_SLAPD_F (int) slap_sasl_regexp_config LDAP_P((
1374         const char *match, const char *replace ));
1375 LDAP_SLAPD_F (void) slap_sasl_regexp_unparse LDAP_P(( BerVarray *bva ));
1376 LDAP_SLAPD_F (int) slap_sasl_setpolicy LDAP_P(( const char * ));
1377 LDAP_SLAPD_F (const char *) slap_sasl_getpolicy LDAP_P(( void ));
1378 #ifdef SLAP_AUTH_REWRITE
1379 LDAP_SLAPD_F (int) slap_sasl_rewrite_config LDAP_P(( 
1380         const char *fname,
1381         int lineno,
1382         int argc, 
1383         char **argv ));
1384 #endif /* SLAP_AUTH_REWRITE */
1385 #ifdef SLAP_AUTHZ_SYNTAX
1386 LDAP_SLAPD_F (int) authzValidate LDAP_P((
1387         Syntax *syn, struct berval *in ));
1388 #if 0
1389 LDAP_SLAPD_F (int) authzMatch LDAP_P((
1390         int *matchp,
1391         slap_mask_t flags,
1392         Syntax *syntax,
1393         MatchingRule *mr,
1394         struct berval *value,
1395         void *assertedValue ));
1396 #endif
1397 LDAP_SLAPD_F (int) authzPretty LDAP_P((
1398         Syntax *syntax,
1399         struct berval *val,
1400         struct berval *out,
1401         void *ctx ));
1402 LDAP_SLAPD_F (int) authzNormalize LDAP_P((
1403         slap_mask_t usage,
1404         Syntax *syntax,
1405         MatchingRule *mr,
1406         struct berval *val,
1407         struct berval *normalized,
1408         void *ctx ));
1409 #endif /* SLAP_AUTHZ_SYNTAX */
1410
1411 /*
1412  * schema.c
1413  */
1414 LDAP_SLAPD_F (int) schema_info LDAP_P(( Entry **entry, const char **text ));
1415
1416 /*
1417  * schema_check.c
1418  */
1419 LDAP_SLAPD_F( int ) oc_check_allowed(
1420         AttributeType *type,
1421         BerVarray oclist,
1422         ObjectClass *sc );
1423
1424 LDAP_SLAPD_F( int ) structural_class(
1425         BerVarray ocs,
1426         struct berval *scbv,
1427         ObjectClass **sc,
1428         const char **text,
1429         char *textbuf, size_t textlen );
1430
1431 LDAP_SLAPD_F( int ) entry_schema_check(
1432         Operation *op,
1433         Entry *e,
1434         Attribute *attrs,
1435         int manage,
1436         const char** text,
1437         char *textbuf, size_t textlen );
1438
1439 LDAP_SLAPD_F( int ) mods_structural_class(
1440         Modifications *mods,
1441         struct berval *oc,
1442         const char** text,
1443         char *textbuf, size_t textlen );
1444
1445 /*
1446  * schema_init.c
1447  */
1448 LDAP_SLAPD_V( int ) schema_init_done;
1449 LDAP_SLAPD_F (int) slap_schema_init LDAP_P((void));
1450 LDAP_SLAPD_F (void) schema_destroy LDAP_P(( void ));
1451
1452 LDAP_SLAPD_F( slap_mr_indexer_func ) octetStringIndexer;
1453 LDAP_SLAPD_F( slap_mr_filter_func ) octetStringFilter;
1454
1455 LDAP_SLAPD_F( int ) numericoidValidate LDAP_P((
1456         struct slap_syntax *syntax,
1457         struct berval *in ));
1458 LDAP_SLAPD_F( int ) octetStringMatch LDAP_P((
1459         int *matchp,
1460         slap_mask_t flags,
1461         Syntax *syntax,
1462         MatchingRule *mr,
1463         struct berval *value,
1464         void *assertedValue ));
1465
1466 /*
1467  * schema_prep.c
1468  */
1469 LDAP_SLAPD_V( struct slap_internal_schema ) slap_schema;
1470 LDAP_SLAPD_F (int) slap_schema_load LDAP_P((void));
1471 LDAP_SLAPD_F (int) slap_schema_check LDAP_P((void));
1472
1473 /*
1474  * schemaparse.c
1475  */
1476 LDAP_SLAPD_F( int ) slap_valid_descr( const char * );
1477
1478 LDAP_SLAPD_F (int) parse_cr LDAP_P((
1479         const char *fname, int lineno, char *line, char **argv,
1480         ContentRule **scr ));
1481 LDAP_SLAPD_F (int) parse_oc LDAP_P((
1482         const char *fname, int lineno, char *line, char **argv,
1483         ObjectClass **soc ));
1484 LDAP_SLAPD_F (int) parse_at LDAP_P((
1485         const char *fname, int lineno, char *line, char **argv,
1486         AttributeType **sat ));
1487 LDAP_SLAPD_F (char *) scherr2str LDAP_P((int code)) LDAP_GCCATTR((const));
1488 LDAP_SLAPD_F (int) dscompare LDAP_P(( const char *s1, const char *s2del,
1489         char delim ));
1490
1491 /*
1492  * sessionlog.c
1493  */
1494 LDAP_SLAPD_F (int) slap_send_session_log LDAP_P((
1495                                         Operation *, Operation *, SlapReply *));
1496 LDAP_SLAPD_F (int) slap_add_session_log LDAP_P((
1497                                         Operation *, Operation *, Entry * ));
1498
1499 /*
1500  * sl_malloc.c
1501  */
1502 LDAP_SLAPD_F (void *) slap_sl_malloc LDAP_P((
1503         ber_len_t size, void *ctx ));
1504 LDAP_SLAPD_F (void *) slap_sl_realloc LDAP_P((
1505         void *block, ber_len_t size, void *ctx ));
1506 LDAP_SLAPD_F (void *) slap_sl_calloc LDAP_P((
1507         ber_len_t nelem, ber_len_t size, void *ctx ));
1508 LDAP_SLAPD_F (void) slap_sl_free LDAP_P((
1509         void *, void *ctx ));
1510
1511 LDAP_SLAPD_V (BerMemoryFunctions) slap_sl_mfuncs;
1512
1513 LDAP_SLAPD_F (void) slap_sl_mem_init LDAP_P(( void ));
1514 LDAP_SLAPD_F (void *) slap_sl_mem_create LDAP_P((
1515                                                 ber_len_t size, int stack, void *ctx ));
1516 LDAP_SLAPD_F (void) slap_sl_mem_detach LDAP_P(( void *ctx, void *memctx ));
1517 LDAP_SLAPD_F (void) slap_sl_mem_destroy LDAP_P(( void *key, void *data ));
1518 LDAP_SLAPD_F (void *) slap_sl_context LDAP_P(( void *ptr ));
1519
1520 /*
1521  * starttls.c
1522  */
1523 LDAP_SLAPD_F (SLAP_EXTOP_MAIN_FN) starttls_extop;
1524
1525 /*
1526  * str2filter.c
1527  */
1528 LDAP_SLAPD_F (Filter *) str2filter LDAP_P(( const char *str ));
1529 LDAP_SLAPD_F (Filter *) str2filter_x LDAP_P(( Operation *op, const char *str ));
1530
1531 /*
1532  * syncrepl.c
1533  */
1534
1535 LDAP_SLAPD_F (void)  syncrepl_add_glue LDAP_P(( 
1536                                         Operation*, Entry* ));
1537 LDAP_SLAPD_F (void) syncinfo_free LDAP_P(( struct syncinfo_s * ));
1538
1539 /* syntax.c */
1540 LDAP_SLAPD_F (Syntax *) syn_find LDAP_P((
1541         const char *synname ));
1542 LDAP_SLAPD_F (Syntax *) syn_find_desc LDAP_P((
1543         const char *syndesc, int *slen ));
1544 LDAP_SLAPD_F (int) syn_add LDAP_P((
1545         LDAPSyntax *syn,
1546         slap_syntax_defs_rec *def,
1547         const char **err ));
1548 LDAP_SLAPD_F (void) syn_destroy LDAP_P(( void ));
1549
1550 LDAP_SLAPD_F (int) register_syntax LDAP_P((
1551         slap_syntax_defs_rec *def ));
1552
1553 LDAP_SLAPD_F (int) syn_schema_info( Entry *e );
1554
1555 /*
1556  * user.c
1557  */
1558 #if defined(HAVE_PWD_H) && defined(HAVE_GRP_H)
1559 LDAP_SLAPD_F (void) slap_init_user LDAP_P(( char *username, char *groupname ));
1560 #endif
1561
1562 /*
1563  * value.c
1564  */
1565 LDAP_SLAPD_F (int) asserted_value_validate_normalize LDAP_P((
1566         AttributeDescription *ad,
1567         MatchingRule *mr,
1568         unsigned usage,
1569         struct berval *in,
1570         struct berval *out,
1571         const char ** text,
1572         void *ctx ));
1573
1574 LDAP_SLAPD_F (int) value_match LDAP_P((
1575         int *match,
1576         AttributeDescription *ad,
1577         MatchingRule *mr,
1578         unsigned flags,
1579         struct berval *v1,
1580         void *v2,
1581         const char ** text ));
1582 LDAP_SLAPD_F (int) value_find_ex LDAP_P((
1583         AttributeDescription *ad,
1584         unsigned flags,
1585         BerVarray values,
1586         struct berval *value,
1587         void *ctx ));
1588
1589 LDAP_SLAPD_F (int) ordered_value_add LDAP_P((
1590         Entry *e,
1591         AttributeDescription *ad,
1592         Attribute *a,
1593         BerVarray vals,
1594         BerVarray nvals ));
1595
1596 LDAP_SLAPD_F (int) ordered_value_validate LDAP_P((
1597         AttributeDescription *ad,
1598         struct berval *in ));
1599
1600 LDAP_SLAPD_F (int) ordered_value_pretty LDAP_P((
1601         AttributeDescription *ad,
1602         struct berval *val,
1603         struct berval *out,
1604         void *ctx ));
1605
1606 LDAP_SLAPD_F (int) ordered_value_normalize LDAP_P((
1607         slap_mask_t usage,
1608         AttributeDescription *ad,
1609         MatchingRule *mr,
1610         struct berval *val,
1611         struct berval *normalized,
1612         void *ctx ));
1613
1614 LDAP_SLAPD_F (int) ordered_value_match LDAP_P((
1615         int *match,
1616         AttributeDescription *ad,
1617         MatchingRule *mr,
1618         unsigned flags,
1619         struct berval *v1,
1620         struct berval *v2,
1621         const char ** text ));
1622
1623 LDAP_SLAPD_F (void) ordered_value_renumber LDAP_P((
1624         Attribute *a,
1625         int vals ));
1626
1627 LDAP_SLAPD_F (int) ordered_value_sort LDAP_P((
1628         Attribute *a,
1629         int do_renumber ));
1630
1631 LDAP_SLAPD_F (int) value_add LDAP_P((
1632         BerVarray *vals,
1633         BerVarray addvals ));
1634 LDAP_SLAPD_F (int) value_add_one LDAP_P((
1635         BerVarray *vals,
1636         struct berval *addval ));
1637
1638 /* assumes (x) > (y) returns 1 if true, 0 otherwise */
1639 #define SLAP_PTRCMP(x, y) ((x) < (y) ? -1 : (x) > (y))
1640
1641 #ifdef SLAP_ZONE_ALLOC
1642 /*
1643  * zn_malloc.c
1644  */
1645 LDAP_SLAPD_F (void *) slap_zn_malloc LDAP_P((ber_len_t, void *));
1646 LDAP_SLAPD_F (void *) slap_zn_realloc LDAP_P((void *, ber_len_t, void *));
1647 LDAP_SLAPD_F (void *) slap_zn_calloc LDAP_P((ber_len_t, ber_len_t, void *));
1648 LDAP_SLAPD_F (void) slap_zn_free LDAP_P((void *, void *));
1649
1650 LDAP_SLAPD_F (void *) slap_zn_mem_create LDAP_P((
1651                                                         ber_len_t, ber_len_t, ber_len_t, ber_len_t));
1652 LDAP_SLAPD_F (void) slap_zn_mem_destroy LDAP_P((void *));
1653 LDAP_SLAPD_F (int) slap_zn_validate LDAP_P((void *, void *, int));
1654 LDAP_SLAPD_F (int) slap_zn_invalidate LDAP_P((void *, void *));
1655 LDAP_SLAPD_F (int) slap_zh_rlock LDAP_P((void*));
1656 LDAP_SLAPD_F (int) slap_zh_runlock LDAP_P((void*));
1657 LDAP_SLAPD_F (int) slap_zh_wlock LDAP_P((void*));
1658 LDAP_SLAPD_F (int) slap_zh_wunlock LDAP_P((void*));
1659 LDAP_SLAPD_F (int) slap_zn_rlock LDAP_P((void*, void*));
1660 LDAP_SLAPD_F (int) slap_zn_runlock LDAP_P((void*, void*));
1661 LDAP_SLAPD_F (int) slap_zn_wlock LDAP_P((void*, void*));
1662 LDAP_SLAPD_F (int) slap_zn_wunlock LDAP_P((void*, void*));
1663 #endif
1664
1665 /*
1666  * Other...
1667  */
1668 LDAP_SLAPD_V (unsigned int) index_substr_if_minlen;
1669 LDAP_SLAPD_V (unsigned int) index_substr_if_maxlen;
1670 LDAP_SLAPD_V (unsigned int) index_substr_any_len;
1671 LDAP_SLAPD_V (unsigned int) index_substr_any_step;
1672
1673 LDAP_SLAPD_V (ber_len_t) sockbuf_max_incoming;
1674 LDAP_SLAPD_V (ber_len_t) sockbuf_max_incoming_auth;
1675 LDAP_SLAPD_V (int)              slap_conn_max_pending;
1676 LDAP_SLAPD_V (int)              slap_conn_max_pending_auth;
1677
1678 LDAP_SLAPD_V (slap_mask_t)      global_allows;
1679 LDAP_SLAPD_V (slap_mask_t)      global_disallows;
1680
1681 LDAP_SLAPD_V (BerVarray)        default_referral;
1682 LDAP_SLAPD_V (const char)       Versionstr[];
1683
1684 LDAP_SLAPD_V (int)              global_gentlehup;
1685 LDAP_SLAPD_V (int)              global_idletimeout;
1686 LDAP_SLAPD_V (char *)   global_host;
1687 LDAP_SLAPD_V (char *)   global_realm;
1688 LDAP_SLAPD_V (char **)  default_passwd_hash;
1689 LDAP_SLAPD_V (int)              lber_debug;
1690 LDAP_SLAPD_V (int)              ldap_syslog;
1691 LDAP_SLAPD_V (struct berval)    default_search_base;
1692 LDAP_SLAPD_V (struct berval)    default_search_nbase;
1693
1694 LDAP_SLAPD_V (slap_counters_t)  slap_counters;
1695
1696 LDAP_SLAPD_V (char *)           slapd_pid_file;
1697 LDAP_SLAPD_V (char *)           slapd_args_file;
1698 LDAP_SLAPD_V (time_t)           starttime;
1699
1700 /* use time(3) -- no mutex */
1701 #define slap_get_time() time( NULL )
1702
1703 LDAP_SLAPD_V (ldap_pvt_thread_pool_t)   connection_pool;
1704 LDAP_SLAPD_V (int)                      connection_pool_max;
1705
1706 LDAP_SLAPD_V (ldap_pvt_thread_mutex_t)  entry2str_mutex;
1707 LDAP_SLAPD_V (ldap_pvt_thread_mutex_t)  replog_mutex;
1708
1709 #ifndef HAVE_GMTIME_R
1710 LDAP_SLAPD_V (ldap_pvt_thread_mutex_t)  gmtime_mutex;
1711 #endif
1712
1713 LDAP_SLAPD_V (ldap_pvt_thread_mutex_t)  ad_undef_mutex;
1714 LDAP_SLAPD_V (ldap_pvt_thread_mutex_t)  oc_undef_mutex;
1715
1716 LDAP_SLAPD_V (ber_socket_t)     dtblsize;
1717
1718 LDAP_SLAPD_V (int)              use_reverse_lookup;
1719
1720 LDAP_SLAPD_V (struct berval)    AllUser;
1721 LDAP_SLAPD_V (struct berval)    AllOper;
1722 LDAP_SLAPD_V (struct berval)    NoAttrs;
1723
1724 /*
1725  * operations
1726  */
1727 LDAP_SLAPD_F (int) do_abandon LDAP_P((Operation *op, SlapReply *rs));
1728 LDAP_SLAPD_F (int) do_add LDAP_P((Operation *op, SlapReply *rs));
1729 LDAP_SLAPD_F (int) do_bind LDAP_P((Operation *op, SlapReply *rs));
1730 LDAP_SLAPD_F (int) do_compare LDAP_P((Operation *op, SlapReply *rs));
1731 LDAP_SLAPD_F (int) do_delete LDAP_P((Operation *op, SlapReply *rs));
1732 LDAP_SLAPD_F (int) do_modify LDAP_P((Operation *op, SlapReply *rs));
1733 LDAP_SLAPD_F (int) do_modrdn LDAP_P((Operation *op, SlapReply *rs));
1734 LDAP_SLAPD_F (int) do_search LDAP_P((Operation *op, SlapReply *rs));
1735 LDAP_SLAPD_F (int) do_unbind LDAP_P((Operation *op, SlapReply *rs));
1736 LDAP_SLAPD_F (int) do_extended LDAP_P((Operation *op, SlapReply *rs));
1737
1738 /*
1739  * frontend operations
1740  */
1741 LDAP_SLAPD_F (int) fe_op_abandon LDAP_P((Operation *op, SlapReply *rs));
1742 LDAP_SLAPD_F (int) fe_op_add LDAP_P((Operation *op, SlapReply *rs));
1743 LDAP_SLAPD_F (int) fe_op_bind LDAP_P((Operation *op, SlapReply *rs));
1744 LDAP_SLAPD_F (int) fe_op_compare LDAP_P((Operation *op, SlapReply *rs));
1745 LDAP_SLAPD_F (int) fe_op_delete LDAP_P((Operation *op, SlapReply *rs));
1746 LDAP_SLAPD_F (int) fe_op_modify LDAP_P((Operation *op, SlapReply *rs));
1747 LDAP_SLAPD_F (int) fe_op_modrdn LDAP_P((Operation *op, SlapReply *rs));
1748 LDAP_SLAPD_F (int) fe_op_search LDAP_P((Operation *op, SlapReply *rs));
1749 LDAP_SLAPD_F (int) fe_aux_operational LDAP_P((Operation *op, SlapReply *rs));
1750 #if 0
1751 LDAP_SLAPD_F (int) fe_op_unbind LDAP_P((Operation *op, SlapReply *rs));
1752 #endif
1753 LDAP_SLAPD_F (int) fe_extended LDAP_P((Operation *op, SlapReply *rs));
1754 LDAP_SLAPD_F (int) fe_acl_group LDAP_P((
1755         Operation *op,
1756         Entry   *target,
1757         struct berval *gr_ndn,
1758         struct berval *op_ndn,
1759         ObjectClass *group_oc,
1760         AttributeDescription *group_at ));
1761 LDAP_SLAPD_F (int) fe_acl_attribute LDAP_P((
1762         Operation *op,
1763         Entry   *target,
1764         struct berval   *edn,
1765         AttributeDescription *entry_at,
1766         BerVarray *vals,
1767         slap_access_t access ));
1768 LDAP_SLAPD_F (int) fe_access_allowed LDAP_P((
1769         Operation               *op,
1770         Entry                   *e,
1771         AttributeDescription    *desc,
1772         struct berval           *val,
1773         slap_access_t           access,
1774         AccessControlState      *state,
1775         slap_mask_t             *maskp ));
1776
1777 /* NOTE: this macro assumes that bv has been allocated
1778  * by ber_* malloc functions or is { 0L, NULL } */
1779 #if defined(HAVE_BIGNUM)
1780 #define UI2BVX(bv,ui,ctx) \
1781         do { \
1782                 char            *val; \
1783                 ber_len_t       len; \
1784                 val = BN_bn2dec(ui); \
1785                 if (val) { \
1786                         len = strlen(val); \
1787                         if ( len > (bv)->bv_len ) { \
1788                                 (bv)->bv_val = ber_memrealloc_x( (bv)->bv_val, len + 1, (ctx) ); \
1789                         } \
1790                         AC_MEMCPY((bv)->bv_val, val, len + 1); \
1791                         (bv)->bv_len = len; \
1792                         OPENSSL_free(val); \
1793                 } else { \
1794                         ber_memfree_x( (bv)->bv_val, (ctx) ); \
1795                         BER_BVZERO( (bv) ); \
1796                 } \
1797         } while ( 0 )
1798 #elif defined(HAVE_GMP)
1799 /* NOTE: according to the documentation, the result 
1800  * of mpz_sizeinbase() can exceed the length of the
1801  * string representation of the number by 1
1802  */
1803 #define UI2BVX(bv,ui,ctx) \
1804         do { \
1805                 ber_len_t       len = mpz_sizeinbase( (ui), 10 ); \
1806                 if ( len > (bv)->bv_len ) { \
1807                         (bv)->bv_val = ber_memrealloc_x( (bv)->bv_val, len + 1, (ctx) ); \
1808                 } \
1809                 (void)mpz_get_str( (bv)->bv_val, 10, (ui) ); \
1810                 if ( (bv)->bv_val[ len - 1 ] == '\0' ) { \
1811                         len--; \
1812                 } \
1813                 (bv)->bv_len = len; \
1814         } while ( 0 )
1815 #else /* ! HAVE_BIGNUM && ! HAVE_GMP */
1816 #ifdef HAVE_LONG_LONG
1817 #define UI2BV_FORMAT    "%llu"
1818 #else /* ! HAVE_LONG_LONG */
1819 #define UI2BV_FORMAT    "%lu"
1820 #endif /* ! HAVE_LONG_LONG */
1821 #define UI2BVX(bv,ui,ctx) \
1822         do { \
1823                 char            buf[] = "+9223372036854775807L"; \
1824                 ber_len_t       len; \
1825                 len = snprintf( buf, sizeof( buf ), UI2BV_FORMAT, (ui) ); \
1826                 if ( len > (bv)->bv_len ) { \
1827                         (bv)->bv_val = ber_memrealloc_x( (bv)->bv_val, len + 1, (ctx) ); \
1828                 } \
1829                 (bv)->bv_len = len; \
1830                 AC_MEMCPY( (bv)->bv_val, buf, len + 1 ); \
1831         } while ( 0 )
1832 #endif /* ! HAVE_GMP */
1833
1834 #define UI2BV(bv,ui)    UI2BVX(bv,ui,NULL)
1835
1836 LDAP_END_DECL
1837
1838 #endif /* PROTO_SLAP_H */
1839