Kea 1.5.0
d2_config.cc
Go to the documentation of this file.
1// Copyright (C) 2013-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
9#include <d2/d2_log.h>
10#include <d2/d2_cfg_mgr.h>
13#include <asiolink/io_error.h>
14
15#include <boost/foreach.hpp>
16#include <boost/scoped_ptr.hpp>
17#include <boost/algorithm/string/predicate.hpp>
18
19#include <sstream>
20#include <string>
21
22using namespace isc::process;
23using namespace isc::data;
24
25namespace isc {
26namespace d2 {
27
28// *********************** D2Params *************************
29
31 const size_t port,
32 const size_t dns_server_timeout,
33 const dhcp_ddns::NameChangeProtocol& ncr_protocol,
34 const dhcp_ddns::NameChangeFormat& ncr_format)
35 : ip_address_(ip_address),
36 port_(port),
37 dns_server_timeout_(dns_server_timeout),
38 ncr_protocol_(ncr_protocol),
39 ncr_format_(ncr_format) {
41}
42
44 : ip_address_(isc::asiolink::IOAddress("127.0.0.1")),
45 port_(53001), dns_server_timeout_(100),
46 ncr_protocol_(dhcp_ddns::NCR_UDP),
47 ncr_format_(dhcp_ddns::FMT_JSON) {
49}
50
52
53void
55 if ((ip_address_.toText() == "0.0.0.0") || (ip_address_.toText() == "::")) {
57 "D2Params: IP address cannot be \"" << ip_address_ << "\"");
58 }
59
60 if (port_ == 0) {
61 isc_throw(D2CfgError, "D2Params: port cannot be 0");
62 }
63
64 if (dns_server_timeout_ < 1) {
66 "D2Params: DNS server timeout must be larger than 0");
67 }
68
69 if (ncr_format_ != dhcp_ddns::FMT_JSON) {
70 isc_throw(D2CfgError, "D2Params: NCR Format:"
71 << dhcp_ddns::ncrFormatToString(ncr_format_)
72 << " is not yet supported");
73 }
74
75 if (ncr_protocol_ != dhcp_ddns::NCR_UDP) {
76 isc_throw(D2CfgError, "D2Params: NCR Protocol:"
77 << dhcp_ddns::ncrProtocolToString(ncr_protocol_)
78 << " is not yet supported");
79 }
80}
81
82std::string
84 std::ostringstream s;
85 s << "listening on " << getIpAddress() << ", port " << getPort()
86 << ", using " << ncrProtocolToString(ncr_protocol_);
87 return (s.str());
88}
89
90bool
91D2Params::operator == (const D2Params& other) const {
92 return ((ip_address_ == other.ip_address_) &&
93 (port_ == other.port_) &&
94 (dns_server_timeout_ == other.dns_server_timeout_) &&
95 (ncr_protocol_ == other.ncr_protocol_) &&
96 (ncr_format_ == other.ncr_format_));
97}
98
99bool
100D2Params::operator != (const D2Params& other) const {
101 return (!(*this == other));
102}
103
104std::string
106 std::ostringstream stream;
107
108 stream << ", ip-address: " << ip_address_.toText()
109 << ", port: " << port_
110 << ", dns-server-timeout_: " << dns_server_timeout_
111 << ", ncr-protocol: "
112 << dhcp_ddns::ncrProtocolToString(ncr_protocol_)
113 << ", ncr-format: " << ncr_format_
114 << dhcp_ddns::ncrFormatToString(ncr_format_);
115
116 return (stream.str());
117}
118
119std::ostream&
120operator<<(std::ostream& os, const D2Params& config) {
121 os << config.toText();
122 return (os);
123}
124
125// *********************** TSIGKeyInfo *************************
126// Note these values match corresponding values for Bind9's
127// dnssec-keygen
128const char* TSIGKeyInfo::HMAC_MD5_STR = "HMAC-MD5";
129const char* TSIGKeyInfo::HMAC_SHA1_STR = "HMAC-SHA1";
130const char* TSIGKeyInfo::HMAC_SHA224_STR = "HMAC-SHA224";
131const char* TSIGKeyInfo::HMAC_SHA256_STR = "HMAC-SHA256";
132const char* TSIGKeyInfo::HMAC_SHA384_STR = "HMAC-SHA384";
133const char* TSIGKeyInfo::HMAC_SHA512_STR = "HMAC-SHA512";
134
135TSIGKeyInfo::TSIGKeyInfo(const std::string& name, const std::string& algorithm,
136 const std::string& secret, uint32_t digestbits)
137 :name_(name), algorithm_(algorithm), secret_(secret),
138 digestbits_(digestbits), tsig_key_() {
139 remakeKey();
140}
141
143}
144
145const dns::Name&
146TSIGKeyInfo::stringToAlgorithmName(const std::string& algorithm_id) {
147 if (boost::iequals(algorithm_id, HMAC_MD5_STR)) {
149 } else if (boost::iequals(algorithm_id, HMAC_SHA1_STR)) {
151 } else if (boost::iequals(algorithm_id, HMAC_SHA224_STR)) {
153 } else if (boost::iequals(algorithm_id, HMAC_SHA256_STR)) {
155 } else if (boost::iequals(algorithm_id, HMAC_SHA384_STR)) {
157 } else if (boost::iequals(algorithm_id, HMAC_SHA512_STR)) {
159 }
160
161 isc_throw(BadValue, "Unknown TSIG Key algorithm: " << algorithm_id);
162}
163
164void
165TSIGKeyInfo::remakeKey() {
166 try {
167 // Since our secret value is base64 encoded already, we need to
168 // build the input string for the appropriate TSIGKey constructor.
169 // If secret isn't a valid base64 value, the constructor will throw.
170 std::ostringstream stream;
171 stream << dns::Name(name_).toText() << ":"
172 << secret_ << ":"
173 << stringToAlgorithmName(algorithm_);
174 if (digestbits_ > 0) {
175 stream << ":" << digestbits_;
176 }
177
178 tsig_key_.reset(new dns::TSIGKey(stream.str()));
179 } catch (const std::exception& ex) {
180 isc_throw(D2CfgError, "Cannot make TSIGKey: " << ex.what());
181 }
182}
183
187 // Set user-context
188 contextToElement(result);
189 // Set name
190 result->set("name", Element::create(name_));
191 // Set algorithm
192 result->set("algorithm", Element::create(algorithm_));
193 // Set secret
194 result->set("secret", Element::create(secret_));
195 // Set digest-bits
196 result->set("digest-bits",
197 Element::create(static_cast<int64_t>(digestbits_)));
198
199 return (result);
200}
201
202// *********************** DnsServerInfo *************************
203DnsServerInfo::DnsServerInfo(const std::string& hostname,
204 isc::asiolink::IOAddress ip_address, uint32_t port,
205 bool enabled)
206 :hostname_(hostname), ip_address_(ip_address), port_(port),
207 enabled_(enabled) {
208}
209
211}
212
213std::string
215 std::ostringstream stream;
216 stream << (getIpAddress().toText()) << " port:" << getPort();
217 return (stream.str());
218}
219
223 // Set user-context
224 contextToElement(result);
225 // Set hostname
226 result->set("hostname", Element::create(hostname_));
227 // Set ip-address
228 result->set("ip-address", Element::create(ip_address_.toText()));
229 // Set port
230 result->set("port", Element::create(static_cast<int64_t>(port_)));
231
232 return (result);
233}
234
235
236std::ostream&
237operator<<(std::ostream& os, const DnsServerInfo& server) {
238 os << server.toText();
239 return (os);
240}
241
242// *********************** DdnsDomain *************************
243
244DdnsDomain::DdnsDomain(const std::string& name,
246 const TSIGKeyInfoPtr& tsig_key_info)
247 : name_(name), servers_(servers),
248 tsig_key_info_(tsig_key_info) {
249}
250
252}
253
254const std::string
256 if (tsig_key_info_) {
257 return (tsig_key_info_->getName());
258 }
259
260 return ("");
261}
262
266 // Set user-context
267 contextToElement(result);
268 // Set name
269 result->set("name", Element::create(name_));
270 // Set servers
272 for (DnsServerInfoStorage::const_iterator server = servers_->begin();
273 server != servers_->end(); ++server) {
274 ElementPtr dns_server = (*server)->toElement();
275 servers->add(dns_server);
276 }
277 // the dns server list may not be empty
278 if (!servers->empty()) {
279 result->set("dns-servers", servers);
280 }
281 // Set key-name
282 if (tsig_key_info_) {
283 result->set("key-name", Element::create(tsig_key_info_->getName()));
284 }
285
286 return (result);
287}
288
289// *********************** DdnsDomainLstMgr *************************
290
292
293DdnsDomainListMgr::DdnsDomainListMgr(const std::string& name) : name_(name),
294 domains_(new DdnsDomainMap()) {
295}
296
297
299}
300
301void
303 if (!domains) {
305 "DdnsDomainListMgr::setDomains: Domain list may not be null");
306 }
307
308 domains_ = domains;
309
310 // Look for the wild card domain. If present, set the member variable
311 // to remember it. This saves us from having to look for it every time
312 // we attempt a match.
313 DdnsDomainMap::iterator gotit = domains_->find(wildcard_domain_name_);
314 if (gotit != domains_->end()) {
315 wildcard_domain_ = gotit->second;
316 }
317}
318
319bool
320DdnsDomainListMgr::matchDomain(const std::string& fqdn, DdnsDomainPtr& domain) {
321 // First check the case of one domain to rule them all.
322 if ((size() == 1) && (wildcard_domain_)) {
323 domain = wildcard_domain_;
324 return (true);
325 }
326
327 // Iterate over the domain map looking for the domain which matches
328 // the longest portion of the given fqdn.
329
330 size_t req_len = fqdn.size();
331 size_t match_len = 0;
332 DdnsDomainMapPair map_pair;
333 DdnsDomainPtr best_match;
334 BOOST_FOREACH (map_pair, *domains_) {
335 std::string domain_name = map_pair.first;
336 size_t dom_len = domain_name.size();
337
338 // If the domain name is longer than the fqdn, then it cant be match.
339 if (req_len < dom_len) {
340 continue;
341 }
342
343 // If the lengths are identical and the names match we're done.
344 if (req_len == dom_len) {
345 if (boost::iequals(fqdn, domain_name)) {
346 // exact match, done
347 domain = map_pair.second;
348 return (true);
349 }
350 } else {
351 // The fqdn is longer than the domain name. Adjust the start
352 // point of comparison by the excess in length. Only do the
353 // comparison if the adjustment lands on a boundary. This
354 // prevents "onetwo.net" from matching "two.net".
355 size_t offset = req_len - dom_len;
356 if ((fqdn[offset - 1] == '.') &&
357 (boost::iequals(fqdn.substr(offset), domain_name))) {
358 // Fqdn contains domain name, keep it if its better than
359 // any we have matched so far.
360 if (dom_len > match_len) {
361 match_len = dom_len;
362 best_match = map_pair.second;
363 }
364 }
365 }
366 }
367
368 if (!best_match) {
369 // There's no match. If they specified a wild card domain use it
370 // otherwise there's no domain for this entry.
371 if (wildcard_domain_) {
372 domain = wildcard_domain_;
373 return (true);
374 }
375
376 LOG_WARN(dhcp_to_d2_logger, DHCP_DDNS_NO_MATCH).arg(fqdn);
377 return (false);
378 }
379
380 domain = best_match;
381 return (true);
382}
383
387 // Iterate on ddns domains
388 for (DdnsDomainMap::const_iterator domain = domains_->begin();
389 domain != domains_->end(); ++domain) {
390 ElementPtr ddns_domain = domain->second->toElement();
391 result->add(ddns_domain);
392 }
393
394 return (result);
395}
396
397// *************************** PARSERS ***********************************
398
399// *********************** TSIGKeyInfoParser *************************
400
403 std::string name = getString(key_config, "name");
404 std::string algorithm = getString(key_config, "algorithm");
405 uint32_t digestbits = getInteger(key_config, "digest-bits");
406 std::string secret = getString(key_config, "secret");
407 ConstElementPtr user_context = key_config->get("user-context");
408
409 // Algorithm must be valid.
410 try {
412 } catch (const std::exception& ex) {
413 isc_throw(D2CfgError, "tsig-key : " << ex.what()
414 << " (" << getPosition("algorithm", key_config) << ")");
415 }
416
417 // Non-zero digest-bits must be an integral number of octets, greater
418 // than 80 and at least half of the algorithm key length. It defaults
419 // to zero and JSON parsing ensures it's a multiple of 8.
420 if ((digestbits > 0) &&
421 ((digestbits < 80) ||
422 (boost::iequals(algorithm, TSIGKeyInfo::HMAC_SHA224_STR)
423 && (digestbits < 112)) ||
424 (boost::iequals(algorithm, TSIGKeyInfo::HMAC_SHA256_STR)
425 && (digestbits < 128)) ||
426 (boost::iequals(algorithm, TSIGKeyInfo::HMAC_SHA384_STR)
427 && (digestbits < 192)) ||
428 (boost::iequals(algorithm, TSIGKeyInfo::HMAC_SHA512_STR)
429 && (digestbits < 256)))) {
430 isc_throw(D2CfgError, "tsig-key: digest-bits too small : "
431 << " (" << getPosition("digest-bits", key_config) << ")");
432 }
433
434 // Everything should be valid, so create the key instance.
435 // It is possible for the asiodns::dns::TSIGKey create to fail such as
436 // with an invalid secret content.
437 TSIGKeyInfoPtr key_info;
438 try {
439 key_info.reset(new TSIGKeyInfo(name, algorithm, secret, digestbits));
440 } catch (const std::exception& ex) {
441 isc_throw(D2CfgError, ex.what() << " ("
442 << key_config->getPosition() << ")");
443 }
444
445 // Add user-context
446 if (user_context) {
447 key_info->setContext(user_context);
448 }
449
450 return (key_info);
451}
452
453// *********************** TSIGKeyInfoListParser *************************
454
458 ConstElementPtr key_config;
459 TSIGKeyInfoParser key_parser;
460 BOOST_FOREACH(key_config, key_list->listValue()) {
461 TSIGKeyInfoPtr key = key_parser.parse(key_config);
462
463 // Duplicates are not allowed and should be flagged as an error.
464 if (keys->find(key->getName()) != keys->end()) {
465 isc_throw(D2CfgError, "Duplicate TSIG key name specified : "
466 << key->getName()
467 << " (" << getPosition("name", key_config) << ")");
468 }
469
470 (*keys)[key->getName()] = key;
471 }
472
473 return (keys);
474}
475
476// *********************** DnsServerInfoParser *************************
477
480 std::string hostname = getString(server_config, "hostname");
481 std::string ip_address = getString(server_config, "ip-address");
482 uint32_t port = getInteger(server_config, "port");
483 ConstElementPtr user_context = server_config->get("user-context");
484
485 // The configuration must specify one or the other.
486 if (hostname.empty() == ip_address.empty()) {
487 isc_throw(D2CfgError, "Dns Server must specify one or the other"
488 " of hostname or IP address"
489 << " (" << server_config->getPosition() << ")");
490 }
491
492 DnsServerInfoPtr server_info;
493 if (!hostname.empty()) {
507 isc_throw(D2CfgError, "Dns Server : hostname is not yet supported"
508 << " (" << getPosition("hostname", server_config) << ")");
509 } else {
510 try {
511 // Create an IOAddress from the IP address string given and then
512 // create the DnsServerInfo.
513 isc::asiolink::IOAddress io_addr(ip_address);
514 server_info.reset(new DnsServerInfo(hostname, io_addr, port));
515 } catch (const isc::asiolink::IOError& ex) {
516 isc_throw(D2CfgError, "Dns Server : invalid IP address : "
517 << ip_address
518 << " (" << getPosition("ip-address", server_config) << ")");
519 }
520 }
521
522 // Add user-context
523 if (user_context) {
524 server_info->setContext(user_context);
525 }
526
527 return (server_info);
528}
529
530// *********************** DnsServerInfoListParser *************************
531
535 ConstElementPtr server_config;
536 DnsServerInfoParser parser;
537 BOOST_FOREACH(server_config, server_list->listValue()) {
538 DnsServerInfoPtr server = parser.parse(server_config);
539 servers->push_back(server);
540 }
541
542 return (servers);
543}
544
545// *********************** DdnsDomainParser *************************
546
548 const TSIGKeyInfoMapPtr keys) {
549 std::string name = getString(domain_config, "name");
550 std::string key_name = getString(domain_config, "key-name");
551 ConstElementPtr user_context = domain_config->get("user-context");
552
553 // Key name is optional. If it is not blank, then find the key in the
554 // list of defined keys.
555 TSIGKeyInfoPtr tsig_key_info;
556 if (!key_name.empty()) {
557 if (keys) {
558 TSIGKeyInfoMap::iterator kit = keys->find(key_name);
559 if (kit != keys->end()) {
560 tsig_key_info = kit->second;
561 }
562 }
563
564 if (!tsig_key_info) {
565 isc_throw(D2CfgError, "DdnsDomain : " << name
566 << " specifies an undefined key: " << key_name
567 << " (" << getPosition("key-name", domain_config) << ")");
568 }
569 }
570
571 // Parse the list of DNS servers
572 ConstElementPtr servers_config;
573 try {
574 servers_config = domain_config->get("dns-servers");
575 } catch (const std::exception& ex) {
576 isc_throw(D2CfgError, "DdnsDomain : missing dns-server list"
577 << " (" << servers_config->getPosition() << ")");
578 }
579
580 DnsServerInfoListParser server_parser;
581 DnsServerInfoStoragePtr servers = server_parser.parse(servers_config);
582 if (servers->size() == 0) {
583 isc_throw(D2CfgError, "DNS server list cannot be empty"
584 << servers_config->getPosition());
585 }
586
587 // Instantiate the new domain and add it to domain storage.
588 DdnsDomainPtr domain(new DdnsDomain(name, servers, tsig_key_info));
589
590 // Add user-context
591 if (user_context) {
592 domain->setContext(user_context);
593 }
594
595 return (domain);
596}
597
598// *********************** DdnsDomainListParser *************************
599
601 const TSIGKeyInfoMapPtr keys) {
602 DdnsDomainMapPtr domains(new DdnsDomainMap());
603 DdnsDomainParser parser;
604 ConstElementPtr domain_config;
605 BOOST_FOREACH(domain_config, domain_list->listValue()) {
606 DdnsDomainPtr domain = parser.parse(domain_config, keys);
607
608 // Duplicates are not allowed
609 if (domains->find(domain->getName()) != domains->end()) {
610 isc_throw(D2CfgError, "Duplicate domain specified:"
611 << domain->getName()
612 << " (" << getPosition("name", domain_config) << ")");
613 }
614
615 (*domains)[domain->getName()] = domain;
616 }
617
618 return (domains);
619}
620
621// *********************** DdnsDomainListMgrParser *************************
622
625 const std::string& mgr_name,
626 const TSIGKeyInfoMapPtr keys) {
627 DdnsDomainListMgrPtr mgr(new DdnsDomainListMgr(mgr_name));
628
629 // Parse the list of domains
630 ConstElementPtr domains_config = mgr_config->get("ddns-domains");
631 if (domains_config) {
632 DdnsDomainListParser domain_parser;
633 DdnsDomainMapPtr domains = domain_parser.parse(domains_config, keys);
634
635 // Add the new domain to the domain storage.
636 mgr->setDomains(domains);
637 }
638
639 return(mgr);
640}
641
642}; // end of isc::dhcp namespace
643}; // end of isc namespace
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Exception thrown when the error during configuration handling occurs.
Definition: d2_config.h:130
Acts as a storage vault for D2 global scalar parameters.
Definition: d2_config.h:137
D2Params()
Default constructor The default constructor creates an instance that has updates disabled.
Definition: d2_config.cc:43
const isc::asiolink::IOAddress & getIpAddress() const
Return the IP address D2 listens on.
Definition: d2_config.h:168
bool operator!=(const D2Params &other) const
Compares two D2Params's for inequality.
Definition: d2_config.cc:100
size_t getPort() const
Return the TCP/UPD port D2 listens on.
Definition: d2_config.h:173
bool operator==(const D2Params &other) const
Compares two D2Params's for equality.
Definition: d2_config.cc:91
virtual ~D2Params()
Destructor.
Definition: d2_config.cc:51
std::string getConfigSummary() const
Return summary of the configuration used by D2.
Definition: d2_config.cc:83
std::string toText() const
Generates a string representation of the class contents.
Definition: d2_config.cc:105
virtual void validateContents()
Validates member values.
Definition: d2_config.cc:54
DdnsDomainListMgrPtr parse(data::ConstElementPtr mgr_config, const std::string &mgr_name, const TSIGKeyInfoMapPtr keys)
Performs the actual parsing of the given manager element.
Definition: d2_config.cc:624
Provides storage for and management of a list of DNS domains.
Definition: d2_config.h:608
DdnsDomainListMgr(const std::string &name)
Constructor.
Definition: d2_config.cc:293
virtual bool matchDomain(const std::string &fqdn, DdnsDomainPtr &domain)
Matches a given name to a domain based on a longest match scheme.
Definition: d2_config.cc:320
void setDomains(DdnsDomainMapPtr domains)
Sets the manger's domain list to the given list of domains.
Definition: d2_config.cc:302
static const char * wildcard_domain_name_
defines the domain name for denoting the wildcard domain.
Definition: d2_config.h:611
virtual ~DdnsDomainListMgr()
Destructor.
Definition: d2_config.cc:298
uint32_t size() const
Returns the number of domains in the domain list.
Definition: d2_config.h:651
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition: d2_config.cc:385
Parser for a list of DdnsDomains.
Definition: d2_config.h:848
DdnsDomainMapPtr parse(data::ConstElementPtr domain_list_config, const TSIGKeyInfoMapPtr keys)
Performs the actual parsing of the given list "ddns-domain" elements.
Definition: d2_config.cc:600
Parser for DdnsDomain.
Definition: d2_config.h:829
DdnsDomainPtr parse(data::ConstElementPtr domain_config, const TSIGKeyInfoMapPtr keys)
Performs the actual parsing of the given "ddns-domain" element.
Definition: d2_config.cc:547
Represents a DNS domain that is may be updated dynamically.
Definition: d2_config.h:525
const std::string getKeyName() const
Convenience method which returns the domain's TSIG key name.
Definition: d2_config.cc:255
virtual ~DdnsDomain()
Destructor.
Definition: d2_config.cc:251
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition: d2_config.cc:264
DdnsDomain(const std::string &name, DnsServerInfoStoragePtr servers, const TSIGKeyInfoPtr &tsig_key_info=TSIGKeyInfoPtr())
Constructor.
Definition: d2_config.cc:244
Parser for a list of DnsServerInfos.
Definition: d2_config.h:809
DnsServerInfoStoragePtr parse(data::ConstElementPtr server_list_config)
Performs the actual parsing of the given list "dns-server" elements.
Definition: d2_config.cc:533
Parser for DnsServerInfo.
Definition: d2_config.h:785
DnsServerInfoPtr parse(data::ConstElementPtr server_config)
Performs the actual parsing of the given "dns-server" element.
Definition: d2_config.cc:479
Represents a specific DNS Server.
Definition: d2_config.h:415
std::string toText() const
Returns a text representation for the server.
Definition: d2_config.cc:214
DnsServerInfo(const std::string &hostname, isc::asiolink::IOAddress ip_address, uint32_t port=STANDARD_DNS_PORT, bool enabled=true)
Constructor.
Definition: d2_config.cc:203
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition: d2_config.cc:221
uint32_t getPort() const
Getter which returns the server's port number.
Definition: d2_config.h:450
const isc::asiolink::IOAddress & getIpAddress() const
Getter which returns the server's ip_address.
Definition: d2_config.h:457
virtual ~DnsServerInfo()
Destructor.
Definition: d2_config.cc:210
TSIGKeyInfoMapPtr parse(data::ConstElementPtr key_list_config)
Performs the parsing of the given list "tsig-key" elements.
Definition: d2_config.cc:456
Parser for TSIGKeyInfo.
Definition: d2_config.h:746
TSIGKeyInfoPtr parse(data::ConstElementPtr key_config)
Performs the actual parsing of the given "tsig-key" element.
Definition: d2_config.cc:402
Represents a TSIG Key.
Definition: d2_config.h:260
static const char * HMAC_SHA224_STR
Definition: d2_config.h:267
TSIGKeyInfo(const std::string &name, const std::string &algorithm, const std::string &secret, uint32_t digestbits=0)
Constructor.
Definition: d2_config.cc:135
virtual ~TSIGKeyInfo()
Destructor.
Definition: d2_config.cc:142
static const char * HMAC_MD5_STR
Defines string values for the supported TSIG algorithms.
Definition: d2_config.h:264
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition: d2_config.cc:185
static const char * HMAC_SHA1_STR
Definition: d2_config.h:265
static const char * HMAC_SHA256_STR
Definition: d2_config.h:266
static const dns::Name & stringToAlgorithmName(const std::string &algorithm_id)
Converts algorithm id to dns::TSIGKey algorithm dns::Name.
Definition: d2_config.cc:146
static const char * HMAC_SHA512_STR
Definition: d2_config.h:269
static const char * HMAC_SHA384_STR
Definition: d2_config.h:268
static ElementPtr create(const Position &pos=ZERO_POSITION())
Definition: data.cc:223
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
Definition: data.cc:268
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
Definition: data.cc:263
static const data::Element::Position & getPosition(const std::string &name, const data::ConstElementPtr parent)
Utility method that returns position of an element.
static std::string getString(isc::data::ConstElementPtr scope, const std::string &name)
Returns a string parameter from a scope.
static int64_t getInteger(isc::data::ConstElementPtr scope, const std::string &name)
Returns an integer parameter from a scope.
The Name class encapsulates DNS names.
Definition: name.h:223
std::string toText(bool omit_final_dot=false) const
Convert the Name to a string.
Definition: name.cc:507
TSIG key.
Definition: tsigkey.h:56
static const Name & HMACMD5_NAME()
HMAC-MD5 (RFC2845)
Definition: tsigkey.cc:262
static const Name & HMACSHA224_NAME()
HMAC-SHA256 (RFC4635)
Definition: tsigkey.cc:286
static const Name & HMACSHA256_NAME()
HMAC-SHA256 (RFC4635)
Definition: tsigkey.cc:280
static const Name & HMACSHA1_NAME()
HMAC-SHA1 (RFC4635)
Definition: tsigkey.cc:274
static const Name & HMACSHA512_NAME()
HMAC-SHA256 (RFC4635)
Definition: tsigkey.cc:298
static const Name & HMACSHA384_NAME()
HMAC-SHA256 (RFC4635)
Definition: tsigkey.cc:292
const Name & name_
Definition: dns/message.cc:693
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define LOG_WARN(LOGGER, MESSAGE)
Macro to conveniently test warn output and log it.
Definition: macros.h:26
boost::shared_ptr< DdnsDomainListMgr > DdnsDomainListMgrPtr
Defines a pointer for DdnsDomain instances.
Definition: d2_cfg_mgr.h:120
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
Definition: d2_config.h:586
boost::shared_ptr< DdnsDomainMap > DdnsDomainMapPtr
Defines a pointer to DdnsDomain storage containers.
Definition: d2_config.h:595
boost::shared_ptr< DnsServerInfo > DnsServerInfoPtr
Defines a pointer for DnsServerInfo instances.
Definition: d2_config.h:509
std::map< std::string, DdnsDomainPtr > DdnsDomainMap
Defines a map of DdnsDomains, keyed by the domain name.
Definition: d2_config.h:589
std::pair< std::string, DdnsDomainPtr > DdnsDomainMapPair
Defines a iterator pairing domain name and DdnsDomain.
Definition: d2_config.h:592
isc::log::Logger dhcp_to_d2_logger("dhcp-to-d2")
Definition: d2_log.h:19
boost::shared_ptr< TSIGKeyInfo > TSIGKeyInfoPtr
Defines a pointer for TSIGKeyInfo instances.
Definition: d2_config.h:398
std::vector< DnsServerInfoPtr > DnsServerInfoStorage
Defines a storage container for DnsServerInfo pointers.
Definition: d2_config.h:512
std::map< std::string, TSIGKeyInfoPtr > TSIGKeyInfoMap
Defines a map of TSIGKeyInfos, keyed by the name.
Definition: d2_config.h:401
std::ostream & operator<<(std::ostream &os, const D2Params &config)
Dumps the contents of a D2Params as text to an output stream.
Definition: d2_config.cc:120
boost::shared_ptr< DnsServerInfoStorage > DnsServerInfoStoragePtr
Defines a pointer to DnsServerInfo storage containers.
Definition: d2_config.h:515
boost::shared_ptr< TSIGKeyInfoMap > TSIGKeyInfoMapPtr
Defines a pointer to map of TSIGkeyInfos.
Definition: d2_config.h:407
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:23
boost::shared_ptr< Element > ElementPtr
Definition: data.h:22
NameChangeFormat
Defines the list of data wire formats supported.
Definition: ncr_msg.h:60
NameChangeProtocol
Defines the list of socket protocols supported.
Definition: ncr_io.h:66
std::string ncrProtocolToString(NameChangeProtocol protocol)
Function which converts NameChangeProtocol enums to text labels.
Definition: ncr_io.cc:30
std::string ncrFormatToString(NameChangeFormat format)
Function which converts NameChangeFormat enums to text labels.
Definition: ncr_msg.cc:36
Defines the logger used by the top-level component of kea-dhcp-ddns.
void contextToElement(data::ElementPtr map) const
Merge unparse a user_context object.
Definition: user_context.cc:15