16 : length_field_type_(length_field_type) {
23 append(&text[0], text.size());
33 assign(&text[0], text.size());
50 return (std::string(data_.begin(), data_.end()));
57 " opaque data field, because current data length "
58 <<
getLength() <<
" exceeds the maximum size for the length"
63 buf.writeUint8(
static_cast<uint8_t
>(
getLength()));
81 assign(&other[0], other.length());
96 os << tuple.getText();
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);
Exception to be thrown when the operation on OpaqueDataTuple object results in an error.
Represents a single instance of the opaque data preceded by length.
bool operator==(const std::string &other) const
Equality operator.
void clear()
Removes the contents of the tuple.
int getDataFieldSize() const
Returns the size of the tuple length field.
OpaqueDataTuple & operator=(const std::string &other)
Assignment operator.
OpaqueDataTuple(LengthFieldType length_field_type)
Default constructor.
const Buffer & getData() const
Returns a reference to the buffer holding tuple data.
LengthFieldType
Size of the length field in the tuple.
void pack(isc::util::OutputBuffer &buf) const
Renders the tuple to a buffer in the wire format.
Buffer::const_iterator InputIterator
void assign(const char *data, const size_t len)
Assigns data to the tuple.
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.
bool equals(const std::string &other) const
Checks if the data carried in the tuple match the string.
void unpack(InputIterator begin, InputIterator end)
Parses wire data and creates a tuple from it.
bool operator!=(const std::string &other)
Inequality operator.
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.
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::ostream & operator<<(std::ostream &os, const IOAddress &address)
Insert the IOAddress as a string into stream.
std::istream & operator>>(std::istream &is, OpaqueDataTuple &tuple)
Inserts data carried in the stream into the tuple.
uint16_t readUint16(void const *const buffer, size_t const length)
uint16_t wrapper over readUint.
Defines the logger used by the top-level component of kea-lfc.