50 RRType(typeCode) <<
" RDATA: 0-length character string");
54 const uint8_t len = buffer.readUint8();
55 if (rdata_len < len + 1) {
58 " RDATA: character string length is too large: " <<
59 static_cast<int>(len));
61 std::vector<uint8_t> data(len + 1);
63 buffer.readData(&data[0] + 1, len);
64 string_list_.push_back(data);
66 rdata_len -= (len + 1);
67 }
while (rdata_len > 0);
75 std::istringstream ss(txtstr);
80 buildFromTextHelper(lexer);
83 RRType(typeCode) <<
" RDATA from '" << txtstr <<
88 RRType(typeCode) <<
" RDATA from '" << txtstr <<
"': "
101 buildFromTextHelper(lexer);
113 string_list_.push_back(std::vector<uint8_t>());
120 if (string_list_.empty()) {
122 RRType(typeCode) <<
" RDATA: empty input");
131 string_list_(other.string_list_)
140 for (std::vector<std::vector<uint8_t> >::const_iterator it =
141 string_list_.begin();
142 it != string_list_.end();
145 buffer.writeData(&(*it)[0], (*it).size());
156 for (std::vector<std::vector<uint8_t> >::const_iterator it =
157 string_list_.begin();
158 it != string_list_.end();
161 renderer.writeData(&(*it)[0], (*it).size());
172 for (std::vector<std::vector<uint8_t> >::const_iterator it =
173 string_list_.begin(); it != string_list_.end(); ++it)
201 uint8_t
const*
const this_data = (uint8_t
const*)this_buffer.getData();
202 const size_t this_len = this_buffer.getLength();
205 other.toWire(other_buffer);
206 uint8_t
const*
const other_data
207 = (uint8_t
const*)other_buffer.getData();
208 const size_t other_len = other_buffer.getLength();
210 const size_t cmplen = std::min(this_len, other_len);
211 const int cmp = memcmp(this_data, other_data, cmplen);
216 return ((this_len == other_len) ? 0 :
217 (this_len < other_len) ? -1 : 1);
224 std::vector<std::vector<uint8_t> > string_list_;
The AbstractMessageRenderer class is an abstract base class that provides common interfaces for rende...
Exception thrown from a wrapper version of MasterLexer::getNextToken() for non fatal errors.
Tokenizer for parsing DNS master files.
bool pushSource(const char *filename, std::string *error=0)
Open a file and make it the current input source of MasterLexer.
@ QSTRING
A single string quoted by double-quotes (").
@ END_OF_FILE
End of file detected.
Type getType() const
Return the token type.
const StringRegion & getStringRegion() const
Return the value of a string-variant token.
The RRType class encapsulates DNS resource record types.
A standard DNS module exception that is thrown if RDATA parser encounters an invalid or inconsistent ...
A standard DNS module exception that is thrown if RDATA parser fails to recognize a given textual rep...
rdata::TXTLikeImpl class represents the TXT-like RDATA for TXT and SPF types.
TXTLikeImpl(const TXTLikeImpl &other)
The copy constructor.
TXTLikeImpl(util::InputBuffer &buffer, size_t rdata_len)
Constructor from wire-format data.
int compare(const TXTLikeImpl &other) const
Compare two instances of TXT-like RDATA.
std::string toText() const
Convert the TXT-like data to a string.
TXTLikeImpl(const std::string &txtstr)
Constructor from string.
TXTLikeImpl(MasterLexer &lexer)
Constructor using the master lexer.
void toWire(util::OutputBuffer &buffer) const
Render the TXT-like data in the wire format to an OutputBuffer object.
void toWire(AbstractMessageRenderer &renderer) const
Render the TXT-like data in the wire format to an AbstractMessageRenderer object.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
std::string charStringToString(const CharString &char_string)
Convert a CharString into a textual DNS character-string.
void stringToCharString(const MasterToken::StringRegion &str_region, CharString &result)
Convert a DNS character-string into corresponding binary data.
const size_t MAX_RDLENGTH
Possible maximum length of RDATA, which is the maximum unsigned 16 bit value.
Defines the logger used by the top-level component of kea-lfc.