| Kea 3.0.2-git

config_base.h
Go to the documentation of this file.
1// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef CONFIG_BASE_H
8#define CONFIG_BASE_H
9
10#include <cc/cfg_to_element.h>
11#include <cc/user_context.h>
12#include <process/config_ctl_info.h>
13#include <process/logging_info.h>
14#include <util/optional.h>
15#include <boost/date_time/posix_time/posix_time.hpp>
16
17 namespace isc {
18 namespace process {
19
33 class ConfigBase : public isc::data::UserContext, public isc::data::CfgToElement {
34 public:
41
42
43 const process::LoggingInfoStorage& getLoggingInfo() const {
44 return (logging_info_);
45 }
46
50 void addLoggingInfo(const process::LoggingInfo& logging_info) {
51 logging_info_.push_back(logging_info);
52 }
53
55 void applyLoggingCfg() const;
56
60 bool equals(const ConfigBase& other) const;
61
82 virtual void merge(ConfigBase& other);
83
101 virtual isc::data::ElementPtr toElement() const;
102
106 process::ConstConfigControlInfoPtr getConfigControlInfo() const {
107 return (config_ctl_info_);
108 }
109
118 void setConfigControlInfo(const process::ConfigControlInfoPtr&
119 config_ctl_info) {
120 config_ctl_info_ = config_ctl_info;
121 }
122
127 void setServerTag(const util::Optional<std::string>& server_tag) {
128 server_tag_ = server_tag;
129 }
130
134 util::Optional<std::string> getServerTag() const {
135 return (server_tag_);
136 }
137
140 boost::posix_time::ptime getLastCommitTime() const {
141 return (last_commit_time_);
142 }
143
146 void setLastCommitTime(const boost::posix_time::ptime& last_commit_time) {
147 last_commit_time_ = last_commit_time;
148 }
149
150 protected:
159 void copy(ConfigBase& new_config) const;
160
161 private:
163 process::LoggingInfoStorage logging_info_;
164
166 process::ConfigControlInfoPtr config_ctl_info_;
167
169 util::Optional<std::string> server_tag_;
170
172 boost::posix_time::ptime last_commit_time_;
173};
174
176 typedef boost::shared_ptr<ConfigBase> ConfigPtr;
177
178} // namespace process
179} // namespace isc
180
181#endif /* CONFIG_BASE_H */
cfg_to_element.h
isc::process::ConfigBase
Base class for all configurations.
Definition config_base.h:33
isc::process::ConfigBase::addLoggingInfo
void addLoggingInfo(const process::LoggingInfo &logging_info)
Sets logging specific configuration.
Definition config_base.h:50
isc::process::ConfigBase::applyLoggingCfg
void applyLoggingCfg() const
Apply logging configuration to log4cplus.
Definition config_base.cc:23
isc::process::ConfigBase::toElement
virtual isc::data::ElementPtr toElement() const
Converts to Element representation.
Definition config_base.cc:118
isc::process::ConfigBase::getConfigControlInfo
process::ConstConfigControlInfoPtr getConfigControlInfo() const
Fetches a read-only copy of the configuration control information.
Definition config_base.h:106
isc::process::ConfigBase::setConfigControlInfo
void setConfigControlInfo(const process::ConfigControlInfoPtr &config_ctl_info)
Set the configuration control information.
Definition config_base.h:118
isc::process::ConfigBase::getLoggingInfo
const process::LoggingInfoStorage & getLoggingInfo() const
Returns logging specific configuration.
Definition config_base.h:43
isc::process::ConfigBase::setServerTag
void setServerTag(const util::Optional< std::string > &server_tag)
Sets the server's logical name.
Definition config_base.h:127
isc::process::ConfigBase::getLastCommitTime
boost::posix_time::ptime getLastCommitTime() const
Returns the last commit timestamp.
Definition config_base.h:140
isc::process::ConfigBase::setLastCommitTime
void setLastCommitTime(const boost::posix_time::ptime &last_commit_time)
Sets the last commit timestamp.
Definition config_base.h:146
isc::process::ConfigBase::getServerTag
util::Optional< std::string > getServerTag() const
Returns the server's logical name.
Definition config_base.h:134
isc::process::ConfigBase::copy
void copy(ConfigBase &new_config) const
Copies the current configuration to a new configuration.
Definition config_base.cc:77
isc::process::ConfigBase::merge
virtual void merge(ConfigBase &other)
Merges specified configuration into this configuration.
Definition config_base.cc:96
isc::process::ConfigBase::equals
bool equals(const ConfigBase &other) const
Compares two configuration.
Definition config_base.cc:39
isc::process::LoggingInfo
structure that describes one logging entry
Definition logging_info.h:81
isc::util::Optional
A template representing an optional value.
Definition optional.h:36
config_ctl_info.h
logging_info.h
isc::data::ElementPtr
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
isc::process
Definition cb_ctl_base.h:22
isc::process::LoggingInfoStorage
std::vector< isc::process::LoggingInfo > LoggingInfoStorage
storage for logging information in log4cplus format
Definition logging_info.h:141
isc::process::ConfigPtr
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the ConfigBase.
Definition config_base.h:176
isc::process::ConstConfigControlInfoPtr
boost::shared_ptr< const ConfigControlInfo > ConstConfigControlInfoPtr
Defines a pointer to a const ConfigControlInfo.
Definition config_ctl_info.h:242
isc::process::ConfigControlInfoPtr
boost::shared_ptr< ConfigControlInfo > ConfigControlInfoPtr
Defines a pointer to a ConfigControlInfo.
Definition config_ctl_info.h:239
isc
Defines the logger used by the top-level component of kea-lfc.
Definition agent_parser.cc:148
optional.h
isc::data::CfgToElement
Abstract class for configuration Cfg_* classes.
Definition cfg_to_element.h:29
isc::data::UserContext
Base class for user context.
Definition user_context.h:22
user_context.h