Kea 1.5.0
dhcp6/json_config_parser.cc
Go to the documentation of this file.
1// Copyright (C) 2012-2018 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
10#include <cc/data.h>
12#include <config/command_mgr.h>
14#include <dhcp/libdhcp++.h>
16#include <dhcp6/dhcp6_log.h>
17#include <dhcp6/dhcp6_srv.h>
18#include <dhcp/iface_mgr.h>
19#include <dhcpsrv/cfg_option.h>
20#include <dhcpsrv/cfgmgr.h>
21#include <dhcpsrv/db_type.h>
22#include <dhcpsrv/pool.h>
23#include <dhcpsrv/subnet.h>
24#include <dhcpsrv/timer_mgr.h>
25#include <dhcpsrv/triplet.h>
39#include <hooks/hooks_parser.h>
40#include <log/logger_support.h>
42#include <util/encode/hex.h>
43#include <util/strutil.h>
44
45#include <boost/algorithm/string.hpp>
46#include <boost/foreach.hpp>
47#include <boost/lexical_cast.hpp>
48#include <boost/scoped_ptr.hpp>
49#include <boost/shared_ptr.hpp>
50
51#include <iostream>
52#include <limits>
53#include <map>
54#include <netinet/in.h>
55#include <vector>
56
57#include <stdint.h>
58
59using namespace std;
60using namespace isc;
61using namespace isc::data;
62using namespace isc::dhcp;
63using namespace isc::asiolink;
64using namespace isc::hooks;
65
66namespace {
67
76class RSOOListConfigParser : public isc::data::SimpleParser {
77public:
78
86 void parse(const SrvConfigPtr& cfg, const isc::data::ConstElementPtr& value) {
87 try {
88 BOOST_FOREACH(ConstElementPtr source_elem, value->listValue()) {
89 std::string option_str = source_elem->stringValue();
90 // This option can be either code (integer) or name. Let's try code first
91 int64_t code = 0;
92 try {
93 code = boost::lexical_cast<int64_t>(option_str);
94 // Protect against the negative value and too high value.
95 if (code < 0) {
96 isc_throw(BadValue, "invalid option code value specified '"
97 << option_str << "', the option code must be a"
98 " non-negative value");
99
100 } else if (code > std::numeric_limits<uint16_t>::max()) {
101 isc_throw(BadValue, "invalid option code value specified '"
102 << option_str << "', the option code must not be"
103 " greater than '" << std::numeric_limits<uint16_t>::max()
104 << "'");
105 }
106
107 } catch (const boost::bad_lexical_cast &) {
108 // Oh well, it's not a number
109 }
110
111 if (!code) {
113 option_str);
114 if (def) {
115 code = def->getCode();
116 } else {
117 isc_throw(BadValue, "unable to find option code for the "
118 " specified option name '" << option_str << "'"
119 " while parsing the list of enabled"
120 " relay-supplied-options");
121 }
122 }
123 cfg->getCfgRSOO()->enable(code);
124 }
125 } catch (const std::exception& ex) {
126 // Rethrow exception with the appended position of the parsed
127 // element.
128 isc_throw(DhcpConfigError, ex.what() << " (" << value->getPosition() << ")");
129 }
130 }
131};
132
141class Dhcp6ConfigParser : public isc::data::SimpleParser {
142public:
143
157 void parse(const SrvConfigPtr& srv_config, const ConstElementPtr& global) {
158
159 // Set the probation period for decline handling.
160 uint32_t probation_period =
161 getUint32(global, "decline-probation-period");
162 srv_config->setDeclinePeriod(probation_period);
163
164 // Set the DHCPv4-over-DHCPv6 interserver port.
165 uint16_t dhcp4o6_port = getUint16(global, "dhcp4o6-port");
166 srv_config->setDhcp4o6Port(dhcp4o6_port);
167
168 // Set the global user context.
169 ConstElementPtr user_context = global->get("user-context");
170 if (user_context) {
171 srv_config->setContext(user_context);
172 }
173
174 // Set the server's logical name
175 std::string server_tag = getString(global, "server-tag");
176 srv_config->setServerTag(server_tag);
177 }
178
185 void
186 copySubnets6(const CfgSubnets6Ptr& dest, const CfgSharedNetworks6Ptr& from) {
187
188 if (!dest || !from) {
189 isc_throw(BadValue, "Unable to copy subnets: at least one pointer is null");
190 }
191
192 const SharedNetwork6Collection* networks = from->getAll();
193 if (!networks) {
194 // Nothing to copy. Technically, it should return a pointer to empty
195 // container, but let's handle null pointer as well.
196 return;
197 }
198
199 // Let's go through all the networks one by one
200 for (auto net = networks->begin(); net != networks->end(); ++net) {
201
202 // For each network go through all the subnets in it.
203 const Subnet6Collection* subnets = (*net)->getAllSubnets();
204 if (!subnets) {
205 // Shared network without subnets it weird, but we decided to
206 // accept such configurations.
207 continue;
208 }
209
210 // For each subnet, add it to a list of regular subnets.
211 for (auto subnet = subnets->begin(); subnet != subnets->end(); ++subnet) {
212 dest->add(*subnet);
213 }
214 }
215 }
216
225 void
226 sanityChecks(const SrvConfigPtr& cfg, const ConstElementPtr& global) {
227
229 const SharedNetwork6Collection* networks = cfg->getCfgSharedNetworks6()->getAll();
230 if (networks) {
231 sharedNetworksSanityChecks(*networks, global->get("shared-networks"));
232 }
233 }
234
241 void
242 sharedNetworksSanityChecks(const SharedNetwork6Collection& networks,
243 ConstElementPtr json) {
244
246 if (!json) {
247 // No json? That means that the shared-networks was never specified
248 // in the config.
249 return;
250 }
251
252 // Used for names uniqueness checks.
253 std::set<string> names;
254
255 // Let's go through all the networks one by one
256 for (auto net = networks.begin(); net != networks.end(); ++net) {
257 string txt;
258
259 // Let's check if all subnets have either the same interface
260 // or don't have the interface specified at all.
261 string iface = (*net)->getIface();
262
263 const Subnet6Collection* subnets = (*net)->getAllSubnets();
264 if (subnets) {
265
266 bool rapid_commit = false;
267
268 // For each subnet, add it to a list of regular subnets.
269 for (auto subnet = subnets->begin(); subnet != subnets->end(); ++subnet) {
270
271 // Rapid commit must either be enabled or disabled in all subnets
272 // in the shared network.
273 if (subnet == subnets->begin()) {
274 // If this is the first subnet, remember the value.
275 rapid_commit = (*subnet)->getRapidCommit();
276 } else {
277 // Ok, this is the second or following subnets. The value
278 // must match what was set in the first subnet.
279 if (rapid_commit != (*subnet)->getRapidCommit()) {
280 isc_throw(DhcpConfigError, "All subnets in a shared network "
281 "must have the same rapid-commit value. Subnet "
282 << (*subnet)->toText()
283 << " has specified rapid-commit "
284 << ( (*subnet)->getRapidCommit() ? "true" : "false")
285 << ", but earlier subnet in the same shared-network"
286 << " or the shared-network itself used rapid-commit "
287 << (rapid_commit ? "true" : "false"));
288 }
289 }
290
291
292 if (iface.empty()) {
293 iface = (*subnet)->getIface();
294 continue;
295 }
296
297 if ((*subnet)->getIface().empty()) {
298 continue;
299 }
300
301 if (iface != (*subnet)->getIface()) {
302 isc_throw(DhcpConfigError, "Subnet " << (*subnet)->toText()
303 << " has specified interface " << (*subnet)->getIface()
304 << ", but earlier subnet in the same shared-network"
305 << " or the shared-network itself used " << iface);
306 }
307
308 // Let's collect the subnets in case we later find out the
309 // subnet doesn't have a mandatory name.
310 txt += (*subnet)->toText() + " ";
311 }
312 }
313
314 // Next, let's check name of the shared network.
315 if ((*net)->getName().empty()) {
316 isc_throw(DhcpConfigError, "Shared-network with subnets "
317 << txt << " is missing mandatory 'name' parameter");
318 }
319
320 // Is it unique?
321 if (names.find((*net)->getName()) != names.end()) {
322 isc_throw(DhcpConfigError, "A shared-network with "
323 "name " << (*net)->getName() << " defined twice.");
324 }
325 names.insert((*net)->getName());
326
327 }
328 }
329
330
331};
332
333} // anonymous namespace
334
335namespace isc {
336namespace dhcp {
337
346 // Get new socket configuration.
347 ConstElementPtr sock_cfg =
348 CfgMgr::instance().getStagingCfg()->getControlSocketInfo();
349
350 // Get current socket configuration.
351 ConstElementPtr current_sock_cfg =
352 CfgMgr::instance().getCurrentCfg()->getControlSocketInfo();
353
354 // Determine if the socket configuration has changed. It has if
355 // both old and new configuration is specified but respective
356 // data elements aren't equal.
357 bool sock_changed = (sock_cfg && current_sock_cfg &&
358 !sock_cfg->equals(*current_sock_cfg));
359
360 // If the previous or new socket configuration doesn't exist or
361 // the new configuration differs from the old configuration we
362 // close the existing socket and open a new socket as appropriate.
363 // Note that closing an existing socket means the client will not
364 // receive the configuration result.
365 if (!sock_cfg || !current_sock_cfg || sock_changed) {
366 // Close the existing socket (if any).
368
369 if (sock_cfg) {
370 // This will create a control socket and install the external
371 // socket in IfaceMgr. That socket will be monitored when
372 // Dhcp4Srv::receivePacket() calls IfaceMgr::receive4() and
373 // callback in CommandMgr will be called, if necessary.
375 }
376 }
377}
378
381 bool check_only) {
382
383 if (!config_set) {
385 string("Can't parse NULL config"));
386 return (answer);
387 }
388
390 DHCP6_CONFIG_START).arg(config_set->str());
391
392 // Before starting any subnet operations, let's reset the subnet-id counter,
393 // so newly recreated configuration starts with first subnet-id equal 1.
395
396 // Remove any existing timers.
397 if (!check_only) {
398 TimerMgr::instance()->unregisterTimers();
399 server.discardPackets();
400 }
401
402 // Revert any runtime option definitions configured so far and not committed.
404 // Let's set empty container in case a user hasn't specified any configuration
405 // for option definitions. This is equivalent to committing empty container.
407
408 // Print the list of known backends.
410
411 // This is a way to convert ConstElementPtr to ElementPtr.
412 // We need a config that can be edited, because we will insert
413 // default values and will insert derived values as well.
414 ElementPtr mutable_cfg = boost::const_pointer_cast<Element>(config_set);
415
416 // answer will hold the result.
417 ConstElementPtr answer;
418 // rollback informs whether error occurred and original data
419 // have to be restored to global storages.
420 bool rollback = false;
421 // config_pair holds the details of the current parser when iterating over
422 // the parsers. It is declared outside the loop so in case of error, the
423 // name of the failing parser can be retrieved within the "catch" clause.
424 ConfigPair config_pair;
425 try {
426
428
429 // Preserve all scalar global parameters
430 srv_config->extractConfiguredGlobals(config_set);
431
432 // Set all default values if not specified by the user.
434
435 // And now derive (inherit) global parameters to subnets, if not specified.
437
438 // Make parsers grouping.
439 const std::map<std::string, ConstElementPtr>& values_map =
440 mutable_cfg->mapValue();
441
442 // We need definitions first
443 ConstElementPtr option_defs = mutable_cfg->get("option-def");
444 if (option_defs) {
445 OptionDefListParser parser;
446 CfgOptionDefPtr cfg_option_def = srv_config->getCfgOptionDef();
447 parser.parse(cfg_option_def, option_defs);
448 }
449
450 // This parser is used in several places, so it should be available
451 // early.
452 Dhcp6ConfigParser global_parser;
453
454 BOOST_FOREACH(config_pair, values_map) {
455 // In principle we could have the following code structured as a series
456 // of long if else if clauses. That would give a marginal performance
457 // boost, but would make the code less readable. We had serious issues
458 // with the parser code debugability, so I decided to keep it as a
459 // series of independent ifs.
460
461 if (config_pair.first == "option-def") {
462 // This is converted to SimpleParser and is handled already above.
463 continue;
464 }
465
466 if (config_pair.first == "option-data") {
467 OptionDataListParser parser(AF_INET6);
468 CfgOptionPtr cfg_option = srv_config->getCfgOption();
469 parser.parse(cfg_option, config_pair.second);
470 continue;
471 }
472
473 if (config_pair.first == "mac-sources") {
475 CfgMACSource& mac_source = srv_config->getMACSources();
476 parser.parse(mac_source, config_pair.second);
477 continue;
478 }
479
480 if (config_pair.first == "control-socket") {
481 ControlSocketParser parser;
482 parser.parse(*srv_config, config_pair.second);
483 continue;
484 }
485
486 if (config_pair.first == "dhcp-queue-control") {
488 srv_config->setDHCPQueueControl(parser.parse(config_pair.second));
489 continue;
490 }
491
492 if (config_pair.first == "host-reservation-identifiers") {
494 parser.parse(config_pair.second);
495 continue;
496 }
497
498 if (config_pair.first == "server-id") {
499 DUIDConfigParser parser;
500 const CfgDUIDPtr& cfg = srv_config->getCfgDUID();
501 parser.parse(cfg, config_pair.second);
502 continue;
503 }
504
505 if (config_pair.first == "interfaces-config") {
506 ElementPtr ifaces_cfg =
507 boost::const_pointer_cast<Element>(config_pair.second);
508 if (check_only) {
509 // No re-detection in check only mode
510 ifaces_cfg->set("re-detect", Element::create(false));
511 }
512 IfacesConfigParser parser(AF_INET6);
513 CfgIfacePtr cfg_iface = srv_config->getCfgIface();
514 parser.parse(cfg_iface, ifaces_cfg);
515 continue;
516 }
517
518 if (config_pair.first == "sanity-checks") {
519 SanityChecksParser parser;
520 parser.parse(*srv_config, config_pair.second);
521 continue;
522 }
523
524 if (config_pair.first == "expired-leases-processing") {
526 parser.parse(config_pair.second);
527 continue;
528 }
529
530 if (config_pair.first == "hooks-libraries") {
531 HooksLibrariesParser hooks_parser;
532 HooksConfig& libraries = srv_config->getHooksConfig();
533 hooks_parser.parse(libraries, config_pair.second);
534 libraries.verifyLibraries(config_pair.second->getPosition());
535 continue;
536 }
537
538 if (config_pair.first == "dhcp-ddns") {
539 // Apply defaults
540 D2ClientConfigParser::setAllDefaults(config_pair.second);
542 D2ClientConfigPtr cfg = parser.parse(config_pair.second);
543 srv_config->setD2ClientConfig(cfg);
544 continue;
545 }
546
547 if (config_pair.first =="client-classes") {
549 ClientClassDictionaryPtr dictionary =
550 parser.parse(config_pair.second, AF_INET6);
551 srv_config->setClientClassDictionary(dictionary);
552 continue;
553 }
554
555 // Please move at the end when migration will be finished.
556 if (config_pair.first == "lease-database") {
557 db::DbAccessParser parser;
558 std::string access_string;
559 parser.parse(access_string, config_pair.second);
560 CfgDbAccessPtr cfg_db_access = srv_config->getCfgDbAccess();
561 cfg_db_access->setLeaseDbAccessString(access_string);
562 continue;
563 }
564
565 if (config_pair.first == "hosts-database") {
566 db::DbAccessParser parser;
567 std::string access_string;
568 parser.parse(access_string, config_pair.second);
569 CfgDbAccessPtr cfg_db_access = srv_config->getCfgDbAccess();
570 cfg_db_access->setHostDbAccessString(access_string);
571 continue;
572 }
573
574 if (config_pair.first == "hosts-databases") {
575 CfgDbAccessPtr cfg_db_access = srv_config->getCfgDbAccess();
576 db::DbAccessParser parser;
577 auto list = config_pair.second->listValue();
578 for (auto it : list) {
579 std::string access_string;
580 parser.parse(access_string, it);
581 cfg_db_access->setHostDbAccessString(access_string);
582 }
583 continue;
584 }
585
586 if (config_pair.first == "subnet6") {
587 Subnets6ListConfigParser subnets_parser;
588 // parse() returns number of subnets parsed. We may log it one day.
589 subnets_parser.parse(srv_config, config_pair.second);
590 continue;
591 }
592
593 if (config_pair.first == "shared-networks") {
599
601 CfgSharedNetworks6Ptr cfg = srv_config->getCfgSharedNetworks6();
602 parser.parse(cfg, config_pair.second);
603
604 // We also need to put the subnets it contains into normal
605 // subnets list.
606 global_parser.copySubnets6(srv_config->getCfgSubnets6(), cfg);
607 continue;
608 }
609
610 if (config_pair.first == "reservations") {
611 HostCollection hosts;
613 parser.parse(SUBNET_ID_GLOBAL, config_pair.second, hosts);
614 for (auto h = hosts.begin(); h != hosts.end(); ++h) {
615 srv_config->getCfgHosts()->add(*h);
616 }
617
618 continue;
619 }
620
621 if (config_pair.first == "config-control") {
623 process::ConfigControlInfoPtr config_ctl_info = parser.parse(config_pair.second);
624 CfgMgr::instance().getStagingCfg()->setConfigControlInfo(config_ctl_info);
625 continue;
626 }
627
628 // Timers are not used in the global scope. Their values are derived
629 // to specific subnets (see SimpleParser6::deriveParameters).
630 // decline-probation-period, dhcp4o6-port and user-context
631 // are handled in the global_parser.parse() which sets
632 // global parameters.
633 if ( (config_pair.first == "renew-timer") ||
634 (config_pair.first == "rebind-timer") ||
635 (config_pair.first == "preferred-lifetime") ||
636 (config_pair.first == "valid-lifetime") ||
637 (config_pair.first == "decline-probation-period") ||
638 (config_pair.first == "dhcp4o6-port") ||
639 (config_pair.first == "user-context") ||
640 (config_pair.first == "server-tag") ||
641 (config_pair.first == "reservation-mode")) {
642 continue;
643 }
644
645 if (config_pair.first == "relay-supplied-options") {
646 RSOOListConfigParser parser;
647 parser.parse(srv_config, config_pair.second);
648 continue;
649 }
650
651 // If we got here, no code handled this parameter, so we bail out.
653 "unsupported global configuration parameter: " << config_pair.first
654 << " (" << config_pair.second->getPosition() << ")");
655 }
656
657 // Apply global options in the staging config.
658 global_parser.parse(srv_config, mutable_cfg);
659
660 // This method conducts final sanity checks and tweaks. In particular,
661 // it checks that there is no conflict between plain subnets and those
662 // defined as part of shared networks.
663 global_parser.sanityChecks(srv_config, mutable_cfg);
664
665 } catch (const isc::Exception& ex) {
666 LOG_ERROR(dhcp6_logger, DHCP6_PARSER_FAIL)
667 .arg(config_pair.first).arg(ex.what());
668 answer = isc::config::createAnswer(1, ex.what());
669 // An error occurred, so make sure that we restore original data.
670 rollback = true;
671
672 } catch (...) {
673 // for things like bad_cast in boost::lexical_cast
674 LOG_ERROR(dhcp6_logger, DHCP6_PARSER_EXCEPTION).arg(config_pair.first);
675 answer = isc::config::createAnswer(1, "undefined configuration"
676 " processing error");
677 // An error occurred, so make sure that we restore original data.
678 rollback = true;
679 }
680
681 if (check_only) {
682 rollback = true;
683 if (!answer) {
684 answer = isc::config::createAnswer(0,
685 "Configuration seems sane. Control-socket, hook-libraries, and D2 "
686 "configuration were sanity checked, but not applied.");
687 }
688 }
689
690 // So far so good, there was no parsing error so let's commit the
691 // configuration. This will add created subnets and option values into
692 // the server's configuration.
693 // This operation should be exception safe but let's make sure.
694 if (!rollback) {
695 try {
696
697 // Setup the command channel.
699
700 // No need to commit interface names as this is handled by the
701 // CfgMgr::commit() function.
702
703 // Apply staged D2ClientConfig, used to be done by parser commit
705 cfg = CfgMgr::instance().getStagingCfg()->getD2ClientConfig();
707
708 // This occurs last as if it succeeds, there is no easy way to
709 // revert it. As a result, the failure to commit a subsequent
710 // change causes problems when trying to roll back.
711 const HooksConfig& libraries =
712 CfgMgr::instance().getStagingCfg()->getHooksConfig();
713 libraries.loadLibraries();
714 }
715 catch (const isc::Exception& ex) {
716 LOG_ERROR(dhcp6_logger, DHCP6_PARSER_COMMIT_FAIL).arg(ex.what());
717 answer = isc::config::createAnswer(2, ex.what());
718 // An error occurred, so make sure to restore the original data.
719 rollback = true;
720 } catch (...) {
721 // for things like bad_cast in boost::lexical_cast
722 LOG_ERROR(dhcp6_logger, DHCP6_PARSER_COMMIT_EXCEPTION);
723 answer = isc::config::createAnswer(2, "undefined configuration"
724 " parsing error");
725 // An error occurred, so make sure to restore the original data.
726 rollback = true;
727 }
728 }
729
730 // Rollback changes as the configuration parsing failed.
731 if (rollback) {
732 // Revert to original configuration of runtime option definitions
733 // in the libdhcp++.
735 return (answer);
736 }
737
738 LOG_INFO(dhcp6_logger, DHCP6_CONFIG_COMPLETE)
739 .arg(CfgMgr::instance().getStagingCfg()->
740 getConfigSummary(SrvConfig::CFGSEL_ALL6));
741
742 // Everything was fine. Configuration is successful.
743 answer = isc::config::createAnswer(0, "Configuration successful.");
744 return (answer);
745}
746
747}; // end of isc::dhcp namespace
748}; // end of isc namespace
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
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.
void closeCommandSocket()
Shuts down any open control sockets.
Definition: command_mgr.cc:598
static CommandMgr & instance()
CommandMgr is a singleton class.
Definition: command_mgr.cc:620
void openCommandSocket(const isc::data::ConstElementPtr &socket_info)
Opens control socket with parameters specified in socket_info.
Definition: command_mgr.cc:594
static ElementPtr create(const Position &pos=ZERO_POSITION())
Definition: data.cc:223
static std::string getString(isc::data::ConstElementPtr scope, const std::string &name)
Returns a string parameter from a scope.
uint32_t getUint32(isc::data::ConstElementPtr scope, const std::string &name)
Returns a value converted to uint32_t.
uint16_t getUint16(isc::data::ConstElementPtr scope, const std::string &name)
Returns a value converted to uint16_t.
Parse Database Parameters.
void parse(std::string &access_string, isc::data::ConstElementPtr database_config)
Parse configuration value.
Wrapper class that holds MAC/hardware address sources.
void setD2ClientConfig(D2ClientConfigPtr &new_config)
Updates the DHCP-DDNS client configuration to the given value.
Definition: cfgmgr.cc:40
static CfgMgr & instance()
returns a single instance of Configuration Manager
Definition: cfgmgr.cc:25
SrvConfigPtr getStagingCfg()
Returns a pointer to the staging configuration.
Definition: cfgmgr.cc:160
SrvConfigPtr getCurrentCfg()
Returns a pointer to the current configuration.
Definition: cfgmgr.cc:154
Parser for a list of client class definitions.
ClientClassDictionaryPtr parse(isc::data::ConstElementPtr class_def_list, uint16_t family)
Parse configuration entries.
Parser for the control-socket structure.
Definition: dhcp_parsers.h:209
void parse(SrvConfig &srv_cfg, isc::data::ConstElementPtr value)
"Parses" control-socket structure
Definition: dhcp_parsers.cc:69
Parser for D2ClientConfig.
Definition: dhcp_parsers.h:783
D2ClientConfigPtr parse(isc::data::ConstElementPtr d2_client_cfg)
Parses a given dhcp-ddns element into D2ClientConfig.
static size_t setAllDefaults(isc::data::ConstElementPtr d2_config)
Sets all defaults for D2 client configuration.
Parser for the configuration of DHCP packet queue controls.
data::ElementPtr parse(const isc::data::ConstElementPtr &control_elem)
Parses content of the "dhcp-queue-control".
Parser for server DUID configuration.
void parse(const CfgDUIDPtr &cfg, isc::data::ConstElementPtr duid_configuration)
Parses DUID configuration.
To be removed. Please use ConfigError instead.
DHCPv6 server service.
Definition: dhcp6_srv.h:59
void discardPackets()
Discards cached and parked packets Clears the call_handle store and packet parking lots of all packet...
Definition: dhcp6_srv.cc:3827
Parser for the configuration parameters pertaining to the processing of expired leases.
void parse(isc::data::ConstElementPtr expiration_config)
Parses parameters in the JSON map, pertaining to the processing of the expired leases.
static void printRegistered()
Prints out all registered backends.
Parser for a list of host identifiers for DHCPv6.
void parse(isc::data::ConstElementPtr ids_list)
Parses a list of host identifiers.
Parser for a list of host reservations for a subnet.
void parse(const SubnetID &subnet_id, isc::data::ConstElementPtr hr_list, HostCollection &hosts_list)
Parses a list of host reservation entries for a subnet.
Parser for the configuration of interfaces.
void parse(const CfgIfacePtr &config, const isc::data::ConstElementPtr &values)
Parses content of the "interfaces-config".
static void setRuntimeOptionDefs(const OptionDefSpaceContainer &defs)
Copies option definitions created at runtime.
Definition: libdhcp++.cc:234
static OptionDefinitionPtr getOptionDef(const std::string &space, const uint16_t code)
Return the first option definition matching a particular option code.
Definition: libdhcp++.cc:144
static void revertRuntimeOptionDefs()
Reverts uncommitted changes to runtime option definitions.
Definition: libdhcp++.cc:255
parser for MAC/hardware acquisition sources
Definition: dhcp_parsers.h:193
void parse(CfgMACSource &mac_sources, isc::data::ConstElementPtr value)
parses parameters value
Definition: dhcp_parsers.cc:38
Parser for option data values within a subnet.
void parse(const CfgOptionPtr &cfg, isc::data::ConstElementPtr option_data_list)
Parses a list of options, instantiates them and stores in cfg.
Parser for a list of option definitions.
Definition: dhcp_parsers.h:246
void parse(CfgOptionDefPtr cfg, isc::data::ConstElementPtr def_list)
Parses a list of option definitions, create them and store in cfg.
Simple parser for sanity-checks structure.
void parse(SrvConfig &srv_cfg, const isc::data::ConstElementPtr &value)
parses JSON structure
Parser for a list of shared networks.
void parse(CfgSharedNetworksTypePtr &cfg, const data::ConstElementPtr &shared_networks_list_data)
Parses a list of shared networks.
static size_t deriveParameters(isc::data::ElementPtr global)
Derives (inherits) all parameters from global to more specific scopes.
static size_t setAllDefaults(isc::data::ElementPtr global)
Sets all defaults for DHCPv6 configuration.
static const uint32_t CFGSEL_ALL6
IPv6 related config.
Definition: srv_config.h:70
static void resetSubnetID()
Resets subnet-id counter to its initial value (1)
Definition: subnet.h:231
this class parses a list of DHCP6 subnets
Definition: dhcp_parsers.h:754
size_t parse(SrvConfigPtr cfg, data::ConstElementPtr subnets_list)
parses contents of the list
static const TimerMgrPtr & instance()
Returns pointer to the sole instance of the TimerMgr.
Definition: timer_mgr.cc:319
Wrapper class that holds hooks libraries configuration.
Definition: hooks_config.h:36
void verifyLibraries(const isc::data::Element::Position &position) const
Verifies that libraries stored in libraries_ are valid.
Definition: hooks_config.cc:20
void loadLibraries() const
Commits hooks libraries configuration.
Definition: hooks_config.cc:55
Parser for hooks library list.
Definition: hooks_parser.h:21
void parse(HooksConfig &libraries, isc::data::ConstElementPtr value)
Parses parameters value.
Definition: hooks_parser.cc:28
Implements parser for config control information, "config-control".
ConfigControlInfoPtr parse(const data::ConstElementPtr &config_control)
Parses a configuration control Element.
Parsers for client class definitions.
This file contains several functions and constants that are used for handling commands and responses ...
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
Logging initialization functions.
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
Definition: macros.h:32
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
Definition: macros.h:20
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
Definition: macros.h:14
ConstElementPtr createAnswer()
Creates a standard config/command level success answer message (i.e.
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:23
boost::shared_ptr< Element > ElementPtr
Definition: data.h:22
void configureCommandChannel()
Initialize the command channel based on the staging configuration.
boost::shared_ptr< CfgDUID > CfgDUIDPtr
Pointer to the Non-const object.
Definition: cfg_duid.h:149
OptionSpaceContainer< OptionDefContainer, OptionDefinitionPtr, std::string > OptionDefSpaceContainer
std::pair< std::string, isc::data::ConstElementPtr > ConfigPair
Combination of parameter name and configuration contents.
Definition: dhcp_parsers.h:173
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.
Definition: subnet.h:843
boost::shared_ptr< D2ClientConfig > D2ClientConfigPtr
Defines a pointer for D2ClientConfig instances.
isc::data::ConstElementPtr configureDhcp6Server(Dhcpv6Srv &server, isc::data::ConstElementPtr config_set, bool check_only)
Configures DHCPv6 server.
boost::shared_ptr< CfgOption > CfgOptionPtr
Non-const pointer.
Definition: cfg_option.h:497
boost::shared_ptr< CfgOptionDef > CfgOptionDefPtr
Non-const pointer.
boost::shared_ptr< CfgDbAccess > CfgDbAccessPtr
A pointer to the CfgDbAccess.
const int DBG_DHCP6_COMMAND
Debug level used to log receiving commands.
Definition: dhcp6_log.h:27
boost::shared_ptr< CfgIface > CfgIfacePtr
A pointer to the CfgIface .
Definition: cfg_iface.h:387
boost::shared_ptr< SrvConfig > SrvConfigPtr
Non-const pointer to the SrvConfig.
Definition: srv_config.h:707
boost::shared_ptr< CfgSubnets6 > CfgSubnets6Ptr
Non-const pointer.
Definition: cfg_subnets6.h:268
std::vector< HostPtr > HostCollection
Collection of the Host objects.
Definition: host.h:734
boost::shared_ptr< OptionDefinition > OptionDefinitionPtr
Pointer to option definition object.
boost::shared_ptr< ClientClassDictionary > ClientClassDictionaryPtr
Defines a pointer to a ClientClassDictionary.
boost::shared_ptr< CfgSharedNetworks6 > CfgSharedNetworks6Ptr
Pointer to the configuration of IPv6 shared networks.
boost::multi_index_container< SharedNetwork6Ptr, boost::multi_index::indexed_by< boost::multi_index::random_access< boost::multi_index::tag< SharedNetworkRandomAccessIndexTag > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SharedNetworkNameIndexTag >, boost::multi_index::const_mem_fun< SharedNetwork6, std::string, &SharedNetwork6::getName > > > > SharedNetwork6Collection
Multi index container holding shared networks.
isc::log::Logger dhcp6_logger(DHCP6_APP_LOGGER_NAME)
Base logger for DHCPv6 server.
Definition: dhcp6_log.h:87
boost::shared_ptr< ConfigControlInfo > ConfigControlInfoPtr
Defines a pointer to a ConfigControlInfo.
Defines the logger used by the top-level component of kea-dhcp-ddns.
#define DHCP6_OPTION_SPACE
Definition: option_space.h:17