]> git.sur5r.net Git - openldap/blob - servers/slapd/frontend.c
1495edd176aef17af8fbfd45d05f22007f754930
[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 #if 0
69         /* FIXME: do we need this? */
70         frontendDB->be_pcl_mutexp = &frontendDB->be_pcl_mutex;
71         ldap_pvt_thread_mutex_init( frontendDB->be_pcl_mutexp );
72
73         LDAP_STAILQ_INIT( &frontendDB->be_syncinfo );
74 #endif
75
76         /* suffix */
77         frontendDB->be_suffix = ch_calloc( 2, sizeof( struct berval ) );
78         ber_str2bv( "", 0, 1, &frontendDB->be_suffix[0] );
79         BER_BVZERO( &frontendDB->be_suffix[1] );
80         frontendDB->be_nsuffix = ch_calloc( 2, sizeof( struct berval ) );
81         ber_str2bv( "", 0, 1, &frontendDB->be_nsuffix[0] );
82         BER_BVZERO( &frontendDB->be_nsuffix[1] );
83
84         /* info */
85         frontendDB->bd_info = &slap_frontendInfo;
86
87         /* name */
88         frontendDB->bd_info->bi_type = "frontend";
89
90         /* known controls */
91         frontendDB->bd_info->bi_controls = slap_known_controls;
92
93         /* calls */
94         frontendDB->bd_info->bi_op_abandon = fe_op_abandon;
95         frontendDB->bd_info->bi_op_add = fe_op_add;
96         frontendDB->bd_info->bi_op_bind = fe_op_bind;
97         frontendDB->bd_info->bi_op_compare = fe_op_compare;
98         frontendDB->bd_info->bi_op_delete = fe_op_delete;
99         frontendDB->bd_info->bi_op_modify = fe_op_modify;
100         frontendDB->bd_info->bi_op_modrdn = fe_op_modrdn;
101         frontendDB->bd_info->bi_op_search = fe_op_search;
102         frontendDB->bd_info->bi_extended = fe_extended;
103
104 #if 0
105         /* FIXME: is this too early? */
106         return backend_startup_one( frontendDB );
107 #endif
108
109         return 0;
110 }
111