24 class AbstractMessageRenderer;
32 EmptyLabel(
const char* file,
size_t line,
const char* what) :
42 TooLongName(
const char* file,
size_t line,
const char* what) :
74 BadEscape(
const char* file,
size_t line,
const char* what) :
160 order_(order), nlabels_(nlabels), relation_(relation) {}
167 int getOrder()
const {
return (order_); }
176 unsigned int nlabels_;
235 typedef std::basic_string<uint8_t> NameString;
237 typedef std::vector<uint8_t> NameOffsets;
245 Name() : length_(0), labelcount_(0) {}
257 explicit Name(
const std::string& namestr,
bool downcase =
false);
286 Name(
const char* name_data,
size_t data_len,
const Name* origin,
287 bool downcase =
false);
316 uint8_t at(
size_t pos)
const 348 if (pos >= length_) {
351 return (ndata_[pos]);
393 std::string toText(
bool omit_final_dot =
false)
const;
403 std::string toRawText(
bool omit_final_dot =
false)
const;
464 bool equals(
const Name& other)
const;
474 bool nequals(
const Name& other)
const {
return (!(equals(other))); }
488 bool leq(
const Name& other)
const;
503 bool geq(
const Name& other)
const;
517 bool lthan(
const Name& other)
const;
531 bool gthan(
const Name& other)
const;
541 Name split(
unsigned int first,
unsigned int n)
const;
634 Name split(
unsigned int level)
const;
642 Name reverse()
const;
657 Name concatenate(
const Name& suffix)
const;
687 bool isWildcard()
const;
698 static const size_t MAX_WIRE = 255;
705 static const size_t MAX_LABELS = 128;
708 static const size_t MAX_LABELLEN = 63;
715 static const uint16_t MAX_COMPRESS_POINTER = 0x3fff;
717 static const uint16_t COMPRESS_POINTER_MARK8 = 0xc0;
719 static const uint16_t COMPRESS_POINTER_MARK16 = 0xc000;
726 static const Name& ROOT_NAME();
732 NameOffsets offsets_;
733 unsigned int length_;
734 unsigned int labelcount_;
739 static Name root_name(
".");
The Name class encapsulates DNS names.
Thrown when origin is NULL and is needed.
bool nequals(const Name &other) const
Return true iff two names are not equal.
Base class for name parser exceptions.
bool operator<(const Name &other) const
Same as lthan()
BadEscape(const char *file, size_t line, const char *what)
EmptyLabel(const char *file, size_t line, const char *what)
bool operator<=(const Name &other) const
Same as leq()
std::ostream & operator<<(std::ostream &os, const CSVRow &row)
Overrides standard output stream operator for CSVRow object.
NameRelation getRelation() const
Returns the NameRelation of the comparison result.
bool operator==(const Name &other) const
Same as equals()
MissingNameOrigin(const char *file, size_t line, const char *what)
unsigned int getLabelCount() const
Returns the number of labels contained in the Name.
This is a supplemental class used only as a return value of Name::compare() and LabelSequence::compar...
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
The AbstractMessageRenderer class is an abstract base class that provides common interfaces for rende...
A standard DNS module exception that is thrown if the name parser encounters an empty label in the mi...
bool operator!=(const Name &other) const
Same as nequals()
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
size_t getLength() const
Gets the length of the Name in its wire format.
unsigned int getCommonLabels() const
Returns the number of common labels of the comparison result.
A standard DNS module exception that is thrown if the name parser encounters an obsolete or incomplet...
bool operator>(const Name &other) const
Same as gthan()
Defines the logger used by the top-level component of kea-lfc.
IncompleteName(const char *file, size_t line, const char *what)
A standard DNS module exception that is thrown if the name parser fails to decode a back-slash escape...
BadLabelType(const char *file, size_t line, const char *what)
A standard DNS module exception that is thrown if the name parser finds the input (string or wire-for...
A generic exception that is thrown if a parameter given to a method would refer to or modify out-of-r...
bool operator>=(const Name &other) const
Same as geq()
NameRelation
The relation of two names under comparison.
Light-weight Accessor to Name data.