Skip to content
Browse files

docs: added chapter Configuration Parser

  • Loading branch information...
franku committed May 24, 2019
1 parent 6dce739 commit b1dfa6a5ea0387b2647dddb28c030d24f20b048c
@@ -11,6 +11,7 @@ Developer Guide
@@ -0,0 +1,21 @@
Configuration Parser


The **Bareos** configuration parser saves the scanned configuration resources respectively their directives in dedicated classes. The following diagram shows the resource classes overview of the |sd|. All other daemons as well as the |bconsole| and the command line tools are similar with this.

Class Model of Storage Daemon Resources
The following diagram shows the class model of the Storage Daemon resources.

.. include:: configparser/sd_resources_class_model.puml

**Outdated: Old Class Model of Storage Daemon Resources**

The following diagram is added for historic documentation purposes only. It contains the old class model of the |sd| resources as it was existent until Bareos Version 18.2.

.. include:: configparser/sd_resources_class_model_outdated.puml

@@ -0,0 +1,190 @@
.. uml::
:caption: Class Diagram of Storage Daemon Resource Classes


!define STRUCT_COLOR (S,#FF7700)
!define UNION_COLOR (U,#3377FF)

package lib/resource_item.h {
class ResourceItem << STRUCT_COLOR >> {
const char* name;
const int type;
union {
char** value; /* Where to store the item */
std::string** strValue;
uint16_t* ui16value;
uint32_t* ui32value;
int16_t* i16value;
int32_t* i32value;
uint64_t* ui64value;
int64_t* i64value;
bool* boolvalue;
utime_t* utimevalue;
s_password* pwdvalue;
CommonResourceHeader** resvalue;
alist** alistvalue;
dlist** dlistvalue;
char* bitvalue;
BareosResource* static_resource;
int32_t code;
uint32_t flags;
const char* default_value;
const char* versions;
const char* description;

package parse_conf.h {
class ResourceTable << STRUCT_COLOR >> {
const char* name;
ResourceItem* items;
uint32_t rcode;
uint32_t size;
std::function<void*(void* res)> initres;
BareosResource* static_initialization_resource_;

package bareos_resource.h {
class BareosResource {
BareosResource* next_; /* Pointer to next resource of this type */
char* resource_name_; /* Resource name */
char* description_; /* Resource description */
uint32_t rcode_; /* Resource id or type */
int32_t refcnt_; /* Reference count for releasing */
char item_present_[MAX_RES_ITEMS]; /* Set if item is present in conf file */
char inherit_content_[MAX_RES_ITEMS]; /* Set if item has inherited content */

BareosResource(const BareosResource& other);
BareosResource& operator=(const BareosResource& rhs);

virtual ~BareosResource() = default;

virtual void ShallowCopyTo(BareosResource* static_memory) const = 0;

virtual bool PrintConfig();

package tls_conf.h {
class TlsConfig {
s_password password_;
TlsConfigCert tls_cert_;
std::string* cipherlist_;
bool authenticate_;
bool tls_enable_;
bool tls_require_;

bool IsTlsConfigured() const;
TlsPolicy GetPolicy() const;
int SelectTlsPolicy(TlsPolicy remote_policy) const;

package {
class AutochangerResource {
AutochangerResource& operator=(const AutochangerResource& rhs);
bool PrintConfig();

alist* device;
char* changer_name;
char* changer_command;
brwlock_t changer_lock;

package lib/messages_resource.h {
class MessagesResource {
char* mail_cmd;
char* operator_cmd;
char* timestamp_format;
DEST* dest_chain;
char SendMsg[NbytesForBits(M_MAX + 1)];

bool in_use_;
bool closing_;

void ClearInUse()
void SetInUse()
void SetClosing()
bool GetClosing()
void ClearClosing()
bool IsClosing()

void WaitNotInUse();
void lock();
void unlock();
bool PrintConfig();

package stored_conf.h {

class StorageResource {
dlist* SDaddrs;
dlist* SDsrc_addr;
dlist* NDMPaddrs;

class DirectorResource {
char* address;
bool monitor;
uint64_t max_bandwidth_per_job;
s_password keyencrkey;

class NdmpResource {
CommonResourceHeader hdr;

uint32_t AuthType;
uint32_t LogLevel;
char* username;
s_password password;

class DeviceResource {
char* media_type;
char* device_name;
char* device_options;
DeviceResource(const DeviceResource& other);
DeviceResource& operator=(const DeviceResource& rhs);
bool PrintConfigToBuffer(PoolMem& buf);
void CreateAndAssignSerialNumber(uint16_t number);
void MultipliedDeviceRestoreBaseName();
void MultipliedDeviceRestoreNumberedName();

package {
hide members
hide circle

store_items "1"*--"1..*" ResourceItem
dir_items "1"*--"1..*" ResourceItem
ndmp_items "1"*--"1..*" ResourceItem
dev_items "1"*--"1..*" ResourceItem
changer_items "1"*--"1..*" ResourceItem

resources "1"*--"1..*" ResourceTable

TlsConfig <|-- DirectorResource
TlsConfig <|-- StorageResource

BareosResource <|-- DirectorResource
BareosResource <|-- StorageResource
BareosResource <|-- AutochangerResource
BareosResource <|-- NdmpResource
BareosResource <|-- MessagesResource
BareosResource <|-- DeviceResource


0 comments on commit b1dfa6a

Please sign in to comment.
You can’t perform that action at this time.