42 if ( (distance(first, last) % V4ADDRESS_LEN) ) {
44 <<
" has invalid length=" << distance(first, last)
45 <<
", must be divisible by 4.");
48 while (first != last) {
49 const uint8_t* ptr = &(*first);
51 first += V4ADDRESS_LEN;
62 return (cloneInternal<Option4AddrLst>());
69 <<
"At most 255 bytes are supported.");
72 buf.writeUint8(
type_);
75 AddressContainer::const_iterator addr =
addrs_.begin();
77 while (addr !=
addrs_.end()) {
78 buf.writeUint32(addr->toUint32());
86 <<
"Option4AddrLst option");
96 for (
auto const& addr : addrs) {
104 <<
"Option4AddrLst option");
115 std::stringstream output;
118 for (
auto const& addr :
addrs_) {
119 output <<
" " << addr;
122 return (output.str());
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
A generic exception that is thrown if a parameter given to a method would refer to or modify out-of-r...
The IOAddress class represents an IP addresses (version agnostic)
bool isV4() const
Convenience function to check for an IPv4 address.
std::vector< isc::asiolink::IOAddress > AddressContainer
Defines a collection of IPv4 addresses.
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
Option4AddrLst(uint8_t type)
Constructor, creates an option with empty list of addresses.
void setAddresses(const AddressContainer &addrs)
Sets addresses list.
void setAddress(const isc::asiolink::IOAddress &addr)
Clears address list and sets a single address.
AddressContainer addrs_
contains list of addresses
virtual std::string toText(int indent=0) const
Returns string representation of the option.
virtual uint16_t len() const
Returns length of the complete option (data length + DHCPv4/DHCPv6 option header)
void addAddress(const isc::asiolink::IOAddress &addr)
Adds address to existing list of addresses.
virtual void pack(isc::util::OutputBuffer &buf, bool check=true) const
Writes option in a wire-format to a buffer.
uint16_t type_
option type (0-255 for DHCPv4, 0-65535 for DHCPv6)
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)
void check() const
A protected method used for option correctness.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
boost::shared_ptr< Option > OptionPtr
uint32_t readUint32(void const *const buffer, size_t const length)
uint32_t wrapper over readUint.
Defines the logger used by the top-level component of kea-lfc.