Kea  1.9.9-git
cb_ctl_dhcp.h
Go to the documentation of this file.
1 // Copyright (C) 2019 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 CB_CTL_DHCP_H
8 #define CB_CTL_DHCP_H
9 
10 #include <cc/stamped_value.h>
11 #include <process/cb_ctl_base.h>
12 #include <dhcpsrv/srv_config.h>
13 
14 namespace isc {
15 namespace dhcp {
16 
26 template<typename ConfigBackendMgrType>
27 class CBControlDHCP : public process::CBControlBase<ConfigBackendMgrType> {
28 public:
29 
32  : process::CBControlBase<ConfigBackendMgrType>() {
33  }
34 
35 protected:
36 
45  void addGlobalsToConfig(SrvConfigPtr external_cfg,
46  data::StampedValueCollection& cb_globals) const {
47  const auto& index = cb_globals.get<data::StampedValueNameIndexTag>();
48  for (auto cb_global = index.begin(); cb_global != index.end(); ++cb_global) {
49 
50  if ((*cb_global)->amNull()) {
51  continue;
52  }
53 
54  external_cfg->addConfiguredGlobal((*cb_global)->getName(),
55  (*cb_global)->getElementValue());
56  }
57  }
58 };
59 
60 } // end of namespace isc::dhcp
61 } // end of namespace isc
62 
63 #endif // CB_CTL_DHCP_H
CBControlBase()
Constructor.
Definition: cb_ctl_base.h:97
Base class for implementing server specific mechanisms to control the use of the Configuration Backen...
Definition: cb_ctl_base.h:80
boost::shared_ptr< SrvConfig > SrvConfigPtr
Non-const pointer to the SrvConfig.
Definition: srv_config.h:1036
void addGlobalsToConfig(SrvConfigPtr external_cfg, data::StampedValueCollection &cb_globals) const
Adds globals fetched from config backend(s) to a SrvConfig instance.
Definition: cb_ctl_dhcp.h:45
Base class for implementing mechanisms to control the use of the Configuration Backends by DHCPv4 and...
Definition: cb_ctl_dhcp.h:27
CBControlDHCP()
Constructor.
Definition: cb_ctl_dhcp.h:31
Tag for the index for access by value name.
Defines the logger used by the top-level component of kea-dhcp-ddns.
boost::multi_index_container< StampedValuePtr, boost::multi_index::indexed_by< boost::multi_index::hashed_non_unique< boost::multi_index::tag< StampedValueNameIndexTag >, boost::multi_index::const_mem_fun< StampedValue, std::string,&StampedValue::getName > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< StampedValueModificationTimeIndexTag >, boost::multi_index::const_mem_fun< BaseStampedElement, boost::posix_time::ptime,&BaseStampedElement::getModificationTime > > >> StampedValueCollection
Multi index container for StampedValue.