23 return (cloneInternal<Option6Dnr>());
45 if (!address.isV6()) {
47 << address.toText() <<
" is not an IPv6 address");
50 buf.
writeData(&address.toBytes()[0], V6ADDRESS_LEN);
58 <<
"data truncated to size " << std::distance(begin, end));
85 std::ostringstream stream;
86 std::string in(indent,
' ');
87 stream << in <<
"type=" <<
type_ <<
"(V6_DNR), "
89 return (stream.str());
101 " ADN field, there should be at least "
102 "2 bytes long Addr Length field");
111 <<
"Addr Len=" <<
addr_length_ <<
" is not divisible by 16");
120 <<
" but it must contain at least one valid IP address");
126 <<
" but IPv6 address(es) are truncated to len="
127 << std::distance(begin, end));
132 while (begin != addr_end) {
137 <<
" - " << ex.
what());
140 begin += V6ADDRESS_LEN;
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
A generic exception that is thrown if a parameter given to a method would refer to or modify out-of-r...
static IOAddress fromBytes(short family, const uint8_t *data)
Creates an address from over wire data.
Represents DNR Instance which is used both in DHCPv4 and DHCPv6 Encrypted DNS Option.
std::string getDnrInstanceAsText() const
Returns string representation of the DNR instance.
void unpackSvcParams(OptionBufferConstIter &begin, OptionBufferConstIter end)
Unpacks Service Parameters from wire data buffer and stores it in svc_params_.
uint8_t getMinimalLength() const
Returns minimal length of the DNR instance data (without headers) in octets.
AddressContainer ip_addresses_
Vector container holding one or more IP addresses.
void packAdn(isc::util::OutputBuffer &buf) const
Writes the ADN FQDN in the wire format into a buffer.
uint16_t addr_length_
Length of included IP addresses in octets.
uint8_t getAddrLengthSize() const
Returns size in octets of Addr Length field.
void unpackServicePriority(OptionBufferConstIter &begin)
Unpacks Service Priority from wire data buffer and stores it in service_priority_.
uint16_t service_priority_
The priority of this instance compared to other DNR instances.
void packSvcParams(isc::util::OutputBuffer &buf) const
Writes the Service Parameters in the wire format into a buffer.
std::string getLogPrefix() const
Returns Log prefix depending on V4/V6 Option universe.
bool adn_only_mode_
Flag stating whether ADN only mode is used or not.
uint16_t adn_length_
Length of the authentication-domain-name data in octets.
uint16_t dnrInstanceLen() const
Calculates and returns length of DNR Instance data in octets.
void unpackAdn(OptionBufferConstIter &begin, OptionBufferConstIter end)
Unpacks the ADN from given wire data buffer and stores it in adn_ field.
uint16_t len() const override
Returns length of the complete option (data length + DHCPv4/DHCPv6 option header)
void packAddresses(isc::util::OutputBuffer &buf) const override
Writes the IP address(es) in the wire format into a buffer.
void unpackAddresses(OptionBufferConstIter &begin, OptionBufferConstIter end) override
Unpacks IP address(es) from wire data and stores it/them in ip_addresses_.
std::string toText(int indent=0) const override
Returns string representation of the option.
void unpack(OptionBufferConstIter begin, OptionBufferConstIter end) override
Parses received wire data buffer.
void pack(util::OutputBuffer &buf, bool check=false) const override
Writes option in wire-format to a buffer.
OptionPtr clone() const override
Copies this option and returns a pointer to the copy.
Option6Dnr(OptionBufferConstIter begin, OptionBufferConstIter end)
Constructor of the Option from on-wire data.
uint16_t type_
option type (0-255 for DHCPv4, 0-65535 for DHCPv6)
virtual uint16_t getHeaderLen() const
Returns length of header (2 for v4, 4 for v6)
static const size_t OPTION6_HDR_LEN
length of any DHCPv6 option header
void setData(InputIterator first, InputIterator last)
Sets content of this option from buffer.
void packHeader(isc::util::OutputBuffer &buf, bool check=true) const
Store option's header in a buffer.
void check() const
A protected method used for option correctness.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
void writeUint16(uint16_t data)
Write an unsigned 16-bit integer in host byte order into the buffer in network byte order.
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.
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
boost::shared_ptr< Option > OptionPtr
uint16_t readUint16(const void *buffer, size_t length)
Read Unsigned 16-Bit Integer from Buffer.
Defines the logger used by the top-level component of kea-lfc.