1 /* 2 BAREOS® - Backup Archiving REcovery Open Sourced 3 4 Copyright (C) 2000-2011 Free Software Foundation Europe e.V. 5 Copyright (C) 2011-2012 Planets Communications B.V. 6 Copyright (C) 2013-2016 Bareos GmbH & Co. KG 7 8 This program is Free Software; you can redistribute it and/or 9 modify it under the terms of version three of the GNU Affero General Public 10 License as published by the Free Software Foundation and included 11 in the file LICENSE. 12 13 This program is distributed in the hope that it will be useful, but 14 WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 Affero General Public License for more details. 17 18 You should have received a copy of the GNU Affero General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 21 02110-1301, USA. 22 */ 23 24 /** 25 * @file bareos storage daemon configuration definitions 26 * 27 */ 28 #ifndef BAREOS_STORED_STORED_CONF_H_ 29 #define BAREOS_STORED_STORED_CONF_H_ 1 30 31 #include "stored/dev.h" 32 #include "stored/autochanger_resource.h" 33 #include "stored/device_resource.h" 34 #include "lib/messages_resource.h" 35 #include "lib/tls_conf.h" 36 37 class alist; 38 class dlist; 39 40 namespace storagedaemon { 41 42 static const std::string default_config_filename("bareos-sd.conf"); 43 44 /* 45 * Resource codes -- they must be sequential for indexing 46 */ 47 enum 48 { 49 R_DIRECTOR = 3001, 50 R_NDMP, 51 R_STORAGE, 52 R_DEVICE, 53 R_MSGS, 54 R_AUTOCHANGER, 55 R_JOB, /* needed for Job name conversion */ 56 R_FIRST = R_DIRECTOR, 57 R_LAST = R_JOB, /* keep this updated */ 58 R_CLIENT = 0xff // dummy for bsock printing 59 }; 60 61 enum 62 { 63 R_NAME = 3020, 64 R_ADDRESS, 65 R_PASSWORD, 66 R_TYPE, 67 R_BACKUP 68 }; 69 70 /* Definition of the contents of each Resource */ 71 class DirectorResource 72 : public BareosResource 73 , public TlsResource { 74 public: 75 char* address = nullptr; /**< Director IP address or zero */ 76 bool monitor = false; /**< Have only access to status and .status functions */ 77 uint64_t max_bandwidth_per_job = 0; /**< Per director bandwidth limitation */ 78 s_password keyencrkey; /**< Key Encryption Key */ 79 80 DirectorResource() = default; 81 virtual ~DirectorResource() = default; 82 }; 83 84 class NdmpResource : public BareosResource { 85 public: 86 uint32_t AuthType = 0; /**< Authentication Type to use */ 87 uint32_t LogLevel = 0; /**< Log level to use for logging NDMP protocol msgs */ 88 char* username = nullptr; /**< NDMP username */ 89 s_password password; /**< NDMP password */ 90 91 NdmpResource() = default; 92 virtual ~NdmpResource() = default; 93 }; 94 95 /* Storage daemon "global" definitions */ 96 class StorageResource 97 : public BareosResource 98 , public TlsResource { 99 public: 100 dlist* SDaddrs = nullptr; 101 dlist* SDsrc_addr = nullptr; /**< Address to source connections from */ 102 dlist* NDMPaddrs = nullptr; 103 char* working_directory = nullptr; /**< Working directory for checkpoints */ 104 char* pid_directory = nullptr; 105 char* subsys_directory = nullptr; 106 char* plugin_directory = nullptr; /**< Plugin directory */ 107 alist* plugin_names = nullptr; 108 char* scripts_directory = nullptr; 109 std::vector<std::string> backend_directories; 110 uint32_t MaxConcurrentJobs = 0; /**< Maximum concurrent jobs to run */ 111 uint32_t MaxConnections = 0; /**< Maximum connections to allow */ 112 uint32_t ndmploglevel = 0; /**< Initial NDMP log level */ 113 uint32_t jcr_watchdog_time = 0; /**< Absolute time after which a Job gets 114 terminated regardless of its progress */ 115 uint32_t stats_collect_interval = 0; /**< in seconds */ 116 MessagesResource* messages = nullptr; /**< Daemon message handler */ 117 utime_t SDConnectTimeout = {0}; /**< Timeout in seconds */ 118 utime_t FDConnectTimeout = {0}; /**< Timeout in seconds */ 119 utime_t heartbeat_interval = {0}; /**< Interval to send hb to FD */ 120 utime_t client_wait = {0}; /**< Time to wait for FD to connect */ 121 uint32_t max_network_buffer_size = 0; /**< Max network buf size */ 122 bool autoxflateonreplication = 123 false; /**< Perform autoxflation when replicating data 124 */ 125 bool compatible = false; /**< Write compatible format */ 126 bool allow_bw_bursting = false; /**< Allow bursting with bandwidth limiting */ 127 bool ndmp_enable = false; /**< Enable NDMP protocol listener */ 128 bool ndmp_snooping = false; /**< Enable NDMP protocol snooping */ 129 bool nokeepalive = false; /**< Don't use SO_KEEPALIVE on sockets */ 130 bool collect_dev_stats = false; /**< Collect Device Statistics */ 131 bool collect_job_stats = false; /**< Collect Job Statistics */ 132 bool device_reserve_by_mediatype = false; /**< Allow device reservation based 133 on a matching mediatype */ 134 bool filedevice_concurrent_read = false; /**< Allow filedevices to be read 135 concurrently */ 136 char* verid = nullptr; /**< Custom Id to print in version command */ 137 char* secure_erase_cmdline = nullptr; /**< Cmdline to execute to perform 138 secure erase of file */ 139 char* log_timestamp_format = nullptr; /**< Timestamp format to use in generic 140 logging messages */ 141 uint64_t max_bandwidth_per_job = 0; /**< Bandwidth limitation (global) */ 142 143 StorageResource() = default; 144 virtual ~StorageResource() = default; 145 }; 146 147 ConfigurationParser* InitSdConfig(const char* configfile, int exit_code); 148 bool ParseSdConfig(const char* configfile, int exit_code); 149 bool PrintConfigSchemaJson(PoolMem& buffer); 150 151 } /* namespace storagedaemon */ 152 #endif /* BAREOS_STORED_STORED_CONF_H_ */ 153