3 * Copyright 1999, John C. Quillan, All rights reserved.
5 * Redistribution and use in source and binary forms are permitted only
6 * as authorized by the OpenLDAP Public License. A copy of this
7 * license is available at http://www.OpenLDAP.org/license.html or
8 * in file LICENSE in the top-level directory of the distribution.
12 /* init.c - initialize shell backend */
15 /* #include <ac/types.h>
16 #include <ac/socket.h>
25 #include "perl_back.h"
28 static void perl_back_xs_init LDAP_P((void));
29 EXT void boot_DynaLoader LDAP_P((CV* cv));
31 PerlInterpreter *perl_interpreter = NULL;
32 ldap_pvt_thread_mutex_t perl_interpreter_mutex;
34 #ifdef SLAPD_PERL_DYNAMIC
36 int back_perl_LTX_init_module(int argc, char *argv[]) {
39 memset( &bi, '\0', sizeof(bi) );
41 bi.bi_init = perl_back_initialize;
47 #endif /* SLAPD_PERL_DYNAMIC */
50 /**********************************************************
54 **********************************************************/
61 char *embedding[] = { "", "-e", "0" };
63 Debug( LDAP_DEBUG_TRACE, "perl backend open\n", 0, 0, 0 );
65 if( perl_interpreter != NULL ) {
66 Debug( LDAP_DEBUG_ANY, "perl backend open: already opened\n",
71 perl_interpreter = perl_alloc();
72 perl_construct(perl_interpreter);
73 perl_parse(perl_interpreter, perl_back_xs_init, 3, embedding, (char **)NULL);
74 perl_run(perl_interpreter);
76 bi->bi_open = perl_back_open;
78 bi->bi_close = perl_back_close;
79 bi->bi_destroy = perl_back_destroy;
81 bi->bi_db_init = perl_back_db_init;
82 bi->bi_db_config = perl_back_db_config;
85 bi->bi_db_destroy = perl_back_db_destroy;
87 bi->bi_op_bind = perl_back_bind;
88 bi->bi_op_unbind = perl_back_unbind;
89 bi->bi_op_search = perl_back_search;
90 bi->bi_op_compare = perl_back_compare;
91 bi->bi_op_modify = perl_back_modify;
92 bi->bi_op_modrdn = perl_back_modrdn;
93 bi->bi_op_add = perl_back_add;
94 bi->bi_op_delete = perl_back_delete;
95 bi->bi_op_abandon = 0;
100 bi->bi_acl_attribute = 0;
101 bi->bi_chk_referrals = 0;
103 bi->bi_connection_init = 0;
104 bi->bi_connection_destroy = 0;
114 ldap_pvt_thread_mutex_init( &perl_interpreter_mutex );
123 be->be_private = (PerlBackend *) ch_malloc( sizeof(PerlBackend) );
124 memset( be->be_private, '\0', sizeof(PerlBackend));
126 Debug( LDAP_DEBUG_TRACE, "perl backend db init\n", 0, 0, 0 );
135 char *file = __FILE__;
137 newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);