20 vendor_id_(vendor_id) {
34 return (cloneInternal<OptionVendor>());
59 if (distance(begin, end) <
sizeof(uint32_t)) {
61 "Truncated vendor-specific information option"
62 <<
", length=" << distance(begin, end));
79 length +=
sizeof(uint32_t);
83 length +=
sizeof(uint8_t);
87 for (OptionCollection::const_iterator it =
options_.begin();
90 length += (*it).second->len();
96 OptionVendor::dataLen()
const {
105 std::stringstream output;
111 output <<
" " <<
static_cast<int>(dataLen()) <<
" (uint8)";
117 return (output.str());
Universe getUniverse() const
returns option universe (V4 or V6)
void packHeader(isc::util::OutputBuffer &buf) const
Store option's header in a buffer.
void packOptions(isc::util::OutputBuffer &buf) const
Store sub options in a buffer.
Exception thrown during option unpacking This exception is thrown when an error has occurred...
OptionVendor(Option::Universe u, const uint32_t vendor_id)
Constructor.
static size_t unpackVendorOptions4(const uint32_t vendor_id, const OptionBuffer &buf, isc::dhcp::OptionCollection &options)
Parses provided buffer as DHCPv4 vendor options and creates Option objects.
boost::shared_ptr< Option > OptionPtr
Universe
defines option universe DHCPv4 or DHCPv6
virtual std::string toText(int indent=0) const
Returns the option in the textual format.
virtual uint16_t getHeaderLen() const
Returns length of header (2 for v4, 4 for v6)
Universe universe_
option universe (V4 or V6)
std::vector< uint8_t > OptionBuffer
buffer types used in DHCP code.
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received buffer.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
OptionCollection options_
collection for storing suboptions
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
std::string suboptionsToText(const int indent=0) const
Returns collection of suboptions in the textual format.
void writeUint32(uint32_t data)
Write an unsigned 32-bit integer in host byte order into the buffer in network byte order...
static size_t unpackVendorOptions6(const uint32_t vendor_id, const OptionBuffer &buf, isc::dhcp::OptionCollection &options)
Parses provided buffer as DHCPv6 vendor options and creates Option objects.
OptionPtr clone() const
Copies this option and returns a pointer to the copy.
std::string headerToText(const int indent=0, const std::string &type_name="") const
Returns option header in the textual format.
void writeUint8(uint8_t data)
Write an unsigned 8-bit integer into the buffer.
virtual void pack(isc::util::OutputBuffer &buf) const
Writes option in wire-format to buf, returns pointer to first unused byte after stored option...
virtual uint16_t len() const
returns complete length of option
uint32_t getVendorId() const
Returns enterprise identifier.