1 /*	$NetBSD: dlz_drivers.c,v 1.5 2014/12/10 04:37:55 christos Exp $	*/
2 
3 /*
4  * Copyright (C) 2005  Internet Systems Consortium, Inc. ("ISC")
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /* Id: dlz_drivers.c,v 1.4 2011/03/10 04:36:16 each Exp  */
20 
21 /*! \file */
22 
23 #include <config.h>
24 
25 #include <isc/result.h>
26 
27 /*
28  * Pull in declarations for this module's functions.
29  */
30 
31 #include <dlz/dlz_drivers.h>
32 
33 /*
34  * Pull in driver-specific stuff.
35  */
36 
37 #ifdef DLZ_STUB
38 #include <dlz/dlz_stub_driver.h>
39 #endif
40 
41 #ifdef DLZ_POSTGRES
42 #include <dlz/dlz_postgres_driver.h>
43 #endif
44 
45 #ifdef DLZ_MYSQL
46 #include <dlz/dlz_mysql_driver.h>
47 #endif
48 
49 #ifdef DLZ_FILESYSTEM
50 #include <dlz/dlz_filesystem_driver.h>
51 #endif
52 
53 #ifdef DLZ_BDB
54 #include <dlz/dlz_bdb_driver.h>
55 #include <dlz/dlz_bdbhpt_driver.h>
56 #endif
57 
58 #ifdef DLZ_LDAP
59 #include <dlz/dlz_ldap_driver.h>
60 #endif
61 
62 #ifdef DLZ_ODBC
63 #include <dlz/dlz_odbc_driver.h>
64 #endif
65 
66 /*%
67  * Call init functions for all relevant DLZ drivers.
68  */
69 
70 isc_result_t
71 dlz_drivers_init(void) {
72 
73 	isc_result_t result = ISC_R_SUCCESS;
74 
75 #ifdef DLZ_STUB
76 	result = dlz_stub_init();
77 	if (result != ISC_R_SUCCESS)
78 		return (result);
79 #endif
80 
81 #ifdef DLZ_POSTGRES
82 	result = dlz_postgres_init();
83 	if (result != ISC_R_SUCCESS)
84 		return (result);
85 #endif
86 
87 #ifdef DLZ_MYSQL
88 	result = dlz_mysql_init();
89 	if (result != ISC_R_SUCCESS)
90 		return (result);
91 #endif
92 
93 #ifdef DLZ_FILESYSTEM
94 	result = dlz_fs_init();
95 	if (result != ISC_R_SUCCESS)
96 		return (result);
97 #endif
98 
99 #ifdef DLZ_BDB
100 	result = dlz_bdb_init();
101 	if (result != ISC_R_SUCCESS)
102 		return (result);
103 	result = dlz_bdbhpt_init();
104 	if (result != ISC_R_SUCCESS)
105 		return (result);
106 #endif
107 
108 #ifdef DLZ_LDAP
109 	result = dlz_ldap_init();
110 	if (result != ISC_R_SUCCESS)
111 		return (result);
112 #endif
113 
114 #ifdef DLZ_ODBC
115 	result = dlz_odbc_init();
116 	if (result != ISC_R_SUCCESS)
117 		return (result);
118 #endif
119 
120 	return (result);
121 }
122 
123 /*%
124  * Call shutdown functions for all relevant DLZ drivers.
125  */
126 
127 void
128 dlz_drivers_clear(void) {
129 
130 #ifdef DLZ_STUB
131 	dlz_stub_clear();
132 #endif
133 
134 #ifdef DLZ_POSTGRES
135         dlz_postgres_clear();
136 #endif
137 
138 #ifdef DLZ_MYSQL
139  	dlz_mysql_clear();
140 #endif
141 
142 #ifdef DLZ_FILESYSTEM
143         dlz_fs_clear();
144 #endif
145 
146 #ifdef DLZ_BDB
147         dlz_bdb_clear();
148         dlz_bdbhpt_clear();
149 #endif
150 
151 #ifdef DLZ_LDAP
152         dlz_ldap_clear();
153 #endif
154 
155 #ifdef DLZ_ODBC
156         dlz_odbc_clear();
157 #endif
158 
159 }
160