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