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 current data length " 57 <<
getLength() <<
" exceeds the maximum size for the length" 80 assign(&other[0], other.length());
105 is.read(buf,
sizeof(buf));
108 tuple.
append(buf, is.gcount());
120 "unable to parse the opaque data tuple, the buffer" 121 " length is " << std::distance(begin, end)
132 if (std::distance(begin, end) < len) {
135 len = std::distance(begin, end);
138 "unable to parse the opaque data tuple, " 139 "the buffer length is " << std::distance(begin, end)
140 <<
", but the tuple length is " << len);
OpaqueDataTuple & operator=(const std::string &other)
Assignment operator.
Buffer::const_iterator InputIterator
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 pack(isc::util::OutputBuffer &buf) const
Renders the tuple to a buffer in the wire format.
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.
std::string getText() const
Return the tuple data in the textual 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.
bool equals(const std::string &other) const
Checks if the data carried in the tuple match the string.
Defines the logger used by the top-level component of kea-lfc.
int getDataFieldSize() const
Returns the size of the tuple length field.
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.
bool operator==(const std::string &other) const
Equality operator.
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...