20 :
Option(u, type), length_field_type_(length_field_type) {
31 :
Option(u, type), length_field_type_(length_field_type) {
47 for (
auto const& it : tuples_) {
63 while (offset < std::distance(begin, end)) {
77 " invalid size of the length field "
81 tuples_.push_back(tuple);
89 " opaque data tuple option at position " << at <<
" which"
94 " invalid size of the length field "
105 " opaque data tuple option at position " << at <<
" which is"
106 " out of range. There are only " <<
getTuplesNum() <<
" tuples");
108 return (tuples_[at]);
115 for (
auto const& it : tuples_) {
116 if (it == tuple_str) {
128 for (
auto const& it : tuples_) {
129 length += it.getTotalLength();
137 std::ostringstream s;
140 s << std::string(indent,
' ');
148 s <<
", data" << i <<
"='" <<
getTuple(i) <<
"'";
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
A generic exception that is thrown if a parameter given to a method would refer to or modify out-of-r...
Represents a single instance of the opaque data preceded by length.
int getDataFieldSize() const
Returns the size of the tuple length field.
LengthFieldType
Size of the length field in the tuple.
LengthFieldType getLengthFieldType() const
Returns tuple length data field type.
size_t getTotalLength() const
Returns a total size of the tuple, including length field.
size_t getLength() const
Returns the length of the data in the tuple.
static OpaqueDataTuple::LengthFieldType getTupleLenFieldType(Option::Universe u)
Returns Length Field Type for a tuple.
void setTuple(const size_t at, const OpaqueDataTuple &tuple)
Replaces tuple at the specified index with a new tuple.
virtual std::string toText(int indent=0) const
Returns text representation of the option.
size_t getTuplesNum() const
Returns the number of opaque data tuples added to the option.
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses buffer holding an option.
void addTuple(const OpaqueDataTuple &tuple)
Adds a new opaque data tuple to the option.
virtual uint16_t len() const
Returns the full length of the option, including option header.
OptionPtr clone() const
Copies this option and returns a pointer to the copy.
virtual void pack(isc::util::OutputBuffer &buf, bool check=true) const
Renders option into the buffer in the wire format.
OpaqueDataTuple getTuple(const size_t at) const
Returns opaque data tuple at the specified position.
bool hasTuple(const std::string &tuple_str) const
Checks if the object holds the opaque data tuple with the specified string.
OptionOpaqueDataTuples(Option::Universe u, const uint16_t type, OpaqueDataTuple::LengthFieldType length_field_type=OpaqueDataTuple::LENGTH_EMPTY)
Constructor.
virtual uint16_t getHeaderLen() const
Returns length of header (2 for v4, 4 for v6)
Universe
defines option universe DHCPv4 or DHCPv6
uint16_t getType() const
Returns option type (0-255 for DHCPv4, 0-65535 for DHCPv6)
OptionPtr cloneInternal() const
Copies this option and returns a pointer to the copy.
void packHeader(isc::util::OutputBuffer &buf, bool check=true) const
Store option's header in a buffer.
void check() const
A protected method used for option correctness.
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.
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
boost::shared_ptr< Option > OptionPtr
Defines the logger used by the top-level component of kea-lfc.