1 /* init.c - initialize relay backend */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 2003-2004 The OpenLDAP Foundation.
5 * Portions Copyright 2004 Pierangelo Masarati.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
12 * A copy of this license is available in the file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
17 * This work was initially developed by Pierangelo Masarati for inclusion
18 * in OpenLDAP Software.
25 #include <ac/string.h>
26 #include <ac/socket.h>
29 #include "back-relay.h"
31 #ifdef SLAPD_RELAY_DYNAMIC
34 init_module( int argc, char *argv[] ) {
37 memset( &bi, '\0', sizeof( bi ) );
39 bi.bi_init = relay_back_initialize;
45 #endif /* SLAPD_RELAY_DYNAMIC */
48 relay_back_initialize( BackendInfo *bi )
56 bi->bi_db_init = relay_back_db_init;
57 bi->bi_db_config = relay_back_db_config;
58 bi->bi_db_open = relay_back_db_open;
59 bi->bi_db_close = 0 /* relay_back_db_close */ ;
60 bi->bi_db_destroy = relay_back_db_destroy;
62 bi->bi_op_bind = relay_back_op_bind;
63 bi->bi_op_unbind = relay_back_op_unbind;
64 bi->bi_op_search = relay_back_op_search;
65 bi->bi_op_compare = relay_back_op_compare;
66 bi->bi_op_modify = relay_back_op_modify;
67 bi->bi_op_modrdn = relay_back_op_modrdn;
68 bi->bi_op_add = relay_back_op_add;
69 bi->bi_op_delete = relay_back_op_delete;
70 bi->bi_op_abandon = relay_back_op_abandon;
71 bi->bi_op_cancel = relay_back_op_cancel;
72 bi->bi_extended = relay_back_op_extended;
73 bi->bi_entry_release_rw = relay_back_entry_release_rw;
74 bi->bi_entry_get_rw = relay_back_entry_get_rw;
75 bi->bi_chk_referrals = relay_back_chk_referrals;
76 bi->bi_operational = relay_back_operational;
77 bi->bi_has_subordinates = relay_back_has_subordinates;
79 bi->bi_connection_init = relay_back_connection_init;
80 bi->bi_connection_destroy = relay_back_connection_destroy;
86 relay_back_db_init( Backend *be )
90 ri = (relay_back_info *)ch_calloc( 1, sizeof( relay_back_info ) );
97 be->be_private = (void *)ri;
103 relay_back_db_open( Backend *be )
105 relay_back_info *ri = (relay_back_info *)be->be_private;
107 assert( ri != NULL );
110 be->bd_info = ri->ri_bd->bd_info;
112 if ( !ri->ri_do_not_massage ) {
115 argv[ 0 ] = "suffixmassage";
116 argv[ 1 ] = be->be_suffix[0].bv_val;
117 argv[ 2 ] = ri->ri_bd->be_suffix[0].bv_val;
120 if ( be->be_config( be, "back-relay", 1, 3, argv ) ) {
130 relay_back_db_close( Backend *be )
136 relay_back_db_destroy( Backend *be )
138 relay_back_info *ri = (relay_back_info *)be->be_private;