1 /*
2    BAREOS® - Backup Archiving REcovery Open Sourced
3 
4    Copyright (C) 2011-2016 Planets Communications B.V.
5    Copyright (C) 2013-2016 Bareos GmbH & Co. KG
6 
7    This program is Free Software; you can redistribute it and/or
8    modify it under the terms of version three of the GNU Affero General Public
9    License as published by the Free Software Foundation and included
10    in the file LICENSE.
11 
12    This program is distributed in the hope that it will be useful, but
13    WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15    Affero General Public License for more details.
16 
17    You should have received a copy of the GNU Affero General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20    02110-1301, USA.
21 */
22 /*
23  * Marco van Wieringen, November 2010
24  */
25 /**
26  * @file
27  * Dynamic loading of catalog plugins.
28  */
29 
30 #ifndef BAREOS_CATS_CATS_BACKENDS_H_
31 #define BAREOS_CATS_CATS_BACKENDS_H_ 1
32 
33 extern "C" {
34 typedef BareosDb *(*t_backend_instantiate)(JobControlRecord *jcr,
35                                        const char *db_driver,
36                                        const char *db_name,
37                                        const char *db_user,
38                                        const char *db_password,
39                                        const char *db_address,
40                                        int db_port,
41                                        const char *db_socket,
42                                        bool mult_db_connections,
43                                        bool disable_batch_insert,
44                                        bool try_reconnect,
45                                        bool exit_on_fatal,
46                                        bool need_private);
47 
48 typedef void (*t_flush_backend)(void);
49 }
50 
51 /**
52  * Loaded shared library with a certain backend interface type.
53  */
54 struct backend_shared_library_t {
55    int interface_type_id;
56    void *handle;
57    /*
58     * Entry points into loaded shared library.
59     */
60    t_backend_instantiate backend_instantiate;
61    t_flush_backend flush_backend;
62 };
63 
64 #if defined(HAVE_WIN32)
65 #define DYN_LIB_EXTENSION ".dll"
66 #elif defined(HAVE_DARWIN_OS)
67 /* cmake MODULE creates a .so files; cmake SHARED creates .dylib */
68 // #define DYN_LIB_EXTENSION ".dylib"
69 #define DYN_LIB_EXTENSION ".so"
70 #else
71 #define DYN_LIB_EXTENSION ".so"
72 #endif
73 
74 #if defined(HAVE_DYNAMIC_CATS_BACKENDS)
75 void DbSetBackendDirs(alist *new_backend_dirs);
76 #endif
77 void DbFlushBackends(void);
78 BareosDb *db_init_database(JobControlRecord *jcr,
79                        const char *db_driver,
80                        const char *db_name,
81                        const char *db_user,
82                        const char *db_password,
83                        const char *db_address,
84                        int db_port,
85                        const char *db_socket,
86                        bool mult_db_connections,
87                        bool disable_batch_insert,
88                        bool try_reconnect,
89                        bool exit_on_fatal,
90                        bool need_private = false);
91 
92 
93 
94 #endif /* BAREOS_CATS_CATS_BACKENDS_H_ */
95