1 /* init.c - initialize relay backend */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 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.
26 #include "back-relay.h"
29 relay_back_initialize( BackendInfo *bi )
37 bi->bi_db_init = relay_back_db_init;
38 bi->bi_db_config = relay_back_db_config;
39 bi->bi_db_open = relay_back_db_open;
40 bi->bi_db_close = 0 /* relay_back_db_close */ ;
41 bi->bi_db_destroy = relay_back_db_destroy;
43 bi->bi_op_bind = relay_back_op_bind;
44 bi->bi_op_unbind = relay_back_op_unbind;
45 bi->bi_op_search = relay_back_op_search;
46 bi->bi_op_compare = relay_back_op_compare;
47 bi->bi_op_modify = relay_back_op_modify;
48 bi->bi_op_modrdn = relay_back_op_modrdn;
49 bi->bi_op_add = relay_back_op_add;
50 bi->bi_op_delete = relay_back_op_delete;
51 bi->bi_op_abandon = relay_back_op_abandon;
52 bi->bi_op_cancel = relay_back_op_cancel;
53 bi->bi_extended = relay_back_op_extended;
54 bi->bi_entry_release_rw = relay_back_entry_release_rw;
55 bi->bi_entry_get_rw = relay_back_entry_get_rw;
56 bi->bi_chk_referrals = relay_back_chk_referrals;
57 bi->bi_operational = relay_back_operational;
58 bi->bi_has_subordinates = relay_back_has_subordinates;
60 bi->bi_connection_init = relay_back_connection_init;
61 bi->bi_connection_destroy = relay_back_connection_destroy;
67 relay_back_db_init( Backend *be )
71 be->be_private = NULL;
73 ri = (relay_back_info *)ch_calloc( 1, sizeof( relay_back_info ) );
79 BER_BVZERO( &ri->ri_realsuffix );
82 be->be_private = (void *)ri;
88 relay_back_db_open( Backend *be )
90 relay_back_info *ri = (relay_back_info *)be->be_private;
94 if ( !BER_BVISNULL( &ri->ri_realsuffix ) ) {
95 ri->ri_bd = select_backend( &ri->ri_realsuffix, 0, 1 );
96 /* must be there: it was during config! */
99 /* FIXME: (somehow) copy supported controls ? */
106 relay_back_db_close( Backend *be )
112 relay_back_db_destroy( Backend *be )
114 relay_back_info *ri = (relay_back_info *)be->be_private;
117 if ( !BER_BVISNULL( &ri->ri_realsuffix ) ) {
118 ch_free( ri->ri_realsuffix.bv_val );
126 #if SLAPD_RELAY == SLAPD_MOD_DYNAMIC
128 /* conditionally define the init_module() function */
129 SLAP_BACKEND_INIT_MODULE( relay )
131 #endif /* SLAPD_RELAY == SLAPD_MOD_DYNAMIC */