7#ifndef OPAQUE_DATA_TUPLE_H
8#define OPAQUE_DATA_TUPLE_H
86 : length_field_type_(length_field_type) {
103 void append(
const char* data,
const size_t len) {
104 data_.insert(data_.end(), data, data + len);
106 void append(
const uint8_t* data,
const size_t len) {
107 data_.insert(data_.end(), data, data + len);
110 data_.insert(data_.end(), data, data + len);
119 void append(
const std::string& text);
131 void assign(
const char* data,
const size_t len) {
132 data_.assign(data, data + len);
135 data_.assign(data, data + len);
144 void assign(
const std::string& text);
152 bool equals(
const std::string& other)
const;
156 return (length_field_type_);
161 return (data_.size());
239 bool operator==(
const std::string& other)
const;
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Exception to be thrown when the operation on OpaqueDataTuple object results in an error.
OpaqueDataTupleError(const char *file, size_t line, const char *what)
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.
void assign(InputIterator data, const size_t len)
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.
void append(InputIterator data, const size_t len)
LengthFieldType getLengthFieldType() const
Returns tuple length data field type.
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.
size_t getTotalLength() const
Returns a total size of the tuple, including length field.
void append(const char *data, const size_t len)
Appends data to the tuple.
void append(const uint8_t *data, const size_t len)
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.
OpaqueDataTuple(LengthFieldType length_field_type, InputIterator begin, InputIterator end)
Constructor.
std::vector< uint8_t > Buffer
Defines a type of the data buffer used to hold the opaque data.
size_t getLength() const
Returns the length of the data in the tuple.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
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.
boost::shared_ptr< OpaqueDataTuple > OpaqueDataTuplePtr
Pointer to the OpaqueDataTuple object.
Defines the logger used by the top-level component of kea-lfc.