]> git.sur5r.net Git - openldap/blob - servers/slapd/frontend.c
required by global overlay write funcs...
[openldap] / servers / slapd / frontend.c
1 /* frontend.c - routines for dealing with frontend */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3  *
4  * Copyright 1998-2004 The OpenLDAP Foundation.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted only as authorized by the OpenLDAP
9  * Public License.
10  *
11  * A copy of this license is available in the file LICENSE in the
12  * top-level directory of the distribution or, alternatively, at
13  * <http://www.OpenLDAP.org/license.html>.
14  */
15 /* Portions Copyright (c) 1995 Regents of the University of Michigan.
16  * All rights reserved.
17  *
18  * Redistribution and use in source and binary forms are permitted
19  * provided that this notice is preserved and that due credit is given
20  * to the University of Michigan at Ann Arbor. The name of the University
21  * may not be used to endorse or promote products derived from this
22  * software without specific prior written permission. This software
23  * is provided ``as is'' without express or implied warranty.
24  */
25
26
27 #include "portable.h"
28
29 #include <stdio.h>
30
31 #include <ac/string.h>
32 #include <ac/socket.h>
33 #include <sys/stat.h>
34
35 #include "slap.h"
36 #include "lutil.h"
37 #include "lber_pvt.h"
38
39 #include "ldap_rq.h"
40
41 #ifdef LDAP_SLAPI
42 #include "slapi/slapi.h"
43 #endif
44
45 BackendInfo     slap_frontendInfo;
46 BackendDB       slap_frontendDB;
47 BackendDB       *frontendDB;
48
49 int
50 frontend_init( void )
51 {
52         /* data */
53         frontendDB = &slap_frontendDB;
54
55         /* ACLs */
56         frontendDB->be_dfltaccess = ACL_READ;
57
58         /* limits */
59         frontendDB->be_def_limit.lms_t_soft = SLAPD_DEFAULT_TIMELIMIT;  /* backward compatible limits */
60         frontendDB->be_def_limit.lms_t_hard = 0;
61         frontendDB->be_def_limit.lms_s_soft = SLAPD_DEFAULT_SIZELIMIT;  /* backward compatible limits */
62         frontendDB->be_def_limit.lms_s_hard = 0;
63         frontendDB->be_def_limit.lms_s_unchecked = -1;                  /* no limit on unchecked size */
64         frontendDB->be_def_limit.lms_s_pr = 0;                          /* page limit */
65         frontendDB->be_def_limit.lms_s_pr_hide = 0;                     /* don't hide number of entries left */
66         frontendDB->be_def_limit.lms_s_pr_total = 0;                    /* number of total entries returned by pagedResults equal to hard limit */
67
68         /* FIXME: do we need this? */
69         frontendDB->be_pcl_mutexp = &frontendDB->be_pcl_mutex;
70         ldap_pvt_thread_mutex_init( frontendDB->be_pcl_mutexp );
71
72         LDAP_STAILQ_INIT( &frontendDB->be_syncinfo );
73
74         /* suffix */
75         frontendDB->be_suffix = ch_calloc( 2, sizeof( struct berval ) );
76         ber_str2bv( "", 0, 1, &frontendDB->be_suffix[0] );
77         BER_BVZERO( &frontendDB->be_suffix[1] );
78         frontendDB->be_nsuffix = ch_calloc( 2, sizeof( struct berval ) );
79         ber_str2bv( "", 0, 1, &frontendDB->be_nsuffix[0] );
80         BER_BVZERO( &frontendDB->be_nsuffix[1] );
81
82         /* info */
83         frontendDB->bd_info = &slap_frontendInfo;
84
85         /* name */
86         frontendDB->bd_info->bi_type = "frontend";
87
88         /* known controls */
89         frontendDB->bd_info->bi_controls = slap_known_controls;
90
91         /* calls */
92         frontendDB->bd_info->bi_op_abandon = fe_op_abandon;
93         frontendDB->bd_info->bi_op_add = fe_op_add;
94         frontendDB->bd_info->bi_op_bind = fe_op_bind;
95         frontendDB->bd_info->bi_op_compare = fe_op_compare;
96         frontendDB->bd_info->bi_op_delete = fe_op_delete;
97         frontendDB->bd_info->bi_op_modify = fe_op_modify;
98         frontendDB->bd_info->bi_op_modrdn = fe_op_modrdn;
99         frontendDB->bd_info->bi_op_search = fe_op_search;
100         frontendDB->bd_info->bi_extended = fe_extended;
101
102         /* FIXME: is this too early? */
103         return backend_startup_one( frontendDB );
104 }
105