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