1 /* init.c - initialize relay backend */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 2004-2005 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;
41 bi->bi_db_close =relay_back_db_close;
43 bi->bi_db_destroy = relay_back_db_destroy;
45 bi->bi_op_bind = relay_back_op_bind;
46 bi->bi_op_unbind = relay_back_op_unbind;
47 bi->bi_op_search = relay_back_op_search;
48 bi->bi_op_compare = relay_back_op_compare;
49 bi->bi_op_modify = relay_back_op_modify;
50 bi->bi_op_modrdn = relay_back_op_modrdn;
51 bi->bi_op_add = relay_back_op_add;
52 bi->bi_op_delete = relay_back_op_delete;
53 bi->bi_op_abandon = relay_back_op_abandon;
54 bi->bi_op_cancel = relay_back_op_cancel;
55 bi->bi_extended = relay_back_op_extended;
56 bi->bi_entry_release_rw = relay_back_entry_release_rw;
57 bi->bi_entry_get_rw = relay_back_entry_get_rw;
58 #if 0 /* see comment in op.c */
59 bi->bi_chk_referrals = relay_back_chk_referrals;
61 bi->bi_operational = relay_back_operational;
62 bi->bi_has_subordinates = relay_back_has_subordinates;
64 bi->bi_connection_init = relay_back_connection_init;
65 bi->bi_connection_destroy = relay_back_connection_destroy;
71 relay_back_db_init( Backend *be )
75 be->be_private = NULL;
77 ri = (relay_back_info *)ch_calloc( 1, sizeof( relay_back_info ) );
83 BER_BVZERO( &ri->ri_realsuffix );
86 be->be_private = (void *)ri;
92 relay_back_db_open( Backend *be )
94 relay_back_info *ri = (relay_back_info *)be->be_private;
98 if ( !BER_BVISNULL( &ri->ri_realsuffix ) ) {
99 ri->ri_bd = select_backend( &ri->ri_realsuffix, 0, 1 );
100 /* must be there: it was during config! */
103 /* FIXME: (somehow) copy supported controls ? */
110 relay_back_db_close( Backend *be )
116 relay_back_db_destroy( Backend *be )
118 relay_back_info *ri = (relay_back_info *)be->be_private;
121 if ( !BER_BVISNULL( &ri->ri_realsuffix ) ) {
122 ch_free( ri->ri_realsuffix.bv_val );
130 #if SLAPD_RELAY == SLAPD_MOD_DYNAMIC
132 /* conditionally define the init_module() function */
133 SLAP_BACKEND_INIT_MODULE( relay )
135 #endif /* SLAPD_RELAY == SLAPD_MOD_DYNAMIC */