|
@@ -201,30 +201,7 @@ TSIGKeyInfoParser::build(isc::data::ConstElementPtr key_config) {
|
|
|
parser->build(config_pair.second);
|
|
|
parser->commit();
|
|
|
}
|
|
|
-}
|
|
|
-
|
|
|
-isc::dhcp::ParserPtr
|
|
|
-TSIGKeyInfoParser::createConfigParser(const std::string& config_id) {
|
|
|
- DhcpConfigParser* parser = NULL;
|
|
|
- // Based on the configuration id of the element, create the appropriate
|
|
|
- // parser. Scalars are set to use the parser's local scalar storage.
|
|
|
- if ((config_id == "name") ||
|
|
|
- (config_id == "algorithm") ||
|
|
|
- (config_id == "secret")) {
|
|
|
- parser = new isc::dhcp::StringParser(config_id,
|
|
|
- local_scalars_.getStringStorage());
|
|
|
- } else {
|
|
|
- isc_throw(NotImplemented,
|
|
|
- "parser error: TSIGKeyInfo parameter not supported: "
|
|
|
- << config_id);
|
|
|
- }
|
|
|
|
|
|
- // Return the new parser instance.
|
|
|
- return (isc::dhcp::ParserPtr(parser));
|
|
|
-}
|
|
|
-
|
|
|
-void
|
|
|
-TSIGKeyInfoParser::commit() {
|
|
|
std::string name;
|
|
|
std::string algorithm;
|
|
|
std::string secret;
|
|
@@ -266,6 +243,33 @@ TSIGKeyInfoParser::commit() {
|
|
|
(*keys_)[name]=key_info;
|
|
|
}
|
|
|
|
|
|
+isc::dhcp::ParserPtr
|
|
|
+TSIGKeyInfoParser::createConfigParser(const std::string& config_id) {
|
|
|
+ DhcpConfigParser* parser = NULL;
|
|
|
+ // Based on the configuration id of the element, create the appropriate
|
|
|
+ // parser. Scalars are set to use the parser's local scalar storage.
|
|
|
+ if ((config_id == "name") ||
|
|
|
+ (config_id == "algorithm") ||
|
|
|
+ (config_id == "secret")) {
|
|
|
+ parser = new isc::dhcp::StringParser(config_id,
|
|
|
+ local_scalars_.getStringStorage());
|
|
|
+ } else {
|
|
|
+ isc_throw(NotImplemented,
|
|
|
+ "parser error: TSIGKeyInfo parameter not supported: "
|
|
|
+ << config_id);
|
|
|
+ }
|
|
|
+
|
|
|
+ // Return the new parser instance.
|
|
|
+ return (isc::dhcp::ParserPtr(parser));
|
|
|
+}
|
|
|
+
|
|
|
+void
|
|
|
+TSIGKeyInfoParser::commit() {
|
|
|
+ /// @todo if at some point TSIG keys need some form of runtime resource
|
|
|
+ /// initialization, such as creating some sort of hash instance in
|
|
|
+ /// crytpolib. Once TSIG is fully implemented under Trac #3432 we'll know.
|
|
|
+}
|
|
|
+
|
|
|
// *********************** TSIGKeyInfoListParser *************************
|
|
|
|
|
|
TSIGKeyInfoListParser::TSIGKeyInfoListParser(const std::string& list_name,
|
|
@@ -278,12 +282,12 @@ TSIGKeyInfoListParser::TSIGKeyInfoListParser(const std::string& list_name,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-TSIGKeyInfoListParser::~TSIGKeyInfoListParser(){
|
|
|
+TSIGKeyInfoListParser::~TSIGKeyInfoListParser() {
|
|
|
}
|
|
|
|
|
|
void
|
|
|
TSIGKeyInfoListParser::
|
|
|
-build(isc::data::ConstElementPtr key_list){
|
|
|
+build(isc::data::ConstElementPtr key_list) {
|
|
|
int i = 0;
|
|
|
isc::data::ConstElementPtr key_config;
|
|
|
// For each key element in the key list:
|
|
@@ -299,6 +303,10 @@ build(isc::data::ConstElementPtr key_list){
|
|
|
parser->build(key_config);
|
|
|
parsers_.push_back(parser);
|
|
|
}
|
|
|
+
|
|
|
+ // Now that we know we have a valid list, commit that list to the
|
|
|
+ // area given to us during construction (i.e. to the d2 context).
|
|
|
+ *keys_ = *local_keys_;
|
|
|
}
|
|
|
|
|
|
void
|
|
@@ -308,10 +316,6 @@ TSIGKeyInfoListParser::commit() {
|
|
|
BOOST_FOREACH(isc::dhcp::ParserPtr parser, parsers_) {
|
|
|
parser->commit();
|
|
|
}
|
|
|
-
|
|
|
- // Now that we know we have a valid list, commit that list to the
|
|
|
- // area given to us during construction (i.e. to the d2 context).
|
|
|
- *keys_ = *local_keys_;
|
|
|
}
|
|
|
|
|
|
// *********************** DnsServerInfoParser *************************
|
|
@@ -343,32 +347,6 @@ DnsServerInfoParser::build(isc::data::ConstElementPtr server_config) {
|
|
|
parser->commit();
|
|
|
}
|
|
|
|
|
|
-}
|
|
|
-
|
|
|
-isc::dhcp::ParserPtr
|
|
|
-DnsServerInfoParser::createConfigParser(const std::string& config_id) {
|
|
|
- DhcpConfigParser* parser = NULL;
|
|
|
- // Based on the configuration id of the element, create the appropriate
|
|
|
- // parser. Scalars are set to use the parser's local scalar storage.
|
|
|
- if ((config_id == "hostname") ||
|
|
|
- (config_id == "ip_address")) {
|
|
|
- parser = new isc::dhcp::StringParser(config_id,
|
|
|
- local_scalars_.getStringStorage());
|
|
|
- } else if (config_id == "port") {
|
|
|
- parser = new isc::dhcp::Uint32Parser(config_id,
|
|
|
- local_scalars_.getUint32Storage());
|
|
|
- } else {
|
|
|
- isc_throw(NotImplemented,
|
|
|
- "parser error: DnsServerInfo parameter not supported: "
|
|
|
- << config_id);
|
|
|
- }
|
|
|
-
|
|
|
- // Return the new parser instance.
|
|
|
- return (isc::dhcp::ParserPtr(parser));
|
|
|
-}
|
|
|
-
|
|
|
-void
|
|
|
-DnsServerInfoParser::commit() {
|
|
|
std::string hostname;
|
|
|
std::string ip_address;
|
|
|
uint32_t port = DnsServerInfo::STANDARD_DNS_PORT;
|
|
@@ -407,6 +385,32 @@ DnsServerInfoParser::commit() {
|
|
|
servers_->push_back(serverInfo);
|
|
|
}
|
|
|
|
|
|
+isc::dhcp::ParserPtr
|
|
|
+DnsServerInfoParser::createConfigParser(const std::string& config_id) {
|
|
|
+ DhcpConfigParser* parser = NULL;
|
|
|
+ // Based on the configuration id of the element, create the appropriate
|
|
|
+ // parser. Scalars are set to use the parser's local scalar storage.
|
|
|
+ if ((config_id == "hostname") ||
|
|
|
+ (config_id == "ip_address")) {
|
|
|
+ parser = new isc::dhcp::StringParser(config_id,
|
|
|
+ local_scalars_.getStringStorage());
|
|
|
+ } else if (config_id == "port") {
|
|
|
+ parser = new isc::dhcp::Uint32Parser(config_id,
|
|
|
+ local_scalars_.getUint32Storage());
|
|
|
+ } else {
|
|
|
+ isc_throw(NotImplemented,
|
|
|
+ "parser error: DnsServerInfo parameter not supported: "
|
|
|
+ << config_id);
|
|
|
+ }
|
|
|
+
|
|
|
+ // Return the new parser instance.
|
|
|
+ return (isc::dhcp::ParserPtr(parser));
|
|
|
+}
|
|
|
+
|
|
|
+void
|
|
|
+DnsServerInfoParser::commit() {
|
|
|
+}
|
|
|
+
|
|
|
// *********************** DnsServerInfoListParser *************************
|
|
|
|
|
|
DnsServerInfoListParser::DnsServerInfoListParser(const std::string& list_name,
|
|
@@ -439,17 +443,16 @@ build(isc::data::ConstElementPtr server_list){
|
|
|
parser->build(server_config);
|
|
|
parsers_.push_back(parser);
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
-void
|
|
|
-DnsServerInfoListParser::commit() {
|
|
|
// Domains must have at least one server.
|
|
|
if (parsers_.size() == 0) {
|
|
|
isc_throw (D2CfgError, "Server List must contain at least one server");
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
- // Invoke commit on each server parser. This will cause each one to
|
|
|
- // create it's server instance and commit it to storage.
|
|
|
+void
|
|
|
+DnsServerInfoListParser::commit() {
|
|
|
+ // Invoke commit on each server parser.
|
|
|
BOOST_FOREACH(isc::dhcp::ParserPtr parser, parsers_) {
|
|
|
parser->commit();
|
|
|
}
|
|
@@ -486,34 +489,8 @@ DdnsDomainParser::build(isc::data::ConstElementPtr domain_config) {
|
|
|
parser->build(config_pair.second);
|
|
|
parser->commit();
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
-isc::dhcp::ParserPtr
|
|
|
-DdnsDomainParser::createConfigParser(const std::string& config_id) {
|
|
|
- DhcpConfigParser* parser = NULL;
|
|
|
- // Based on the configuration id of the element, create the appropriate
|
|
|
- // parser. Scalars are set to use the parser's local scalar storage.
|
|
|
- if ((config_id == "name") ||
|
|
|
- (config_id == "key_name")) {
|
|
|
- parser = new isc::dhcp::StringParser(config_id,
|
|
|
- local_scalars_.getStringStorage());
|
|
|
- } else if (config_id == "dns_servers") {
|
|
|
- // Server list parser is given in our local server storage. It will pass
|
|
|
- // this down to its server parsers and is where they will write their
|
|
|
- // server instances upon commit.
|
|
|
- parser = new DnsServerInfoListParser(config_id, local_servers_);
|
|
|
- } else {
|
|
|
- isc_throw(NotImplemented,
|
|
|
- "parser error: DdnsDomain parameter not supported: "
|
|
|
- << config_id);
|
|
|
- }
|
|
|
-
|
|
|
- // Return the new domain parser instance.
|
|
|
- return (isc::dhcp::ParserPtr(parser));
|
|
|
-}
|
|
|
-
|
|
|
-void
|
|
|
-DdnsDomainParser::commit() {
|
|
|
+ // Now construct the domain.
|
|
|
std::string name;
|
|
|
std::string key_name;
|
|
|
|
|
@@ -547,7 +524,35 @@ DdnsDomainParser::commit() {
|
|
|
DdnsDomainPtr domain(new DdnsDomain(name, key_name, local_servers_));
|
|
|
|
|
|
// Add the new domain to the domain storage.
|
|
|
- (*domains_)[name]=domain;
|
|
|
+ (*domains_)[name] = domain;
|
|
|
+}
|
|
|
+
|
|
|
+isc::dhcp::ParserPtr
|
|
|
+DdnsDomainParser::createConfigParser(const std::string& config_id) {
|
|
|
+ DhcpConfigParser* parser = NULL;
|
|
|
+ // Based on the configuration id of the element, create the appropriate
|
|
|
+ // parser. Scalars are set to use the parser's local scalar storage.
|
|
|
+ if ((config_id == "name") ||
|
|
|
+ (config_id == "key_name")) {
|
|
|
+ parser = new isc::dhcp::StringParser(config_id,
|
|
|
+ local_scalars_.getStringStorage());
|
|
|
+ } else if (config_id == "dns_servers") {
|
|
|
+ // Server list parser is given in our local server storage. It will pass
|
|
|
+ // this down to its server parsers and is where they will write their
|
|
|
+ // server instances upon commit.
|
|
|
+ parser = new DnsServerInfoListParser(config_id, local_servers_);
|
|
|
+ } else {
|
|
|
+ isc_throw(NotImplemented,
|
|
|
+ "parser error: DdnsDomain parameter not supported: "
|
|
|
+ << config_id);
|
|
|
+ }
|
|
|
+
|
|
|
+ // Return the new domain parser instance.
|
|
|
+ return (isc::dhcp::ParserPtr(parser));
|
|
|
+}
|
|
|
+
|
|
|
+void
|
|
|
+DdnsDomainParser::commit() {
|
|
|
}
|
|
|
|
|
|
// *********************** DdnsDomainListParser *************************
|
|
@@ -620,6 +625,9 @@ DdnsDomainListMgrParser::build(isc::data::ConstElementPtr domain_config) {
|
|
|
parser->build(config_pair.second);
|
|
|
parser->commit();
|
|
|
}
|
|
|
+
|
|
|
+ // Add the new domain to the domain storage.
|
|
|
+ mgr_->setDomains(local_domains_);
|
|
|
}
|
|
|
|
|
|
isc::dhcp::ParserPtr
|
|
@@ -641,8 +649,6 @@ DdnsDomainListMgrParser::createConfigParser(const std::string& config_id) {
|
|
|
|
|
|
void
|
|
|
DdnsDomainListMgrParser::commit() {
|
|
|
- // Add the new domain to the domain storage.
|
|
|
- mgr_->setDomains(local_domains_);
|
|
|
}
|
|
|
|
|
|
|