 |
Kea
1.5.0
|
Go to the documentation of this file.
53 typedef boost::shared_ptr<OptionInt<T> > OptionIntTypePtr;
66 :
Option(u, type), value_(value) {
148 if (distance(begin, end) <
sizeof(T)) {
159 switch (data_size_len) {
165 std::distance(begin, end));
169 std::distance(begin, end));
178 begin += data_size_len;
197 virtual uint16_t
len()
const {
199 uint16_t length = (getUniverse() ==
Option::V4) ? OPTION4_HDR_LEN : OPTION6_HDR_LEN;
201 length +=
sizeof(T);;
203 for (OptionCollection::const_iterator it = options_.begin();
204 it != options_.end();
206 length += (*it).second->len();
217 virtual std::string
toText(
int indent = 0)
const {
218 std::stringstream output;
219 output << headerToText(indent) <<
": ";
225 output << static_cast<int>(
getValue());
236 output << suboptionsToText(indent + 2);
238 return (output.str());
249 #endif // OPTION_INT_H
std::vector< uint8_t > OptionBuffer
buffer types used in DHCP code.
T getValue() const
Return option value.
boost::shared_ptr< OptionUint8 > OptionUint8Ptr
static const std::string & getDataTypeName(const OptionDataType data_type)
Return option data type name from the data type enumerator.
OptionInt< uint16_t > OptionUint16
uint32_t readUint32(const uint8_t *buffer, size_t length)
Read Unsigned 32-Bit Integer from Buffer.
#define DHCP6_OPTION_SPACE
void writeUint16(uint16_t data)
Write an unsigned 16-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.
void setValue(T value)
Set option value.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
Trait class for data types supported in DHCP option definitions.
virtual uint16_t len() const
returns complete length of option
OptionInt(Option::Universe u, uint16_t type, OptionBufferConstIter begin, OptionBufferConstIter end)
Constructor.
void writeUint8(uint8_t data)
Write an unsigned 8-bit integer into the buffer.
OptionInt(Option::Universe u, uint16_t type, T value)
Constructor.
#define DHCP4_OPTION_SPACE
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Exception to be thrown when invalid type specified as template parameter.
uint16_t readUint16(const void *buffer, size_t length)
Read Unsigned 16-Bit Integer from Buffer.
OptionInt< uint32_t > OptionUint32
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received buffer.
boost::shared_ptr< OptionUint16 > OptionUint16Ptr
Forward declaration to OptionInt.
A generic exception that is thrown if a parameter given to a method would refer to or modify out-of-r...
boost::shared_ptr< Option > OptionPtr
void writeUint32(uint32_t data)
Write an unsigned 32-bit integer in host byte order into the buffer in network byte order.
boost::shared_ptr< OptionUint32 > OptionUint32Ptr
Universe
defines option universe DHCPv4 or DHCPv6
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
OptionInt< uint8_t > OptionUint8
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
void pack(isc::util::OutputBuffer &buf) const
Writes option in wire-format to buf, returns pointer to first unused byte after stored option.
virtual std::string toText(int indent=0) const
Returns option carrying an integer value in the textual format.