47 const std::string& domain_name,
88 static void checkFlags(
const uint8_t flags,
const bool check_mbz);
103 const std::string& domain_name,
112 domain_name_type_(name_type) {
131 : flags_(source.flags_),
133 domain_name_type_(source.domain_name_type_) {
174 "fully qualified domain-name must not be empty"
175 <<
" when setting new domain-name for DHCPv6 Client"
188 << domain_name <<
"' when setting new domain-name for"
189 <<
" DHCPv6 Client FQDN Option");
202 "invalid DHCPv6 Client FQDN Option flags: 0x"
203 << std::hex << static_cast<int>(flags) << std::dec);
211 "both N and S flag of the DHCPv6 Client FQDN Option are set."
212 <<
" According to RFC 4704, if the N bit is 1 the S bit"
227 <<
", got option with size " << std::distance(first, last));
234 if (std::distance(first, last) > 0) {
238 if (*(last - 1) != 0) {
248 "partial domain-name from wire format");
258 std::distance(first, last));
263 "fully qualified domain-name from wire format");
277 const std::string& domain_name,
300 return (cloneInternal<Option6ClientFqdn>());
321 <<
" Option flag specified, expected N, S or O");
324 return ((impl_->
flags_ & flag) != 0);
333 if (((flag & ~
FLAG_MASK) != 0) || (flag == 0)) {
335 <<
" Option flag 0x" << std::hex
336 << static_cast<int>(flag) << std::dec
337 <<
" is being set. Expected: N, S or O");
342 uint8_t new_flag = impl_->
flags_;
381 const uint8_t* data = labels.
getData(&read_len);
428 std::ostringstream stream;
429 std::string in(indent,
' ');
430 stream << in <<
"type=" <<
type_ <<
"(CLIENT_FQDN)" <<
", "
439 return (stream.str());
444 uint16_t domain_name_length = 0;
static const uint8_t FLAG_N
N bit.
The Name class encapsulates DNS names.
Option6ClientFqdnImpl(const uint8_t flags, const std::string &domain_name, const Option6ClientFqdn::DomainNameType name_type)
Constructor, from domain name.
Option6ClientFqdn(const uint8_t flags, const std::string &domain_name, const DomainNameType domain_name_type=FULL)
Constructor, creates option instance using flags and domain name.
virtual void unpack(OptionBufferConstIter first, OptionBufferConstIter last)
Parses option from the received buffer.
virtual void pack(isc::util::OutputBuffer &buf) const
Writes option in the wire format into a buffer.
Represents DHCPv6 Client FQDN Option (code 39).
void packHeader(isc::util::OutputBuffer &buf) const
Store option's header in a buffer.
void parseWireData(OptionBufferConstIter first, OptionBufferConstIter last)
Parse the Option provided in the wire format.
std::string getDomainName() const
Returns the domain-name in the text format.
static const uint8_t FLAG_O
O bit.
static const uint16_t FLAG_FIELD_LEN
The length of the flag field within DHCPv6 Client Fqdn Option.
virtual uint16_t len() const
Returns length of the complete option (data length + DHCPv6 option header).
boost::shared_ptr< Option > OptionPtr
virtual uint16_t getHeaderLen() const
Returns length of header (2 for v4, 4 for v6)
std::vector< uint8_t > OptionBuffer
buffer types used in DHCP code.
static const uint8_t FLAG_MASK
Mask which zeroes MBZ flag bits.
void setDomainName(const std::string &domain_name, const DomainNameType domain_name_type)
Set new domain-name.
virtual std::string toText(int indent=0) const
Returns string representation of the option.
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.
Option6ClientFqdn & operator=(const Option6ClientFqdn &source)
Assignment operator.
boost::shared_ptr< isc::dns::Name > domain_name_
Holds the pointer to a domain name carried in the option.
Option6ClientFqdnImpl & operator=(const Option6ClientFqdnImpl &source)
Assignment operator.
bool getFlag(const uint8_t flag) const
Checks if the specified flag of the DHCPv6 Client FQDN Option is set.
size_t getDataLength() const
Return the length of the wire-format data of this LabelSequence.
void setDomainName(const std::string &domain_name, const Option6ClientFqdn::DomainNameType name_type)
Set a new domain name for the option.
static void checkFlags(const uint8_t flags, const bool check_mbz)
Check if flags are valid.
Implements the logic for the Option6ClientFqdn class.
Exception thrown when invalid flags have been specified for DHCPv6 Client Fqdn Option.
void resetFlags()
Sets the flag field value to 0.
virtual ~Option6ClientFqdn()
Destructor.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-dhcp-ddns.
Option6ClientFqdn::DomainNameType domain_name_type_
Indicates whether domain name is partial or fully qualified.
uint8_t flags_
Holds flags carried by the option.
const uint8_t * getData(size_t *len) const
Return the wire-format data for this LabelSequence.
Option & operator=(const Option &rhs)
Assignment operator.
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
static const uint8_t FLAG_S
S bit.
void writeUint8(uint8_t data)
Write an unsigned 8-bit integer into the buffer.
A generic exception that is thrown if a parameter given to a method would refer to or modify out-of-r...
DomainNameType
Type of the domain-name: partial or full.
string trim(const string &instring)
Trim Leading and Trailing Spaces.
uint16_t type_
option type (0-255 for DHCPv4, 0-65535 for DHCPv6)
void setData(InputIterator first, InputIterator last)
Sets content of this option from buffer.
void resetDomainName()
Set empty domain-name.
void setFlag(const uint8_t flag, const bool set)
Modifies the value of the specified DHCPv6 Client Fqdn Option flag.
void packDomainName(isc::util::OutputBuffer &buf) const
Writes domain-name in the wire format into a buffer.
Exception thrown when invalid domain name is specified.
DomainNameType getDomainNameType() const
Returns enumerator value which indicates whether domain-name is partial or full.
Light-weight Accessor to Name data.