]> git.sur5r.net Git - openldap/blob - servers/slapd/proto-slap.h
Further trim_refs_url fixes from Hallvard. Need additional testing.
[openldap] / servers / slapd / proto-slap.h
1 /*
2  * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
3  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
4  */
5 #ifndef _PROTO_SLAP
6 #define _PROTO_SLAP
7
8 #include <ldap_cdefs.h>
9
10 LDAP_BEGIN_DECL
11
12 /*
13  * acl.c
14  */
15
16 int access_allowed LDAP_P(( Backend *be, Connection *conn,
17         Operation *op, Entry *e,
18         char *attr, struct berval *val, int access ));
19
20 AccessControl * acl_get_applicable LDAP_P(( Backend *be,
21         Operation *op, Entry *e,
22         char *attr, int nmatches, regmatch_t *matches ));
23
24 int acl_access_allowed LDAP_P((
25         AccessControl *a, char *attr, Backend *be, Connection *conn, Entry *e,
26         struct berval *val, Operation *op, int  access, char *edn,
27         regmatch_t *matches ));
28
29 int acl_check_modlist LDAP_P(( Backend *be,
30         Connection *conn,
31         Operation *op,
32         Entry *e,
33         LDAPModList *ml ));
34
35 /*
36  * aclparse.c
37  */
38
39 void parse_acl LDAP_P(( Backend *be,
40         const char *fname,
41         int lineno,
42         int argc, char **argv ));
43 char * access2str LDAP_P(( int access ));
44 int str2access LDAP_P(( char *str ));
45
46 /*
47  * attr.c
48  */
49
50 void attr_free LDAP_P(( Attribute *a ));
51 Attribute *attr_dup LDAP_P(( Attribute *a ));
52 char * attr_normalize LDAP_P(( char *s ));
53 int attr_merge_fast LDAP_P(( Entry *e, char *type, struct berval **vals, int  nvals,
54         int  naddvals, int  *maxvals, Attribute ***a ));
55 int attr_merge LDAP_P(( Entry *e, char *type, struct berval **vals ));
56 Attribute * attr_find LDAP_P(( Attribute *a, const char *type ));
57 int attr_delete LDAP_P(( Attribute **attrs, const char *type ));
58 int attr_syntax LDAP_P(( char *type ));
59 void attr_syntax_config LDAP_P(( const char *fname, int lineno, int argc, char **argv ));
60 AttributeType * at_find LDAP_P(( const char *name ));
61 int at_find_in_list LDAP_P(( AttributeType *sat, AttributeType **list ));
62 int at_append_to_list LDAP_P(( AttributeType *sat, AttributeType ***listp ));
63 int at_delete_from_list LDAP_P(( int pos, AttributeType ***listp ));
64 int at_fake_if_needed LDAP_P(( char *name ));
65 int at_schema_info LDAP_P(( Entry *e ));
66 int at_add LDAP_P(( LDAP_ATTRIBUTE_TYPE *at, const char **err ));
67 char * at_canonical_name LDAP_P(( char * a_type ));
68
69 void attrs_free LDAP_P(( Attribute *a ));
70 Attribute *attrs_dup LDAP_P(( Attribute *a ));
71
72 /*
73  * ava.c
74  */
75
76 int get_ava LDAP_P(( BerElement *ber, Ava *ava ));
77 void ava_free LDAP_P(( Ava *ava, int freeit ));
78
79 /*
80  * backend.c
81  */
82
83 int backend_init LDAP_P((void));
84 int backend_add LDAP_P((BackendInfo *aBackendInfo));
85 int backend_num LDAP_P((Backend *be));
86 int backend_startup LDAP_P((Backend *be));
87 int backend_shutdown LDAP_P((Backend *be));
88 int backend_destroy LDAP_P((void));
89
90 BackendInfo * backend_info LDAP_P(( const char *type ));
91 BackendDB * backend_db_init LDAP_P(( const char *type ));
92
93 BackendDB * select_backend LDAP_P(( const char * dn ));
94
95 int be_issuffix LDAP_P(( Backend *be, const char *suffix ));
96 int be_isroot LDAP_P(( Backend *be, const char *ndn ));
97 int be_isroot_pw LDAP_P(( Backend *be, const char *ndn, struct berval *cred ));
98 char* be_root_dn LDAP_P(( Backend *be ));
99 int be_entry_release_rw LDAP_P(( Backend *be, Entry *e, int rw ));
100 #define be_entry_release_r( be, e ) be_entry_release_rw( be, e, 0 )
101 #define be_entry_release_w( be, e ) be_entry_release_rw( be, e, 1 )
102
103
104 extern int      backend_unbind LDAP_P((Connection *conn, Operation *op));
105
106 extern int      backend_connection_init LDAP_P((Connection *conn));
107 extern int      backend_connection_destroy LDAP_P((Connection *conn));
108
109 extern int      backend_group LDAP_P((Backend *be,
110         Entry *target,
111         const char *gr_ndn,
112         const char *op_ndn,
113         const char *objectclassValue,
114         const char *groupattrName));
115
116 #ifdef SLAPD_SCHEMA_DN
117 /* temporary extern for temporary routine*/
118 extern Attribute *backend_subschemasubentry( Backend * );
119 #endif
120
121
122 /*
123  * ch_malloc.c
124  */
125
126 #ifdef CSRIMALLOC
127 #define ch_malloc malloc
128 #define ch_realloc realloc
129 #define ch_calloc calloc
130 #define ch_strdup strdup
131 #define ch_free free
132
133 #else
134 void * ch_malloc LDAP_P(( ber_len_t size ));
135 void * ch_realloc LDAP_P(( void *block, ber_len_t size ));
136 void * ch_calloc LDAP_P(( ber_len_t nelem, ber_len_t size ));
137 char * ch_strdup LDAP_P(( const char *string ));
138 void   ch_free LDAP_P(( void * ));
139
140 #ifndef CH_FREE
141 #undef free
142 #define free ch_free
143 #endif
144 #endif
145
146 /*
147  * charray.c
148  */
149
150 void charray_add LDAP_P(( char ***a, const char *s ));
151 void charray_merge LDAP_P(( char ***a, char **s ));
152 void charray_free LDAP_P(( char **array ));
153 int charray_inlist LDAP_P(( char **a, const char *s ));
154 char ** charray_dup LDAP_P(( char **a ));
155 char ** str2charray LDAP_P(( const char *str, const char *brkstr ));
156 char * charray2str LDAP_P(( char **a ));
157
158 /*
159  * controls.c
160  */
161 int get_ctrls LDAP_P((
162         Connection *co,
163         Operation *op,
164         int senderrors ));
165
166 int get_manageDSAit LDAP_P(( Operation *op ));
167
168 /*
169  * config.c
170  */
171
172 int read_config LDAP_P(( const char *fname ));
173
174 /*
175  * connection.c
176  */
177 int connections_init LDAP_P((void));
178 int connections_shutdown LDAP_P((void));
179 int connections_destroy LDAP_P((void));
180 int connections_timeout_idle LDAP_P((time_t));
181
182 long connection_init LDAP_P((
183         ber_socket_t s,
184         const char* url,
185         const char* dnsname,
186         const char* peername,
187         const char* sockname,
188         int use_tls ));
189
190 void connection_closing LDAP_P(( Connection *c ));
191 int connection_state_closing LDAP_P(( Connection *c ));
192 const char *connection_state2str LDAP_P(( int state )) LDAP_GCCATTR((const));
193
194 int connection_write LDAP_P((ber_socket_t s));
195 int connection_read LDAP_P((ber_socket_t s));
196
197 unsigned long connections_nextid(void);
198
199 Connection* connection_first LDAP_P((ber_socket_t *));
200 Connection* connection_next LDAP_P((Connection *, ber_socket_t *));
201 void connection_done LDAP_P((Connection *));
202
203 /*
204  * dn.c
205  */
206
207 char * dn_normalize LDAP_P(( char *dn ));
208 char * dn_normalize_case LDAP_P(( char *dn ));
209 char * dn_parent LDAP_P(( Backend *be, const char *dn ));
210 char ** dn_subtree LDAP_P(( Backend *be, const char *dn ));
211 char * dn_rdn LDAP_P(( Backend *be, char *dn ));
212 int dn_issuffix LDAP_P(( char *dn, char *suffix ));
213 #ifdef DNS_DN
214 int dn_type LDAP_P(( char *dn ));
215 #endif
216 int rdn_validate LDAP_P(( const char* str ));
217 char * rdn_attr_value LDAP_P(( char * rdn ));
218 char * rdn_attr_type LDAP_P(( char * rdn ));
219
220 void build_new_dn LDAP_P(( char ** new_dn,
221         const char *e_dn,
222         const char * p_dn,
223         const char * newrdn ));
224 /*
225  * entry.c
226  */
227
228 int entry_destroy LDAP_P((void));
229
230 Entry * str2entry LDAP_P(( char *s ));
231 char * entry2str LDAP_P(( Entry *e, int *len ));
232 void entry_free LDAP_P(( Entry *e ));
233
234 int entry_cmp LDAP_P(( Entry *a, Entry *b ));
235 int entry_dn_cmp LDAP_P(( Entry *a, Entry *b ));
236 int entry_id_cmp LDAP_P(( Entry *a, Entry *b ));
237
238 /*
239  * filter.c
240  */
241
242 int get_filter LDAP_P(( Connection *conn, BerElement *ber, Filter **filt, char **fstr ));
243 void filter_free LDAP_P(( Filter *f ));
244 void filter_print LDAP_P(( Filter *f ));
245
246 /*
247  * filterentry.c
248  */
249
250 int test_filter LDAP_P(( Backend *be, Connection *conn, Operation *op, Entry *e,
251         Filter  *f ));
252
253 /*
254  * lock.c
255  */
256
257 FILE * lock_fopen LDAP_P(( const char *fname, const char *type, FILE **lfp ));
258 int lock_fclose LDAP_P(( FILE *fp, FILE *lfp ));
259
260 /*
261  * module.c
262  */
263
264 #ifdef SLAPD_MODULES
265 int module_load LDAP_P(( const char* file_name, int argc, char *argv[] ));
266 int module_path LDAP_P(( const char* path ));
267 #endif /* SLAPD_MODULES */
268
269 /*
270  * monitor.c
271  */
272 extern char *supportedExtensions[];
273 extern char *supportedControls[];
274
275 void monitor_info LDAP_P((
276         Connection *conn,
277         Operation *op,
278         char ** attrs,
279         int attrsonly ));
280
281 /*
282  * operation.c
283  */
284
285 void slap_op_free LDAP_P(( Operation *op ));
286 Operation * slap_op_alloc LDAP_P((
287         BerElement *ber, ber_int_t msgid,
288         ber_tag_t tag, ber_int_t id ));
289
290 int slap_op_add LDAP_P(( Operation **olist, Operation *op ));
291 int slap_op_remove LDAP_P(( Operation **olist, Operation *op ));
292 Operation * slap_op_pop LDAP_P(( Operation **olist ));
293
294 /*
295  * phonetic.c
296  */
297
298 char * first_word LDAP_P(( char *s ));
299 char * next_word LDAP_P(( char *s ));
300 char * word_dup LDAP_P(( char *w ));
301 char * phonetic LDAP_P(( char *s ));
302
303 /*
304  * repl.c
305  */
306
307 void replog LDAP_P(( Backend *be, Operation *op, char *dn, void *change ));
308
309 /*
310  * result.c
311  */
312
313 struct berval **get_entry_referrals LDAP_P((
314         Backend *be, Connection *conn, Operation *op,
315         Entry *e ));
316
317 void send_ldap_result LDAP_P((
318         Connection *conn, Operation *op,
319         int err, const char *matched, const char *text,
320         struct berval **refs,
321         LDAPControl **ctrls ));
322
323 void send_ldap_disconnect LDAP_P((
324         Connection *conn, Operation *op,
325         int err, const char *text ));
326
327 void send_search_result LDAP_P((
328         Connection *conn, Operation *op,
329         int err, const char *matched, const char *text,
330         struct berval **refs,
331         LDAPControl **ctrls,
332         int nentries ));
333
334 int send_search_reference LDAP_P((
335         Backend *be, Connection *conn, Operation *op,
336         Entry *e, struct berval **refs, int scope,
337         LDAPControl **ctrls,
338         struct berval ***v2refs ));
339
340 int send_search_entry LDAP_P((
341         Backend *be, Connection *conn, Operation *op,
342         Entry *e, char **attrs, int attrsonly,
343         LDAPControl **ctrls ));
344
345 int str2result LDAP_P(( char *s,
346         int *code, char **matched, char **info ));
347
348 /*
349  * sasl.c
350  */
351 extern char **supportedSASLMechanisms;
352
353 int sasl_init(void);
354 int sasl_destroy(void);
355
356 /*
357  * schema.c
358  */
359
360 int oc_schema_check LDAP_P(( Entry *e ));
361 int oc_check_operational_attr LDAP_P(( const char *type ));
362 int oc_check_usermod_attr LDAP_P(( const char *type ));
363 int oc_check_no_usermod_attr LDAP_P(( const char *type ));
364 ObjectClass *oc_find LDAP_P((const char *ocname));
365 int oc_add LDAP_P((LDAP_OBJECT_CLASS *oc, const char **err));
366 Syntax *syn_find LDAP_P((const char *synname));
367 Syntax *syn_find_desc LDAP_P((const char *syndesc, int *slen));
368 int syn_add LDAP_P((LDAP_SYNTAX *syn, slap_syntax_check_func *check, const char **err));
369 MatchingRule *mr_find LDAP_P((const char *mrname));
370 int mr_add LDAP_P((LDAP_MATCHING_RULE *mr, slap_mr_normalize_func *normalize, slap_mr_compare_func *compare, const char **err));
371 int case_ignore_normalize LDAP_P((struct berval *val, struct berval **normalized));
372 int register_syntax LDAP_P((char *desc, slap_syntax_check_func *check ));
373 int register_matching_rule LDAP_P((char * desc, slap_mr_normalize_func *normalize, slap_mr_compare_func *compare));
374 void schema_info LDAP_P((Connection *conn, Operation *op, char **attrs, int attrsonly));
375 int schema_init LDAP_P((void));
376
377 int is_entry_objectclass LDAP_P(( Entry *, const char* objectclass ));
378 #define is_entry_alias(e)               is_entry_objectclass((e), "ALIAS")
379 #define is_entry_referral(e)    is_entry_objectclass((e), "REFERRAL")
380
381
382 /*
383  * schemaparse.c
384  */
385
386 void parse_oc_old LDAP_P(( Backend *be, const char *fname, int lineno, int argc, char **argv ));
387 void parse_oc LDAP_P(( const char *fname, int lineno, char *line, char **argv ));
388 void parse_at LDAP_P(( const char *fname, int lineno, char *line, char **argv ));
389 void parse_oidm LDAP_P(( const char *fname, int lineno, int argc, char **argv ));
390 char *scherr2str LDAP_P((int code)) LDAP_GCCATTR((const));
391 int dscompare LDAP_P(( const char *s1, const char *s2del, char delim ));
392 /*
393  * str2filter.c
394  */
395
396 Filter * str2filter LDAP_P(( char *str ));
397
398 /*
399  * suffixalias.c
400  */
401 char *suffix_alias LDAP_P(( Backend *be, char *ndn ));
402
403 /*
404  * value.c
405  */
406
407 int value_add_fast LDAP_P(( struct berval ***vals, struct berval **addvals, int nvals,
408         int naddvals, int *maxvals ));
409 int value_add LDAP_P(( struct berval ***vals, struct berval **addvals ));
410 void value_normalize LDAP_P(( char *s, int syntax ));
411 int value_cmp LDAP_P(( struct berval *v1, struct berval *v2, int syntax,
412         int normalize ));
413 int value_find LDAP_P(( struct berval **vals, struct berval *v, int syntax,
414         int normalize ));
415
416 /*
417  * user.c
418  */
419 #if defined(HAVE_PWD_H) && defined(HAVE_GRP_H)
420 void slap_init_user LDAP_P(( char *username, char *groupname ));
421 #endif
422
423 /*
424  * Other...
425  */
426
427 extern struct berval **default_referral;
428 extern char             *replogfile;
429 extern const char Versionstr[];
430 extern int              active_threads;
431 extern int              defsize;
432 extern int              deftime;
433 extern int              g_argc;
434 extern int              global_default_access;
435 extern int              global_readonly;
436 extern int              global_lastmod;
437 extern int              global_idletimeout;
438 extern int              global_schemacheck;
439 extern char             *global_realm;
440 extern int              lber_debug;
441 extern int              ldap_syslog;
442
443 extern ldap_pvt_thread_mutex_t  num_sent_mutex;
444 extern long             num_bytes_sent;
445 extern long             num_pdu_sent;
446 extern long             num_entries_sent;
447 extern long             num_refs_sent;
448
449 extern ldap_pvt_thread_mutex_t  num_ops_mutex;
450 extern long             num_ops_completed;
451 extern long             num_ops_initiated;
452
453 extern char   *slapd_pid_file;
454 extern char   *slapd_args_file;
455 extern char             **g_argv;
456 extern time_t   starttime;
457
458 time_t slap_get_time LDAP_P((void));
459
460 extern ldap_pvt_thread_mutex_t  active_threads_mutex;
461 extern ldap_pvt_thread_cond_t   active_threads_cond;
462
463 extern ldap_pvt_thread_mutex_t  entry2str_mutex;
464 extern ldap_pvt_thread_mutex_t  replog_mutex;
465
466 #ifdef SLAPD_CRYPT
467 extern ldap_pvt_thread_mutex_t  crypt_mutex;
468 #endif
469 extern ldap_pvt_thread_mutex_t  gmtime_mutex;
470
471 extern AccessControl *global_acl;
472
473 int     slap_init LDAP_P((int mode, char* name));
474 int     slap_startup LDAP_P(( Backend *be ));
475 int     slap_shutdown LDAP_P(( Backend *be ));
476 int     slap_destroy LDAP_P((void));
477
478 struct sockaddr_in;
479
480 extern int      slapd_daemon_init( char *urls, int port, int tls_port );
481 extern int      slapd_daemon_destroy(void);
482 extern int      slapd_daemon(void);
483
484 extern void slapd_set_write LDAP_P((ber_socket_t s, int wake));
485 extern void slapd_clr_write LDAP_P((ber_socket_t s, int wake));
486 extern void slapd_set_read LDAP_P((ber_socket_t s, int wake));
487 extern void slapd_clr_read LDAP_P((ber_socket_t s, int wake));
488
489 extern void slapd_remove LDAP_P((ber_socket_t s, int wake));
490
491 extern RETSIGTYPE slap_sig_shutdown LDAP_P((int sig));
492 extern RETSIGTYPE slap_sig_wake LDAP_P((int sig));
493
494 extern void     config_info LDAP_P((
495         Connection *conn,
496         Operation *op,
497         char ** attrs,
498         int attrsonly ));
499
500 extern void     root_dse_info LDAP_P((
501         Connection *conn,
502         Operation *op,
503         char ** attrs,
504         int attrsonly ));
505
506 extern int      do_abandon LDAP_P((Connection *conn, Operation *op));
507 extern int      do_add LDAP_P((Connection *conn, Operation *op));
508 extern int      do_bind LDAP_P((Connection *conn, Operation *op));
509 extern int      do_compare LDAP_P((Connection *conn, Operation *op));
510 extern int      do_delete LDAP_P((Connection *conn, Operation *op));
511 extern int      do_modify LDAP_P((Connection *conn, Operation *op));
512 extern int      do_modrdn LDAP_P((Connection *conn, Operation *op));
513 extern int      do_search LDAP_P((Connection *conn, Operation *op));
514 extern int      do_unbind LDAP_P((Connection *conn, Operation *op));
515 extern int      do_extended LDAP_P((Connection *conn, Operation *op));
516
517
518 extern ber_socket_t dtblsize;
519
520 LDAP_END_DECL
521
522 #endif /* _proto_slap */
523