1 /* 2 BAREOS® - Backup Archiving REcovery Open Sourced 3 4 Copyright (C) 2011-2016 Planets Communications B.V. 5 Copyright (C) 2013-2020 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 class BareosDb; 34 35 extern "C" { 36 typedef BareosDb* (*t_backend_instantiate)(JobControlRecord* jcr, 37 const char* db_driver, 38 const char* db_name, 39 const char* db_user, 40 const char* db_password, 41 const char* db_address, 42 int db_port, 43 const char* db_socket, 44 bool mult_db_connections, 45 bool disable_batch_insert, 46 bool try_reconnect, 47 bool exit_on_fatal, 48 bool need_private); 49 50 typedef void (*t_flush_backend)(void); 51 } 52 53 /** 54 * Loaded shared library with a certain backend interface type. 55 */ 56 struct backend_shared_library_t { 57 int interface_type_id; 58 void* handle; 59 /* 60 * Entry points into loaded shared library. 61 */ 62 t_backend_instantiate backend_instantiate; 63 t_flush_backend flush_backend; 64 }; 65 66 #if defined(HAVE_WIN32) 67 # define DYN_LIB_EXTENSION ".dll" 68 #elif defined(HAVE_DARWIN_OS) 69 /* cmake MODULE creates a .so files; cmake SHARED creates .dylib */ 70 // #define DYN_LIB_EXTENSION ".dylib" 71 # define DYN_LIB_EXTENSION ".so" 72 #else 73 # define DYN_LIB_EXTENSION ".so" 74 #endif 75 76 #if defined(HAVE_DYNAMIC_CATS_BACKENDS) 77 void DbSetBackendDirs(std::vector<std::string>& new_backend_dirs); 78 #endif 79 void DbFlushBackends(void); 80 BareosDb* db_init_database(JobControlRecord* jcr, 81 const char* db_driver, 82 const char* db_name, 83 const char* db_user, 84 const char* db_password, 85 const char* db_address, 86 int db_port, 87 const char* db_socket, 88 bool mult_db_connections, 89 bool disable_batch_insert, 90 bool try_reconnect, 91 bool exit_on_fatal, 92 bool need_private = false); 93 94 95 #endif /* BAREOS_CATS_CATS_BACKENDS_H_ */ 96