27 : sequence_(0), cfg_iface_(new
CfgIface()),
38 decline_timer_(0), echo_v4_client_id_(true), dhcp4o6_port_(0),
40 configured_globals_(
Element::createMap()),
46 : sequence_(sequence), cfg_iface_(new
CfgIface()),
57 decline_timer_(0), echo_v4_client_id_(true), dhcp4o6_port_(0),
59 configured_globals_(
Element::createMap()),
70 if (subnets_num > 0) {
71 s <<
"added IPv4 subnets: " << subnets_num;
73 s <<
"no IPv4 subnets!";
80 if (subnets_num > 0) {
81 s <<
"added IPv6 subnets: " << subnets_num;
83 s <<
"no IPv6 subnets!";
90 s <<
"DDNS: " << (ddns_enabled ?
"enabled" :
"disabled") <<
"; ";
93 if (s.tellp() ==
static_cast<std::streampos
>(0)) {
94 s <<
"no config details available";
97 std::string summary = s.str();
98 size_t last_separator_pos = summary.find_last_of(
";");
99 if (last_separator_pos == summary.length() - 2) {
100 summary.erase(last_separator_pos);
115 new_config.cfg_iface_.reset(
new CfgIface(*cfg_iface_));
117 cfg_option_def_->copyTo(*new_config.cfg_option_def_);
118 cfg_option_->copyTo(*new_config.cfg_option_);
124 new_config.hooks_config_.
clear();
126 for (HookLibsCollection::const_iterator it =
127 hooks_config_.
get().begin();
128 it != hooks_config_.
get().end(); ++it) {
129 new_config.hooks_config_.
add(it->first, it->second);
142 if ((*cfg_iface_ != *other.cfg_iface_) ||
143 (*cfg_option_def_ != *other.cfg_option_def_) ||
144 (*cfg_option_ != *other.cfg_option_) ||
145 (*class_dictionary_ != *other.class_dictionary_) ||
146 (*d2_client_config_ != *other.d2_client_config_)) {
152 if (hooks_config_.
get().size() != other.hooks_config_.
get().size()) {
156 return (hooks_config_.
equal(other.hooks_config_));
189 const std::map<std::string, ConstElementPtr>& values = config->mapValue();
190 for (
auto value = values.begin(); value != values.end(); ++value) {
209 dhcp->setValue(configured_globals_->mapValue());
215 dhcp->set(
"decline-probation-period",
218 if (family == AF_INET) {
222 dhcp->set(
"dhcp4o6-port",
226 dhcp->set(
"dhcp-ddns", d2_client_config_->toElement());
228 dhcp->set(
"interfaces-config", cfg_iface_->toElement());
230 dhcp->set(
"option-def", cfg_option_def_->toElement());
232 dhcp->set(
"option-data", cfg_option_->toElement());
245 std::vector<ElementPtr> sn_list;
247 if (family == AF_INET) {
251 for (Subnet4Collection::const_iterator subnet = subnets->cbegin();
252 subnet != subnets->cend(); ++subnet) {
255 (*subnet)->getSharedNetwork(network);
259 ElementPtr subnet_cfg = (*subnet)->toElement();
260 sn_list.push_back(subnet_cfg);
261 plain_subnets->add(subnet_cfg);
263 dhcp->set(
"subnet4", plain_subnets);
266 ElementPtr shared_networks = cfg_shared_networks4_->toElement();
267 dhcp->set(
"shared-networks", shared_networks);
270 const std::vector<ElementPtr> networks = shared_networks->listValue();
271 for (
auto network = networks.cbegin();
272 network != networks.cend(); ++network) {
273 const std::vector<ElementPtr> sh_list =
274 (*network)->get(
"subnet4")->listValue();
275 for (
auto subnet = sh_list.cbegin();
276 subnet != sh_list.cend(); ++subnet) {
277 sn_list.push_back(*subnet);
285 for (Subnet6Collection::const_iterator subnet = subnets->cbegin();
286 subnet != subnets->cend(); ++subnet) {
289 (*subnet)->getSharedNetwork(network);
293 ElementPtr subnet_cfg = (*subnet)->toElement();
294 sn_list.push_back(subnet_cfg);
295 plain_subnets->add(subnet_cfg);
297 dhcp->set(
"subnet6", plain_subnets);
300 ElementPtr shared_networks = cfg_shared_networks6_->toElement();
301 dhcp->set(
"shared-networks", shared_networks);
304 const std::vector<ElementPtr> networks = shared_networks->listValue();
305 for (
auto network = networks.cbegin();
306 network != networks.cend(); ++network) {
307 const std::vector<ElementPtr> sh_list =
308 (*network)->get(
"subnet6")->listValue();
309 for (
auto subnet = sh_list.cbegin();
310 subnet != sh_list.cend(); ++subnet) {
311 sn_list.push_back(*subnet);
322 if (global_resvs->size() > 0) {
323 dhcp->set(
"reservations", global_resvs);
327 for (std::vector<ElementPtr>::const_iterator subnet = sn_list.cbegin();
328 subnet != sn_list.cend(); ++subnet) {
333 SubnetID subnet_id =
id->intValue();
335 (*subnet)->set(
"reservations", resvs);
340 dhcp->set(
"expired-leases-processing", expired);
341 if (family == AF_INET6) {
343 dhcp->set(
"server-id", cfg_duid_->toElement());
346 dhcp->set(
"relay-supplied-options", cfg_rsoo_->toElement());
350 dhcp->set(
"lease-database", lease_db.
toElement());
354 if (hosts_databases->size() > 0) {
355 dhcp->set(
"hosts-databases", hosts_databases);
359 if (family == AF_INET) {
360 host_ids = cfg_host_operations4_->toElement();
362 host_ids = cfg_host_operations6_->toElement();
364 dhcp->set(
"host-reservation-identifiers", host_ids);
366 if (family == AF_INET6) {
367 dhcp->set(
"mac-sources", cfg_mac_source_.
toElement());
370 if (!
isNull(control_socket_)) {
376 if (!client_classes->empty()) {
377 dhcp->set(
"client-classes", client_classes);
381 dhcp->set(
"hooks-libraries", hooks_libs);
383 result->set(family == AF_INET ?
"Dhcp4" :
"Dhcp6", dhcp);
386 dhcp->set(
"sanity-checks", cfg_consist);
392 dhcp->set(
"config-control", info_elem);
397 if (dhcp_queue_control) {
398 dhcp->set(
"dhcp-queue-control", dhcp_queue_control);
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
The Element class represents a piece of data, used by the command channel and configuration parts.
static ElementPtr create(const Position &pos=ZERO_POSITION())
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
Parameters for various consistency checks.
Holds manual configuration of the server identifier (DUID).
Holds access parameters and the configuration of the lease and hosts database connection.
Holds configuration parameters pertaining to lease expiration and lease affinity.
Represents global configuration for host reservations.
Utility class to represent host reservation configurations internally as a map keyed by subnet IDs,...
isc::data::ConstElementPtr get(SubnetID id) const
Return the host reservations for a subnet ID.
void internalize(isc::data::ConstElementPtr list)
Internalize a list Element.
Represents the host reservations specified in the configuration file.
Represents selection of interfaces for DHCP server.
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
uint16_t getFamily() const
Returns address family.
static CfgMgr & instance()
returns a single instance of Configuration Manager
Represents option definitions used by the DHCP server.
Represents option data configuration for the DHCP server.
Represents configuration of the RSOO options for the DHCP server.
Represents configuration of IPv4 shared networks.
Represents configuration of IPv6 shared networks.
Holds subnets configured for the DHCPv4 server.
Holds subnets configured for the DHCPv6 server.
Maintains a list of ClientClassDef's.
Acts as a storage vault for D2 client configuration.
static bool haveInstance()
Indicates if the lease manager has been instantiated.
Specifies current DHCP configuration.
static const uint32_t CFGSEL_SUBNET4
Number of IPv4 subnets.
void addConfiguredGlobal(const std::string &name, isc::data::ConstElementPtr value)
Adds a parameter to the collection configured globals.
void extractConfiguredGlobals(isc::data::ConstElementPtr config)
Saves scalar elements from the global scope of a configuration.
void setD2ClientConfig(const D2ClientConfigPtr &d2_client_config)
Sets the D2 client configuration.
bool sequenceEquals(const SrvConfig &other)
Compares configuration sequence with other sequence.
CfgSubnets4Ptr getCfgSubnets4()
Returns pointer to non-const object holding subnets configuration for DHCPv4.
CfgSubnets6Ptr getCfgSubnets6()
Returns pointer to non-const object holding subnets configuration for DHCPv6.
D2ClientConfigPtr getD2ClientConfig()
Returns pointer to the D2 client configuration.
std::string getConfigSummary(const uint32_t selection) const
Returns summary of the configuration in the textual format.
const isc::data::ConstElementPtr getDHCPQueueControl() const
Returns DHCP queue control information.
bool equals(const SrvConfig &other) const
Compares two objects for equality.
uint32_t getSequence() const
Returns configuration sequence number.
static const uint32_t CFGSEL_DDNS
DDNS enabled/disabled.
void removeStatistics()
Removes statistics.
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
static const uint32_t CFGSEL_SUBNET6
Number of IPv6 subnets.
void updateStatistics()
Updates statistics.
void copy(SrvConfig &new_config) const
Copies the current configuration to a new configuration.
SrvConfig()
Default constructor.
void clear()
Removes all configured hooks libraries.
bool equal(const HooksConfig &other) const
Compares two Hooks Config classes for equality.
const isc::hooks::HookLibsCollection & get() const
Provides access to the configured hooks libraries.
isc::data::ElementPtr toElement() const
Unparse a configuration object.
void add(std::string libname, isc::data::ConstElementPtr parameters)
Adds additional hooks libraries.
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 copy(ConfigBase &new_config) const
Copies the current configuration to a new configuration.
bool equals(const ConfigBase &other) const
Compares two configuration.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< const Element > ConstElementPtr
bool isNull(ConstElementPtr p)
Checks whether the given ElementPtr is a NULL pointer.
boost::shared_ptr< Element > ElementPtr
boost::multi_index_container< Subnet6Ptr, boost::multi_index::indexed_by< boost::multi_index::random_access< boost::multi_index::tag< SubnetRandomAccessIndexTag > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetSubnetIdIndexTag >, boost::multi_index::const_mem_fun< Subnet, SubnetID, &Subnet::getID > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetPrefixIndexTag >, boost::multi_index::const_mem_fun< Subnet, std::string, &Subnet::toText > > > > Subnet6Collection
A collection of Subnet6 objects.
boost::shared_ptr< SharedNetwork6 > SharedNetwork6Ptr
Pointer to SharedNetwork6 object.
uint32_t SubnetID
Unique identifier for a subnet (both v4 and v6)
boost::multi_index_container< Subnet4Ptr, boost::multi_index::indexed_by< boost::multi_index::random_access< boost::multi_index::tag< SubnetRandomAccessIndexTag > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetSubnetIdIndexTag >, boost::multi_index::const_mem_fun< Subnet, SubnetID, &Subnet::getID > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetPrefixIndexTag >, boost::multi_index::const_mem_fun< Subnet, std::string, &Subnet::toText > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SubnetServerIdIndexTag >, boost::multi_index::const_mem_fun< Network4, asiolink::IOAddress, &Network4::getServerId > > > > Subnet4Collection
A collection of Subnet4 objects.
boost::shared_ptr< SharedNetwork4 > SharedNetwork4Ptr
Pointer to SharedNetwork4 object.
boost::shared_ptr< const ConfigControlInfo > ConstConfigControlInfoPtr
Defines a pointer to a const ConfigControlInfo.
Defines the logger used by the top-level component of kea-dhcp-ddns.
void contextToElement(data::ElementPtr map) const
Merge unparse a user_context object.
static data::ElementPtr toElement(data::ConstElementPtr map)
Copy extracting comments an Element map.
virtual isc::data::ElementPtr toElement() const
Unparse.
utility class for unparsing
virtual isc::data::ElementPtr toElement() const
Unparse.