20 #include <arpa/inet.h>
30 uint32_t pref, uint32_t valid)
31 :
Option(V6, type), addr_(addr), preferred_(pref),
40 OptionBuffer::const_iterator end)
41 :
Option(V6, type), addr_(
"::") {
48 return (cloneInternal<Option6IAAddr>());
72 OptionBuffer::const_iterator end) {
79 begin += V6ADDRESS_LEN;
82 begin +=
sizeof(uint32_t);
85 begin +=
sizeof(uint32_t);
91 std::stringstream output;
93 <<
"address=" <<
addr_
95 <<
", valid-lft=" <<
valid_;
98 return (output.str());
108 for (OptionCollection::const_iterator it =
options_.begin();
111 length += (*it).second->len();
static const size_t OPTION6_IAADDR_LEN
length of the fixed part of the IAADDR option
virtual uint16_t len() const
returns data length (data length + DHCPv4/DHCPv6 option header)
void packOptions(isc::util::OutputBuffer &buf) const
Store sub options in a buffer.
Option6IAAddr(uint16_t type, const isc::asiolink::IOAddress &addr, uint32_t preferred, uint32_t valid)
Constructor, used for options constructed (during transmission).
unsigned int valid_
contains valid-lifetime timer (in seconds)
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
isc::asiolink::IOAddress addr_
contains an IPv6 address
boost::shared_ptr< Option > OptionPtr
virtual std::string toText(int indent=0) const
Returns string representation of the option.
virtual uint16_t getHeaderLen() const
Returns length of header (2 for v4, 4 for v6)
std::vector< uint8_t > OptionBuffer
buffer types used in DHCP code.
std::vector< uint8_t > toBytes() const
Return address as set of bytes.
void writeData(const void *data, size_t len)
Copy an arbitrary length of data into the buffer.
#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...
static IOAddress fromBytes(short family, const uint8_t *data)
Creates an address from over wire data.
OptionCollection options_
collection for storing suboptions
void setEncapsulatedSpace(const std::string &encapsulated_space)
Sets the name of the option space encapsulated by this 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.
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...
Defines the logger used by the top-level component of kea-dhcp-ddns.
void unpackOptions(const OptionBuffer &buf)
Builds a collection of sub options from the buffer.
#define DHCP6_OPTION_SPACE
std::string headerToText(const int indent=0, const std::string &type_name="") const
Returns option header in the textual format.
void writeUint16(uint16_t data)
Write an unsigned 16-bit integer in host byte order into the buffer in network byte order...
A generic exception that is thrown if a parameter given to a method would refer to or modify out-of-r...
bool isV6() const
Convenience function to check for an IPv6 address.
uint16_t type_
option type (0-255 for DHCPv4, 0-65535 for DHCPv6)
The IOAddress class represents an IP addresses (version agnostic)
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received buffer.
unsigned int preferred_
contains preferred-lifetime timer (in seconds)
void pack(isc::util::OutputBuffer &buf) const
Writes option in wire-format.
static const size_t OPTION6_HDR_LEN
length of any DHCPv6 option header