24 class AbstractMessageRenderer;
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,
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;
488 bool leq(
const Name& other)
const;
503 bool geq(
const Name& other)
const;
541 Name split(
unsigned int first,
unsigned int n)
const;
732 NameOffsets offsets_;
733 unsigned int length_;
734 unsigned int labelcount_;
739 static Name root_name(
".");
The Name class encapsulates DNS names.
ostream & operator<<(std::ostream &os, const EDNS &edns)
Insert the EDNS as a string into stream.
Thrown when origin is NULL and is needed.
NameRelation getRelation() const
Returns the NameRelation of the comparison result.
bool equals(const Name &other) const
Return true iff two names are equal.
std::string toText(bool omit_final_dot=false) const
Convert the Name to a string.
bool gthan(const Name &other) const
Greater-than comparison for Name against other
Base class for name parser exceptions.
Name & downcase()
Downcase all upper case alphabet characters in the name.
BadEscape(const char *file, size_t line, const char *what)
EmptyLabel(const char *file, size_t line, const char *what)
bool leq(const Name &other) const
Less-than or equal comparison for Name against other
uint8_t at(size_t pos) const
Provides one-byte name data in wire format at the specified position.
int getOrder() const
Returns the ordering of the comparison result.
bool lthan(const Name &other) const
Less-than comparison for Name against other
MissingNameOrigin(const char *file, size_t line, const char *what)
Name concatenate(const Name &suffix) const
Concatenate two names.
This is a supplemental class used only as a return value of Name::compare() and LabelSequence::compar...
bool operator>=(const Name &other) const
Same as geq()
static const size_t MAX_WIRE
Max allowable length of domain names.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
std::string toRawText(bool omit_final_dot=false) const
Convert the LabelSequence to a string without escape sequences.
NameComparisonResult compare(const Name &other) const
Compare two Names.
Name split(unsigned int first, unsigned int n) const
Extract a specified subpart of Name.
The AbstractMessageRenderer class is an abstract base class that provides common interfaces for rende...
static const uint16_t COMPRESS_POINTER_MARK8
A 8-bit masked value indicating a start of compression pointer.
static const Name & ROOT_NAME()
Root name (i.e. ".").
unsigned int getLabelCount() const
Returns the number of labels contained in the Name.
A standard DNS module exception that is thrown if the name parser encounters an empty label in the mi...
bool nequals(const Name &other) const
Return true iff two names are not equal.
bool isWildcard() const
Test if this is a wildcard name.
unsigned int getCommonLabels() const
Returns the number of common labels of the comparison result.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
static const uint16_t MAX_COMPRESS_POINTER
Max possible pointer value for name compression.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
bool geq(const Name &other) const
Greater-than or equal comparison for Name against other
A standard DNS module exception that is thrown if the name parser encounters an obsolete or incomplet...
Defines the logger used by the top-level component of kea-dhcp-ddns.
Name reverse() const
Reverse the labels of a name.
static const uint16_t COMPRESS_POINTER_MARK16
A 16-bit masked value indicating a start of compression pointer.
IncompleteName(const char *file, size_t line, const char *what)
bool operator<=(const Name &other) const
Same as leq()
size_t getLength() const
Gets the length of the Name in its wire format.
static const size_t MAX_LABELLEN
Max allowable length of labels of a domain name.
bool operator<(const Name &other) const
Same as lthan()
A standard DNS module exception that is thrown if the name parser fails to decode a back-slash escape...
static const size_t MAX_LABELS
Max allowable labels of domain names.
BadLabelType(const char *file, size_t line, const char *what)
NameComparisonResult(int order, unsigned int nlabels, NameRelation relation)
Constructor from a comparison tuple.
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 equals()
bool operator!=(const Name &other) const
Same as nequals()
void toWire(AbstractMessageRenderer &renderer) const
Render the Name in the wire format with compression.
bool operator>(const Name &other) const
Same as gthan()
NameRelation
The relation of two names under comparison.
Light-weight Accessor to Name data.