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