]> git.sur5r.net Git - openldap/blob - servers/slapd/overlays/overlays.c
Overlay build environment
[openldap] / servers / slapd / overlays / overlays.c
1 /* overlays.c - Static overlay framework */
2 /* $OpenLDAP$ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4  *
5  * Copyright 2003 The OpenLDAP Foundation.
6  * Copyright 2003 by Howard Chu.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted only as authorized by the OpenLDAP
11  * Public License.
12  *
13  * A copy of this license is available in the file LICENSE in the
14  * top-level directory of the distribution or, alternatively, at
15  * <http://www.OpenLDAP.org/license.html>.
16  */
17 /* ACKNOWLEDGEMENTS:
18  * This work was initially developed by Howard Chu for inclusion in
19  * OpenLDAP Software.
20  */
21
22 #include "portable.h"
23
24 #include "slap.h"
25
26
27 #if SLAPD_OVER_DYNGROUP == SLAPD_MOD_STATIC
28 extern int dyngroup_init();
29 #endif
30 #if SLAPD_OVER_PROXYCACHE == SLAPD_MOD_STATIC
31 extern int pcache_init();
32 #endif
33
34 static struct {
35         char *name;
36         int (*func)();
37 } funcs[] = {
38 #if SLAPD_OVER_DYNGROUP == SLAPD_MOD_STATIC
39         { "Dynamic Group", dyngroup_init },
40 #endif
41 #if SLAPD_OVER_PROXYCACHE == SLAPD_MOD_STATIC
42         { "Proxy Cache", pcache_init },
43 #endif
44         { NULL, NULL }
45 };
46
47 int overlay_init() {
48         int i, rc = 0;
49
50         for ( i=0; funcs[i].name; i++ ) {
51                 rc = funcs[i].func();
52                 if ( rc ) {
53 #ifdef NEW_LOGGING
54                         LDAP_LOG( BACKEND, ERR,
55                 "%s overlay setup failed, err %d\n", funcs[i].name, rc, 0 );
56 #else
57                         Debug( LDAP_DEBUG_ANY,
58                 "%s overlay setup failed, err %d\n", funcs[i].name, rc, 0 );
59 #endif
60                         break;
61                 }
62         }
63         return rc;
64 }