Kea 2.0.0
ncr_msg.cc
Go to the documentation of this file.
1// Copyright (C) 2013-2020 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 <dhcp_ddns/ncr_msg.h>
10#include <asiolink/io_address.h>
11#include <asiolink/io_error.h>
14#include <util/encode/hex.h>
15
16#include <boost/algorithm/string/predicate.hpp>
17
18#include <sstream>
19#include <limits>
20
21
22namespace isc {
23namespace dhcp_ddns {
24
25
26NameChangeFormat stringToNcrFormat(const std::string& fmt_str) {
27 if (boost::iequals(fmt_str, "JSON")) {
28 return FMT_JSON;
29 }
30
31 isc_throw(BadValue, "Invalid NameChangeRequest format: " << fmt_str);
32}
33
34
36 if (format == FMT_JSON) {
37 return ("JSON");
38 }
39
40 std::ostringstream stream;
41 stream << "UNKNOWN(" << format << ")";
42 return (stream.str());
43}
44
45/********************************* D2Dhcid ************************************/
46
47namespace {
48
51
52
53const uint8_t DHCID_ID_HWADDR = 0x0;
55const uint8_t DHCID_ID_CLIENTID = 0x1;
57const uint8_t DHCID_ID_DUID = 0x2;
58
59}
60
62}
63
64D2Dhcid::D2Dhcid(const std::string& data) {
65 fromStr(data);
66}
67
69 const std::vector<uint8_t>& wire_fqdn) {
70 fromHWAddr(hwaddr, wire_fqdn);
71}
72
73D2Dhcid::D2Dhcid(const std::vector<uint8_t>& clientid_data,
74 const std::vector<uint8_t>& wire_fqdn) {
75 fromClientId(clientid_data, wire_fqdn);
76}
77
79 const std::vector<uint8_t>& wire_fqdn) {
80 fromDUID(duid, wire_fqdn);
81}
82
83
84void
85D2Dhcid::fromStr(const std::string& data) {
86 bytes_.clear();
87 try {
88 isc::util::encode::decodeHex(data, bytes_);
89 } catch (const isc::Exception& ex) {
90 isc_throw(NcrMessageError, "Invalid data in Dhcid: " << ex.what());
91 }
92}
93
94std::string
96 return (isc::util::encode::encodeHex(bytes_));
97}
98
99void
100D2Dhcid::fromClientId(const std::vector<uint8_t>& clientid_data,
101 const std::vector<uint8_t>& wire_fqdn) {
102 createDigest(DHCID_ID_CLIENTID, clientid_data, wire_fqdn);
103}
104
105void
107 const std::vector<uint8_t>& wire_fqdn) {
108 if (!hwaddr) {
110 "unable to compute DHCID from the HW address, "
111 "NULL pointer has been specified");
112 } else if (hwaddr->hwaddr_.empty()) {
114 "unable to compute DHCID from the HW address, "
115 "HW address is empty");
116 }
117 std::vector<uint8_t> hwaddr_data;
118 hwaddr_data.push_back(hwaddr->htype_);
119 hwaddr_data.insert(hwaddr_data.end(), hwaddr->hwaddr_.begin(),
120 hwaddr->hwaddr_.end());
121 createDigest(DHCID_ID_HWADDR, hwaddr_data, wire_fqdn);
122}
123
124
125void
127 const std::vector<uint8_t>& wire_fqdn) {
128
129 createDigest(DHCID_ID_DUID, duid.getDuid(), wire_fqdn);
130}
131
132void
133D2Dhcid::createDigest(const uint8_t identifier_type,
134 const std::vector<uint8_t>& identifier_data,
135 const std::vector<uint8_t>& wire_fqdn) {
136 // We get FQDN in the wire format, so we don't know if it is
137 // valid. It is caller's responsibility to make sure it is in
138 // the valid format. Here we just make sure it is not empty.
139 if (wire_fqdn.empty()) {
141 "empty FQDN used to create DHCID");
142 }
143
144 // It is a responsibility of the classes which encapsulate client
145 // identifiers, e.g. DUID, to validate the client identifier data.
146 // But let's be on the safe side and at least check that it is not
147 // empty.
148 if (identifier_data.empty()) {
150 "empty DUID used to create DHCID");
151 }
152
153 // A data buffer will be used to compute the digest.
154 std::vector<uint8_t> data = identifier_data;
155
156 // Append FQDN in the wire format.
157 data.insert(data.end(), wire_fqdn.begin(), wire_fqdn.end());
158
159 // Use the DUID and FQDN to compute the digest (see RFC4701, section 3).
160
162 try {
163 // We have checked already that the DUID and FQDN aren't empty
164 // so it is safe to assume that the data buffer is not empty.
165 cryptolink::digest(&data[0], data.size(), cryptolink::SHA256, hash);
166 } catch (const std::exception& ex) {
168 "error while generating DHCID from DUID: "
169 << ex.what());
170 }
171
172 // The DHCID RDATA has the following structure:
173 //
174 // < identifier-type > < digest-type > < digest >
175 //
176 // where identifier type
177
178 // Let's allocate the space for the identifier-type (2 bytes) and
179 // digest-type (1 byte). This is 3 bytes all together.
180 bytes_.resize(3 + hash.getLength());
181 // Leave first byte 0 and set the second byte. Those two bytes
182 // form the identifier-type.
183 bytes_[1] = identifier_type;
184 // Third byte is always equal to 1, which specifies SHA-256 digest type.
185 bytes_[2] = 1;
186 // Now let's append the digest.
187 std::memcpy(&bytes_[3], hash.getData(), hash.getLength());
188}
189
190std::ostream&
191operator<<(std::ostream& os, const D2Dhcid& dhcid) {
192 os << dhcid.toStr();
193 return (os);
194}
195
196
197
198/**************************** NameChangeRequest ******************************/
199
201 : change_type_(CHG_ADD), forward_change_(false),
202 reverse_change_(false), fqdn_(""), ip_io_address_("0.0.0.0"),
203 dhcid_(), lease_expires_on_(), lease_length_(0), conflict_resolution_(true),
204 status_(ST_NEW) {
205}
206
208 const bool forward_change, const bool reverse_change,
209 const std::string& fqdn, const std::string& ip_address,
210 const D2Dhcid& dhcid,
211 const uint64_t lease_expires_on,
212 const uint32_t lease_length,
213 const bool conflict_resolution)
214 : change_type_(change_type), forward_change_(forward_change),
215 reverse_change_(reverse_change), fqdn_(fqdn), ip_io_address_("0.0.0.0"),
216 dhcid_(dhcid), lease_expires_on_(lease_expires_on),
217 lease_length_(lease_length), conflict_resolution_(conflict_resolution),
218 status_(ST_NEW) {
219
220 // User setter to validate fqdn.
221 setFqdn(fqdn);
222
223 // User setter to validate address.
224 setIpAddress(ip_address);
225
226 // Validate the contents. This will throw a NcrMessageError if anything
227 // is invalid.
229}
230
233 isc::util::InputBuffer& buffer) {
234 // Based on the format requested, pull the marshalled request from
235 // InputBuffer and pass it into the appropriate format-specific factory.
237 switch (format) {
238 case FMT_JSON: {
239 try {
240 // Get the length of the JSON text.
241 size_t len = buffer.readUint16();
242
243 // Read the text from the buffer into a vector.
244 std::vector<uint8_t> vec;
245 buffer.readVector(vec, len);
246
247 // Turn the vector into a string.
248 std::string string_data(vec.begin(), vec.end());
249
250 // Pass the string of JSON text into JSON factory to create the
251 // NameChangeRequest instance. Note the factory may throw
252 // NcrMessageError.
253 ncr = NameChangeRequest::fromJSON(string_data);
254 } catch (const isc::util::InvalidBufferPosition& ex) {
255 // Read error accessing data in InputBuffer.
256 isc_throw(NcrMessageError, "fromFormat: buffer read error: "
257 << ex.what());
258 }
259
260 break;
261 }
262 default:
263 // Programmatic error, shouldn't happen.
264 isc_throw(NcrMessageError, "fromFormat - invalid format");
265 break;
266 }
267
268 return (ncr);
269}
270
271void
273 isc::util::OutputBuffer& buffer) const {
274 // Based on the format requested, invoke the appropriate format handler
275 // which will marshal this request's contents into the OutputBuffer.
276 switch (format) {
277 case FMT_JSON: {
278 // Invoke toJSON to create a JSON text of this request's contents.
279 std::string json = toJSON();
280 uint16_t length = json.size();
281
282 // Write the length of the JSON text to the OutputBuffer first, then
283 // write the JSON text itself.
284 buffer.writeUint16(length);
285 buffer.writeData(json.c_str(), length);
286 break;
287 }
288 default:
289 // Programmatic error, shouldn't happen.
290 isc_throw(NcrMessageError, "toFormat - invalid format");
291 break;
292 }
293}
294
296NameChangeRequest::fromJSON(const std::string& json) {
297 // This method leverages the existing JSON parsing provided by isc::data
298 // library. Should this prove to be a performance issue, it may be that
299 // lighter weight solution would be appropriate.
300
301 // Turn the string of JSON text into an Element set.
302 isc::data::ElementPtr elements;
303 try {
304 elements = isc::data::Element::fromJSON(json);
305 } catch (const isc::data::JSONError& ex) {
307 "Malformed NameChangeRequest JSON: " << ex.what());
308 }
309
310 // Get a map of the Elements, keyed by element name.
311 ElementMap element_map = elements->mapValue();
313
314 // Use default constructor to create a "blank" NameChangeRequest.
316
317 // For each member of NameChangeRequest, find its element in the map and
318 // call the appropriate Element-based setter. These setters may throw
319 // NcrMessageError if the given Element is the wrong type or its data
320 // content is lexically invalid. If the element is NOT found in the
321 // map, getElement will throw NcrMessageError indicating the missing
322 // member.
323 element = ncr->getElement("change-type", element_map);
324 ncr->setChangeType(element);
325
326 element = ncr->getElement("forward-change", element_map);
327 ncr->setForwardChange(element);
328
329 element = ncr->getElement("reverse-change", element_map);
330 ncr->setReverseChange(element);
331
332 element = ncr->getElement("fqdn", element_map);
333 ncr->setFqdn(element);
334
335 element = ncr->getElement("ip-address", element_map);
336 ncr->setIpAddress(element);
337
338 element = ncr->getElement("dhcid", element_map);
339 ncr->setDhcid(element);
340
341 element = ncr->getElement("lease-expires-on", element_map);
342 ncr->setLeaseExpiresOn(element);
343
344 element = ncr->getElement("lease-length", element_map);
345 ncr->setLeaseLength(element);
346
347 // For backward compatibility use-conflict-resolution is optional
348 // and defaults to true.
349 auto found = element_map.find("use-conflict-resolution");
350 if (found != element_map.end()) {
351 ncr->setConflictResolution(found->second);
352 } else {
353 ncr->setConflictResolution(true);
354 }
355
356 // All members were in the Element set and were correct lexically. Now
357 // validate the overall content semantically. This will throw an
358 // NcrMessageError if anything is amiss.
359 ncr->validateContent();
360
361 // Everything is valid, return the new instance.
362 return (ncr);
363}
364
365std::string
367 // Create a JSON string of this request's contents. Note that this method
368 // does NOT use the isc::data library as generating the output is straight
369 // forward.
370 std::ostringstream stream;
371
372 stream << "{\"change-type\":" << getChangeType() << ","
373 << "\"forward-change\":"
374 << (isForwardChange() ? "true" : "false") << ","
375 << "\"reverse-change\":"
376 << (isReverseChange() ? "true" : "false") << ","
377 << "\"fqdn\":\"" << getFqdn() << "\","
378 << "\"ip-address\":\"" << getIpAddress() << "\","
379 << "\"dhcid\":\"" << getDhcid().toStr() << "\","
380 << "\"lease-expires-on\":\"" << getLeaseExpiresOnStr() << "\","
381 << "\"lease-length\":" << getLeaseLength() << ","
382 << "\"use-conflict-resolution\":"
383 << (useConflictResolution() ? "true" : "false") << "}";
384
385 return (stream.str());
386}
387
388
389void
391 //@todo This is an initial implementation which provides a minimal amount
392 // of validation. FQDN and DHCID members are all currently
393 // strings, these may be replaced with richer classes.
394 if (fqdn_ == "") {
395 isc_throw(NcrMessageError, "FQDN cannot be blank");
396 }
397
398 // Validate the DHCID.
399 if (dhcid_.getBytes().size() == 0) {
400 isc_throw(NcrMessageError, "DHCID cannot be blank");
401 }
402
403 // Ensure the request specifies at least one direction to update.
404 if (!forward_change_ && !reverse_change_) {
406 "Invalid Request, forward and reverse flags are both false");
407 }
408}
409
411NameChangeRequest::getElement(const std::string& name,
412 const ElementMap& element_map) const {
413 // Look for "name" in the element map.
414 ElementMap::const_iterator it = element_map.find(name);
415 if (it == element_map.end()) {
416 // Didn't find the element, so throw.
418 "NameChangeRequest value missing for: " << name );
419 }
420
421 // Found the element, return it.
422 return (it->second);
423}
424
425void
427 change_type_ = value;
428}
429
430
431void
433 long raw_value = -1;
434 try {
435 // Get the element's integer value.
436 raw_value = element->intValue();
437 } catch (const isc::data::TypeError& ex) {
438 // We expect a integer Element type, don't have one.
440 "Wrong data type for change_type: " << ex.what());
441 }
442
443 if ((raw_value != CHG_ADD) && (raw_value != CHG_REMOVE)) {
444 // Value is not a valid change type.
446 "Invalid data value for change_type: " << raw_value);
447 }
448
449 // Good to go, make the assignment.
450 setChangeType(static_cast<NameChangeType>(raw_value));
451}
452
453void
455 forward_change_ = value;
456}
457
458void
460 bool value;
461 try {
462 // Get the element's boolean value.
463 value = element->boolValue();
464 } catch (const isc::data::TypeError& ex) {
465 // We expect a boolean Element type, don't have one.
467 "Wrong data type for forward-change: " << ex.what());
468 }
469
470 // Good to go, make the assignment.
471 setForwardChange(value);
472}
473
474void
476 reverse_change_ = value;
477}
478
479void
481 bool value;
482 try {
483 // Get the element's boolean value.
484 value = element->boolValue();
485 } catch (const isc::data::TypeError& ex) {
486 // We expect a boolean Element type, don't have one.
488 "Wrong data type for reverse_change: " << ex.what());
489 }
490
491 // Good to go, make the assignment.
492 setReverseChange(value);
493}
494
495
496void
498 setFqdn(element->stringValue());
499}
500
501void
502NameChangeRequest::setFqdn(const std::string& value) {
503 try {
504 dns::Name tmp(value);
505 fqdn_ = tmp.toText();
506 } catch (const std::exception& ex) {
508 "Invalid FQDN value: " << value << ", reason: "
509 << ex.what());
510 }
511}
512
513void
514NameChangeRequest::setIpAddress(const std::string& value) {
515 // Validate IP Address.
516 try {
517 ip_io_address_ = isc::asiolink::IOAddress(value);
518 } catch (const isc::asiolink::IOError&) {
520 "Invalid ip address string for ip_address: " << value);
521 }
522}
523
524void
526 setIpAddress(element->stringValue());
527}
528
529
530void
531NameChangeRequest::setDhcid(const std::string& value) {
532 dhcid_.fromStr(value);
533}
534
535void
537 setDhcid(element->stringValue());
538}
539
540std::string
542 return (isc::util::timeToText64(lease_expires_on_));
543}
544
545void
546NameChangeRequest::setLeaseExpiresOn(const std::string& value) {
547 try {
548 lease_expires_on_ = isc::util::timeFromText64(value);
549 } catch (...) {
550 // We were given an invalid string, so throw.
552 "Invalid date-time string: [" << value << "]");
553 }
554
555}
556
558 // Pull out the string value and pass it into the string setter.
559 setLeaseExpiresOn(element->stringValue());
560}
561
562void
564 lease_length_ = value;
565}
566
567void
569 long value = -1;
570 try {
571 // Get the element's integer value.
572 value = element->intValue();
573 } catch (const isc::data::TypeError& ex) {
574 // We expect a integer Element type, don't have one.
576 "Wrong data type for lease_length: " << ex.what());
577 }
578
579 // Make sure we the range is correct and value is positive.
580 if (value > std::numeric_limits<uint32_t>::max()) {
581 isc_throw(NcrMessageError, "lease_length value " << value <<
582 "is too large for unsigned 32-bit integer.");
583 }
584 if (value < 0) {
585 isc_throw(NcrMessageError, "lease_length value " << value <<
586 "is negative. It must greater than or equal to zero ");
587 }
588
589 // Good to go, make the assignment.
590 setLeaseLength(static_cast<uint32_t>(value));
591}
592
593void
595 conflict_resolution_ = value;
596}
597
598void
600 bool value;
601 try {
602 // Get the element's boolean value.
603 value = element->boolValue();
604 } catch (const isc::data::TypeError& ex) {
605 // We expect a boolean Element type, don't have one.
607 "Wrong data type for use-conflict-resolution: " << ex.what());
608 }
609
610 // Good to go, make the assignment.
612}
613
614void
616 status_ = value;
617}
618
619std::string
621 std::ostringstream stream;
622
623 stream << "Type: " << static_cast<int>(change_type_) << " (";
624 switch (change_type_) {
625 case CHG_ADD:
626 stream << "CHG_ADD)\n";
627 break;
628 case CHG_REMOVE:
629 stream << "CHG_REMOVE)\n";
630 break;
631 default:
632 // Shouldn't be possible.
633 stream << "Invalid Value\n";
634 }
635
636 stream << "Forward Change: " << (forward_change_ ? "yes" : "no")
637 << std::endl
638 << "Reverse Change: " << (reverse_change_ ? "yes" : "no")
639 << std::endl
640 << "FQDN: [" << fqdn_ << "]" << std::endl
641 << "IP Address: [" << ip_io_address_ << "]" << std::endl
642 << "DHCID: [" << dhcid_.toStr() << "]" << std::endl
643 << "Lease Expires On: " << getLeaseExpiresOnStr() << std::endl
644 << "Lease Length: " << lease_length_ << std::endl
645 << "Conflict Resolution: " << (conflict_resolution_ ? "yes" : "no")
646 << std::endl;
647
648 return (stream.str());
649}
650
651bool
653 return ((change_type_ == other.change_type_) &&
654 (forward_change_ == other.forward_change_) &&
655 (reverse_change_ == other.reverse_change_) &&
656 (fqdn_ == other.fqdn_) &&
657 (ip_io_address_ == other.ip_io_address_) &&
658 (dhcid_ == other.dhcid_) &&
659 (lease_expires_on_ == other.lease_expires_on_) &&
660 (lease_length_ == other.lease_length_) &&
661 (conflict_resolution_ == other.conflict_resolution_));
662}
663
664bool
666 return (!(*this == other));
667}
668
669
670}; // end of isc::dhcp namespace
671}; // end of isc namespace
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.
static ElementPtr fromJSON(const std::string &in, bool preproc=false)
These functions will parse the given string (JSON) representation of a compound element.
Definition: data.cc:759
A standard Data module exception that is thrown if a parse error is encountered when constructing an ...
Definition: data.h:47
A standard Data module exception that is thrown if a function is called for an Element that has a wro...
Definition: data.h:34
Holds DUID (DHCPv6 Unique Identifier)
Definition: duid.h:27
const std::vector< uint8_t > & getDuid() const
Returns a const reference to the actual DUID value.
Definition: duid.cc:46
Container class for handling the DHCID value within a NameChangeRequest.
Definition: ncr_msg.h:86
void fromHWAddr(const isc::dhcp::HWAddrPtr &hwaddr, const std::vector< uint8_t > &wire_fqdn)
Sets the DHCID value based on the HW address and FQDN.
Definition: ncr_msg.cc:106
void fromDUID(const isc::dhcp::DUID &duid, const std::vector< uint8_t > &wire_fqdn)
Sets the DHCID value based on the DUID and FQDN.
Definition: ncr_msg.cc:126
const std::vector< uint8_t > & getBytes() const
Returns a reference to the DHCID byte vector.
Definition: ncr_msg.h:169
D2Dhcid()
Default constructor.
Definition: ncr_msg.cc:61
void fromClientId(const std::vector< uint8_t > &clientid_data, const std::vector< uint8_t > &wire_fqdn)
Sets the DHCID value based on the Client Identifier.
Definition: ncr_msg.cc:100
void fromStr(const std::string &data)
Sets the DHCID value based on the given string.
Definition: ncr_msg.cc:85
std::string toStr() const
Returns the DHCID value as a string of hexadecimal digits.
Definition: ncr_msg.cc:95
Exception thrown when there is an error occurred during computation of the DHCID.
Definition: ncr_msg.h:38
Represents a DHCP-DDNS client request.
Definition: ncr_msg.h:227
bool useConflictResolution() const
Checks if conflict resolution is enabled.
Definition: ncr_msg.h:663
void setStatus(const NameChangeStatus value)
Sets the request status to the given value.
Definition: ncr_msg.cc:615
void setChangeType(const NameChangeType value)
Sets the change type to the given value.
Definition: ncr_msg.cc:426
std::string toText() const
Returns a text rendition of the contents of the request.
Definition: ncr_msg.cc:620
uint32_t getLeaseLength() const
Fetches the request lease length.
Definition: ncr_msg.h:643
void setIpAddress(const std::string &value)
Sets the IP address to the given value.
Definition: ncr_msg.cc:514
const D2Dhcid & getDhcid() const
Fetches the request DHCID.
Definition: ncr_msg.h:562
void setDhcid(const std::string &value)
Sets the DHCID based on the given string value.
Definition: ncr_msg.cc:531
std::string toJSON() const
Instance method for marshalling the contents of the request into a string of JSON text.
Definition: ncr_msg.cc:366
std::string getIpAddress() const
Fetches the request IP address string.
Definition: ncr_msg.h:521
void setFqdn(const std::string &value)
Sets the FQDN to the given value.
Definition: ncr_msg.cc:502
void setReverseChange(const bool value)
Sets the reverse change flag to the given value.
Definition: ncr_msg.cc:475
bool operator!=(const NameChangeRequest &b)
Definition: ncr_msg.cc:665
void setLeaseLength(const uint32_t value)
Sets the lease length to the given value.
Definition: ncr_msg.cc:563
bool operator==(const NameChangeRequest &b)
Definition: ncr_msg.cc:652
void setLeaseExpiresOn(const std::string &value)
Sets the lease expiration based on the given string.
Definition: ncr_msg.cc:546
void toFormat(const NameChangeFormat format, isc::util::OutputBuffer &buffer) const
Instance method for marshalling the contents of the request into the given buffer in the given format...
Definition: ncr_msg.cc:272
NameChangeRequest()
Default Constructor.
Definition: ncr_msg.cc:200
NameChangeType getChangeType() const
Fetches the request change type.
Definition: ncr_msg.h:437
static NameChangeRequestPtr fromJSON(const std::string &json)
Static method for creating a NameChangeRequest from a string containing a JSON rendition of a request...
Definition: ncr_msg.cc:296
void setForwardChange(const bool value)
Sets the forward change flag to the given value.
Definition: ncr_msg.cc:454
std::string getLeaseExpiresOnStr() const
Fetches the request lease expiration as string.
Definition: ncr_msg.cc:541
isc::data::ConstElementPtr getElement(const std::string &name, const ElementMap &element_map) const
Given a name, finds and returns an element from a map of elements.
Definition: ncr_msg.cc:411
void setConflictResolution(const bool value)
Sets the conflict resolution flag to the given value.
Definition: ncr_msg.cc:594
bool isForwardChange() const
Checks forward change flag.
Definition: ncr_msg.h:457
static NameChangeRequestPtr fromFormat(const NameChangeFormat format, isc::util::InputBuffer &buffer)
Static method for creating a NameChangeRequest from a buffer containing a marshalled request in a giv...
Definition: ncr_msg.cc:232
void validateContent()
Validates the content of a populated request.
Definition: ncr_msg.cc:390
const std::string getFqdn() const
Fetches the request FQDN.
Definition: ncr_msg.h:501
bool isReverseChange() const
Checks reverse change flag.
Definition: ncr_msg.h:479
Exception thrown when NameChangeRequest marshalling error occurs.
Definition: ncr_msg.h:30
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
The InputBuffer class is a buffer abstraction for manipulating read-only data.
Definition: buffer.h:81
void readVector(std::vector< uint8_t > &data, size_t len)
Read specified number of bytes as a vector.
Definition: buffer.h:204
uint16_t readUint16()
Read an unsigned 16-bit integer in network byte order from the buffer, convert it to host byte order,...
Definition: buffer.h:142
A standard DNS module exception that is thrown if an out-of-range buffer operation is being performed...
Definition: buffer.h:27
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Definition: buffer.h:294
void writeUint16(uint16_t data)
Write an unsigned 16-bit integer in host byte order into the buffer in network byte order.
Definition: buffer.h:490
void writeData(const void *data, size_t len)
Copy an arbitrary length of data into the buffer.
Definition: buffer.h:550
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:27
boost::shared_ptr< Element > ElementPtr
Definition: data.h:24
NameChangeFormat
Defines the list of data wire formats supported.
Definition: ncr_msg.h:60
NameChangeStatus
Defines the runtime processing status values for requests.
Definition: ncr_msg.h:52
std::map< std::string, isc::data::ConstElementPtr > ElementMap
Defines a map of Elements, keyed by their string name.
Definition: ncr_msg.h:217
std::ostream & operator<<(std::ostream &os, const D2Dhcid &dhcid)
Definition: ncr_msg.cc:191
NameChangeFormat stringToNcrFormat(const std::string &fmt_str)
Function which converts labels to NameChangeFormat enum values.
Definition: ncr_msg.cc:26
boost::shared_ptr< NameChangeRequest > NameChangeRequestPtr
Defines a pointer to a NameChangeRequest.
Definition: ncr_msg.h:212
std::string ncrFormatToString(NameChangeFormat format)
Function which converts NameChangeFormat enums to text labels.
Definition: ncr_msg.cc:35
NameChangeType
Defines the types of DNS updates that can be requested.
Definition: ncr_msg.h:46
boost::shared_ptr< HWAddr > HWAddrPtr
Shared pointer to a hardware address structure.
Definition: hwaddr.h:154
string encodeHex(const vector< uint8_t > &binary)
Encode binary data in the base16 ('hex') format.
Definition: base_n.cc:469
void decodeHex(const string &input, vector< uint8_t > &result)
Decode a text encoded in the base16 ('hex') format into the original data.
Definition: base_n.cc:474
std::string format(const std::string &format, const std::vector< std::string > &args)
Apply Formatting.
Definition: strutil.cc:157
string timeToText64(uint64_t value)
Convert integral DNSSEC time to textual form, 64-bit version.
uint64_t timeFromText64(const string &time_txt)
Convert textual DNSSEC time to integer, 64-bit version.
Defines the logger used by the top-level component of kea-lfc.
This file provides the classes needed to embody, compose, and decompose DNS update requests that are ...