Kea  1.9.9-git
option6_client_fqdn.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2018 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef OPTION6_CLIENT_FQDN_H
8 #define OPTION6_CLIENT_FQDN_H
9 
10 #include <dhcp/option.h>
11 #include <dns/name.h>
12 
13 #include <string>
14 
15 namespace isc {
16 namespace dhcp {
17 
21 public:
22  InvalidOption6FqdnFlags(const char* file, size_t line, const char* what) :
23  isc::Exception(file, line, what) {}
24 };
25 
28 public:
29  InvalidOption6FqdnDomainName(const char* file, size_t line,
30  const char* what) :
31  isc::Exception(file, line, what) {}
32 };
33 
35 class Option6ClientFqdnImpl;
36 
87 class Option6ClientFqdn : public Option {
88 public:
89 
92 
93  static const uint8_t FLAG_S = 0x01;
94  static const uint8_t FLAG_O = 0x02;
95  static const uint8_t FLAG_N = 0x04;
96 
97 
99  static const uint8_t FLAG_MASK = 0x7;
100 
102  static const uint16_t FLAG_FIELD_LEN = 1;
103 
108  };
109 
119  explicit Option6ClientFqdn(const uint8_t flags,
120  const std::string& domain_name,
121  const DomainNameType domain_name_type = FULL);
122 
129  Option6ClientFqdn(const uint8_t flags);
130 
142  OptionBufferConstIter last);
143 
145  Option6ClientFqdn(const Option6ClientFqdn& source);
146 
148  virtual OptionPtr clone() const;
149 
151  virtual ~Option6ClientFqdn();
152 
155 
168  bool getFlag(const uint8_t flag) const;
169 
182  void setFlag(const uint8_t flag, const bool set);
183 
185  void resetFlags();
186 
194  std::string getDomainName() const;
195 
201  void packDomainName(isc::util::OutputBuffer& buf) const;
202 
208  void setDomainName(const std::string& domain_name,
209  const DomainNameType domain_name_type);
210 
215  void resetDomainName();
216 
223 
227  virtual void pack(isc::util::OutputBuffer& buf) const;
228 
239  virtual void unpack(OptionBufferConstIter first,
240  OptionBufferConstIter last);
241 
250  virtual std::string toText(int indent = 0) const;
251 
256  virtual uint16_t len() const;
257 
258 private:
259 
261  Option6ClientFqdnImpl* impl_;
262 };
263 
265 typedef boost::shared_ptr<Option6ClientFqdn> Option6ClientFqdnPtr;
266 
267 } // namespace isc::dhcp
268 } // namespace isc
269 
270 #endif // OPTION6_CLIENT_FQDN_H
static const uint8_t FLAG_N
N bit.
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).
std::string getDomainName() const
Returns the domain-name in the text format.
static const uint8_t FLAG_O
O bit.
InvalidOption6FqdnFlags(const char *file, size_t line, const char *what)
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
Definition: option.h:36
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.
Option6ClientFqdn & operator=(const Option6ClientFqdn &source)
Assignment operator.
bool getFlag(const uint8_t flag) const
Checks if the specified flag of the DHCPv6 Client FQDN Option is set.
boost::shared_ptr< Option6ClientFqdn > Option6ClientFqdnPtr
A pointer to the Option6ClientFqdn object.
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.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Definition: buffer.h:294
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
Definition: option.h:30
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.
virtual OptionPtr clone() const
Copies this option and returns a pointer to the copy.
static const uint8_t FLAG_S
S bit.
DomainNameType
Type of the domain-name: partial or full.
InvalidOption6FqdnDomainName(const char *file, size_t line, const char *what)
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.