Kea: isc::process::ConfigBase Class Reference

| Kea 3.2.0-git

isc::process::ConfigBase Class Reference

Base class for all configurations. More...

`#include <config_base.h>`

Inheritance diagram for isc::process::ConfigBase:
[legend]

## Modifiers and accesors for the configuration objects.
Warning References to the objects returned by accessors are only valid during the lifetime of the `ConfigBase` object which returned them.
const process::LoggingInfoStorage & | getLoggingInfo () const
| Returns logging specific configuration.
void | addLoggingInfo (const process::LoggingInfo &logging_info)
| Sets logging specific configuration.
void | applyLoggingCfg () const
| Apply logging configuration to log4cplus.
bool | equals (const ConfigBase &other) const
| Compares two configuration.
virtual void | merge (ConfigBase &other)
| Merges specified configuration into this configuration.
virtual isc::data::ElementPtr | toElement () const
| Converts to Element representation.
process::ConstConfigControlInfoPtr | getConfigControlInfo () const
| Fetches a read-only copy of the configuration control information.
void | setConfigControlInfo (const process::ConfigControlInfoPtr &config_ctl_info)
| Set the configuration control information.
void | setServerTag (const util::Optional< std::string > &server_tag)
| Sets the server's logical name.
util::Optional< std::string > | getServerTag () const
| Returns the server's logical name.
boost::posix_time::ptime | getLastCommitTime () const
| Returns the last commit timestamp.
void | setLastCommitTime (const boost::posix_time::ptime &last_commit_time)
| Sets the last commit timestamp.
void | copy (ConfigBase &new_config) const
| Copies the current configuration to a new configuration.

## Additional Inherited Members
Public Member Functions inherited from isc::data::UserContext
void | contextToElement (data::ElementPtr map) const
| Merge unparse a user_context object.
data::ConstElementPtr | getContext () const
| Returns const pointer to the user context.
void | setContext (const data::ConstElementPtr &ctx)
| Sets user context.
Public Member Functions inherited from isc::data::CfgToElement
virtual | ~CfgToElement ()
| Destructor.
Static Public Member Functions inherited from isc::data::UserContext
static data::ElementPtr | toElement (data::ConstElementPtr map)
| Copy an Element map.
Protected Attributes inherited from isc::data::UserContext
data::ConstElementPtr | user_context_
| Pointer to the user context (may be NULL).

## Detailed Description

Base class for all configurations.

This is a common base class that represents configurations. SrvConfig, D2CfgContext and possibly other classes holding configurations are derived from this.

It should contain only those elements that are applicable to really every daemon we may have. Before adding anything here, please consider whether it would be usable by all of the following: DHCP servers, DDNS update daemon, Netconf daemon, DHCP relay, DHCP client.

This class currently holds information about common server configuration.

Definition at line 33 of file config_base.h.

## Member Function Documentation

## ◆ addLoggingInfo()

void isc::process::ConfigBase::addLoggingInfo | ( | const process::LoggingInfo & | logging_info | ) |
| inline

Sets logging specific configuration.

Parameters

  logging_info | New logging configuration.

Definition at line 50 of file config_base.h.

Referenced by copy().

## ◆ applyLoggingCfg()

void isc::process::ConfigBase::applyLoggingCfg | ( |  | ) | const

Apply logging configuration to log4cplus.

Definition at line 23 of file config_base.cc.

References isc::log::getRootLoggerName(), and isc::log::LoggerManager::process().

Here is the call graph for this function:

## ◆ copy()

void isc::process::ConfigBase::copy | ( | ConfigBase & | new_config | ) | const
| protected

Copies the current configuration to a new configuration.

This method copies only the parameters defined in this class. Since derived classes are expected to provide their own copy methods, this one is protected and can be used only by descendant classes.

Parameters

  new_config | this configuration will be copied to new_config

Definition at line 77 of file config_base.cc.

References addLoggingInfo().

Referenced by isc::dhcp::SrvConfig::copy().

Here is the call graph for this function:

## ◆ equals()

bool isc::process::ConfigBase::equals | ( | const ConfigBase & | other | ) | const

Compares two configuration.

Parameters

  other | the other configuration to compare to

Definition at line 39 of file config_base.cc.

Referenced by isc::dhcp::SrvConfig::equals().

## ◆ getConfigControlInfo()

process::ConstConfigControlInfoPtr isc::process::ConfigBase::getConfigControlInfo | ( |  | ) | const
| inline

Fetches a read-only copy of the configuration control information.

Returns
  pointer to the const ConfigControlInfo

Definition at line 106 of file config_base.h.

Referenced by isc::dhcp::SrvConfig::toElement().

## ◆ getLastCommitTime()

boost::posix_time::ptime isc::process::ConfigBase::getLastCommitTime | ( |  | ) | const
| inline

Returns the last commit timestamp.

Returns
  the last commit timestamp.

Definition at line 140 of file config_base.h.

## ◆ getLoggingInfo()

const process::LoggingInfoStorage & isc::process::ConfigBase::getLoggingInfo | ( |  | ) | const
| inline

Returns logging specific configuration.

Definition at line 43 of file config_base.h.

Referenced by isc::dhcp::SrvConfig::toElement().

## ◆ getServerTag()

util::Optional< std::string > isc::process::ConfigBase::getServerTag | ( |  | ) | const
| inline

Returns the server's logical name.

Returns
  string containing the server's tag

Definition at line 134 of file config_base.h.

## ◆ merge()

void isc::process::ConfigBase::merge | ( | ConfigBase & | other | ) |
| virtual

Merges specified configuration into this configuration.

This method merges logging and config control configuration into this configuration. The new logging configuration replaces the existing configuration if the new logging configuration is non-empty. The new config control configuration replaces the existing configuration if the new logging configuration is non-null and non-empty.

Warning
  The call to `merge` may modify the data in the `other` object. Therefore, the caller must not rely on the data held in the `other` object after the call to `merge`. Also, the data held in `other` must not be modified after the call to `merge` because it may affect the merged configuration.

If a derivation of this class implements the `merge` method it should call `ConfigBase::merge`.

Parameters

  other | the other configuration to be merged into this configuration.

Definition at line 96 of file config_base.cc.

References isc::util::Optional< T >::get(), and isc::util::Optional< T >::unspecified().

Referenced by isc::dhcp::SrvConfig::merge().

Here is the call graph for this function:

## ◆ setConfigControlInfo()

void isc::process::ConfigBase::setConfigControlInfo | ( | const process::ConfigControlInfoPtr & | config_ctl_info | ) |
| inline

Set the configuration control information.

Updates the internal pointer to the configuration control information with the given pointer value. If the given pointer is empty, the internal pointer will be reset.

Parameters

  config_ctl_info | pointer to the configuration value to store.

Definition at line 118 of file config_base.h.

## ◆ setLastCommitTime()

void isc::process::ConfigBase::setLastCommitTime | ( | const boost::posix_time::ptime & | last_commit_time | ) |
| inline

Sets the last commit timestamp.

Parameters

  last_commit_time | last commit timestamp.

Definition at line 146 of file config_base.h.

## ◆ setServerTag()

void isc::process::ConfigBase::setServerTag | ( | const util::Optional< std::string > & | server_tag | ) |
| inline

Sets the server's logical name.

Parameters

  server_tag | a unique string name which identifies this server from any other configured servers

Definition at line 127 of file config_base.h.

## ◆ toElement()

ElementPtr isc::process::ConfigBase::toElement | ( |  | ) | const
| virtual

Converts to Element representation.

This creates a Map element with the following content (expressed as JSON): {{{ { "Server": { : } } }}}

Note that it will not contain the configuration control information (i.e. "config-control"), as this is not a top-level element, rather it belongs within the configured process element.

Returns
  Element representation.

Implements isc::data::CfgToElement.

Reimplemented in isc::d2::D2CfgContext, isc::d2::DScalarContext, isc::dhcp::SrvConfig, and isc::netconf::NetconfConfig.

Definition at line 118 of file config_base.cc.

References Element::create(), Element::createList(), and Element::createMap().

Referenced by isc::d2::D2CfgContext::toElement(), and isc::netconf::NetconfConfig::toElement().

Here is the call graph for this function:

The documentation for this class was generated from the following files:

- config_base.h
- config_base.cc