32 return (cloneInternal<OptionOpaqueDataTuples>());
39 for (TuplesCollection::const_iterator it = tuples_.begin();
40 it != tuples_.end(); ++it) {
48 if (std::distance(begin, end) < getMinimalLength() -
getHeaderLen()) {
50 " size " << std::distance(begin, end));
55 while (offset < std::distance(begin, end)) {
69 " invalid size of the length field "
73 tuples_.push_back(tuple);
81 " opaque data tuple option at position " << at <<
" which"
86 " invalid size of the length field "
97 " opaque data tuple option at position " << at <<
" which is"
98 " out of range. There are only " <<
getTuplesNum() <<
" tuples");
100 return (tuples_[at]);
107 for (TuplesCollection::const_iterator it = tuples_.begin();
108 it != tuples_.end(); ++it) {
109 if (*it == tuple_str) {
121 for (TuplesCollection::const_iterator it = tuples_.begin();
122 it != tuples_.end(); ++it) {
123 length += it->getTotalLength();
131 std::ostringstream s;
134 s << std::string(indent,
' ');
142 s <<
", data" << i <<
"='" <<
getTuple(i) <<
"'";
void setTuple(const size_t at, const OpaqueDataTuple &tuple)
Replaces tuple at the specified index with a new tuple.
virtual void pack(isc::util::OutputBuffer &buf) const
Renders option into the buffer in the wire format.
void addTuple(const OpaqueDataTuple &tuple)
Adds a new opaque data tuple to the option.
int getDataFieldSize() const
Returns the size of the tuple length field.
OptionOpaqueDataTuples(Option::Universe u, const uint16_t type)
Constructor.
void packHeader(isc::util::OutputBuffer &buf) const
Store option's header in a buffer.
LengthFieldType getLengthFieldType() const
Returns tuple length data field type.
size_t getTuplesNum() const
Returns the number of opaque data tuples added to the option.
boost::shared_ptr< Option > OptionPtr
Universe
defines option universe DHCPv4 or DHCPv6
virtual std::string toText(int indent=0) const
Returns text representation of the option.
virtual uint16_t getHeaderLen() const
Returns length of header (2 for v4, 4 for v6)
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
OptionPtr clone() const
Copies this option and returns a pointer to the copy.
virtual uint16_t len() const
Returns the full length of the option, including option header.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
bool hasTuple(const std::string &tuple_str) const
Checks if the object holds the opaque data tuple with the specified string.
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
Defines the logger used by the top-level component of kea-dhcp-ddns.
uint16_t getType() const
Returns option type (0-255 for DHCPv4, 0-65535 for DHCPv6)
size_t getTotalLength() const
Returns a total size of the tuple, including length field.
Represents a single instance of the opaque data preceded by length.
OpaqueDataTuple getTuple(const size_t at) const
Returns opaque data tuple at the specified position.
A generic exception that is thrown if a parameter given to a method would refer to or modify out-of-r...
size_t getLength() const
Returns the length of the data in the tuple.
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses buffer holding an option.