20#include <boost/shared_ptr.hpp>
21#include <boost/noncopyable.hpp>
70class CfgMgr :
public boost::noncopyable {
95 void setDataDir(
const std::string& datadir,
bool unspecified =
true);
195 void revert(
const size_t index);
276 family_ = family == AF_INET ? AF_INET : AF_INET6;
306 void ensureCurrentAllocated();
315 void mergeIntoCfg(
const SrvConfigPtr& taget_config,
const uint32_t seq);
333 typedef std::list<SrvConfigPtr> SrvConfigList;
336 SrvConfigList configs_;
343 typedef std::map<uint32_t, SrvConfigPtr> SrvConfigMap;
347 SrvConfigMap external_configs_;
Defines elements for storing the names of client classes.
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
util::Optional< std::string > getDataDir() const
returns path do the data directory
CfgMgr()
Protected constructor.
const D2ClientConfigPtr & getD2ClientConfig() const
Fetches the DHCP-DDNS configuration pointer.
D2ClientMgr & getD2ClientMgr()
Fetches the DHCP-DDNS manager.
uint16_t getFamily() const
Returns address family.
void setFamily(uint16_t family)
Sets address family (AF_INET or AF_INET6)
void clear()
Removes current, staging and all previous configurations.
SrvConfigPtr createExternalCfg()
Creates an external configuration and returns pointer to it.
void setD2ClientConfig(D2ClientConfigPtr &new_config)
Updates the DHCP-DDNS client configuration to the given value.
void rollback()
Removes staging configuration.
static CfgMgr & instance()
returns a single instance of Configuration Manager
virtual ~CfgMgr()
virtual destructor
void mergeIntoStagingCfg(const uint32_t seq)
Merges external configuration with the given sequence number into the staging configuration.
void mergeIntoCurrentCfg(const uint32_t seq)
Merges external configuration with the given sequence number into the current configuration.
void setDataDir(const std::string &datadir, bool unspecified=true)
Sets new data directory.
SrvConfigPtr getStagingCfg()
Returns a pointer to the staging configuration.
bool ddnsEnabled()
Convenience method for checking if DHCP-DDNS updates are enabled.
void revert(const size_t index)
Reverts to one of the previous configurations.
static const size_t CONFIG_LIST_SIZE
A number of configurations held by CfgMgr.
void commit()
Commits the staging configuration.
SrvConfigPtr getCurrentCfg()
Returns a pointer to the current configuration.
D2ClientMgr isolates Kea from the details of being a D2 client.
Exception thrown when the same interface has been specified twice.
DuplicateListeningIface(const char *file, size_t line, const char *what)
A template representing an optional value.
Defines the D2ClientMgr class.
boost::shared_ptr< D2ClientConfig > D2ClientConfigPtr
Defines a pointer for D2ClientConfig instances.
boost::shared_ptr< SrvConfig > SrvConfigPtr
Non-const pointer to the SrvConfig.
boost::shared_ptr< D2ClientMgr > D2ClientMgrPtr
Defines a pointer for D2ClientMgr instances.
Defines the logger used by the top-level component of kea-lfc.