46                          const std::string& domain_name,
 
   87    static void checkFlags(
const uint8_t flags, 
const bool check_mbz);
 
 
  102                      const std::string& domain_name,
 
 
  134        domain_name_.reset(new isc::dns::Name(*source.domain_name_));
 
 
  173                      "fully qualified domain-name must not be empty" 
  174                      << 
" when setting new domain-name for DHCPv6 Client" 
  187                      << domain_name << 
"' when setting new domain-name for" 
  188                      << 
" DHCPv6 Client FQDN Option");
 
 
  201                  "invalid DHCPv6 Client FQDN Option flags: 0x" 
  202                  << std::hex << 
static_cast<int>(flags) << std::dec);
 
  210                  "both N and S flag of the DHCPv6 Client FQDN Option are set." 
  211                  << 
" According to RFC 4704, if the N bit is 1 the S bit" 
 
  226                  << 
", got option with size " << std::distance(first, last));
 
  233    if (std::distance(first, last) > 0) {
 
  237        if (*(last - 1) != 0) {
 
  248                              "partial domain-name from wire format");
 
  251                              "partial domain-name from wire format");
 
  262                                            std::distance(first, last));
 
  268                              "fully qualified domain-name from wire format");
 
  271                              "fully qualified domain-name from wire format");
 
 
  286                                     const std::string& domain_name,
 
 
  330                  << 
" Option flag specified, expected N, S or O");
 
  333    return ((impl_->flags_ & flag) != 0);
 
 
  342    if (((flag & ~
FLAG_MASK) != 0) || (flag == 0)) {
 
  344                  << 
" Option flag 0x" << std::hex
 
  345                  << 
static_cast<int>(flag) << std::dec
 
  346                  << 
" is being set. Expected: N, S or O");
 
  351    uint8_t new_flag = impl_->flags_;
 
  360    impl_->flags_ = new_flag;
 
 
  370    if (impl_->domain_name_) {
 
  371        return (impl_->domain_name_->toText(impl_->domain_name_type_ ==
 
 
  382    if (!impl_->domain_name_) {
 
  391        if (impl_->domain_name_type_ == 
PARTIAL) {
 
 
  401    impl_->setDomainName(domain_name, domain_name_type);
 
 
  411    return (impl_->domain_name_type_);
 
 
  428    impl_->parseWireData(first, last);
 
  432    impl_->checkFlags(impl_->flags_, 
false);
 
 
  437    std::ostringstream stream;
 
  438    std::string in(indent, 
' '); 
 
  439    stream << in  << 
"type=" << 
type_ << 
"(CLIENT_FQDN), " 
  448    return (stream.str());
 
 
  453    uint16_t domain_name_length = 0;
 
  454    if (impl_->domain_name_) {
 
  457        domain_name_length = impl_->domain_name_type_ == 
FULL ?
 
  458            impl_->domain_name_->getLength() :
 
  459            impl_->domain_name_->getLength() - 1;
 
 
This is a base class for exceptions thrown from the DNS library module.
A generic exception that is thrown if a parameter given to a method would refer to or modify out-of-r...
Exception thrown when invalid domain name is specified.
Exception thrown when invalid flags have been specified for DHCPv6 Client Fqdn Option.
Implements the logic for the Option6ClientFqdn class.
Option6ClientFqdnImpl & operator=(const Option6ClientFqdnImpl &source)
Assignment operator.
boost::shared_ptr< isc::dns::Name > domain_name_
Holds the pointer to a domain name carried in the option.
uint8_t flags_
Holds flags carried by the option.
Option6ClientFqdn::DomainNameType domain_name_type_
Indicates whether domain name is partial or fully qualified.
void setDomainName(const std::string &domain_name, const Option6ClientFqdn::DomainNameType name_type)
Set a new domain name for the option.
void parseWireData(OptionBufferConstIter first, OptionBufferConstIter last)
Parse the Option provided in the wire format.
Option6ClientFqdnImpl(const uint8_t flags, const std::string &domain_name, const Option6ClientFqdn::DomainNameType name_type)
Constructor, from domain name.
static void checkFlags(const uint8_t flags, const bool check_mbz)
Check if flags are valid.
Represents DHCPv6 Client FQDN Option (code 39).
void resetFlags()
Sets the flag field value to 0.
static const uint8_t FLAG_S
S bit.
static const uint8_t FLAG_N
N bit.
DomainNameType getDomainNameType() const
Returns enumerator value which indicates whether domain-name is partial or full.
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
static const uint16_t FLAG_FIELD_LEN
The length of the flag field within DHCPv6 Client Fqdn Option.
void setDomainName(const std::string &domain_name, const DomainNameType domain_name_type)
Set new domain-name.
void resetDomainName()
Set empty domain-name.
static const uint8_t FLAG_O
O bit.
static const uint8_t FLAG_MASK
Mask which zeroes MBZ flag bits.
virtual uint16_t len() const
Returns length of the complete option (data length + DHCPv6 option header).
virtual void unpack(OptionBufferConstIter first, OptionBufferConstIter last)
Parses option from the received buffer.
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.
std::string getDomainName() const
Returns the domain-name in the text format.
DomainNameType
Type of the domain-name: partial or full.
virtual void pack(isc::util::OutputBuffer &buf, bool check=true) const
Writes option in the wire format into a buffer.
Option6ClientFqdn & operator=(const Option6ClientFqdn &source)
Assignment operator.
void packDomainName(isc::util::OutputBuffer &buf) const
Writes domain-name in the wire format into a buffer.
virtual std::string toText(int indent=0) const
Returns string representation of the option.
bool getFlag(const uint8_t flag) const
Checks if the specified flag of the DHCPv6 Client FQDN Option is set.
virtual ~Option6ClientFqdn()
Destructor.
void setFlag(const uint8_t flag, const bool set)
Modifies the value of the specified DHCPv6 Client Fqdn Option flag.
uint16_t type_
option type (0-255 for DHCPv4, 0-65535 for DHCPv6)
static bool lenient_parsing_
Governs whether options should be parsed less strictly.
virtual uint16_t getHeaderLen() const
Returns length of header (2 for v4, 4 for v6)
Option & operator=(const Option &rhs)
Assignment operator.
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.
Option(Universe u, uint16_t type)
ctor, used for options constructed, usually during transmission
Exception thrown during option unpacking This exception is thrown when an error has occurred unpackin...
Light-weight Accessor to Name data.
const uint8_t * getData(size_t *len) const
Return the wire-format data for this LabelSequence.
size_t getDataLength() const
Return the length of the wire-format data of this LabelSequence.
The Name class encapsulates DNS names.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
void writeUint8(uint8_t data)
Write an unsigned 8-bit integer into the buffer.
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
std::vector< uint8_t > OptionBuffer
buffer types used in DHCP code.
boost::shared_ptr< Option > OptionPtr
string trim(const string &input)
Trim leading and trailing spaces.
Defines the logger used by the top-level component of kea-lfc.