"initServerSelection called with an empty domain");
}
- // Set the tsig_key to that of the DdnsDomain.
- TSIGKeyInfoPtr tsig_key_info = domain->getTSIGKeyInfo();
- if (tsig_key_info) {
- tsig_key_ = tsig_key_info->getTSIGKey();
- } else {
- tsig_key_.reset();
- }
-
current_server_list_ = domain->getServers();
next_server_pos_ = 0;
current_server_.reset();
// Toss out any previous response.
dns_update_response_.reset();
+ // Set the tsig_key to that of the current server..
+ TSIGKeyInfoPtr tsig_key_info = current_server_->getTSIGKeyInfo();
+ if (tsig_key_info) {
+ tsig_key_ = tsig_key_info->getTSIGKey();
+ } else {
+ tsig_key_.reset();
+ }
+
// @todo Protocol is set on DNSClient constructor. We need
// to propagate a configuration value downward, probably starting
// at global, then domain, then server
/// @param config element to parse
virtual void parseElement(data::ConstElementPtr config) {
DnsServerInfoParser parser;
- server_ = parser.parse(config);
+ std::string domain = "{ \"key-name\": \"\" }";
+ server_ = parser.parse(config, Element::fromJSON(domain), {});
}
/// @brief Retains the DnsServerInfo created by a successful parsing
/// @param config element to parse
virtual void parseElement(data::ConstElementPtr config) {
DnsServerInfoListParser parser;
- servers_ = parser.parse(config);
+ std::string domain = "{ \"key-name\": \"\" }";
+ servers_ = parser.parse(config, Element::fromJSON(domain), {});
}
/// @brief Retains the DnsServerInfos created by a successful parsing
" \"dns-servers\" : [ "
" { \"ip-address\": \"127.0.0.3\" , "
" \"port\": 300 } ] } ";
- PARSE_FAIL(config, "DdnsDomain : example.com specifies"
+ PARSE_FAIL(config, "DdnsDomain : specifies"
" an undefined key: d2_key.example.com (<string>:1:41)");
}
// Verify the name and key_name values.
EXPECT_EQ("example.com", domain_->getName());
EXPECT_EQ("d2_key.example.com", domain_->getKeyName());
- ASSERT_TRUE(domain_->getTSIGKeyInfo());
- ASSERT_TRUE(domain_->getTSIGKeyInfo()->getTSIGKey());
// Verify that the server list exists and contains the correct number of
// servers.
const DnsServerInfoStoragePtr& servers = domain_->getServers();
- EXPECT_TRUE(servers);
+ ASSERT_TRUE(servers);
EXPECT_EQ(3, servers->size());
// Fetch each server and verify its contents.
DnsServerInfoPtr server = (*servers)[0];
- EXPECT_TRUE(server);
+ ASSERT_TRUE(server);
EXPECT_TRUE(checkServer(server, "", "127.0.0.1", 100));
+ ASSERT_TRUE(server->getTSIGKeyInfo());
+ EXPECT_TRUE(server->getTSIGKeyInfo()->getTSIGKey());
server = (*servers)[1];
- EXPECT_TRUE(server);
+ ASSERT_TRUE(server);
EXPECT_TRUE(checkServer(server, "", "127.0.0.2", 200));
+ ASSERT_TRUE(server->getTSIGKeyInfo());
+ EXPECT_TRUE(server->getTSIGKeyInfo()->getTSIGKey());
server = (*servers)[2];
- EXPECT_TRUE(server);
+ ASSERT_TRUE(server);
EXPECT_TRUE(checkServer(server, "", "127.0.0.3", 300));
+ ASSERT_TRUE(server->getTSIGKeyInfo());
+ EXPECT_TRUE(server->getTSIGKeyInfo()->getTSIGKey());
// Verify unparsing.
ElementPtr json;
EXPECT_EQ("example.com", domain->getName());
EXPECT_EQ("d2_key.example.com", domain->getKeyName());
- // Verify the TSIGKeyInfo name and that the actual key was created
- ASSERT_TRUE(domain->getTSIGKeyInfo());
- EXPECT_EQ(domain->getKeyName(), domain->getTSIGKeyInfo()->getName());
- EXPECT_TRUE(domain->getTSIGKeyInfo()->getTSIGKey());
-
// Verify the each of the first domain's servers
DnsServerInfoStoragePtr servers = domain->getServers();
- EXPECT_TRUE(servers);
+ ASSERT_TRUE(servers);
EXPECT_EQ(3, servers->size());
DnsServerInfoPtr server = (*servers)[0];
- EXPECT_TRUE(server);
+ ASSERT_TRUE(server);
EXPECT_TRUE(checkServer(server, "", "127.0.0.1", 100));
+ // Verify the TSIGKeyInfo name and that the actual key was created
+ ASSERT_TRUE(server->getTSIGKeyInfo());
+ EXPECT_EQ(domain->getKeyName(), server->getKeyName());
+ EXPECT_EQ(domain->getKeyName(), server->getTSIGKeyInfo()->getName());
+ EXPECT_TRUE(server->getTSIGKeyInfo()->getTSIGKey());
+
server = (*servers)[1];
- EXPECT_TRUE(server);
+ ASSERT_TRUE(server);
EXPECT_TRUE(checkServer(server, "", "127.0.0.2", 200));
+ ASSERT_TRUE(server->getTSIGKeyInfo());
+ EXPECT_EQ(domain->getKeyName(), server->getKeyName());
+ EXPECT_EQ(domain->getKeyName(), server->getTSIGKeyInfo()->getName());
+ EXPECT_TRUE(server->getTSIGKeyInfo()->getTSIGKey());
server = (*servers)[2];
- EXPECT_TRUE(server);
+ ASSERT_TRUE(server);
EXPECT_TRUE(checkServer(server, "", "127.0.0.3", 300));
+ ASSERT_TRUE(server->getTSIGKeyInfo());
+ EXPECT_EQ(domain->getKeyName(), server->getKeyName());
+ EXPECT_EQ(domain->getKeyName(), server->getTSIGKeyInfo()->getName());
+ EXPECT_TRUE(server->getTSIGKeyInfo()->getTSIGKey());
// Verify second domain
gotit = domains_->find("billcat.net");
// Verify the name and key_name values of the second domain.
EXPECT_EQ("billcat.net", domain->getName());
EXPECT_EQ("d2_key.billcat.net", domain->getKeyName());
- ASSERT_TRUE(domain->getTSIGKeyInfo());
- EXPECT_EQ(domain->getKeyName(), domain->getTSIGKeyInfo()->getName());
- EXPECT_TRUE(domain->getTSIGKeyInfo()->getTSIGKey());
// Verify the each of second domain's servers
servers = domain->getServers();
- EXPECT_TRUE(servers);
- servers->size();
+ ASSERT_TRUE(servers);
EXPECT_EQ(3, servers->size());
server = (*servers)[0];
- EXPECT_TRUE(server);
+ ASSERT_TRUE(server);
EXPECT_TRUE(checkServer(server, "", "127.0.0.4", 400));
+ ASSERT_TRUE(server->getTSIGKeyInfo());
+ EXPECT_EQ(domain->getKeyName(), server->getKeyName());
+ EXPECT_EQ(domain->getKeyName(), server->getTSIGKeyInfo()->getName());
+ EXPECT_TRUE(server->getTSIGKeyInfo()->getTSIGKey());
server = (*servers)[1];
- EXPECT_TRUE(server);
+ ASSERT_TRUE(server);
EXPECT_TRUE(checkServer(server, "", "127.0.0.5", 500));
+ ASSERT_TRUE(server->getTSIGKeyInfo());
+ EXPECT_EQ(domain->getKeyName(), server->getKeyName());
+ EXPECT_EQ(domain->getKeyName(), server->getTSIGKeyInfo()->getName());
+ EXPECT_TRUE(server->getTSIGKeyInfo()->getTSIGKey());
server = (*servers)[2];
- EXPECT_TRUE(server);
+ ASSERT_TRUE(server);
EXPECT_TRUE(checkServer(server, "", "127.0.0.6", 600));
+ ASSERT_TRUE(server->getTSIGKeyInfo());
+ EXPECT_EQ(domain->getKeyName(), server->getKeyName());
+ EXPECT_EQ(domain->getKeyName(), server->getTSIGKeyInfo()->getName());
+ EXPECT_TRUE(server->getTSIGKeyInfo()->getTSIGKey());
}
/// @brief Tests that a domain list configuration cannot contain duplicates.
"Duplicate domain specified:example.com (<string>:1:115)");
}
-};
+}
// Create the forward domain and then its servers.
forward_domain_ = makeDomain("example.com.", tsig_key_info);
addDomainServer(forward_domain_, "forward.example.com",
- "127.0.0.1", 5301);
+ "127.0.0.1", 5301, tsig_key_info);
addDomainServer(forward_domain_, "forward2.example.com",
- "127.0.0.1", 5302);
+ "127.0.0.1", 5302, tsig_key_info);
}
// If the change mask does not include a reverse change clear the
// Create the reverse domain and its server.
reverse_domain_ = makeDomain("2.168.192.in.addr.arpa.", tsig_key_info);
addDomainServer(reverse_domain_, "reverse.example.com",
- "127.0.0.1", 5301);
+ "127.0.0.1", 5301, tsig_key_info);
addDomainServer(reverse_domain_, "reverse2.example.com",
- "127.0.0.1", 5302);
+ "127.0.0.1", 5302, tsig_key_info);
}
}
// Create the forward domain and then its servers.
forward_domain_ = makeDomain("example.com.", tsig_key_info);
addDomainServer(forward_domain_, "fwd6-server.example.com",
- "::1", 5301);
+ "::1", 5301, tsig_key_info);
addDomainServer(forward_domain_, "fwd6-server2.example.com",
- "::1", 5302);
+ "::1", 5302, tsig_key_info);
}
// If the change mask does not include a reverse change clear the
// Create the reverse domain and its server.
reverse_domain_ = makeDomain("1.2001.ip6.arpa.", tsig_key_info);
addDomainServer(reverse_domain_, "rev6-server.example.com",
- "::1", 5301);
+ "::1", 5301, tsig_key_info);
addDomainServer(reverse_domain_, "rev6-server2.example.com",
- "::1", 5302);
+ "::1", 5302, tsig_key_info);
}
}
DdnsDomainPtr makeDomain(const std::string& zone_name,
const std::string& key_name) {
DnsServerInfoStoragePtr servers(new DnsServerInfoStorage());
- DdnsDomainPtr domain(new DdnsDomain(zone_name, servers,
- makeTSIGKeyInfo(key_name)));
+ DdnsDomainPtr domain(new DdnsDomain(zone_name, servers, key_name));
return (domain);
}
const TSIGKeyInfoPtr &tsig_key_info) {
DdnsDomainPtr domain;
DnsServerInfoStoragePtr servers(new DnsServerInfoStorage());
- domain.reset(new DdnsDomain(zone_name, servers, tsig_key_info));
+ std::string key_name;
+ if (tsig_key_info) {
+ key_name = tsig_key_info->getName();
+ }
+ domain.reset(new DdnsDomain(zone_name, servers, key_name));
return (domain);
}
}
void addDomainServer(DdnsDomainPtr& domain, const std::string& name,
- const std::string& ip, const size_t port) {
+ const std::string& ip, const size_t port,
+ const TSIGKeyInfoPtr &tsig_key_info) {
DnsServerInfoPtr server(new DnsServerInfo(name, asiolink::IOAddress(ip),
- port));
+ port, true, tsig_key_info, true));
domain->getServers()->push_back(server);
}
-// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2021 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
/// @param name new server's host name of the server
/// @param ip new server's ip address
/// @param port new server's port
+/// @param tsig_key_info pointer to the TSIGInfog key for this server.
+/// Defaults to an empty pointer, meaning this server has no key.
///
/// @throw Underlying methods may throw.
extern void addDomainServer(DdnsDomainPtr& domain, const std::string& name,
const std::string& ip = TEST_DNS_SERVER_IP,
- const size_t port = TEST_DNS_SERVER_PORT);
+ const size_t port = TEST_DNS_SERVER_PORT,
+ const TSIGKeyInfoPtr&
+ tsig_key_info = TSIGKeyInfoPtr());
/// @brief Creates a hex text dump of the given data buffer.
///
-// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2021 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#------ "D2.forward-ddns.dhcp-ddns, key-name tests
,{
"description" : "D2.forward-ddns, no matching key name",
-"logic-error" : "DdnsDomain : four.example.com. specifies an undefined key: no.such.key (<string>:1:104)",
+"logic-error" : "DdnsDomain : specifies an undefined key: no.such.key (<string>:1:104)",
"data" :
{
"forward-ddns" :
#------ "D2.reverse-ddns.dhcp-ddns, key-name tests
,{
"description" : "D2.reverse-ddns, no matching key name",
-"logic-error" : "DdnsDomain : 2.0.192.in-addr.arpa. specifies an undefined key: no.such.key (<string>:1:126)",
+"logic-error" : "DdnsDomain : specifies an undefined key: no.such.key (<string>:1:126)",
"data" :
{
"forward-ddns" : {},
// *********************** DnsServerInfo *************************
DnsServerInfo::DnsServerInfo(const std::string& hostname,
- isc::asiolink::IOAddress ip_address, uint32_t port,
- bool enabled)
- :hostname_(hostname), ip_address_(ip_address), port_(port),
- enabled_(enabled) {
+ isc::asiolink::IOAddress ip_address,
+ uint32_t port,
+ bool enabled,
+ const TSIGKeyInfoPtr& tsig_key_info,
+ bool inherited_key)
+ : hostname_(hostname), ip_address_(ip_address), port_(port),
+ enabled_(enabled), tsig_key_info_(tsig_key_info),
+ inherited_key_(inherited_key) {
}
DnsServerInfo::~DnsServerInfo() {
}
+const std::string
+DnsServerInfo::getKeyName() const {
+ if (tsig_key_info_) {
+ return (tsig_key_info_->getName());
+ }
+
+ return ("");
+}
+
std::string
DnsServerInfo::toText() const {
std::ostringstream stream;
result->set("ip-address", Element::create(ip_address_.toText()));
// Set port
result->set("port", Element::create(static_cast<int64_t>(port_)));
+ // Set key-name
+ if (tsig_key_info_ && !inherited_key_) {
+ result->set("key-name", Element::create(tsig_key_info_->getName()));
+ }
return (result);
}
-
std::ostream&
operator<<(std::ostream& os, const DnsServerInfo& server) {
os << server.toText();
DdnsDomain::DdnsDomain(const std::string& name,
DnsServerInfoStoragePtr servers,
- const TSIGKeyInfoPtr& tsig_key_info)
- : name_(name), servers_(servers),
- tsig_key_info_(tsig_key_info) {
+ const std::string& key_name)
+ : name_(name), servers_(servers), key_name_(key_name) {
}
DdnsDomain::~DdnsDomain() {
}
-const std::string
-DdnsDomain::getKeyName() const {
- if (tsig_key_info_) {
- return (tsig_key_info_->getName());
- }
-
- return ("");
-}
-
ElementPtr
DdnsDomain::toElement() const {
ElementPtr result = Element::createMap();
result->set("dns-servers", servers);
}
// Set key-name
- if (tsig_key_info_) {
- result->set("key-name", Element::create(tsig_key_info_->getName()));
+ if (!key_name_.empty()) {
+ result->set("key-name", Element::create(key_name_));
}
return (result);
// *********************** DnsServerInfoParser *************************
DnsServerInfoPtr
-DnsServerInfoParser::parse(ConstElementPtr server_config) {
+DnsServerInfoParser::parse(ConstElementPtr server_config,
+ ConstElementPtr domain_config,
+ const TSIGKeyInfoMapPtr keys) {
std::string hostname = getString(server_config, "hostname");
std::string ip_address = getString(server_config, "ip-address");
uint32_t port = getInteger(server_config, "port");
+ std::string key_name = getString(server_config, "key-name");
ConstElementPtr user_context = server_config->get("user-context");
+ // Key name is optional. If it is not blank, then find the key in the
+ // list of defined keys.
+ TSIGKeyInfoPtr tsig_key_info;
+ bool inherited_key = false;
+ if (key_name.empty()) {
+ std::string domain_key_name = getString(domain_config, "key-name");
+ if (!domain_key_name.empty()) {
+ key_name = domain_key_name;
+ inherited_key = true;
+ }
+ }
+ if (!key_name.empty()) {
+ if (keys) {
+ TSIGKeyInfoMap::iterator kit = keys->find(key_name);
+ if (kit != keys->end()) {
+ tsig_key_info = kit->second;
+ }
+ }
+
+ if (!tsig_key_info) {
+ if (inherited_key) {
+ isc_throw(D2CfgError, "DdnsDomain : specifies an "
+ << "undefined key: " << key_name << " ("
+ << getPosition("key-name", domain_config) << ")");
+ } else {
+ isc_throw(D2CfgError, "Dns Server : specifies an "
+ << "undefined key: " << key_name << " ("
+ << getPosition("key-name", server_config) << ")");
+ }
+ }
+ }
+
// The configuration must specify one or the other.
if (hostname.empty() == ip_address.empty()) {
isc_throw(D2CfgError, "Dns Server must specify one or the other"
// Create an IOAddress from the IP address string given and then
// create the DnsServerInfo.
isc::asiolink::IOAddress io_addr(ip_address);
- server_info.reset(new DnsServerInfo(hostname, io_addr, port));
+ server_info.reset(new DnsServerInfo(hostname, io_addr, port,
+ true, tsig_key_info,
+ inherited_key));
} catch (const isc::asiolink::IOError& ex) {
isc_throw(D2CfgError, "Dns Server : invalid IP address : "
<< ip_address
// *********************** DnsServerInfoListParser *************************
DnsServerInfoStoragePtr
-DnsServerInfoListParser::parse(ConstElementPtr server_list) {
+DnsServerInfoListParser::parse(ConstElementPtr server_list,
+ ConstElementPtr domain_config,
+ const TSIGKeyInfoMapPtr keys) {
DnsServerInfoStoragePtr servers(new DnsServerInfoStorage());
ConstElementPtr server_config;
DnsServerInfoParser parser;
BOOST_FOREACH(server_config, server_list->listValue()) {
- DnsServerInfoPtr server = parser.parse(server_config);
+ DnsServerInfoPtr server =
+ parser.parse(server_config, domain_config, keys);
servers->push_back(server);
}
std::string key_name = getString(domain_config, "key-name");
ConstElementPtr user_context = domain_config->get("user-context");
- // Key name is optional. If it is not blank, then find the key in the
- // list of defined keys.
- TSIGKeyInfoPtr tsig_key_info;
- if (!key_name.empty()) {
- if (keys) {
- TSIGKeyInfoMap::iterator kit = keys->find(key_name);
- if (kit != keys->end()) {
- tsig_key_info = kit->second;
- }
- }
-
- if (!tsig_key_info) {
- isc_throw(D2CfgError, "DdnsDomain : " << name
- << " specifies an undefined key: " << key_name
- << " (" << getPosition("key-name", domain_config) << ")");
- }
- }
-
// Parse the list of DNS servers
ConstElementPtr servers_config;
try {
}
DnsServerInfoListParser server_parser;
- DnsServerInfoStoragePtr servers = server_parser.parse(servers_config);
+ DnsServerInfoStoragePtr servers =
+ server_parser.parse(servers_config, domain_config, keys);
if (servers->size() == 0) {
isc_throw(D2CfgError, "DNS server list cannot be empty"
<< servers_config->getPosition());
}
// Instantiate the new domain and add it to domain storage.
- DdnsDomainPtr domain(new DdnsDomain(name, servers, tsig_key_info));
+ DdnsDomainPtr domain(new DdnsDomain(name, servers, key_name));
// Add user-context
if (user_context) {
return(mgr);
}
-}; // end of isc::dhcp namespace
-}; // end of isc namespace
+} // end of isc::dhcp namespace
+} // end of isc namespace
/// "key-name": "d2_key.tmark.org" ,
/// "dns-servers" :
/// [
-/// { "ip-address": "127.0.0.101" , "port": 100 }
+/// { "ip-address": "127.0.0.101" , "port": 100 ,
+/// "key-name": "d2_key.tmark.org" }
/// ]
/// }
/// ]
/// the default.)
/// @param enabled is a flag that indicates whether this server is
/// enabled for use. It defaults to true.
+ /// @param tsig_key_info pointer to the TSIGKeyInfo for the server's key
+ /// It defaults to an empty pointer, signifying the server has no key.
+ /// @param inherited_key is a flag that indicates whether the key was
+ /// inherited from the domain or not. It defaults to false i.e. not
+ /// inherited.
DnsServerInfo(const std::string& hostname,
isc::asiolink::IOAddress ip_address,
uint32_t port = STANDARD_DNS_PORT,
- bool enabled=true);
+ bool enabled = true,
+ const TSIGKeyInfoPtr& tsig_key_info = TSIGKeyInfoPtr(),
+ bool inherited_key = false);
/// @brief Destructor
virtual ~DnsServerInfo();
enabled_ = false;
}
+ /// @brief Convenience method which returns the server's TSIG key name.
+ ///
+ /// @return returns the key name in an std::string. If server has no
+ /// TSIG key, the string will empty.
+ const std::string getKeyName() const;
+
+ /// @brief Getter which returns the server's TSIGKey info
+ ///
+ /// @return returns the pointer to the server storage. If the server
+ /// is not configured to use TSIG the pointer will be empty.
+ const TSIGKeyInfoPtr& getTSIGKeyInfo() {
+ return (tsig_key_info_);
+ }
+
/// @brief Returns a text representation for the server.
std::string toText() const;
/// @param enabled is a flag that indicates whether this server is
/// enabled for use. It defaults to true.
bool enabled_;
+
+ /// @brief Pointer to domain's the TSIGKeyInfo.
+ /// Value is empty if the domain is not configured for TSIG.
+ TSIGKeyInfoPtr tsig_key_info_;
+
+ /// @brief Inherited key. When true the key was inherited from the domain,
+ /// when false the key was not inherited from the domain.
+ bool inherited_key_;
};
std::ostream&
///
/// @param name is the domain name of the domain.
/// @param servers is the list of server(s) supporting this domain.
- /// @param tsig_key_info pointer to the TSIGKeyInfo for the domain's key
- /// It defaults to an empty pointer, signifying the domain has no key.
- DdnsDomain(const std::string& name,
- DnsServerInfoStoragePtr servers,
- const TSIGKeyInfoPtr& tsig_key_info = TSIGKeyInfoPtr());
+ /// @param key_name is the TSIG key name of the domain.
+ DdnsDomain(const std::string& name, DnsServerInfoStoragePtr servers,
+ const std::string& key_name = "");
/// @brief Destructor
virtual ~DdnsDomain();
return (name_);
}
- /// @brief Convenience method which returns the domain's TSIG key name.
+ /// @brief Getter which returns the domain's TSIG key name.
+ ///
+ /// @note: TSIG key infos are in servers.
///
/// @return returns the key name in an std::string. If domain has no
/// TSIG key, the string will empty.
- const std::string getKeyName() const;
+ const std::string getKeyName() const {
+ return (key_name_);
+ }
/// @brief Getter which returns the domain's list of servers.
///
return (servers_);
}
- /// @brief Getter which returns the domain's TSIGKey info
- ///
- /// @return returns the pointer to the server storage. If the domain
- /// is not configured to use TSIG the pointer will be empty.
- const TSIGKeyInfoPtr& getTSIGKeyInfo() {
- return (tsig_key_info_);
- }
-
/// @brief Unparse a configuration object
///
/// @return a pointer to a configuration
/// @brief The list of server(s) supporting this domain.
DnsServerInfoStoragePtr servers_;
- /// @brief Pointer to domain's the TSIGKeyInfo.
- /// Value is empty if the domain is not configured for TSIG.
- TSIGKeyInfoPtr tsig_key_info_;
+ /// @brief The TSIG key name (empty when there is no key for the domain).
+ std::string key_name_;
};
/// @brief Defines a pointer for DdnsDomain instances.
/// 3. Add the new TSIGKeyInfo instance to the key map
///
/// @param key_list_config is the list of "tsig_key" elements to parse.
+ /// @param keys map of defined TSIG keys
///
/// @return a map containing the TSIGKeyInfo instances
TSIGKeyInfoMapPtr parse(data::ConstElementPtr key_list_config);
/// and returns it.
///
/// @param server_config is the "dns-server" configuration to parse
+ /// @param domain_config the parent domain's configuration
+ /// @param keys map of defined TSIG keys
///
/// @return a pointer to the newly created server instance
///
/// -# hostname is not blank, hostname is not yet supported
/// -# ip_address is invalid
/// -# port is 0
- DnsServerInfoPtr parse(data::ConstElementPtr server_config);
+ DnsServerInfoPtr parse(data::ConstElementPtr server_config,
+ data::ConstElementPtr domain_config,
+ const TSIGKeyInfoMapPtr keys);
};
/// @brief Parser for a list of DnsServerInfos
/// This class parses a list of "dns-server" configuration elements.
/// The DnsServerInfo instances are added
/// to the given storage upon commit.
-class DnsServerInfoListParser : public data::SimpleParser{
+class DnsServerInfoListParser : public data::SimpleParser {
public:
/// @brief Performs the actual parsing of the given list "dns-server"
/// elements.
/// 2. Adds the server to the server list
///
/// @param server_list_config is the list of "dns-server" elements to parse.
+ /// @param domain_config the parent domain's configuration
+ /// @param keys map of defined TSIG keys
/// @return A pointer to the new, populated server list
- DnsServerInfoStoragePtr parse(data::ConstElementPtr server_list_config);
+ DnsServerInfoStoragePtr parse(data::ConstElementPtr server_list_config,
+ data::ConstElementPtr domain_config,
+ const TSIGKeyInfoMapPtr keys);
};
/// @brief Parser for DdnsDomain
const TSIGKeyInfoMapPtr keys);
};
-
-}; // end of isc::d2 namespace
-}; // end of isc namespace
+} // end of isc::d2 namespace
+} // end of isc namespace
#endif // D2_CONFIG_H
const SimpleDefaults D2SimpleParser::DNS_SERVER_DEFAULTS = {
{ "hostname", Element::string, "" },
{ "port", Element::integer, "53" },
+ { "key-name", Element::string, "" }
};
/// @}