1 /* 2 BAREOS® - Backup Archiving REcovery Open Sourced 3 4 Copyright (C) 2000-2008 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 * Kern Sibbald, Sep MM 25 */ 26 /** 27 * @file 28 * Bareos User Agent specific configuration and defines 29 */ 30 31 #ifndef BAREOS_CONSOLE_CONSOLE_CONF_H_ 32 #define BAREOS_CONSOLE_CONSOLE_CONF_H_ 1 33 34 #include <string> 35 #include "lib/parse_conf.h" 36 37 class ConfigurationParser; 38 39 namespace console { 40 41 static const std::string default_config_filename("bconsole.conf"); 42 43 /** 44 * Resource codes -- they must be sequential for indexing 45 */ 46 47 enum { 48 R_CONSOLE = 1001, 49 R_DIRECTOR, 50 R_FIRST = R_CONSOLE, 51 R_LAST = R_DIRECTOR /* Keep this updated */ 52 }; 53 54 /** 55 * Some resource attributes 56 */ 57 enum { 58 R_NAME = 1020, 59 R_ADDRESS, 60 R_PASSWORD, 61 R_TYPE, 62 R_BACKUP 63 }; 64 65 /* Definition of the contents of each Resource */ 66 67 /* Console "globals" */ 68 class ConsoleResource : public TlsResource { 69 public: 70 char *rc_file; /**< startup file */ 71 char *history_file; /**< command history file */ 72 s_password password; /**< UA server password */ 73 uint32_t history_length; /**< readline history length */ 74 char *director; /**< bind to director */ 75 utime_t heartbeat_interval; /**< Interval to send heartbeats to Dir */ ConsoleResource()76 ConsoleResource() : TlsResource() {} 77 }; 78 79 /* Director */ 80 class DirectorResource : public TlsResource { 81 public: 82 uint32_t DIRport; /**< UA server port */ 83 char *address; /**< UA server address */ 84 utime_t heartbeat_interval; /**< Interval to send heartbeats to Dir */ DirectorResource()85 DirectorResource() : TlsResource() {} 86 }; 87 88 /* Define the Union of all the above 89 * resource structure definitions. 90 */ 91 union UnionOfResources { 92 DirectorResource res_dir; 93 ConsoleResource res_cons; 94 CommonResourceHeader hdr; 95 UnionOfResources()96 UnionOfResources() {new(&hdr) CommonResourceHeader();} ~UnionOfResources()97 ~UnionOfResources() {} 98 }; 99 100 extern ConsoleResource *me; /* "Global" Client resource */ 101 102 ConfigurationParser *InitConsConfig(const char *configfile, int exit_code); 103 bool PrintConfigSchemaJson(PoolMem &buffer); 104 105 } /* namespace console */ 106 #endif /* BAREOS_CONSOLE_CONSOLE_CONF_H_ */ 107