Kea 3.1.1
srv_config.cc
Go to the documentation of this file.
1// Copyright (C) 2014-2025 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#include <config.h>
8
9#include <cc/simple_parser.h>
11#include <dhcpsrv/cfgmgr.h>
23#include <dhcpsrv/srv_config.h>
25#include <dhcpsrv/dhcpsrv_log.h>
28#include <log/logger_manager.h>
30#include <dhcp/pkt.h>
31#include <stats/stats_mgr.h>
32#include <util/str.h>
33
34#include <boost/make_shared.hpp>
35
36#include <list>
37#include <sstream>
38
39using namespace isc::log;
40using namespace isc::data;
41using namespace isc::process;
42
43namespace isc {
44namespace dhcp {
45
47 : sequence_(0), cfg_iface_(new CfgIface()),
48 cfg_option_def_(new CfgOptionDef()), cfg_option_(new CfgOption()),
49 cfg_subnets4_(new CfgSubnets4()), cfg_subnets6_(new CfgSubnets6()),
50 cfg_shared_networks4_(new CfgSharedNetworks4()),
51 cfg_shared_networks6_(new CfgSharedNetworks6()),
52 cfg_hosts_(new CfgHosts()), cfg_rsoo_(new CfgRSOO()),
53 cfg_expiration_(new CfgExpiration()), cfg_duid_(new CfgDUID()),
54 cfg_db_access_(new CfgDbAccess()),
55 cfg_host_operations4_(CfgHostOperations::createConfig4()),
56 cfg_host_operations6_(CfgHostOperations::createConfig6()),
57 class_dictionary_(new ClientClassDictionary()),
58 decline_timer_(0), echo_v4_client_id_(true), dhcp4o6_port_(0),
59 d2_client_config_(new D2ClientConfig()),
60 configured_globals_(new CfgGlobals()), cfg_consist_(new CfgConsistency()),
61 lenient_option_parsing_(false), ignore_dhcp_server_identifier_(false),
62 ignore_rai_link_selection_(false), exclude_first_last_24_(false),
63 reservations_lookup_first_(false) {
64}
65
66SrvConfig::SrvConfig(const uint32_t sequence)
67 : sequence_(sequence), cfg_iface_(new CfgIface()),
68 cfg_option_def_(new CfgOptionDef()), cfg_option_(new CfgOption()),
69 cfg_subnets4_(new CfgSubnets4()), cfg_subnets6_(new CfgSubnets6()),
70 cfg_shared_networks4_(new CfgSharedNetworks4()),
71 cfg_shared_networks6_(new CfgSharedNetworks6()),
72 cfg_hosts_(new CfgHosts()), cfg_rsoo_(new CfgRSOO()),
73 cfg_expiration_(new CfgExpiration()), cfg_duid_(new CfgDUID()),
74 cfg_db_access_(new CfgDbAccess()),
75 cfg_host_operations4_(CfgHostOperations::createConfig4()),
76 cfg_host_operations6_(CfgHostOperations::createConfig6()),
77 class_dictionary_(new ClientClassDictionary()),
78 decline_timer_(0), echo_v4_client_id_(true), dhcp4o6_port_(0),
79 d2_client_config_(new D2ClientConfig()),
80 configured_globals_(new CfgGlobals()), cfg_consist_(new CfgConsistency()),
81 lenient_option_parsing_(false), ignore_dhcp_server_identifier_(false),
82 ignore_rai_link_selection_(false), exclude_first_last_24_(false),
83 reservations_lookup_first_(false) {
84}
85
86std::string
87SrvConfig::getConfigSummary(const uint32_t selection) const {
88 std::ostringstream s;
89 size_t subnets_num;
90 if ((selection & CFGSEL_SUBNET4) == CFGSEL_SUBNET4) {
91 subnets_num = getCfgSubnets4()->getAll()->size();
92 if (subnets_num > 0) {
93 s << "added IPv4 subnets: " << subnets_num;
94 } else {
95 s << "no IPv4 subnets!";
96 }
97 s << "; ";
98 }
99
100 if ((selection & CFGSEL_SUBNET6) == CFGSEL_SUBNET6) {
101 subnets_num = getCfgSubnets6()->getAll()->size();
102 if (subnets_num > 0) {
103 s << "added IPv6 subnets: " << subnets_num;
104 } else {
105 s << "no IPv6 subnets!";
106 }
107 s << "; ";
108 }
109
110 if ((selection & CFGSEL_DDNS) == CFGSEL_DDNS) {
111 bool ddns_enabled = getD2ClientConfig()->getEnableUpdates();
112 s << "DDNS: " << (ddns_enabled ? "enabled" : "disabled") << "; ";
113 }
114
115 if (s.tellp() == static_cast<std::streampos>(0)) {
116 s << "no config details available";
117 }
118
119 std::string summary = s.str();
120 size_t last_separator_pos = summary.find_last_of(";");
121 if (last_separator_pos == summary.length() - 2) {
122 summary.erase(last_separator_pos);
123 }
124 return (summary);
125}
126
127bool
129 return (getSequence() == other.getSequence());
130}
131
132void
133SrvConfig::copy(SrvConfig& new_config) const {
134 ConfigBase::copy(new_config);
135
136 // Replace interface configuration.
137 new_config.cfg_iface_.reset(new CfgIface(*cfg_iface_));
138 // Replace option definitions.
139 cfg_option_def_->copyTo(*new_config.cfg_option_def_);
140 cfg_option_->copyTo(*new_config.cfg_option_);
141 // Replace the client class dictionary
142 new_config.class_dictionary_.reset(new ClientClassDictionary(*class_dictionary_));
143 // Replace the D2 client configuration
145 // Replace configured hooks libraries.
146 new_config.hooks_config_.clear();
147 using namespace isc::hooks;
148 for (auto const& it : hooks_config_.get()) {
149 new_config.hooks_config_.add(it.libname_, it.parameters_, it.cfgname_);
150 }
151}
152
153bool
154SrvConfig::equals(const SrvConfig& other) const {
155
156 // Checks common elements: logging & config control
157 if (!ConfigBase::equals(other)) {
158 return (false);
159 }
160
161 // Common information is equal between objects, so check other values.
162 if ((*cfg_iface_ != *other.cfg_iface_) ||
163 (*cfg_option_def_ != *other.cfg_option_def_) ||
164 (*cfg_option_ != *other.cfg_option_) ||
165 (*class_dictionary_ != *other.class_dictionary_) ||
166 (*d2_client_config_ != *other.d2_client_config_)) {
167 return (false);
168 }
169 // Now only configured hooks libraries can differ.
170 // If number of configured hooks libraries are different, then
171 // configurations aren't equal.
172 if (hooks_config_.get().size() != other.hooks_config_.get().size()) {
173 return (false);
174 }
175
176 // Pass through all configured hooks libraries.
177 return (hooks_config_.equal(other.hooks_config_));
178}
179
180void
182 ConfigBase::merge(other);
183 try {
184 SrvConfig& other_srv_config = dynamic_cast<SrvConfig&>(other);
185 // We merge objects in order of dependency (real or theoretical).
186 // First we merge the common stuff.
187
188 // Merge globals.
189 mergeGlobals(other_srv_config);
190
191 // Merge global containers.
192 mergeGlobalContainers(other_srv_config);
193
194 // Merge option defs. We need to do this next so we
195 // pass these into subsequent merges so option instances
196 // at each level can be created based on the merged
197 // definitions.
198 cfg_option_def_->merge(*other_srv_config.getCfgOptionDef());
199
200 // Merge options.
201 cfg_option_->merge(cfg_option_def_, *other_srv_config.getCfgOption());
202
203 if (!other_srv_config.getClientClassDictionary()->empty()) {
204 // Client classes are complicated because they are ordered and may
205 // depend on each other. Merging two lists of classes with preserving
206 // the order would be very involved and could result in errors. Thus,
207 // we simply replace the current list of classes with a new list.
208 setClientClassDictionary(boost::make_shared
209 <ClientClassDictionary>(*other_srv_config.getClientClassDictionary()));
210 }
211
212 if (CfgMgr::instance().getFamily() == AF_INET) {
213 merge4(other_srv_config);
214 } else {
215 merge6(other_srv_config);
216 }
217 } catch (const std::bad_cast&) {
218 isc_throw(InvalidOperation, "internal server error: must use derivation"
219 " of the SrvConfig as an argument of the call to"
220 " SrvConfig::merge()");
221 }
222}
223
224void
225SrvConfig::merge4(SrvConfig& other) {
226 // Merge shared networks.
227 cfg_shared_networks4_->merge(cfg_option_def_, *(other.getCfgSharedNetworks4()));
228
229 // Merge subnets.
230 cfg_subnets4_->merge(cfg_option_def_, getCfgSharedNetworks4(),
231 *(other.getCfgSubnets4()));
232
234}
235
236void
237SrvConfig::merge6(SrvConfig& other) {
238 // Merge shared networks.
239 cfg_shared_networks6_->merge(cfg_option_def_, *(other.getCfgSharedNetworks6()));
240
241 // Merge subnets.
242 cfg_subnets6_->merge(cfg_option_def_, getCfgSharedNetworks6(),
243 *(other.getCfgSubnets6()));
244
246}
247
248void
249SrvConfig::mergeGlobals(SrvConfig& other) {
250 auto config_set = getConfiguredGlobals();
251 // Iterate over the "other" globals, adding/overwriting them into
252 // this config's list of globals.
253 for (auto const& other_global : other.getConfiguredGlobals()->valuesMap()) {
254 addConfiguredGlobal(other_global.first, other_global.second);
255 }
256
257 // A handful of values are stored as members in SrvConfig. So we'll
258 // iterate over the merged globals, setting appropriate members.
259 for (auto const& merged_global : getConfiguredGlobals()->valuesMap()) {
260 std::string name = merged_global.first;
261 ConstElementPtr element = merged_global.second;
262 try {
263 if (name == "decline-probation-period") {
264 setDeclinePeriod(element->intValue());
265 } else if (name == "echo-client-id") {
266 // echo-client-id is v4 only, but we'll let upstream
267 // worry about that.
268 setEchoClientId(element->boolValue());
269 } else if (name == "dhcp4o6-port") {
270 setDhcp4o6Port(element->intValue());
271 } else if (name == "server-tag") {
272 setServerTag(element->stringValue());
273 } else if (name == "ip-reservations-unique") {
274 setIPReservationsUnique(element->boolValue());
275 } else if (name == "reservations-lookup-first") {
276 setReservationsLookupFirst(element->boolValue());
277 }
278 } catch(const std::exception& ex) {
279 isc_throw (BadValue, "Invalid value:" << element->str()
280 << " explicit global:" << name);
281 }
282 }
283}
284
285void
286SrvConfig::mergeGlobalContainers(SrvConfig& other) {
288 for (auto const& other_global : other.getConfiguredGlobals()->valuesMap()) {
289 config->set(other_global.first, other_global.second);
290 }
291 std::string parameter_name;
292 try {
293 // Merge list containers.
294 ConstElementPtr host_reservation_identifiers = config->get("host-reservation-identifiers");
295 parameter_name = "host-reservation-identifiers";
296 if (host_reservation_identifiers) {
297 if (CfgMgr::instance().getFamily() == AF_INET) {
298 HostReservationIdsParser4 parser(getCfgHostOperations4());
299 parser.parse(host_reservation_identifiers);
300 } else {
301 HostReservationIdsParser6 parser(getCfgHostOperations6());
302 parser.parse(host_reservation_identifiers);
303 }
304 addConfiguredGlobal("host-reservation-identifiers", host_reservation_identifiers);
305 }
306 // Merge map containers.
307 ConstElementPtr compatibility = config->get("compatibility");
308 parameter_name = "compatibility";
309 if (compatibility) {
310 CompatibilityParser parser;
311 parser.parse(compatibility, *this);
312 addConfiguredGlobal("compatibility", compatibility);
313 }
314 ElementPtr dhcp_ddns = boost::const_pointer_cast<Element>(config->get("dhcp-ddns"));
315 parameter_name = "dhcp-ddns";
316 if (dhcp_ddns) {
317 // Apply defaults
319 D2ClientConfigParser parser;
320 // D2 client configuration.
321 D2ClientConfigPtr d2_client_cfg;
322 d2_client_cfg = parser.parse(dhcp_ddns);
323 if (!d2_client_cfg) {
324 d2_client_cfg.reset(new D2ClientConfig());
325 }
326 d2_client_cfg->validateContents();
327 setD2ClientConfig(d2_client_cfg);
328 addConfiguredGlobal("dhcp-ddns", dhcp_ddns);
329 }
330 ConstElementPtr expiration_cfg = config->get("expired-leases-processing");
331 parameter_name = "expired-leases-processing";
332 if (expiration_cfg) {
333 ExpirationConfigParser parser;
334 parser.parse(expiration_cfg, getCfgExpiration());
335 addConfiguredGlobal("expired-leases-processing", expiration_cfg);
336 }
337 ElementPtr multi_threading = boost::const_pointer_cast<Element>(config->get("multi-threading"));
338 parameter_name = "multi-threading";
339 if (multi_threading) {
340 if (CfgMgr::instance().getFamily() == AF_INET) {
342 } else {
344 }
345 MultiThreadingConfigParser parser;
346 parser.parse(*this, multi_threading);
347 addConfiguredGlobal("multi-threading", multi_threading);
348 }
349 bool multi_threading_enabled = true;
350 uint32_t thread_count = 0;
351 uint32_t queue_size = 0;
353 multi_threading_enabled, thread_count, queue_size);
354 ElementPtr sanity_checks = boost::const_pointer_cast<Element>(config->get("sanity-checks"));
355 parameter_name = "sanity-checks";
356 if (sanity_checks) {
357 if (CfgMgr::instance().getFamily() == AF_INET) {
359 } else {
361 }
362 SanityChecksParser parser;
363 parser.parse(*this, sanity_checks);
364 addConfiguredGlobal("multi-threading", sanity_checks);
365 }
366 ConstElementPtr server_id = config->get("server-id");
367 parameter_name = "server-id";
368 if (server_id) {
369 DUIDConfigParser parser;
370 const CfgDUIDPtr& cfg = getCfgDUID();
371 parser.parse(cfg, server_id);
372 addConfiguredGlobal("server-id", server_id);
373 }
374 ElementPtr queue_control = boost::const_pointer_cast<Element>(config->get("dhcp-queue-control"));
375 parameter_name = "dhcp-queue-control";
376 if (queue_control) {
377 if (CfgMgr::instance().getFamily() == AF_INET) {
379 } else {
381 }
382 DHCPQueueControlParser parser;
383 setDHCPQueueControl(parser.parse(queue_control, multi_threading_enabled));
384 addConfiguredGlobal("dhcp-queue-control", queue_control);
385 }
386 } catch (const isc::Exception& ex) {
387 isc_throw(BadValue, "Invalid parameter " << parameter_name << " error: " << ex.what());
388 } catch (...) {
389 isc_throw(BadValue, "Invalid parameter " << parameter_name);
390 }
391}
392
393void
395 // Removes statistics for v4 and v6 subnets
396 getCfgSubnets4()->removeStatistics();
397 getCfgSubnets6()->removeStatistics();
398}
399
400void
402 // Update default sample limits.
404 ConstElementPtr samples =
405 getConfiguredGlobal("statistic-default-sample-count");
406 uint32_t max_samples = 0;
407 if (samples) {
408 max_samples = samples->intValue();
409 stats_mgr.setMaxSampleCountDefault(max_samples);
410 if (max_samples != 0) {
411 stats_mgr.setMaxSampleCountAll(max_samples);
412 }
413 }
414 ConstElementPtr duration =
415 getConfiguredGlobal("statistic-default-sample-age");
416 if (duration) {
417 int64_t time_duration = duration->intValue();
418 auto max_age = std::chrono::seconds(time_duration);
419 stats_mgr.setMaxSampleAgeDefault(max_age);
420 if (max_samples == 0) {
421 stats_mgr.setMaxSampleAgeAll(max_age);
422 }
423 }
424
425 // Updating subnet statistics involves updating lease statistics, which
426 // is done by the LeaseMgr. Since servers with subnets, must have a
427 // LeaseMgr, we do not bother updating subnet stats for servers without
428 // a lease manager, such as D2. @todo We should probably examine why
429 // "SrvConfig" is being used by D2.
431 // Updates statistics for v4 and v6 subnets.
432 getCfgSubnets4()->updateStatistics();
433 getCfgSubnets6()->updateStatistics();
434 }
435}
436
437void
439 // Code from SimpleParser::setDefaults
440 // This is the position representing a default value. As the values
441 // we're inserting here are not present in whatever the config file
442 // came from, we need to make sure it's clearly labeled as default.
443 const Element::Position pos("<default-value>", 0, 0);
444
445 // Let's go over all parameters we have defaults for.
446 for (auto const& def_value : defaults) {
447
448 // Try if such a parameter is there. If it is, let's
449 // skip it, because user knows best *cough*.
450 ConstElementPtr x = getConfiguredGlobal(def_value.name_);
451 if (x) {
452 // There is such a value already, skip it.
453 continue;
454 }
455
456 // There isn't such a value defined, let's create the default
457 // value...
458 switch (def_value.type_) {
459 case Element::string: {
460 x.reset(new StringElement(def_value.value_, pos));
461 break;
462 }
463 case Element::integer: {
464 try {
465 int int_value = boost::lexical_cast<int>(def_value.value_);
466 x.reset(new IntElement(int_value, pos));
467 }
468 catch (const std::exception& ex) {
470 "Internal error. Integer value expected for: "
471 << def_value.name_ << ", value is: "
472 << def_value.value_ );
473 }
474
475 break;
476 }
477 case Element::boolean: {
478 bool bool_value;
479 if (def_value.value_ == std::string("true")) {
480 bool_value = true;
481 } else if (def_value.value_ == std::string("false")) {
482 bool_value = false;
483 } else {
485 "Internal error. Boolean value for "
486 << def_value.name_ << " specified as "
487 << def_value.value_ << ", expected true or false");
488 }
489 x.reset(new BoolElement(bool_value, pos));
490 break;
491 }
492 case Element::real: {
493 double dbl_value = boost::lexical_cast<double>(def_value.value_);
494 x.reset(new DoubleElement(dbl_value, pos));
495 break;
496 }
497 default:
498 // No default values for null, list or map
500 "Internal error. Incorrect default value type for "
501 << def_value.name_);
502 }
503 addConfiguredGlobal(def_value.name_, x);
504 }
505}
506
507void
509 if (config->getType() != Element::map) {
510 isc_throw(BadValue, "extractConfiguredGlobals must be given a map element");
511 }
512
513 const std::map<std::string, ConstElementPtr>& values = config->mapValue();
514 for (auto const& value : values) {
515 if (value.second->getType() != Element::list &&
516 value.second->getType() != Element::map) {
517 addConfiguredGlobal(value.first, value.second);
518 }
519 }
520}
521
522void
523SrvConfig::sanityChecksLifetime(const std::string& name) const {
524 // Initialize as some compilers complain otherwise.
525 uint32_t value = 0;
526 ConstElementPtr has_value = getConfiguredGlobal(name);
527 if (has_value) {
528 value = has_value->intValue();
529 }
530
531 uint32_t min_value = 0;
532 ConstElementPtr has_min = getConfiguredGlobal("min-" + name);
533 if (has_min) {
534 min_value = has_min->intValue();
535 }
536
537 uint32_t max_value = 0;
538 ConstElementPtr has_max = getConfiguredGlobal("max-" + name);
539 if (has_max) {
540 max_value = has_max->intValue();
541 }
542
543 if (!has_value && !has_min && !has_max) {
544 return;
545 }
546 if (has_value) {
547 if (!has_min && !has_max) {
548 // default only.
549 return;
550 } else if (!has_min) {
551 // default and max.
552 min_value = value;
553 } else if (!has_max) {
554 // default and min.
555 max_value = value;
556 }
557 } else if (has_min) {
558 if (!has_max) {
559 // min only.
560 return;
561 } else {
562 // min and max.
563 isc_throw(BadValue, "have min-" << name << " and max-"
564 << name << " but no " << name << " (default)");
565 }
566 } else {
567 // max only.
568 return;
569 }
570
571 // Check that min <= max.
572 if (min_value > max_value) {
573 if (has_min && has_max) {
574 isc_throw(BadValue, "the value of min-" << name << " ("
575 << min_value << ") is not less than max-" << name << " ("
576 << max_value << ")");
577 } else if (has_min) {
578 // Only min and default so min > default.
579 isc_throw(BadValue, "the value of min-" << name << " ("
580 << min_value << ") is not less than (default) " << name
581 << " (" << value << ")");
582 } else {
583 // Only default and max so default > max.
584 isc_throw(BadValue, "the value of (default) " << name
585 << " (" << value << ") is not less than max-" << name
586 << " (" << max_value << ")");
587 }
588 }
589
590 // Check that value is between min and max.
591 if ((value < min_value) || (value > max_value)) {
592 isc_throw(BadValue, "the value of (default) " << name << " ("
593 << value << ") is not between min-" << name << " ("
594 << min_value << ") and max-" << name << " ("
595 << max_value << ")");
596 }
597}
598
599void
601 const std::string& name) const {
602 // Three cases:
603 // - the external/source config has the parameter: use it.
604 // - only the target config has the parameter: use this one.
605 // - no config has the parameter.
606 uint32_t value = 0;
607 ConstElementPtr has_value = getConfiguredGlobal(name);
608 bool new_value = true;
609 if (!has_value) {
610 has_value = target_config.getConfiguredGlobal(name);
611 new_value = false;
612 }
613 if (has_value) {
614 value = has_value->intValue();
615 }
616
617 uint32_t min_value = 0;
618 ConstElementPtr has_min = getConfiguredGlobal("min-" + name);
619 bool new_min = true;
620 if (!has_min) {
621 has_min = target_config.getConfiguredGlobal("min-" + name);
622 new_min = false;
623 }
624 if (has_min) {
625 min_value = has_min->intValue();
626 }
627
628 uint32_t max_value = 0;
629 ConstElementPtr has_max = getConfiguredGlobal("max-" + name);
630 bool new_max = true;
631 if (!has_max) {
632 has_max = target_config.getConfiguredGlobal("max-" + name);
633 new_max = false;
634 }
635 if (has_max) {
636 max_value = has_max->intValue();
637 }
638
639 if (!has_value && !has_min && !has_max) {
640 return;
641 }
642 if (has_value) {
643 if (!has_min && !has_max) {
644 // default only.
645 return;
646 } else if (!has_min) {
647 // default and max.
648 min_value = value;
649 } else if (!has_max) {
650 // default and min.
651 max_value = value;
652 }
653 } else if (has_min) {
654 if (!has_max) {
655 // min only.
656 return;
657 } else {
658 // min and max.
659 isc_throw(BadValue, "have min-" << name << " and max-"
660 << name << " but no " << name << " (default)");
661 }
662 } else {
663 // max only.
664 return;
665 }
666
667 // Check that min <= max.
668 if (min_value > max_value) {
669 if (has_min && has_max) {
670 std::string from_min = (new_min ? "new" : "previous");
671 std::string from_max = (new_max ? "new" : "previous");
672 isc_throw(BadValue, "the value of " << from_min
673 << " min-" << name << " ("
674 << min_value << ") is not less than "
675 << from_max << " max-" << name
676 << " (" << max_value << ")");
677 } else if (has_min) {
678 // Only min and default so min > default.
679 std::string from_min = (new_min ? "new" : "previous");
680 std::string from_value = (new_value ? "new" : "previous");
681 isc_throw(BadValue, "the value of " << from_min
682 << " min-" << name << " ("
683 << min_value << ") is not less than " << from_value
684 << " (default) " << name
685 << " (" << value << ")");
686 } else {
687 // Only default and max so default > max.
688 std::string from_max = (new_max ? "new" : "previous");
689 std::string from_value = (new_value ? "new" : "previous");
690 isc_throw(BadValue, "the value of " << from_value
691 << " (default) " << name
692 << " (" << value << ") is not less than " << from_max
693 << " max-" << name << " (" << max_value << ")");
694 }
695 }
696
697 // Check that value is between min and max.
698 if ((value < min_value) || (value > max_value)) {
699 std::string from_value = (new_value ? "new" : "previous");
700 std::string from_min = (new_min ? "new" : "previous");
701 std::string from_max = (new_max ? "new" : "previous");
702 isc_throw(BadValue, "the value of " << from_value
703 <<" (default) " << name << " ("
704 << value << ") is not between " << from_min
705 << " min-" << name << " (" << min_value
706 << ") and " << from_max << " max-"
707 << name << " (" << max_value << ")");
708 }
709}
710
713 // Top level map
715
716 // Get family for the configuration manager
717 uint16_t family = CfgMgr::instance().getFamily();
718
719 // DhcpX global map initialized from configured globals
720 ElementPtr dhcp = configured_globals_->toElement();
721
722 auto loggers_info = getLoggingInfo();
723 // Was in the Logging global map.
724 if (!loggers_info.empty()) {
725 // Set loggers list
727 for (LoggingInfoStorage::const_iterator logger =
728 loggers_info.cbegin();
729 logger != loggers_info.cend(); ++logger) {
730 loggers->add(logger->toElement());
731 }
732 dhcp->set("loggers", loggers);
733 }
734
735 // Set user-context
737
738 // Set compatibility flags.
739 ElementPtr compatibility = Element::createMap();
741 compatibility->set("lenient-option-parsing", Element::create(true));
742 }
744 compatibility->set("ignore-dhcp-server-identifier", Element::create(true));
745 }
747 compatibility->set("ignore-rai-link-selection", Element::create(true));
748 }
749 if (getExcludeFirstLast24()) {
750 compatibility->set("exclude-first-last-24", Element::create(true));
751 }
752 if (compatibility->size() > 0) {
753 dhcp->set("compatibility", compatibility);
754 }
755
756 // Set decline-probation-period
757 dhcp->set("decline-probation-period",
758 Element::create(static_cast<long long>(decline_timer_)));
759 // Set echo-client-id (DHCPv4)
760 if (family == AF_INET) {
761 dhcp->set("echo-client-id", Element::create(echo_v4_client_id_));
762 }
763 // Set dhcp4o6-port
764 dhcp->set("dhcp4o6-port",
765 Element::create(static_cast<int>(dhcp4o6_port_)));
766 // Set dhcp-ddns
767 dhcp->set("dhcp-ddns", d2_client_config_->toElement());
768 // Set interfaces-config
769 dhcp->set("interfaces-config", cfg_iface_->toElement());
770 // Set option-def
771 dhcp->set("option-def", cfg_option_def_->toElement());
772 // Set option-data
773 dhcp->set("option-data", cfg_option_->toElement());
774
775 // Set subnets and shared networks.
776
777 // We have two problems to solve:
778 // - a subnet is unparsed once:
779 // * if it is a plain subnet in the global subnet list
780 // * if it is a member of a shared network in the shared network
781 // subnet list
782 // - unparsed subnets must be kept to add host reservations in them.
783 // Of course this can be done only when subnets are unparsed.
784
785 // The list of all unparsed subnets
786 std::vector<ElementPtr> sn_list;
787
788 if (family == AF_INET) {
789 // Get plain subnets
790 ElementPtr plain_subnets = Element::createList();
791 const Subnet4Collection* subnets = cfg_subnets4_->getAll();
792 for (auto const& subnet : *subnets) {
793 // Skip subnets which are in a shared-network
794 SharedNetwork4Ptr network;
795 subnet->getSharedNetwork(network);
796 if (network) {
797 continue;
798 }
799 ElementPtr subnet_cfg = subnet->toElement();
800 sn_list.push_back(subnet_cfg);
801 plain_subnets->add(subnet_cfg);
802 }
803 dhcp->set("subnet4", plain_subnets);
804
805 // Get shared networks
806 ElementPtr shared_networks = cfg_shared_networks4_->toElement();
807 dhcp->set("shared-networks", shared_networks);
808
809 // Get subnets in shared network subnet lists
810 const std::vector<ElementPtr> networks = shared_networks->listValue();
811 for (auto const& network : networks) {
812 const std::vector<ElementPtr> sh_list =
813 network->get("subnet4")->listValue();
814 for (auto const& subnet : sh_list) {
815 sn_list.push_back(subnet);
816 }
817 }
818
819 } else {
820 // Get plain subnets
821 ElementPtr plain_subnets = Element::createList();
822 const Subnet6Collection* subnets = cfg_subnets6_->getAll();
823 for (auto const& subnet : *subnets) {
824 // Skip subnets which are in a shared-network
825 SharedNetwork6Ptr network;
826 subnet->getSharedNetwork(network);
827 if (network) {
828 continue;
829 }
830 ElementPtr subnet_cfg = subnet->toElement();
831 sn_list.push_back(subnet_cfg);
832 plain_subnets->add(subnet_cfg);
833 }
834 dhcp->set("subnet6", plain_subnets);
835
836 // Get shared networks
837 ElementPtr shared_networks = cfg_shared_networks6_->toElement();
838 dhcp->set("shared-networks", shared_networks);
839
840 // Get subnets in shared network subnet lists
841 const std::vector<ElementPtr> networks = shared_networks->listValue();
842 for (auto const& network : networks) {
843 const std::vector<ElementPtr> sh_list =
844 network->get("subnet6")->listValue();
845 for (auto const& subnet : sh_list) {
846 sn_list.push_back(subnet);
847 }
848 }
849 }
850
851 // Host reservations
852 CfgHostsList resv_list;
853 resv_list.internalize(cfg_hosts_->toElement());
854
855 // Insert global reservations
856 ConstElementPtr global_resvs = resv_list.get(SUBNET_ID_GLOBAL);
857 if (global_resvs->size() > 0) {
858 dhcp->set("reservations", global_resvs);
859 }
860
861 // Insert subnet reservations
862 for (auto const& subnet : sn_list) {
863 ConstElementPtr id = subnet->get("id");
864 if (isNull(id)) {
865 isc_throw(ToElementError, "subnet has no id");
866 }
867 SubnetID subnet_id = id->intValue();
868 ConstElementPtr resvs = resv_list.get(subnet_id);
869 subnet->set("reservations", resvs);
870 }
871
872 // Set expired-leases-processing
873 ConstElementPtr expired = cfg_expiration_->toElement();
874 dhcp->set("expired-leases-processing", expired);
875 if (family == AF_INET6) {
876 // Set server-id (DHCPv6)
877 dhcp->set("server-id", cfg_duid_->toElement());
878
879 // Set relay-supplied-options (DHCPv6)
880 dhcp->set("relay-supplied-options", cfg_rsoo_->toElement());
881 }
882 // Set lease-database
883 CfgLeaseDbAccess lease_db(*cfg_db_access_);
884 dhcp->set("lease-database", lease_db.toElement());
885 // Set hosts-databases
886 CfgHostDbAccess host_db(*cfg_db_access_);
887 ConstElementPtr hosts_databases = host_db.toElement();
888 if (hosts_databases->size() > 0) {
889 dhcp->set("hosts-databases", hosts_databases);
890 }
891 // Set host-reservation-identifiers
892 ConstElementPtr host_ids;
893 if (family == AF_INET) {
894 host_ids = cfg_host_operations4_->toElement();
895 } else {
896 host_ids = cfg_host_operations6_->toElement();
897 }
898 dhcp->set("host-reservation-identifiers", host_ids);
899 // Set mac-sources (DHCPv6)
900 if (family == AF_INET6) {
901 dhcp->set("mac-sources", cfg_mac_source_.toElement());
902 }
903 // Set control-sockets.
904 ElementPtr control_sockets = Element::createList();
905 if (!isNull(unix_control_socket_)) {
906 for (auto const& socket : unix_control_socket_->listValue()) {
907 control_sockets->add(UserContext::toElement(socket));
908 }
909 }
910 if (!isNull(http_control_socket_)) {
911 for (auto const& socket : http_control_socket_->listValue()) {
912 control_sockets->add(UserContext::toElement(socket));
913 }
914 }
915 if (!control_sockets->empty()) {
916 dhcp->set("control-sockets", control_sockets);
917 }
918 // Set client-classes
919 ConstElementPtr client_classes = class_dictionary_->toElement();
921 if (!client_classes->empty()) {
922 dhcp->set("client-classes", client_classes);
923 }
924 // Set hooks-libraries
925 ConstElementPtr hooks_libs = hooks_config_.toElement();
926 dhcp->set("hooks-libraries", hooks_libs);
927 // Set DhcpX
928 result->set(family == AF_INET ? "Dhcp4" : "Dhcp6", dhcp);
929
930 ConstElementPtr cfg_consist = cfg_consist_->toElement();
931 dhcp->set("sanity-checks", cfg_consist);
932
933 // Set config-control (if it exists)
935 if (info) {
936 ConstElementPtr info_elem = info->toElement();
937 dhcp->set("config-control", info_elem);
938 }
939
940 // Set dhcp-packet-control (if it exists)
941 data::ConstElementPtr dhcp_queue_control = getDHCPQueueControl();
942 if (dhcp_queue_control) {
943 dhcp->set("dhcp-queue-control", dhcp_queue_control);
944 }
945
946 // Set multi-threading (if it exists)
947 data::ConstElementPtr dhcp_multi_threading = getDHCPMultiThreading();
948 if (dhcp_multi_threading) {
949 dhcp->set("multi-threading", dhcp_multi_threading);
950 }
951
952 return (result);
953}
954
957 return (DdnsParamsPtr(new DdnsParams(subnet,
958 getD2ClientConfig()->getEnableUpdates())));
959}
960
963 return (DdnsParamsPtr(new DdnsParams(subnet,
964 getD2ClientConfig()->getEnableUpdates())));
965}
966
967void
969 if (!getCfgDbAccess()->getIPReservationsUnique() && unique) {
971 }
972 getCfgHosts()->setIPReservationsUnique(unique);
973 getCfgDbAccess()->setIPReservationsUnique(unique);
974}
975
976void
978 Option::lenient_parsing_ = lenient_option_parsing_;
979}
980
981bool
983 if (!subnet_) {
984 return (false);
985 }
986
987 if (pool_) {
988 auto optional = pool_->getDdnsSendUpdates();
989 if (!optional.unspecified()) {
990 return (optional.get());
991 }
992 }
993
994 return (d2_client_enabled_ && subnet_->getDdnsSendUpdates().get());
995}
996
997bool
999 if (!subnet_) {
1000 return (false);
1001 }
1002
1003 if (pool_) {
1004 auto optional = pool_->getDdnsOverrideNoUpdate();
1005 if (!optional.unspecified()) {
1006 return (optional.get());
1007 }
1008 }
1009
1010 return (subnet_->getDdnsOverrideNoUpdate().get());
1011}
1012
1014 if (!subnet_) {
1015 return (false);
1016 }
1017
1018 if (pool_) {
1019 auto optional = pool_->getDdnsOverrideClientUpdate();
1020 if (!optional.unspecified()) {
1021 return (optional.get());
1022 }
1023 }
1024
1025 return (subnet_->getDdnsOverrideClientUpdate().get());
1026}
1027
1030 if (!subnet_) {
1032 }
1033
1034 if (pool_) {
1035 auto optional = pool_->getDdnsReplaceClientNameMode();
1036 if (!optional.unspecified()) {
1037 return (optional.get());
1038 }
1039 }
1040
1041 return (subnet_->getDdnsReplaceClientNameMode().get());
1042}
1043
1044std::string
1046 if (!subnet_) {
1047 return ("");
1048 }
1049
1050 if (pool_) {
1051 auto optional = pool_->getDdnsGeneratedPrefix();
1052 if (!optional.unspecified()) {
1053 return (optional.get());
1054 }
1055 }
1056
1057 return (subnet_->getDdnsGeneratedPrefix().get());
1058}
1059
1060std::string
1062 if (!subnet_) {
1063 return ("");
1064 }
1065
1066 if (pool_) {
1067 auto optional = pool_->getDdnsQualifyingSuffix();
1068 if (!optional.unspecified()) {
1069 return (optional.get());
1070 }
1071 }
1072
1073 return (subnet_->getDdnsQualifyingSuffix().get());
1074}
1075
1076std::string
1078 if (!subnet_) {
1079 return ("");
1080 }
1081
1082 return (subnet_->getHostnameCharSet().get());
1083}
1084
1085std::string
1087 if (!subnet_) {
1088 return ("");
1089 }
1090
1091 return (subnet_->getHostnameCharReplacement().get());
1092}
1093
1097 if (subnet_) {
1098 std::string char_set = getHostnameCharSet();
1099 if (!char_set.empty()) {
1100 try {
1101 sanitizer.reset(new util::str::StringSanitizer(char_set,
1103 } catch (const std::exception& ex) {
1104 isc_throw(BadValue, "hostname_char_set_: '" << char_set <<
1105 "' is not a valid regular expression");
1106 }
1107 }
1108 }
1109
1110 return (sanitizer);
1111}
1112
1113void
1115 // Need to check that global DDNS TTL values make sense
1116
1117 // Get ddns-ttl first. If ddns-ttl is specified none of the others should be.
1118 ConstElementPtr has_ddns_ttl = getConfiguredGlobal("ddns-ttl");
1119
1120 if (getConfiguredGlobal("ddns-ttl-percent")) {
1121 if (has_ddns_ttl) {
1122 isc_throw(BadValue, "cannot specify both ddns-ttl-percent and ddns-ttl");
1123 }
1124 }
1125
1126 ConstElementPtr has_ddns_ttl_min = getConfiguredGlobal("ddns-ttl-min");
1127 if (has_ddns_ttl_min && has_ddns_ttl) {
1128 isc_throw(BadValue, "cannot specify both ddns-ttl-min and ddns-ttl");
1129 }
1130
1131 ConstElementPtr has_ddns_ttl_max = getConfiguredGlobal("ddns-ttl-max");
1132 if (has_ddns_ttl_max) {
1133 if (has_ddns_ttl) {
1134 isc_throw(BadValue, "cannot specify both ddns-ttl-max and ddns-ttl");
1135 }
1136
1137 if (has_ddns_ttl_min) {
1138 // Have min and max, make sure the range is sane.
1139 uint32_t ddns_ttl_min = has_ddns_ttl_min->intValue();
1140 uint32_t ddns_ttl_max = has_ddns_ttl_max->intValue();
1141 if (ddns_ttl_max < ddns_ttl_min) {
1142 isc_throw(BadValue, "ddns-ttl-max: " << ddns_ttl_max
1143 << " must be greater than ddns-ttl-min: " << ddns_ttl_min);
1144 }
1145 }
1146 }
1147}
1148
1149} // namespace dhcp
1150} // namespace isc
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
A generic exception that is thrown if a function is called in a prohibited way.
Cannot unparse error.
static ElementPtr create(const Position &pos=ZERO_POSITION())
Definition data.cc:249
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
Definition data.cc:304
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
Definition data.cc:299
Notes: IntElement type is changed to int64_t.
Definition data.h:615
static size_t setDefaults(isc::data::ElementPtr scope, const SimpleDefaults &default_values)
Sets the default values.
Parameters for various consistency checks.
Holds manual configuration of the server identifier (DUID).
Definition cfg_duid.h:30
Holds access parameters and the configuration of the lease and hosts database connection.
Holds configuration parameters pertaining to lease expiration and lease affinity.
Class to store configured global parameters.
Definition cfg_globals.h:25
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.
Definition cfg_hosts.h:41
Represents selection of interfaces for DHCP server.
Definition cfg_iface.h:131
uint16_t getFamily() const
Returns address family.
Definition cfgmgr.h:246
static CfgMgr & instance()
returns a single instance of Configuration Manager
Definition cfgmgr.cc:29
static void extract(data::ConstElementPtr value, bool &enabled, uint32_t &thread_count, uint32_t &queue_size)
Extract multi-threading parameters from a given configuration.
Represents option definitions used by the DHCP server.
Represents option data configuration for the DHCP server.
Definition cfg_option.h:404
Represents configuration of the RSOO options for the DHCP server.
Definition cfg_rsoo.h:25
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.
static size_t setAllDefaults(isc::data::ConstElementPtr d2_config)
Sets all defaults for D2 client configuration.
Acts as a storage vault for D2 client configuration.
ReplaceClientNameMode
Defines the client name replacement modes.
Convenience container for conveying DDNS behavioral parameters It is intended to be created per Packe...
Definition ddns_params.h:23
std::string getHostnameCharReplacement() const
Returns the string to replace invalid characters when scrubbing hostnames.
D2ClientConfig::ReplaceClientNameMode getReplaceClientNameMode() const
Returns how Kea should handle the domain-name supplied by the client.
std::string getGeneratedPrefix() const
Returns the Prefix Kea should use when generating domain-names.
isc::util::str::StringSanitizerPtr getHostnameSanitizer() const
Returns a regular expression string sanitizer.
std::string getHostnameCharSet() const
Returns the regular expression describing invalid characters for client hostnames.
std::string getQualifyingSuffix() const
Returns the suffix Kea should use when to qualify partial domain-names.
bool getOverrideNoUpdate() const
Returns whether or not Kea should perform updates, even if client requested no updates.
bool getEnableUpdates() const
Returns whether or not DHCP DDNS updating is enabled.
bool getOverrideClientUpdate() const
Returns whether or not Kea should perform updates, even if client requested delegation.
static bool haveInstance()
Indicates if the lease manager has been instantiated.
static bool lenient_parsing_
Governs whether options should be parsed less strictly.
Definition option.h:490
static const isc::data::SimpleDefaults DHCP_MULTI_THREADING4_DEFAULTS
This table defines default values for multi-threading in DHCPv4.
static const isc::data::SimpleDefaults SANITY_CHECKS4_DEFAULTS
This defines default values for sanity checking for DHCPv4.
static const isc::data::SimpleDefaults DHCP_QUEUE_CONTROL4_DEFAULTS
This table defines default values for dhcp-queue-control in DHCPv4.
static const isc::data::SimpleDefaults DHCP_QUEUE_CONTROL6_DEFAULTS
This table defines default values for dhcp-queue-control in DHCPv6.
static const isc::data::SimpleDefaults DHCP_MULTI_THREADING6_DEFAULTS
This table defines default values for multi-threading in DHCPv6.
static const isc::data::SimpleDefaults SANITY_CHECKS6_DEFAULTS
This defines default values for sanity checking for DHCPv6.
Specifies current DHCP configuration.
Definition srv_config.h:50
ClientClassDictionaryPtr getClientClassDictionary()
Returns pointer to the dictionary of global client class definitions.
Definition srv_config.h:459
static const uint32_t CFGSEL_SUBNET4
Number of IPv4 subnets.
Definition srv_config.h:58
void setDhcp4o6Port(uint16_t port)
Sets DHCP4o6 IPC port.
Definition srv_config.h:696
void addConfiguredGlobal(const std::string &name, isc::data::ConstElementPtr value)
Adds a parameter to the collection configured globals.
Definition srv_config.h:802
CfgGlobalsPtr getConfiguredGlobals()
Returns non-const pointer to configured global parameters.
Definition srv_config.h:736
void sanityChecksDdnsTtlParameters() const
Conducts sanity checks on global DDNS ttl parameters: ddns-ttl, ddns-ttl-percent, ddns-ttl-min,...
void setClientClassDictionary(const ClientClassDictionaryPtr &dictionary)
Sets the client class dictionary.
Definition srv_config.h:474
virtual void merge(ConfigBase &other)
Merges the configuration specified as a parameter into this configuration.
void extractConfiguredGlobals(isc::data::ConstElementPtr config)
Saves scalar elements from the global scope of a configuration.
isc::data::ConstElementPtr getConfiguredGlobal(std::string name) const
Returns pointer to a given configured global parameter.
Definition srv_config.h:755
CfgSharedNetworks6Ptr getCfgSharedNetworks6() const
Returns pointer to non-const object holding configuration of shared networks in DHCPv6.
Definition srv_config.h:216
bool getIgnoreRAILinkSelection() const
Get ignore RAI Link Selection compatibility flag.
Definition srv_config.h:904
void setD2ClientConfig(const D2ClientConfigPtr &d2_client_config)
Sets the D2 client configuration.
Definition srv_config.h:726
void applyDefaultsConfiguredGlobals(const isc::data::SimpleDefaults &defaults)
Applies defaults to global parameters.
void setIPReservationsUnique(const bool unique)
Configures the server to allow or disallow specifying multiple hosts with the same IP address/subnet.
void configureLowerLevelLibraries() const
Convenience method to propagate configuration parameters through inversion of control.
CfgDUIDPtr getCfgDUID()
Returns pointer to the object holding configuration of the server identifier.
Definition srv_config.h:300
bool sequenceEquals(const SrvConfig &other)
Compares configuration sequence with other sequence.
CfgSubnets4Ptr getCfgSubnets4()
Returns pointer to non-const object holding subnets configuration for DHCPv4.
Definition srv_config.h:198
CfgSubnets6Ptr getCfgSubnets6()
Returns pointer to non-const object holding subnets configuration for DHCPv6.
Definition srv_config.h:232
CfgOptionDefPtr getCfgOptionDef()
Return pointer to non-const object representing user-defined option definitions.
Definition srv_config.h:159
D2ClientConfigPtr getD2ClientConfig()
Returns pointer to the D2 client configuration.
Definition srv_config.h:712
CfgHostOperationsPtr getCfgHostOperations6()
Returns pointer to the object holding general configuration for host reservations in DHCPv6.
Definition srv_config.h:354
void setReservationsLookupFirst(const bool first)
Sets whether the server does host reservations lookup before lease lookup.
Definition srv_config.h:845
const isc::data::ConstElementPtr getDHCPMultiThreading() const
Returns DHCP multi threading information.
Definition srv_config.h:444
void setDHCPQueueControl(const isc::data::ConstElementPtr dhcp_queue_control)
Sets information about the dhcp queue control.
Definition srv_config.h:437
DdnsParamsPtr getDdnsParams(const ConstSubnet4Ptr &subnet) const
Fetches the DDNS parameters for a given DHCPv4 subnet.
void sanityChecksLifetime(const std::string &name) const
Conducts sanity checks on global lifetime parameters.
std::string getConfigSummary(const uint32_t selection) const
Returns summary of the configuration in the textual format.
Definition srv_config.cc:87
const isc::data::ConstElementPtr getDHCPQueueControl() const
Returns DHCP queue control information.
Definition srv_config.h:430
bool equals(const SrvConfig &other) const
Compares two objects for equality.
uint32_t getSequence() const
Returns configuration sequence number.
Definition srv_config.h:116
static const uint32_t CFGSEL_DDNS
DDNS enabled/disabled.
Definition srv_config.h:66
void setDeclinePeriod(const uint32_t decline_timer)
Sets decline probation-period.
Definition srv_config.h:660
void removeStatistics()
Removes statistics.
CfgExpirationPtr getCfgExpiration()
Returns pointer to the object holding configuration pertaining to processing expired leases.
Definition srv_config.h:282
CfgOptionPtr getCfgOption()
Returns pointer to the non-const object holding options.
Definition srv_config.h:180
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
bool getLenientOptionParsing() const
Get lenient option parsing compatibility flag.
Definition srv_config.h:874
static const uint32_t CFGSEL_SUBNET6
Number of IPv6 subnets.
Definition srv_config.h:60
bool getExcludeFirstLast24() const
Get exclude .0 and .255 addresses in subnets bigger than /24 flag.
Definition srv_config.h:919
void updateStatistics()
Updates statistics.
CfgDbAccessPtr getCfgDbAccess()
Returns pointer to the object holding configuration of the lease and host database connection paramet...
Definition srv_config.h:318
void setEchoClientId(const bool echo)
Sets whether server should send back client-id in DHCPv4.
Definition srv_config.h:679
void copy(SrvConfig &new_config) const
Copies the current configuration to a new configuration.
CfgSharedNetworks4Ptr getCfgSharedNetworks4() const
Returns pointer to non-const object holding configuration of shared networks in DHCPv4;.
Definition srv_config.h:207
CfgHostsPtr getCfgHosts()
Returns pointer to the non-const objects representing host reservations for different IPv4 and IPv6 s...
Definition srv_config.h:248
bool getIgnoreServerIdentifier() const
Get ignore DHCP Server Identifier compatibility flag.
Definition srv_config.h:889
SrvConfig()
Default constructor.
Definition srv_config.cc:46
CfgHostOperationsPtr getCfgHostOperations4()
Returns pointer to the object holding general configuration for host reservations in DHCPv4.
Definition srv_config.h:336
void clear()
Removes all configured hooks libraries.
void add(const std::string &libname, isc::data::ConstElementPtr parameters, const std::string &cfgname="")
Adds additional hooks libraries.
const isc::hooks::HookLibsCollection & get() const
Provides access to the configured hooks libraries.
Base class for all configurations.
Definition config_base.h:33
process::ConstConfigControlInfoPtr getConfigControlInfo() const
Fetches a read-only copy of the configuration control information.
const process::LoggingInfoStorage & getLoggingInfo() const
Returns logging specific configuration.
Definition config_base.h:43
void setServerTag(const util::Optional< std::string > &server_tag)
Sets the server's logical name.
void copy(ConfigBase &new_config) const
Copies the current configuration to a new configuration.
virtual void merge(ConfigBase &other)
Merges specified configuration into this configuration.
bool equals(const ConfigBase &other) const
Compares two configuration.
Statistics Manager class.
static StatsMgr & instance()
Statistics Manager accessor method.
Implements a regular expression based string scrubber.
Definition str.h:222
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
void setMaxSampleCountDefault(uint32_t max_samples)
Set default count limit.
void setMaxSampleAgeAll(const StatsDuration &duration)
Set duration limit for all collected statistics.
void setMaxSampleCountAll(uint32_t max_samples)
Set count limit for all collected statistics.
void setMaxSampleAgeDefault(const StatsDuration &duration)
Set default duration limit.
#define LOG_WARN(LOGGER, MESSAGE)
Macro to conveniently test warn output and log it.
Definition macros.h:26
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:29
bool isNull(ConstElementPtr p)
Checks whether the given ElementPtr is a NULL pointer.
Definition data.cc:1148
std::vector< SimpleDefault > SimpleDefaults
This specifies all default values in a given scope (e.g. a subnet).
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
@ info
Definition db_log.h:120
isc::log::Logger dhcpsrv_logger("dhcpsrv")
DHCP server library Logger.
Definition dhcpsrv_log.h:56
boost::shared_ptr< CfgDUID > CfgDUIDPtr
Pointer to the Non-const object.
Definition cfg_duid.h:161
boost::shared_ptr< D2ClientConfig > D2ClientConfigPtr
Defines a pointer for D2ClientConfig instances.
boost::shared_ptr< const Subnet6 > ConstSubnet6Ptr
A const pointer to a Subnet6 object.
Definition subnet.h:623
boost::shared_ptr< const Subnet4 > ConstSubnet4Ptr
A const pointer to a Subnet4 object.
Definition subnet.h:458
boost::multi_index_container< Subnet6Ptr, boost::multi_index::indexed_by< 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< SubnetModificationTimeIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, boost::posix_time::ptime, &data::BaseStampedElement::getModificationTime > > > > Subnet6Collection
A collection of Subnet6 objects.
Definition subnet.h:937
boost::shared_ptr< DdnsParams > DdnsParamsPtr
Defines a pointer for DdnsParams instances.
boost::shared_ptr< SharedNetwork6 > SharedNetwork6Ptr
Pointer to SharedNetwork6 object.
boost::multi_index_container< Subnet4Ptr, boost::multi_index::indexed_by< 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 > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SubnetModificationTimeIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, boost::posix_time::ptime, &data::BaseStampedElement::getModificationTime > > > > Subnet4Collection
A collection of Subnet4 objects.
Definition subnet.h:866
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
Definition subnet_id.h:25
const isc::log::MessageID DHCPSRV_CFGMGR_IP_RESERVATIONS_UNIQUE_DUPLICATES_POSSIBLE
boost::shared_ptr< SharedNetwork4 > SharedNetwork4Ptr
Pointer to SharedNetwork4 object.
boost::shared_ptr< const ConfigControlInfo > ConstConfigControlInfoPtr
Defines a pointer to a const ConfigControlInfo.
std::unique_ptr< StringSanitizer > StringSanitizerPtr
Type representing the pointer to the StringSanitizer.
Definition str.h:263
Defines the logger used by the top-level component of kea-lfc.
Represents the position of the data element within a configuration string.
Definition data.h:94
void contextToElement(data::ElementPtr map) const
Merge unparse a user_context object.
static data::ElementPtr toElement(data::ConstElementPtr map)
Copy an Element map.
virtual isc::data::ElementPtr toElement() const
Unparse.
utility class for unparsing
virtual isc::data::ElementPtr toElement() const
Unparse.