Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / external / bsd / openldap / dist / servers / slapd / back-sock / init.c
blob0db27b7a82762dd7f5e5aadd6a71362442dd7539
1 /* init.c - initialize sock backend */
2 /* $OpenLDAP: pkg/ldap/servers/slapd/back-sock/init.c,v 1.4.2.1 2008/02/09 00:46:09 quanah Exp $ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2007-2008 The OpenLDAP Foundation.
6 * All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
10 * Public License.
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>.
16 /* ACKNOWLEDGEMENTS:
17 * This work was initially developed by Brian Candler for inclusion
18 * in OpenLDAP Software.
21 #include "portable.h"
23 #include <stdio.h>
25 #include <ac/socket.h>
27 #include "slap.h"
28 #include "back-sock.h"
30 int
31 sock_back_initialize(
32 BackendInfo *bi
35 bi->bi_open = 0;
36 bi->bi_config = 0;
37 bi->bi_close = 0;
38 bi->bi_destroy = 0;
40 bi->bi_db_init = sock_back_db_init;
41 bi->bi_db_config = 0;
42 bi->bi_db_open = 0;
43 bi->bi_db_close = 0;
44 bi->bi_db_destroy = sock_back_db_destroy;
46 bi->bi_op_bind = sock_back_bind;
47 bi->bi_op_unbind = sock_back_unbind;
48 bi->bi_op_search = sock_back_search;
49 bi->bi_op_compare = sock_back_compare;
50 bi->bi_op_modify = sock_back_modify;
51 bi->bi_op_modrdn = sock_back_modrdn;
52 bi->bi_op_add = sock_back_add;
53 bi->bi_op_delete = sock_back_delete;
54 bi->bi_op_abandon = 0;
56 bi->bi_extended = 0;
58 bi->bi_chk_referrals = 0;
60 bi->bi_connection_init = 0;
61 bi->bi_connection_destroy = 0;
63 return sock_back_init_cf( bi );
66 int
67 sock_back_db_init(
68 Backend *be,
69 struct config_reply_s *cr
72 struct sockinfo *si;
74 si = (struct sockinfo *) ch_calloc( 1, sizeof(struct sockinfo) );
76 be->be_private = si;
77 be->be_cf_ocs = be->bd_info->bi_cf_ocs;
79 return si == NULL;
82 int
83 sock_back_db_destroy(
84 Backend *be,
85 struct config_reply_s *cr
88 free( be->be_private );
89 return 0;
92 #if SLAPD_SOCK == SLAPD_MOD_DYNAMIC
94 /* conditionally define the init_module() function */
95 SLAP_BACKEND_INIT_MODULE( sock )
97 #endif /* SLAPD_SOCK == SLAPD_MOD_DYNAMIC */