 |
Kea
1.5.0
|
Go to the documentation of this file.
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());
virtual std::string toText(int indent=0) const
Returns string representation of the option.
uint16_t type_
option type (0-255 for DHCPv4, 0-65535 for DHCPv6)
The IOAddress class represents an IP addresses (version agnostic)
void pack(isc::util::OutputBuffer &buf) const
Assembles on-wire form of this option.
void writeUint16(uint16_t data)
Write an unsigned 16-bit integer in host byte order into the buffer in network byte order.
bool isV6() const
Convenience function to check for an IPv6 address.
Defines the logger used by the top-level component of kea-dhcp-ddns.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
void setAddresses(const AddressContainer &addrs)
Sets list of addresses.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
static IOAddress fromBytes(short family, const uint8_t *data)
Creates an address from over wire data.
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end)
Parses received data.
Option6AddrLst(uint16_t type, const AddressContainer &addrs)
Constructor used during option generation.
void setAddress(const isc::asiolink::IOAddress &addr)
Sets a single address.
virtual uint16_t len() const
Returns length of the complete option (data length + DHCPv4/DHCPv6 option header)
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 writeData(const void *data, size_t len)
Copy an arbitrary length of data into the buffer.
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.
virtual uint16_t getHeaderLen() const
Returns length of header (2 for v4, 4 for v6)
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
static const size_t OPTION6_HDR_LEN
length of any DHCPv6 option header
std::vector< isc::asiolink::IOAddress > AddressContainer
a container for (IPv6) addresses