17#include <unordered_set>
87 uint16_t service_priority,
88 const std::string& adn,
90 const std::string& svc_params);
178 return (minimal_length_);
183 return (addr_length_size_);
188 return (dnr_instance_data_length_size_);
193 return (adn_length_size_);
200 return (log_prefix_);
219 void setAdn(
const std::string& adn);
344 boost::shared_ptr<isc::dns::Name>
adn_;
391 uint8_t dnr_instance_data_length_size_;
394 uint8_t adn_length_size_;
397 uint8_t addr_length_size_;
406 uint8_t minimal_length_;
409 std::string log_prefix_;
507 std::string
toText(
int indent = 0)
const override;
513 uint16_t
len()
const override;
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.
The IOAddress class represents an IP addresses (version agnostic)
Represents DNR Instance which is used both in DHCPv4 and DHCPv6 Encrypted DNS Option.
Option::Universe universe_
Either V4 or V6 Option universe.
std::vector< isc::asiolink::IOAddress > AddressContainer
A Type defined for container holding IP addresses.
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_.
void setAdnOnlyMode(bool adn_only_mode)
Setter of the adn_only_mode_ field.
uint16_t getAddrLength() const
Getter of the addr_length_.
uint16_t dnr_instance_data_length_
Length of all following data inside this DNR instance in octets.
uint16_t getDnrInstanceDataLength() const
Getter of the dnr_instance_data_length_.
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.
uint8_t getAdnLengthSize() const
Returns size in octets of ADN Length field.
void unpackDnrInstanceDataLength(OptionBufferConstIter &begin, OptionBufferConstIter end)
Unpacks DNR Instance Data Length from wire data buffer and stores it in dnr_instance_data_length_.
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.
virtual void unpackAddresses(OptionBufferConstIter &begin, OptionBufferConstIter end)
Unpacks IP address(es) from wire data and stores it/them in ip_addresses_.
uint8_t getAddrLengthSize() const
Returns size in octets of Addr Length field.
uint16_t svc_params_length_
Length of Service Parameters field in octets.
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 checkSvcParams(bool from_wire_data=true)
Checks SvcParams field if encoded correctly and throws in case of issue found.
void packSvcParams(isc::util::OutputBuffer &buf) const
Writes the Service Parameters in the wire format into a buffer.
bool isAdnOnlyMode() const
Returns whether ADN only mode is enabled or disabled.
uint16_t getSvcParamsLength() const
Getter of the svc_params_length_.
virtual void packAddresses(isc::util::OutputBuffer &buf) const
Writes the IP address(es) in the wire format into a buffer.
std::string getAdnAsText() const
Returns the Authentication domain name in the text format.
std::string getLogPrefix() const
Returns Log prefix depending on V4/V6 Option universe.
uint16_t getServicePriority() const
Getter of the service_priority_.
const std::string & getSvcParams() const
Getter of the svc_params_ field.
static const std::unordered_set< std::string > FORBIDDEN_SVC_PARAMS
Set of forbidden SvcParams.
void checkFields()
Checks IP address(es) field if data is correct and throws in case of issue found.
bool adn_only_mode_
Flag stating whether ADN only mode is used or not.
void setAdn(const std::string &adn)
Sets Authentication domain name from given string.
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.
virtual ~DnrInstance()=default
Default destructor.
void addIpAddress(const asiolink::IOAddress &ip_address)
Adds IP address to ip_addresses_ container.
uint16_t getAdnLength() const
Getter of the adn_length_.
void unpackAdn(OptionBufferConstIter &begin, OptionBufferConstIter end)
Unpacks the ADN from given wire data buffer and stores it in adn_ field.
static const uint8_t SERVICE_PRIORITY_SIZE
Size in octets of Service Priority field.
uint8_t getDnrInstanceDataLengthSize() const
Returns size in octets of DNR Instance Data Length field.
boost::shared_ptr< isc::dns::Name > adn_
Authentication domain name field of variable length.
std::string svc_params_
Service Parameters (SvcParams) (variable length).
DnrInstance(Option::Universe universe)
Constructor of the empty DNR Instance.
AddressContainer getAddresses() const
Returns vector with addresses.
Exception thrown when invalid domain name is specified.
InvalidOptionDnrDomainName(const char *file, size_t line, const char *what)
Exception thrown when Service parameters have wrong format.
InvalidOptionDnrSvcParams(const char *file, size_t line, const char *what)
Represents DHCPv4 Encrypted DNS Option (code 162).
std::vector< DnrInstance > DnrInstanceContainer
A Type defined for container holding DNR Instances.
OptionPtr clone() const override
Copies this option and returns a pointer to the copy.
void addDnrInstance(DnrInstance &dnr_instance)
Adds given DNR instance to Option's DNR Instance container.
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.
DnrInstanceContainer dnr_instances_
Container holding DNR Instances.
const DnrInstanceContainer & getDnrInstances() const
Getter of the dnr_instances_ field.
uint16_t len() const override
Returns length of the complete option (data length + DHCPv4/DHCPv6 option header)
void pack(util::OutputBuffer &buf, bool check=true) const override
Writes option in wire-format to a buffer.
Option4Dnr()
Constructor of the empty Option.
Universe
defines option universe DHCPv4 or DHCPv6
void check() const
A protected method used for option correctness.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
boost::shared_ptr< Option4Dnr > Option4DnrPtr
A pointer to the OptionDnr4 object.
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
boost::shared_ptr< Option > OptionPtr
Defines the logger used by the top-level component of kea-lfc.