24#include <boost/algorithm/string.hpp>
25#include <boost/foreach.hpp>
26#include <boost/lexical_cast.hpp>
27#include <boost/make_shared.hpp>
28#include <boost/scoped_ptr.hpp>
55 std::string source_str = source_elem->stringValue();
58 mac_sources.
add(source);
62 <<
"' was specified twice (" << value->getPosition() <<
")");
63 }
catch (
const std::exception& ex) {
65 << source_str <<
"' to any recognized MAC source:"
66 << ex.
what() <<
" (" << value->getPosition() <<
")");
85 ", i.e. a structure defined within { }");
93 : address_family_(address_family) {
100 if (address_family_ == AF_INET) {
107 std::string name =
getString(option_def,
"name");
108 int64_t code64 =
getInteger(option_def,
"code");
109 std::string type =
getString(option_def,
"type");
113 bool array_type =
getBoolean(option_def,
"array");
114 std::string record_types =
getString(option_def,
"record-types");
115 std::string space =
getString(option_def,
"space");
116 std::string encapsulates =
getString(option_def,
"encapsulate");
123 }
else if (address_family_ == AF_INET &&
124 code64 > std::numeric_limits<uint8_t>::max()) {
126 <<
"', it must not be greater than '"
127 <<
static_cast<int>(std::numeric_limits<uint8_t>::max())
128 <<
"' (" <<
getPosition(
"code", option_def) <<
")");
129 }
else if (address_family_ == AF_INET6 &&
130 code64 > std::numeric_limits<uint16_t>::max()) {
132 <<
"', it must not be greater than '"
133 << std::numeric_limits<uint16_t>::max()
134 <<
"' (" <<
getPosition(
"code", option_def) <<
")");
136 uint32_t code =
static_cast<uint32_t
>(code64);
150 <<
"reserved for PAD ("
154 <<
"reserved for END ("
163 <<
"reserved value ("
172 if (!encapsulates.empty()) {
176 << name <<
"', comprising an array of data"
177 <<
" fields may not encapsulate any option space ("
178 << option_def->getPosition() <<
")");
180 }
else if (encapsulates == space) {
182 <<
" an option space it belongs to: '"
183 << space <<
"." << name <<
"' is set to"
184 <<
" encapsulate '" << space <<
"' ("
185 << option_def->getPosition() <<
")");
189 encapsulates.c_str()));
198 def->setContext(user_context);
202 std::vector<std::string> record_tokens =
206 BOOST_FOREACH(std::string record_type, record_tokens) {
209 if (!record_type.empty()) {
210 def->addRecordField(record_type);
214 <<
" specified for the option definition: "
216 <<
getPosition(
"record-types", option_def) <<
")");
223 }
catch (
const std::exception& ex) {
225 <<
" (" << option_def->getPosition() <<
")");
235 : address_family_(address_family) {
240 if (!option_def_list) {
243 <<
" option definitions is NULL ("
244 << option_def_list->getPosition() <<
")");
248 BOOST_FOREACH(
ConstElementPtr option_def, option_def_list->listValue()) {
252 }
catch (
const std::exception& ex) {
255 << option_def->getPosition() <<
")");
280 if (address && addresses) {
282 "specify either ip-address or ip-addresses, not both");
285 if (!address && !addresses) {
294 relay_elem, relay_info);
303 "(" <<
getPosition(
"ip-addresses", relay_elem) <<
")");
306 BOOST_FOREACH(
ConstElementPtr address_element, addresses->listValue()) {
307 addAddress(
"ip-addresses", address_element->stringValue(),
308 relay_elem, relay_info);
314 const std::string& address_str,
317 boost::scoped_ptr<isc::asiolink::IOAddress> ip;
320 }
catch (
const std::exception& ex) {
322 <<
" is not a valid: "
339 relay_info->addAddress(*ip);
340 }
catch (
const std::exception& ex) {
342 <<
" to relay info: " << ex.
what()
352 const uint16_t address_family) {
354 if (address_family == AF_INET) {
364 "definition: (" << pool_structure->getPosition() <<
")");
370 string txt = text_pool->stringValue();
373 boost::erase_all(txt,
" ");
374 boost::erase_all(txt,
"\t");
379 size_t pos = txt.find(
"/");
380 if (pos != string::npos) {
387 string prefix_len = txt.substr(pos + 1);
399 int val_len = boost::lexical_cast<int>(prefix_len);
400 if ((val_len < std::numeric_limits<uint8_t>::min()) ||
401 (val_len > std::numeric_limits<uint8_t>::max())) {
405 len =
static_cast<uint8_t
>(val_len);
408 "definition: " << txt <<
" ("
409 << text_pool->getPosition() <<
")");
414 pools->push_back(pool);
415 }
catch (
const std::exception& ex) {
417 << txt <<
" (" << text_pool->getPosition() <<
")");
426 if (pos != string::npos) {
433 "definition: " << txt <<
" ("
434 << text_pool->getPosition() <<
")");
439 pools->push_back(pool);
440 }
catch (
const std::exception& ex) {
442 << txt <<
" (" << text_pool->getPosition() <<
")");
449 << text_pool->stringValue() <<
450 ". There are two acceptable formats <min address-max address>"
452 << text_pool->getPosition() <<
")");
461 << user_context->getPosition() <<
")");
463 pool->setContext(user_context);
472 option_parser->parse(cfg, option_data);
473 }
catch (
const std::exception& ex) {
475 <<
" (" << option_data->getPosition() <<
")");
482 string cclass = client_class->stringValue();
483 if (!cclass.empty()) {
484 pool->allowClientClass(cclass);
489 ConstElementPtr class_list = pool_structure->get(
"require-client-classes");
491 const std::vector<data::ElementPtr>& classes = class_list->listValue();
492 for (
auto cclass = classes.cbegin();
493 cclass != classes.cend(); ++cclass) {
495 (*cclass)->stringValue().empty()) {
497 << (*cclass)->getPosition() <<
")");
499 pool->requireClientClass((*cclass)->stringValue());
504boost::shared_ptr<OptionDataListParser>
506 auto parser = boost::make_shared<OptionDataListParser>(address_family);
528 parser->parse(pools, pool, AF_INET);
532boost::shared_ptr<PoolParser>
534 auto parser = boost::make_shared<Pool4Parser>();
542 address_family_(family),
544 check_iface_(check_iface) {
552 if (options_params) {
554 opt_parser->parse(
options_, options_params);
567 }
catch (
const std::exception& ex) {
569 "subnet configuration failed: " << ex.
what());
577 std::string subnet_txt;
579 subnet_txt =
getString(params,
"subnet");
583 "mandatory 'subnet' parameter is missing for a subnet being"
584 " configured (" << params->getPosition() <<
")");
588 boost::erase_all(subnet_txt,
" ");
589 boost::erase_all(subnet_txt,
"\t");
596 size_t pos = subnet_txt.find(
"/");
597 if (pos == string::npos) {
600 "Invalid subnet syntax (prefix/len expected):" << subnet_txt
601 <<
" (" << elem->getPosition() <<
")");
611 len = boost::lexical_cast<unsigned int>(subnet_txt.substr(pos + 1));
612 }
catch (
const boost::bad_lexical_cast&) {
615 subnet_txt.substr(pos+1) <<
"' is not an integer ("
616 << elem->getPosition() <<
")");
620 if ((addr.
isV6() && len > 128) ||
621 (addr.
isV4() && len > 32)) {
624 "Invalid prefix length specified for subnet: " << len
625 <<
" (" << elem->getPosition() <<
")");
632 for (PoolStorage::iterator it =
pools_->begin(); it !=
pools_->end();
640 ex.
what() <<
" (" << params->getPosition() <<
")");
649 << user_context->getPosition() <<
")");
651 subnet_->setContext(user_context);
662boost::shared_ptr<OptionDataListParser>
664 auto parser = boost::make_shared<OptionDataListParser>(
address_family_);
683 parser->parse(
pools_, pools);
691 "Failed to create an IPv4 subnet (" <<
692 subnet->getPosition() <<
")");
699 "Invalid Subnet4 cast in Subnet4ConfigParser::parse");
713 for (
auto h = hosts.begin(); h != hosts.end(); ++h) {
728 int64_t subnet_id_max =
static_cast<int64_t
>(SUBNET_ID_MAX);
739 mutable_params = boost::const_pointer_cast<Element>(params);
744 NetworkPtr network = boost::dynamic_pointer_cast<Network>(subnet4);
747 std::ostringstream output;
748 output << addr <<
"/" <<
static_cast<int>(len) <<
" with params: ";
750 bool has_renew = !subnet4->getT1().unspecified();
751 bool has_rebind = !subnet4->getT2().unspecified();
757 renew = subnet4->getT1().get();
758 output <<
"t1=" << renew <<
", ";
761 rebind = subnet4->getT2().get();
762 output <<
"t2=" << rebind <<
", ";
765 if (has_renew && has_rebind && (renew > rebind)) {
767 <<
") is greater than the value of rebind-timer ("
771 if (!subnet4->getValid().unspecified()) {
772 output <<
"valid-lifetime=" << subnet4->getValid().get();
778 if (params->contains(
"match-client-id")) {
779 bool match_client_id =
getBoolean(params,
"match-client-id");
780 subnet4->setMatchClientId(match_client_id);
784 if (params->contains(
"authoritative")) {
785 bool authoritative =
getBoolean(params,
"authoritative");
786 subnet4->setAuthoritative(authoritative);
792 if (params->contains(
"next-server")) {
795 next_server =
getString(params,
"next-server");
796 if (!next_server.empty()) {
797 subnet4->setSiaddr(
IOAddress(next_server));
803 pos = next->getPosition().str();
805 pos = params->getPosition().str();
808 << next_server <<
"(" << pos <<
")");
813 if (params->contains(
"server-hostname")) {
814 std::string sname =
getString(params,
"server-hostname");
815 if (!sname.empty()) {
820 << sname.length() <<
" ("
821 <<
error->getPosition() <<
")");
823 subnet4->setSname(sname);
828 if (params->contains(
"boot-file-name")) {
829 std::string filename =
getString(params,
"boot-file-name");
830 if (!filename.empty()) {
835 << filename.length() <<
" ("
836 <<
error->getPosition() <<
")");
838 subnet4->setFilename(filename);
844 if (params->contains(
"interface")) {
845 std::string iface =
getString(params,
"interface");
846 if (!iface.empty()) {
850 <<
" for subnet " << subnet4->toText()
851 <<
" is not present in the system ("
852 <<
error->getPosition() <<
")");
855 subnet4->setIface(iface);
860 if (params->contains(
"client-class")) {
861 string client_class =
getString(params,
"client-class");
862 if (!client_class.empty()) {
863 subnet4->allowClientClass(client_class);
870 const std::vector<data::ElementPtr>& classes = class_list->listValue();
871 for (
auto cclass = classes.cbegin();
872 cclass != classes.cend(); ++cclass) {
874 (*cclass)->stringValue().empty()) {
876 << (*cclass)->getPosition() <<
")");
878 subnet4->requireClientClass((*cclass)->stringValue());
883 if (params->contains(
"4o6-interface")) {
884 string iface4o6 =
getString(params,
"4o6-interface");
885 if (!iface4o6.empty()) {
886 subnet4->get4o6().setIface4o6(iface4o6);
887 subnet4->get4o6().enabled(
true);
892 if (params->contains(
"4o6-subnet")) {
893 string subnet4o6 =
getString(params,
"4o6-subnet");
894 if (!subnet4o6.empty()) {
895 size_t slash = subnet4o6.find(
"/");
896 if (slash == std::string::npos) {
898 << subnet4o6 <<
", expected format: prefix6/length");
900 string prefix = subnet4o6.substr(0, slash);
901 string lenstr = subnet4o6.substr(slash + 1);
905 len = boost::lexical_cast<unsigned int>(lenstr.c_str());
906 }
catch (
const boost::bad_lexical_cast &) {
908 "4o6-subnet parameter: " << subnet4o6 <<
", expected 0..128 value");
910 subnet4->get4o6().setSubnet4o6(
IOAddress(prefix), len);
911 subnet4->get4o6().enabled(
true);
916 if (params->contains(
"4o6-interface-id")) {
917 std::string ifaceid =
getString(params,
"4o6-interface-id");
918 if (!ifaceid.empty()) {
921 subnet4->get4o6().setInterfaceId(opt);
922 subnet4->get4o6().enabled(
true);
934 options_->copyTo(*subnet4->getCfgOption());
948 const IOAddress& address = host->getIPv4Reservation();
949 if (!address.
isV4Zero() && !subnet->inRange(address)) {
951 <<
"' is not within the IPv4 subnet '"
952 << subnet->
toText() <<
"'");
956boost::shared_ptr<PoolsListParser>
958 auto parser = boost::make_shared<Pools4ListParser>();
965 : check_iface_(check_iface) {
972 BOOST_FOREACH(
ConstElementPtr subnet_json, subnets_list->listValue()) {
975 Subnet4Ptr subnet = parser->parse(subnet_json);
982 cfg->getCfgSubnets4()->add(subnet);
984 }
catch (
const std::exception& ex) {
986 << subnet_json->getPosition() <<
")");
997 BOOST_FOREACH(
ConstElementPtr subnet_json, subnets_list->listValue()) {
1000 Subnet4Ptr subnet = parser->parse(subnet_json);
1003 auto ret = subnets.insert(subnet);
1006 "can't store subnet because of conflict");
1009 }
catch (
const std::exception& ex) {
1011 << subnet_json->getPosition() <<
")");
1018boost::shared_ptr<Subnet4ConfigParser>
1020 auto parser = boost::make_shared<Subnet4ConfigParser>(
check_iface_);
1030 (ptype), addr, len)));
1037 (ptype), min, max)));
1047 parser->parse(pools, pool, AF_INET6);
1051boost::shared_ptr<PoolParser>
1053 auto parser = boost::make_shared<Pool6Parser>();
1066 std::string addr_str =
getString(pd_pool_,
"prefix");
1068 uint8_t prefix_len =
getUint8(pd_pool_,
"prefix-len");
1070 uint8_t delegated_len =
getUint8(pd_pool_,
"delegated-len");
1072 std::string excluded_prefix_str =
"::";
1073 if (pd_pool_->contains(
"excluded-prefix")) {
1074 excluded_prefix_str =
getString(pd_pool_,
"excluded-prefix");
1077 uint8_t excluded_prefix_len = 0;
1078 if (pd_pool_->contains(
"excluded-prefix-len")) {
1079 excluded_prefix_len =
getUint8(pd_pool_,
"excluded-prefix-len");
1085 opts_parser->parse(
options_, option_data);
1108 excluded_prefix_len));
1111 }
catch (
const std::exception& ex) {
1116 <<
" (" << pd_pool_->getPosition() <<
")");
1125 if (!cclass.empty()) {
1126 pool_->allowClientClass(cclass);
1131 const std::vector<data::ElementPtr>& classes = class_list->listValue();
1132 for (
auto cclass = classes.cbegin();
1133 cclass != classes.cend(); ++cclass) {
1135 (*cclass)->stringValue().empty()) {
1137 << (*cclass)->getPosition() <<
")");
1139 pool_->requireClientClass((*cclass)->stringValue());
1144 pools->push_back(
pool_);
1147boost::shared_ptr<OptionDataListParser>
1149 auto parser = boost::make_shared<OptionDataListParser>(AF_INET6);
1160 parser->parse(pools, pd_pool);
1164boost::shared_ptr<PdPoolParser>
1166 auto parser = boost::make_shared<PdPoolParser>();
1185 parser->parse(
pools_, pools);
1190 parser->parse(
pools_, pd_pools);
1198 "Failed to create an IPv6 subnet (" <<
1199 subnet->getPosition() <<
")");
1206 "Invalid Subnet6 cast in Subnet6ConfigParser::parse");
1220 for (
auto h = hosts.begin(); h != hosts.end(); ++h) {
1234 .arg(code).arg(addr.
toText());
1243 int64_t subnet_id_max =
static_cast<int64_t
>(SUBNET_ID_MAX);
1250 if (params->contains(
"rapid-commit")) {
1251 rapid_commit =
getBoolean(params,
"rapid-commit");
1267 mutable_params = boost::const_pointer_cast<Element>(params);
1280 std::ostringstream output;
1281 output << addr <<
"/" <<
static_cast<int>(len) <<
" with params: ";
1287 int64_t rebind = -1;
1291 output <<
"t1=" << renew <<
", ";
1295 output <<
"t2=" << rebind <<
", ";
1298 if (has_renew && has_rebind && (renew > rebind)) {
1300 <<
") is greater than the value of rebind-timer ("
1305 output <<
"preferred-lifetime=" << subnet6->
getPreferred().
get() <<
", ";
1308 output <<
"valid-lifetime=" << subnet6->
getValid().
get();
1311 output <<
", rapid-commit is "
1320 if (params->contains(
"interface-id")) {
1321 ifaceid =
getString(params,
"interface-id");
1325 if (params->contains(
"interface")) {
1335 "parser error: interface (defined for locally reachable "
1336 "subnets) and interface-id (defined for subnets reachable"
1337 " via relays) cannot be defined at the same time for "
1338 "subnet " << addr <<
"/" << (
int)len <<
"("
1339 << params->getPosition() <<
")");
1344 std::string ifaceid_value = ifaceid.
get();
1345 OptionBuffer tmp(ifaceid_value.begin(), ifaceid_value.end());
1356 <<
" for subnet " << subnet6->
toText()
1357 <<
" is not present in the system ("
1358 <<
error->getPosition() <<
")");
1365 if (params->contains(
"client-class")) {
1366 string client_class =
getString(params,
"client-class");
1367 if (!client_class.empty()) {
1372 if (params->contains(
"require-client-classes")) {
1376 const std::vector<data::ElementPtr>& classes = class_list->listValue();
1377 for (
auto cclass = classes.cbegin();
1378 cclass != classes.cend(); ++cclass) {
1380 (*cclass)->stringValue().empty()) {
1382 << (*cclass)->getPosition() <<
")");
1408 for (
auto it = range.first; it != range.second; ++it) {
1409 const IOAddress& address = it->second.getPrefix();
1410 if (!subnet->inRange(address)) {
1412 <<
"' is not within the IPv6 subnet '"
1413 << subnet->
toText() <<
"'");
1418boost::shared_ptr<PoolsListParser>
1420 auto parser = boost::make_shared<Pools6ListParser>();
1424boost::shared_ptr<PdPoolsListParser>
1426 auto parser = boost::make_shared<PdPoolsListParser>();
1433 : check_iface_(check_iface) {
1440 BOOST_FOREACH(
ConstElementPtr subnet_json, subnets_list->listValue()) {
1443 Subnet6Ptr subnet = parser->parse(subnet_json);
1449 cfg->getCfgSubnets6()->add(subnet);
1451 }
catch (
const std::exception& ex) {
1453 << subnet_json->getPosition() <<
")");
1463 BOOST_FOREACH(
ConstElementPtr subnet_json, subnets_list->listValue()) {
1466 Subnet6Ptr subnet = parser->parse(subnet_json);
1469 auto ret = subnets.insert(subnet);
1472 "can't store subnet because of conflict");
1475 }
catch (
const std::exception& ex) {
1477 << subnet_json->getPosition() <<
")");
1484boost::shared_ptr<Subnet6ConfigParser>
1486 auto parser = boost::make_shared<Subnet6ConfigParser>(
check_iface_);
1494 const std::string& name) {
1497 (scope, name,
"NameChangeRequest protocol"));
1502 const std::string& name) {
1505 (scope, name,
"NameChangeRequest format"));
1510 const std::string& name) {
1513 (scope, name,
"ReplaceClientName mode"));
1521 bool enable_updates =
getBoolean(client_config,
"enable-updates");
1525 uint32_t server_port =
getUint32(client_config,
"server-port");
1527 std::string sender_ip_str =
getString(client_config,
"sender-ip");
1529 uint32_t sender_port =
getUint32(client_config,
"sender-port");
1531 uint32_t max_queue_size =
getUint32(client_config,
"max-queue-size");
1534 getProtocol(client_config,
"ncr-protocol");
1537 getFormat(client_config,
"ncr-format");
1540 if (sender_ip_str.empty()) {
1547 }
catch (
const std::exception& ex) {
1549 <<
") specified for parameter 'sender-ip' ("
1550 <<
getPosition(
"sender-ip", client_config) <<
")");
1560 <<
" is not supported. ("
1561 <<
getPosition(
"ncr-format", client_config) <<
")");
1567 <<
" is not supported. ("
1568 <<
getPosition(
"ncr-protocol", client_config) <<
")");
1573 "D2ClientConfig error: address family mismatch: "
1574 <<
"server-ip: " << server_ip.
toText()
1575 <<
" is: " << (server_ip.
isV4() ?
"IPv4" :
"IPv6")
1576 <<
" while sender-ip: " << sender_ip.
toText()
1577 <<
" is: " << (sender_ip.
isV4() ?
"IPv4" :
"IPv6")
1578 <<
" (" <<
getPosition(
"sender-ip", client_config) <<
")");
1581 if (server_ip == sender_ip && server_port == sender_port) {
1583 "D2ClientConfig error: server and sender cannot"
1584 " share the exact same IP address/port: "
1585 << server_ip.
toText() <<
"/" << server_port
1586 <<
" (" <<
getPosition(
"sender-ip", client_config) <<
")");
1599 }
catch (
const std::exception& ex) {
1601 << client_config->getPosition() <<
")");
1607 new_config->setContext(user_context);
1610 return (new_config);
1629 ElementPtr mutable_d2 = boost::const_pointer_cast<Element>(d2_config);
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.
A generic exception that is thrown if a parameter given to a method or function is considered invalid...
A generic exception that is thrown if a parameter given to a method would refer to or modify out-of-r...
A generic exception that is thrown when an unexpected error condition occurs.
The IOAddress class represents an IP addresses (version agnostic)
static const IOAddress & IPV4_ZERO_ADDRESS()
Returns an address set to all zeros.
bool isV4Zero() const
Convenience function to check if it is an IPv4 zero address.
std::string toText() const
Convert the address to a string.
bool isV6() const
Convenience function to check for an IPv6 address.
bool isV4() const
Convenience function to check for an IPv4 address.
short getFamily() const
Returns the address family.
static const IOAddress & IPV6_ZERO_ADDRESS()
Returns an IPv6 zero address.
static void checkKeywords(const SimpleKeywords &keywords, isc::data::ConstElementPtr scope)
Checks acceptable keywords with their expected type.
target_type getAndConvert(isc::data::ConstElementPtr scope, const std::string &name, const std::string &type_name)
Returns a converted value from a scope.
static const data::Element::Position & getPosition(const std::string &name, const data::ConstElementPtr parent)
Utility method that returns position of an element.
uint8_t getUint8(ConstElementPtr scope, const std::string &name)
Get an uint8_t value.
static isc::asiolink::IOAddress getAddress(const ConstElementPtr &scope, const std::string &name)
Returns a IOAddress parameter from a scope.
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.
const isc::util::Triplet< uint32_t > parseIntTriplet(const data::ConstElementPtr &scope, const std::string &name)
Parses an integer triplet.
static bool getBoolean(isc::data::ConstElementPtr scope, const std::string &name)
Returns a boolean parameter from a scope.
static int64_t getInteger(isc::data::ConstElementPtr scope, const std::string &name)
Returns an integer parameter from a scope.
static size_t setDefaults(isc::data::ElementPtr scope, const SimpleDefaults &default_values)
Sets the default values.
void parseCacheParams(const data::ConstElementPtr &network_data, NetworkPtr &network)
Parses parameters related to lease cache settings.
void parseDdnsParams(const data::ConstElementPtr &network_data, NetworkPtr &network)
Parses parameters pertaining to DDNS behavior.
void parseCommon(const data::ConstElementPtr &network_data, NetworkPtr &network)
Parses common parameters.
static void moveReservationMode(isc::data::ElementPtr config)
Moves deprecated reservation-mode parameter to new reservations flags.
void parseTeePercents(const data::ConstElementPtr &network_data, NetworkPtr &network)
Parses parameters related to "percent" timers settings.
Wrapper class that holds MAC/hardware address sources.
void add(uint32_t source)
Adds additional MAC/hardware address acquisition.
void clear()
Removes any configured MAC/Hardware address sources.
static uint32_t MACSourceFromText(const std::string &name)
Attempts to convert known hardware address sources to uint32_t.
static CfgMgr & instance()
returns a single instance of Configuration Manager
SrvConfigPtr getStagingCfg()
Returns a pointer to the staging configuration.
Represents option data configuration for the DHCP server.
void parse(SrvConfig &srv_cfg, isc::data::ConstElementPtr value)
"Parses" control-socket structure
D2ClientConfigPtr parse(isc::data::ConstElementPtr d2_client_cfg)
Parses a given dhcp-ddns element into D2ClientConfig.
static const isc::data::SimpleDefaults D2_CLIENT_CONFIG_DEFAULTS
Defaults for the D2 client configuration.
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.
static ReplaceClientNameMode stringToReplaceClientNameMode(const std::string &mode_str)
Converts labels to ReplaceClientNameMode enum values.
ReplaceClientNameMode
Defines the client name replacement modes.
An exception that is thrown if an error occurs while configuring the D2 DHCP DDNS client.
To be removed. Please use ConfigError instead.
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.
static IfaceMgr & instance()
IfaceMgr is a singleton class.
static void setRuntimeOptionDefs(const OptionDefSpaceContainer &defs)
Copies option definitions created at runtime.
void parse(CfgMACSource &mac_sources, isc::data::ConstElementPtr value)
parses parameters value
void setRapidCommit(const util::Optional< bool > &rapid_commit)
Enables or disables Rapid Commit option support for the subnet.
isc::util::Triplet< uint32_t > getPreferred(const Inheritance &inheritance=Inheritance::ALL) const
Returns preferred lifetime (in seconds)
util::Optional< bool > getRapidCommit(const Inheritance &inheritance=Inheritance::ALL) const
Returns boolean value indicating that the Rapid Commit option is supported or unsupported for the sub...
void setInterfaceId(const OptionPtr &ifaceid)
sets interface-id option (if defined)
Holds optional information about relay.
boost::shared_ptr< Network::RelayInfo > RelayInfoPtr
Pointer to the RelayInfo structure.
void requireClientClass(const isc::dhcp::ClientClass &class_name)
Adds class class_name to classes required to be evaluated.
void allowClientClass(const isc::dhcp::ClientClass &class_name)
Sets the supported class to class class_name.
void setIface(const util::Optional< std::string > &iface_name)
Sets local name of the interface for which this network is selected.
isc::util::Triplet< uint32_t > getT1(const Inheritance &inheritance=Inheritance::ALL) const
Returns T1 (renew timer), expressed in seconds.
isc::util::Triplet< uint32_t > getT2(const Inheritance &inheritance=Inheritance::ALL) const
Returns T2 (rebind timer), expressed in seconds.
isc::util::Triplet< uint32_t > getValid(const Inheritance &inheritance=Inheritance::ALL) const
Return valid-lifetime for addresses in that prefix.
CfgOptionPtr getCfgOption()
Returns pointer to the option data configuration for this network.
OptionDefListParser(const uint16_t address_family)
Constructor.
void parse(CfgOptionDefPtr cfg, isc::data::ConstElementPtr def_list)
Parses a list of option definitions, create them and store in cfg.
Parser for a single option definition.
OptionDefinitionPtr parse(isc::data::ConstElementPtr option_def)
Parses an entry that describes single option definition.
OptionDefParser(const uint16_t address_family)
Constructor.
Base class representing a DHCP option definition.
static bool validateName(const std::string &name)
Checks that the provided option space name is valid.
Universe
defines option universe DHCPv4 or DHCPv6
PdPoolParser()
Constructor.
virtual boost::shared_ptr< OptionDataListParser > createOptionDataListParser() const
Returns an instance of the OptionDataListParser to be used in parsing the option-data structure.
isc::data::ConstElementPtr user_context_
User context (optional, may be null)
void parse(PoolStoragePtr pools, data::ConstElementPtr pd_pool_)
Builds a prefix delegation pool from the given configuration.
isc::dhcp::Pool6Ptr pool_
Pointer to the created pool object.
isc::data::ConstElementPtr client_class_
Client class (a client has to belong to to use this pd-pool)
CfgOptionPtr options_
A storage for pool specific option values.
virtual boost::shared_ptr< PdPoolParser > createPdPoolConfigParser() const
Returns an instance of the PdPoolParser to be used in parsing the prefix delegation pools.
void parse(PoolStoragePtr pools, data::ConstElementPtr pd_pool_list)
Parse configuration entries.
static const size_t MAX_SNAME_LEN
length of the SNAME field in DHCPv4 message
static const size_t MAX_FILE_LEN
length of the FILE field in DHCPv4 message
PoolPtr poolMaker(asiolink::IOAddress &addr, uint32_t len, int32_t ignored)
Creates a Pool4 object given a IPv4 prefix and the prefix length.
Pool information for IPv4 addresses.
PoolPtr poolMaker(asiolink::IOAddress &addr, uint32_t len, int32_t ptype)
Creates a Pool6 object given a IPv6 prefix and the prefix length.
Pool information for IPv6 addresses and prefixes.
virtual void parse(PoolStoragePtr pools, isc::data::ConstElementPtr pool_structure, const uint16_t address_family)
parses the actual structure
virtual PoolPtr poolMaker(isc::asiolink::IOAddress &addr, uint32_t len, int32_t ptype=0)=0
Creates a Pool object given a IPv4 prefix and the prefix length.
virtual boost::shared_ptr< OptionDataListParser > createOptionDataListParser(const uint16_t address_family) const
Returns an instance of the OptionDataListParser to be used in parsing the option-data structure.
void parse(PoolStoragePtr pools, data::ConstElementPtr pools_list)
parses the actual structure
virtual boost::shared_ptr< PoolParser > createPoolConfigParser() const
Returns an instance of the Pool4Parser to be used in parsing the address pools.
void parse(PoolStoragePtr pools, data::ConstElementPtr pools_list)
parses the actual structure
virtual boost::shared_ptr< PoolParser > createPoolConfigParser() const
Returns an instance of the Pool6Parser to be used in parsing the address pools.
parser for additional relay information
RelayInfoParser(const isc::dhcp::Option::Universe &family)
constructor
void addAddress(const std::string &name, const std::string &address_str, isc::data::ConstElementPtr relay_elem, const isc::dhcp::Network::RelayInfoPtr &relay_info)
Attempts to add an IP address to list of relay addresses.
void parse(const isc::dhcp::Network::RelayInfoPtr &relay_info, isc::data::ConstElementPtr relay_elem)
parses the actual relay parameters
static const isc::data::SimpleKeywords SUBNET4_PARAMETERS
This table defines all subnet parameters for DHCPv4.
static const isc::data::SimpleKeywords OPTION4_DEF_PARAMETERS
This table defines all option definition parameters.
static const isc::data::SimpleKeywords POOL4_PARAMETERS
This table defines all pool parameters.
static const isc::data::SimpleKeywords POOL6_PARAMETERS
This table defines all pool parameters.
static const isc::data::SimpleKeywords SUBNET6_PARAMETERS
This table defines all subnet parameters for DHCPv6.
static const isc::data::SimpleKeywords OPTION6_DEF_PARAMETERS
This table defines all option definition parameters.
static const isc::data::SimpleKeywords PD_POOL6_PARAMETERS
This table defines all prefix delegation pool parameters.
Specifies current DHCP configuration.
void setControlSocketInfo(const isc::data::ConstElementPtr &control_socket)
Sets information about the control socket.
Subnet4ConfigParser(bool check_iface=true)
Constructor.
virtual boost::shared_ptr< PoolsListParser > createPoolsListParser() const
Returns an instance of the Pools4ListParser to be used in parsing the address pools.
void validateResv(const Subnet4Ptr &subnet, ConstHostPtr host)
Verifies the host reservation address is in the subnet range.
void initSubnet(data::ConstElementPtr params, asiolink::IOAddress addr, uint8_t len)
Instantiates the IPv4 Subnet based on a given IPv4 address and prefix length.
Subnet4Ptr parse(data::ConstElementPtr subnet)
Parses a single IPv4 subnet configuration and adds to the Configuration Manager.
A configuration holder for IPv4 subnet.
virtual boost::shared_ptr< PoolsListParser > createPoolsListParser() const
Returns an instance of the Pools6ListParser to be used in parsing the address pools.
virtual void duplicate_option_warning(uint32_t code, asiolink::IOAddress &addr)
Issues a DHCP6 server specific warning regarding duplicate subnet options.
virtual boost::shared_ptr< PdPoolsListParser > createPdPoolsListParser() const
Returns an instance of the PdPools6ListParser to be used in parsing the prefix delegation pools.
Subnet6Ptr parse(data::ConstElementPtr subnet)
Parses a single IPv6 subnet configuration and adds to the Configuration Manager.
void initSubnet(isc::data::ConstElementPtr params, isc::asiolink::IOAddress addr, uint8_t len)
Instantiates the IPv6 Subnet based on a given IPv6 address and prefix length.
void validateResvs(const Subnet6Ptr &subnet, ConstHostPtr host)
Verifies host reservation addresses are in the subnet range.
Subnet6ConfigParser(bool check_iface=true)
Constructor.
A configuration holder for IPv6 subnet.
this class parses a single subnet
SubnetConfigParser(uint16_t family, bool check_iface=true)
constructor
isc::dhcp::SubnetPtr subnet_
Pointer to the created subnet object.
CfgOptionPtr options_
Pointer to the options configuration.
void createSubnet(isc::data::ConstElementPtr data)
Create a new subnet using a data from child parsers.
virtual void initSubnet(isc::data::ConstElementPtr params, isc::asiolink::IOAddress addr, uint8_t len)=0
Instantiates the subnet based on a given IP prefix and prefix length.
SubnetPtr parse(isc::data::ConstElementPtr subnet)
parses a subnet description and returns Subnet{4,6} structure
isc::dhcp::Network::RelayInfoPtr relay_info_
Pointer to relay information.
uint16_t address_family_
Address family: AF_INET or AF_INET6.
bool check_iface_
Check if the specified interface exists in the system.
virtual boost::shared_ptr< OptionDataListParser > createOptionDataListParser() const
Returns an instance of the OptionDataListParser to be used in parsing the option-data structure.
PoolStoragePtr pools_
Storage for pools belonging to this subnet.
virtual std::string toText() const
Returns textual representation of the subnet (e.g.
bool check_iface_
Check if the specified interface exists in the system.
Subnets4ListConfigParser(bool check_iface=true)
constructor
size_t parse(SrvConfigPtr cfg, data::ConstElementPtr subnets_list)
parses contents of the list
virtual boost::shared_ptr< Subnet4ConfigParser > createSubnetConfigParser() const
Returns an instance of the Subnet4ConfigParser to be used in parsing the subnets.
virtual boost::shared_ptr< Subnet6ConfigParser > createSubnetConfigParser() const
Returns an instance of the Subnet6ConfigParser to be used in parsing the subnets.
Subnets6ListConfigParser(bool check_iface=true)
constructor
size_t parse(SrvConfigPtr cfg, data::ConstElementPtr subnets_list)
parses contents of the list
bool check_iface_
Check if the specified interface exists in the system.
T get() const
Retrieves the encapsulated value.
bool empty() const
Checks if the encapsulated value is empty.
void unspecified(bool unspecified)
Modifies the flag that indicates whether the value is specified or unspecified.
T get(T hint) const
Returns value with a hint.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
#define LOG_WARN(LOGGER, MESSAGE)
Macro to conveniently test warn output and log it.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
boost::shared_ptr< const Element > ConstElementPtr
std::vector< SimpleDefault > SimpleDefaults
This specifies all default values in a given scope (e.g. a subnet).
boost::shared_ptr< Element > ElementPtr
NameChangeProtocol stringToNcrProtocol(const std::string &protocol_str)
Function which converts text labels to NameChangeProtocol enums.
NameChangeFormat
Defines the list of data wire formats supported.
NameChangeProtocol
Defines the list of socket protocols supported.
std::string ncrProtocolToString(NameChangeProtocol protocol)
Function which converts NameChangeProtocol enums to text labels.
NameChangeFormat stringToNcrFormat(const std::string &fmt_str)
Function which converts labels to NameChangeFormat enum values.
std::string ncrFormatToString(NameChangeFormat format)
Function which converts NameChangeFormat enums to text labels.
isc::log::Logger dhcpsrv_logger("dhcpsrv")
DHCP server library Logger.
boost::shared_ptr< const CfgGlobals > ConstCfgGlobalsPtr
Const shared pointer to a CfgGlobals instance.
boost::shared_ptr< Subnet > SubnetPtr
A generic pointer to either Subnet4 or Subnet6 object.
const isc::log::MessageID DHCPSRV_CFGMGR_NEW_SUBNET6
boost::shared_ptr< Subnet4 > Subnet4Ptr
A pointer to a Subnet4 object.
std::vector< PoolPtr > PoolStorage
a collection of pools
boost::shared_ptr< D2ClientConfig > D2ClientConfigPtr
Defines a pointer for D2ClientConfig instances.
boost::shared_ptr< CfgOption > CfgOptionPtr
Non-const pointer.
boost::shared_ptr< CfgOptionDef > CfgOptionDefPtr
Non-const pointer.
const isc::log::MessageID DHCPSRV_CFGMGR_OPTION_DUPLICATE
boost::shared_ptr< Subnet6 > Subnet6Ptr
A pointer to a Subnet6 object.
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.
const isc::log::MessageID DHCPSRV_CFGMGR_RELAY_IP_ADDRESS_DEPRECATED
boost::shared_ptr< SrvConfig > SrvConfigPtr
Non-const pointer to the SrvConfig.
std::pair< IPv6ResrvIterator, IPv6ResrvIterator > IPv6ResrvRange
std::vector< HostPtr > HostCollection
Collection of the Host objects.
const int DHCPSRV_DBG_TRACE_DETAIL
Additional information.
boost::shared_ptr< OptionDefinition > OptionDefinitionPtr
Pointer to option definition object.
boost::shared_ptr< PoolStorage > PoolStoragePtr
boost::shared_ptr< Pool > PoolPtr
a pointer to either IPv4 or IPv6 Pool
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.
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
const isc::log::MessageID DHCPSRV_CFGMGR_NEW_SUBNET4
boost::shared_ptr< const Host > ConstHostPtr
Const pointer to the Host object.
boost::shared_ptr< Network > NetworkPtr
Pointer to the Network object.
std::vector< uint8_t > OptionBuffer
buffer types used in DHCP code.
boost::shared_ptr< Option > OptionPtr
string trim(const string &instring)
Trim Leading and Trailing Spaces.
vector< string > tokens(const std::string &text, const std::string &delim, bool escape)
Split String into Tokens.
Defines the logger used by the top-level component of kea-lfc.
#define DHCP4_OPTION_SPACE
global std option spaces
#define DHCP6_OPTION_SPACE
Type
Type of lease or pool.