18 const uint32_t vendor_id)
19 :
Option(u, getOptionCode(u)), vendor_id_(vendor_id) {
28 :
Option(u, getOptionCode(u)) {
34 return (cloneInternal<OptionVendorClass>());
43 for (TuplesCollection::const_iterator it = tuples_.begin();
44 it != tuples_.end(); ++it) {
59 if (std::distance(begin, end) < getMinimalLength() -
getHeaderLen()) {
61 " size " << std::distance(begin, end));
66 begin +=
sizeof(vendor_id_);
70 while (offset < std::distance(begin, end)) {
82 offset +=
sizeof(vendor_id_);
86 if (offset + 1 >= std::distance(begin, end)) {
88 " option - it should contain enterprise id followed"
89 " by opaque data field tuple");
99 " invalid size of the length field "
103 tuples_.push_back(tuple);
111 " vendor option at position " << at <<
" which is out of"
116 " invalid size of the length field "
127 " vendor option at position " << at <<
" which is out of"
128 " range. There are only " <<
getTuplesNum() <<
" tuples");
130 return (tuples_[at]);
137 for (TuplesCollection::const_iterator it = tuples_.begin();
138 it != tuples_.end(); ++it) {
139 if (*it == tuple_str) {
152 for (TuplesCollection::const_iterator it = tuples_.begin();
153 it != tuples_.end(); ++it) {
157 length +=
sizeof(uint32_t);
159 length += it->getTotalLength();
168 std::ostringstream s;
171 s << std::string(indent,
' ');
174 " enterprise id=0x" << std::hex <<
getVendorId() << std::dec;
179 s <<
", enterprise id=0x" << std::hex <<
getVendorId() << std::dec;
183 s <<
", vendor-class-data" << i <<
"='" <<
getTuple(i) <<
"'";
Universe getUniverse() const
returns option universe (V4 or V6)
virtual uint16_t len() const
Returns the full length of the option, including option header.
int getDataFieldSize() const
Returns the size of the tuple length field.
bool hasTuple(const std::string &tuple_str) const
Checks if the Vendor Class holds the opaque data tuple with the specified string. ...
void packHeader(isc::util::OutputBuffer &buf) const
Store option's header in a buffer.
LengthFieldType getLengthFieldType() const
Returns tuple length data field type.
OpaqueDataTuple getTuple(const size_t at) const
Returns opaque data tuple at the specified position.
OptionVendorClass(Option::Universe u, const uint32_t vendor_id)
Constructor.
boost::shared_ptr< Option > OptionPtr
Universe
defines option universe DHCPv4 or DHCPv6
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...
void addTuple(const OpaqueDataTuple &tuple)
Adds a new opaque data tuple to the option.
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses buffer holding an option.
virtual std::string toText(int indent=0) const
Returns text representation of the option.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
uint32_t readUint32(const uint8_t *buffer, size_t length)
Read Unsigned 32-Bit Integer from Buffer.
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
uint32_t getVendorId() const
Returns enterprise id.
void writeUint32(uint32_t data)
Write an unsigned 32-bit integer in host byte order into the buffer in network byte order...
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.
A generic exception that is thrown if a parameter given to a method would refer to or modify out-of-r...
virtual void pack(isc::util::OutputBuffer &buf) const
Renders option into the buffer in the wire format.
size_t getLength() const
Returns the length of the data in the tuple.
size_t getTuplesNum() const
Returns the number of opaque data tuples added to the option.
OptionPtr clone() const
Copies this option and returns a pointer to the copy.
void setTuple(const size_t at, const OpaqueDataTuple &tuple)
Replaces tuple at the specified index with a new tuple.