Back to index

openldap  2.4.31
init.c
Go to the documentation of this file.
00001 /* init.c - initialize sock backend */
00002 /* $OpenLDAP$ */
00003 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
00004  *
00005  * Copyright 2007-2012 The OpenLDAP Foundation.
00006  * All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted only as authorized by the OpenLDAP
00010  * Public License.
00011  *
00012  * A copy of this license is available in the file LICENSE in the
00013  * top-level directory of the distribution or, alternatively, at
00014  * <http://www.OpenLDAP.org/license.html>.
00015  */
00016 /* ACKNOWLEDGEMENTS:
00017  * This work was initially developed by Brian Candler for inclusion
00018  * in OpenLDAP Software.
00019  */
00020 
00021 #include "portable.h"
00022 
00023 #include <stdio.h>
00024 
00025 #include <ac/socket.h>
00026 
00027 #include "slap.h"
00028 #include "back-sock.h"
00029 
00030 int
00031 sock_back_initialize(
00032     BackendInfo      *bi
00033 )
00034 {
00035        bi->bi_open = 0;
00036        bi->bi_config = 0;
00037        bi->bi_close = 0;
00038        bi->bi_destroy = 0;
00039 
00040        bi->bi_db_init = sock_back_db_init;
00041        bi->bi_db_config = 0;
00042        bi->bi_db_open = 0;
00043        bi->bi_db_close = 0;
00044        bi->bi_db_destroy = sock_back_db_destroy;
00045 
00046        bi->bi_op_bind = sock_back_bind;
00047        bi->bi_op_unbind = sock_back_unbind;
00048        bi->bi_op_search = sock_back_search;
00049        bi->bi_op_compare = sock_back_compare;
00050        bi->bi_op_modify = sock_back_modify;
00051        bi->bi_op_modrdn = sock_back_modrdn;
00052        bi->bi_op_add = sock_back_add;
00053        bi->bi_op_delete = sock_back_delete;
00054        bi->bi_op_abandon = 0;
00055 
00056        bi->bi_extended = 0;
00057 
00058        bi->bi_chk_referrals = 0;
00059 
00060        bi->bi_connection_init = 0;
00061        bi->bi_connection_destroy = 0;
00062 
00063        return sock_back_init_cf( bi );
00064 }
00065 
00066 int
00067 sock_back_db_init(
00068     Backend   *be,
00069        struct config_reply_s *cr
00070 )
00071 {
00072        struct sockinfo      *si;
00073 
00074        si = (struct sockinfo *) ch_calloc( 1, sizeof(struct sockinfo) );
00075 
00076        be->be_private = si;
00077        be->be_cf_ocs = be->bd_info->bi_cf_ocs;
00078 
00079        return si == NULL;
00080 }
00081 
00082 int
00083 sock_back_db_destroy(
00084     Backend   *be,
00085        struct config_reply_s *cr
00086 )
00087 {
00088        free( be->be_private );
00089        return 0;
00090 }
00091 
00092 #if SLAPD_SOCK == SLAPD_MOD_DYNAMIC
00093 
00094 /* conditionally define the init_module() function */
00095 SLAP_BACKEND_INIT_MODULE( sock )
00096 
00097 #endif /* SLAPD_SOCK == SLAPD_MOD_DYNAMIC */