]> git.sur5r.net Git - openldap/blob - servers/slapd/back-perl/init.c
function pointers are incompatible with `void *'; remove NULL or replace with 0
[openldap] / servers / slapd / back-perl / init.c
1 /*
2  *       Copyright 1999, John C. Quillan, All rights reserved.
3  *
4  *       Redistribution and use in source and binary forms are permitted only
5  *       as authorized by the OpenLDAP Public License.  A copy of this
6  *       license is available at http://www.OpenLDAP.org/license.html or
7  *       in file LICENSE in the top-level directory of the distribution.
8  */
9
10 #include "portable.h"
11  /* init.c - initialize shell backend */
12         
13 #include <stdio.h>
14 /* #include <ac/types.h>
15         #include <ac/socket.h>
16 */
17
18 #include <EXTERN.h>
19 #include <perl.h>
20
21
22 #include "slap.h"
23 #include "perl_back.h"
24
25
26 PerlInterpreter *perl_interpreter = NULL;
27 ldap_pvt_thread_mutex_t perl_interpreter_mutex;
28
29
30 /**********************************************************
31  *
32  * Init
33  *
34  **********************************************************/
35
36 int
37 perl_back_initialize(
38         BackendInfo     *bi
39 )
40 {
41         char *embedding[] = { "", "-e", "0" };
42
43         Debug( LDAP_DEBUG_TRACE, "perl backend open\n", 0, 0, 0 );
44
45         if( perl_interpreter != NULL ) {
46                 Debug( LDAP_DEBUG_ANY, "perl backend open: already opened\n",
47                         0, 0, 0 );
48                 return 1;
49         }
50         
51         perl_interpreter = perl_alloc();
52         perl_construct(perl_interpreter);
53         perl_parse(perl_interpreter, NULL, 3, embedding, (char **)NULL);
54         perl_run(perl_interpreter);
55
56         bi->bi_open = perl_back_open;
57         bi->bi_config = 0;
58         bi->bi_close = perl_back_close;
59         bi->bi_destroy = perl_back_destroy;
60
61         bi->bi_db_init = perl_back_db_init;
62         bi->bi_db_config = perl_back_db_config;
63         bi->bi_db_open = 0;
64         bi->bi_db_close = 0;
65         bi->bi_db_destroy = perl_back_db_destroy;
66
67         bi->bi_op_bind = perl_back_bind;
68         bi->bi_op_unbind = perl_back_unbind;
69         bi->bi_op_search = perl_back_search;
70         bi->bi_op_compare = perl_back_compare;
71         bi->bi_op_modify = perl_back_modify;
72         bi->bi_op_modrdn = perl_back_modrdn;
73         bi->bi_op_add = perl_back_add;
74         bi->bi_op_delete = perl_back_delete;
75         bi->bi_op_abandon = 0;
76
77 #ifdef SLAPD_ACLGROUPS
78         bi->bi_acl_group = 0;
79 #endif
80
81         return 0;
82 }
83                 
84 int
85 perl_back_open(
86         BackendInfo     *bi
87 )
88 {
89         ldap_pvt_thread_mutex_init( &perl_interpreter_mutex );
90         return 0;
91 }
92
93 int
94 perl_back_db_init(
95         Backend *be
96 )
97 {
98         be->be_private = (PerlBackend *) ch_malloc( sizeof(PerlBackend) );
99         memset(&be->be_private, 0, sizeof(PerlBackend));
100
101         Debug( LDAP_DEBUG_TRACE, "perl backend db init\n", 0, 0, 0 );
102
103         return 0;
104 }
105