1 /* $NetBSD: init.c,v 1.1.1.4 2014/05/28 09:58:51 tron Exp $ */ 2 3 /* init.c - initialize sock backend */ 4 /* $OpenLDAP$ */ 5 /* This work is part of OpenLDAP Software <http://www.openldap.org/>. 6 * 7 * Copyright 2007-2014 The OpenLDAP Foundation. 8 * All rights reserved. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted only as authorized by the OpenLDAP 12 * Public License. 13 * 14 * A copy of this license is available in the file LICENSE in the 15 * top-level directory of the distribution or, alternatively, at 16 * <http://www.OpenLDAP.org/license.html>. 17 */ 18 /* ACKNOWLEDGEMENTS: 19 * This work was initially developed by Brian Candler for inclusion 20 * in OpenLDAP Software. 21 */ 22 23 #include "portable.h" 24 25 #include <stdio.h> 26 27 #include <ac/socket.h> 28 29 #include "slap.h" 30 #include "back-sock.h" 31 32 int 33 sock_back_initialize( 34 BackendInfo *bi 35 ) 36 { 37 bi->bi_open = 0; 38 bi->bi_config = 0; 39 bi->bi_close = 0; 40 bi->bi_destroy = 0; 41 42 bi->bi_db_init = sock_back_db_init; 43 bi->bi_db_config = 0; 44 bi->bi_db_open = 0; 45 bi->bi_db_close = 0; 46 bi->bi_db_destroy = sock_back_db_destroy; 47 48 bi->bi_op_bind = sock_back_bind; 49 bi->bi_op_unbind = sock_back_unbind; 50 bi->bi_op_search = sock_back_search; 51 bi->bi_op_compare = sock_back_compare; 52 bi->bi_op_modify = sock_back_modify; 53 bi->bi_op_modrdn = sock_back_modrdn; 54 bi->bi_op_add = sock_back_add; 55 bi->bi_op_delete = sock_back_delete; 56 bi->bi_op_abandon = 0; 57 58 bi->bi_extended = 0; 59 60 bi->bi_chk_referrals = 0; 61 62 bi->bi_connection_init = 0; 63 bi->bi_connection_destroy = 0; 64 65 return sock_back_init_cf( bi ); 66 } 67 68 int 69 sock_back_db_init( 70 Backend *be, 71 struct config_reply_s *cr 72 ) 73 { 74 struct sockinfo *si; 75 76 si = (struct sockinfo *) ch_calloc( 1, sizeof(struct sockinfo) ); 77 78 be->be_private = si; 79 be->be_cf_ocs = be->bd_info->bi_cf_ocs; 80 81 return si == NULL; 82 } 83 84 int 85 sock_back_db_destroy( 86 Backend *be, 87 struct config_reply_s *cr 88 ) 89 { 90 free( be->be_private ); 91 return 0; 92 } 93 94 #if SLAPD_SOCK == SLAPD_MOD_DYNAMIC 95 96 /* conditionally define the init_module() function */ 97 SLAP_BACKEND_INIT_MODULE( sock ) 98 99 #endif /* SLAPD_SOCK == SLAPD_MOD_DYNAMIC */ 100