41 ensureCurrentAllocated();
51 configuration_->setD2ClientConfig(new_config);
66 return (d2_client_mgr_);
70CfgMgr::ensureCurrentAllocated() {
71 if (!configuration_ || configs_.empty()) {
73 configs_.push_back(configuration_);
80 configuration_->removeStatistics();
83 ensureCurrentAllocated();
90 ensureCurrentAllocated();
95 configuration_->removeStatistics();
97 if (!configs_.back()->sequenceEquals(*configuration_)) {
98 configuration_ = configs_.back();
102 SrvConfigList::iterator it = configs_.begin();
104 configs_.erase(configs_.begin(), it);
109 configuration_->updateStatistics();
114 ensureCurrentAllocated();
115 if (!configuration_->sequenceEquals(*configs_.back())) {
122 ensureCurrentAllocated();
125 " to an old configuration");
126 }
else if (index > configs_.size() - 1) {
128 << index <<
"', only '" << configs_.size() - 1
129 <<
"' previous commits available");
141 SrvConfigList::const_reverse_iterator it = configs_.rbegin();
142 std::advance(it, index);
155 ensureCurrentAllocated();
156 return (configuration_);
161 ensureCurrentAllocated();
162 if (configuration_->sequenceEquals(*configs_.back())) {
163 uint32_t sequence = configuration_->getSequence();
166 return (configs_.back());
170 : datadir_(DHCP_DATA_DIR), d2_client_mgr_(), family_(AF_INET) {
A generic exception that is thrown if a parameter given to a method would refer to or modify out-of-r...
CfgMgr()
Protected constructor.
const D2ClientConfigPtr & getD2ClientConfig() const
Fetches the DHCP-DDNS configuration pointer.
D2ClientMgr & getD2ClientMgr()
Fetches the DHCP-DDNS manager.
void clear()
Removes current, staging and all previous configurations.
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
SrvConfigPtr getStagingCfg()
Returns a pointer to the staging configuration.
void setDataDir(const std::string &datadir)
Sets new data directory.
bool ddnsEnabled()
Convenience method for checking if DHCP-DDNS updates are enabled.
std::string getDataDir() const
returns path do the data directory
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.
bool ddnsEnabled()
Convenience method for checking if DHCP-DDNS is enabled.
const D2ClientConfigPtr & getD2ClientConfig() const
Fetches the DHCP-DDNS configuration pointer.
void setD2ClientConfig(D2ClientConfigPtr &new_config)
Updates the DHCP-DDNS client configuration to the given value.
Specifies current DHCP configuration.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< D2ClientConfig > D2ClientConfigPtr
Defines a pointer for D2ClientConfig instances.
boost::shared_ptr< SrvConfig > SrvConfigPtr
Non-const pointer to the SrvConfig.
Defines the logger used by the top-level component of kea-dhcp-ddns.