1 /*
2    BAREOS® - Backup Archiving REcovery Open Sourced
3 
4    Copyright (C) 2014-2014 Planets Communications B.V.
5    Copyright (C) 2014-2017 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, June 2014
24  */
25 /**
26  * @file
27  * Dynamic loading of SD backend plugins.
28  */
29 
30 #ifndef BAREOS_STORED_SD_BACKENDS_H_
31 #define BAREOS_STORED_SD_BACKENDS_H_ 1
32 
33 class alist;
34 
35 namespace storagedaemon {
36 
37 extern "C" {
38 typedef Device* (*t_backend_instantiate)(JobControlRecord* jcr,
39                                          int device_type);
40 typedef void (*t_flush_backend)(void);
41 }
42 
43 /**
44  * Loaded shared library with a certain backend interface type.
45  */
46 struct backend_shared_library_t {
47   int interface_type_id;
48   void* handle;
49   /*
50    * Entry points into loaded shared library.
51    */
52   t_backend_instantiate backend_instantiate;
53   t_flush_backend flush_backend;
54 };
55 
56 #if defined(HAVE_WIN32)
57 #define DYN_LIB_EXTENSION ".dll"
58 #elif defined(HAVE_DARWIN_OS)
59 /* cmake MODULE creates a .so files; cmake SHARED creates .dylib */
60 // #define DYN_LIB_EXTENSION ".dylib"
61 #define DYN_LIB_EXTENSION ".so"
62 #else
63 #define DYN_LIB_EXTENSION ".so"
64 #endif
65 
66 
67 #if defined(HAVE_DYNAMIC_SD_BACKENDS)
68 void SdSetBackendDirs(std::vector<std::string>&& new_backend_dirs);
69 Device* init_backend_dev(JobControlRecord* jcr, int device_type);
70 void DevFlushBackends();
71 #endif
72 
73 } /* namespace storagedaemon */
74 
75 #endif /* __SD_DYNAMIC_H_ */
76