20 bool convenient_notation)
49 if (!address.isV6()) {
51 << address.toText() <<
" is not an IPv6 address");
54 buf.
writeData(&address.toBytes()[0], V6ADDRESS_LEN);
60 if (convenient_notation_) {
62 std::string config_txt = std::string(begin, end);
67 <<
"data truncated to size " << std::distance(begin, end));
95 std::ostringstream stream;
96 std::string in(indent,
' ');
97 stream << in <<
"type=" <<
type_ <<
"(V6_DNR), "
99 return (stream.str());
111 " ADN field, there should be at least "
112 "2 bytes long Addr Length field");
121 <<
"Addr Len=" <<
addr_length_ <<
" is not divisible by 16");
130 <<
" but it must contain at least one valid IP address");
136 <<
" but IPv6 address(es) are truncated to len="
137 << std::distance(begin, end));
142 while (begin != addr_end) {
147 <<
" - " << ex.
what());
150 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_buf_.
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 parseDnrInstanceConfigData(const std::string &config_txt)
Parses a convenient notation of the option data, which may be used in config.
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 addIpAddress(const asiolink::IOAddress &ip_address)
Adds IP address to ip_addresses_ container.
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)
Option6Dnr(OptionBufferConstIter begin, OptionBufferConstIter end, bool convenient_notation=false)
Constructor of the Option from on-wire data.
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.
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.
OptionPtr cloneInternal() const
Copies this option and returns a pointer to the copy.
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(void const *const buffer, size_t const length)
uint16_t wrapper over readUint.
Defines the logger used by the top-level component of kea-lfc.