Kea 3.3.3
option6_client_fqdn.h
Go to the documentation of this file.
1// Copyright (C) 2013-2026 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 <cstdint>
14#include <string>
15
16namespace isc {
17namespace dhcp {
18
22public:
23 InvalidOption6FqdnFlags(const char* file, size_t line, const char* what) :
24 isc::Exception(file, line, what) {}
25};
26
29public:
30 InvalidOption6FqdnDomainName(const char* file, size_t line,
31 const char* what) :
32 isc::Exception(file, line, what) {}
33};
34
36class Option6ClientFqdnImpl;
37
88class Option6ClientFqdn : public Option {
89public:
90
93
94 static const uint8_t FLAG_S = 0x01;
95 static const uint8_t FLAG_O = 0x02;
96 static const uint8_t FLAG_N = 0x04;
98
100 static const uint8_t FLAG_MASK = 0x7;
101
103 static const uint16_t FLAG_FIELD_LEN = 1;
104
106 enum DomainNameType : uint16_t {
109 };
110
120 explicit Option6ClientFqdn(const uint8_t flags,
121 const std::string& domain_name,
122 const DomainNameType domain_name_type = FULL);
123
130 Option6ClientFqdn(const uint8_t flags);
131
144
147
149 virtual OptionPtr clone() const;
150
152 virtual ~Option6ClientFqdn();
153
156
169 bool getFlag(const uint8_t flag) const;
170
183 void setFlag(const uint8_t flag, const bool set);
184
186 void resetFlags();
187
195 std::string getDomainName() const;
196
203
209 void setDomainName(const std::string& domain_name,
210 const DomainNameType domain_name_type);
211
216 void resetDomainName();
217
224
229 virtual void pack(isc::util::OutputBuffer& buf, bool check = true) const;
230
241 virtual void unpack(OptionBufferConstIter first,
243
252 virtual std::string toText(int indent = 0) const;
253
258 virtual uint16_t len() const;
259
260private:
261
264};
265
267typedef boost::shared_ptr<Option6ClientFqdn> Option6ClientFqdnPtr;
268
269} // namespace isc::dhcp
270} // namespace isc
271
272#endif // OPTION6_CLIENT_FQDN_H
Exception(const char *file, size_t line, const char *what)
Constructor for a given type for exceptions with file name and file line number.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
InvalidOption6FqdnDomainName(const char *file, size_t line, const char *what)
InvalidOption6FqdnFlags(const char *file, size_t line, const char *what)
Implements the logic for the Option6ClientFqdn class.
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.
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.
DomainNameType
Type of the domain-name: partial or full.
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.
Option(Universe u, uint16_t type)
ctor, used for options constructed, usually during transmission
Definition option.cc:39
void check() const
A protected method used for option correctness.
Definition option.cc:90
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Definition buffer.h:355
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
Definition option.h:31
boost::shared_ptr< Option6ClientFqdn > Option6ClientFqdnPtr
A pointer to the Option6ClientFqdn object.
boost::shared_ptr< Option > OptionPtr
Definition option.h:38
Defines the logger used by the top-level component of kea-lfc.