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