15 : length_field_type_(length_field_type) {
22 append(&text[0], text.size());
32 assign(&text[0], text.size());
49 return (std::string(data_.begin(), data_.end()));
56 " opaque data field, because the field appears to be empty");
59 " opaque data field, because current data length "
60 <<
getLength() <<
" exceeds the maximum size for the length"
81 assign(&other[0], other.length());
106 is.read(buf,
sizeof(buf));
109 tuple.
append(buf, is.gcount());
121 "unable to parse the opaque data tuple, the buffer"
122 " length is " << std::distance(begin, end)
133 if (std::distance(begin, end) < len) {
136 len = std::distance(begin, end);
139 "unable to parse the opaque data tuple, "
140 "the buffer length is " << std::distance(begin, end)
141 <<
", but the tuple length is " << len);
int getDataFieldSize() const
Returns the size of the tuple length field.
OpaqueDataTuple & operator=(const std::string &other)
Assignment operator.
Buffer::const_iterator InputIterator
bool equals(const std::string &other) const
Checks if the data carried in the tuple match the string.
std::string getText() const
Return the tuple data in the textual format.
bool operator!=(const std::string &other)
Inequality operator.
void assign(const char *data, const size_t len)
Assigns data to the tuple.
void unpack(InputIterator begin, InputIterator end)
Parses wire data and creates a tuple from it.
void writeData(const void *data, size_t len)
Copy an arbitrary length of data into the buffer.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
OpaqueDataTuple(LengthFieldType length_field_type)
Default constructor.
bool operator==(const std::string &other) const
Equality operator.
void pack(isc::util::OutputBuffer &buf) const
Renders the tuple to a buffer in the wire format.
void append(const char *data, const size_t len)
Appends data to the tuple.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
LengthFieldType
Size of the length field in the tuple.
Defines the logger used by the top-level component of kea-dhcp-ddns.
uint16_t readUint16(const void *buffer, size_t length)
Read Unsigned 16-Bit Integer from Buffer.
const Buffer & getData() const
Returns a reference to the buffer holding tuple data.
std::ostream & operator<<(std::ostream &os, const OpaqueDataTuple &tuple)
Inserts the OpaqueDataTuple as a string into stream.
void writeUint8(uint8_t data)
Write an unsigned 8-bit integer into the buffer.
Represents a single instance of the opaque data preceded by length.
void writeUint16(uint16_t data)
Write an unsigned 16-bit integer in host byte order into the buffer in network byte order...
size_t getLength() const
Returns the length of the data in the tuple.
static bool lenient_parsing_
Governs whether options should be parsed less strictly.
std::istream & operator>>(std::istream &is, OpaqueDataTuple &tuple)
Inserts data carried in the stream into the tuple.
void clear()
Removes the contents of the tuple.
Exception to be thrown when the operation on OpaqueDataTuple object results in an error...