18 #include <arpa/inet.h>
31 :
Option(V6, type), addrs_(addrs) {
35 :
Option(V6, type), addrs_(1,addr) {
46 return (cloneInternal<Option6AddrLst>());
72 for (AddressContainer::const_iterator addr=
addrs_.begin();
73 addr!=
addrs_.end(); ++addr) {
76 <<
" is not an IPv6 address");
80 buf.
writeData(&addr->toBytes()[0], V6ADDRESS_LEN);
86 if ((distance(begin, end) % V6ADDRESS_LEN) != 0) {
88 <<
" malformed: len=" << distance(begin, end)
89 <<
" is not divisible by 16.");
91 while (begin != end) {
93 begin += V6ADDRESS_LEN;
101 for (AddressContainer::const_iterator addr =
addrs_.begin();
102 addr !=
addrs_.end(); ++addr) {
103 output <<
" " << *addr;
105 return (output.str());
void pack(isc::util::OutputBuffer &buf) const
Assembles on-wire form of this option.
boost::shared_ptr< Option > OptionPtr
virtual uint16_t getHeaderLen() const
Returns length of header (2 for v4, 4 for v6)
virtual std::string toText(int indent=0) const
Returns string representation of the option.
std::vector< isc::asiolink::IOAddress > AddressContainer
a container for (IPv6) addresses
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.
void setAddress(const isc::asiolink::IOAddress &addr)
Sets a single address.
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received data.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Option6AddrLst(uint16_t type, const AddressContainer &addrs)
Constructor used during option generation.
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
Defines the logger used by the top-level component of kea-dhcp-ddns.
virtual 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 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...
void setAddresses(const AddressContainer &addrs)
Sets list of addresses.
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)
static const size_t OPTION6_HDR_LEN
length of any DHCPv6 option header
virtual uint16_t len() const
Returns length of the complete option (data length + DHCPv4/DHCPv6 option header) ...