Kea 2.5.8
cfg_duid.h
Go to the documentation of this file.
1// Copyright (C) 2015-2020 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 CFG_DUID_H
8#define CFG_DUID_H
9
10#include <dhcp/duid.h>
11#include <cc/cfg_to_element.h>
12#include <cc/user_context.h>
13#include <boost/shared_ptr.hpp>
14#include <stdint.h>
15#include <vector>
16
17namespace isc {
18namespace dhcp {
19
31public:
32
34 CfgDUID();
35
38 return (type_);
39 }
40
42 void setType(const DUID::DUIDType& type) {
43 type_ = type;
44 }
45
55 std::vector<uint8_t> getIdentifier() const {
56 return (identifier_);
57 }
58
63 void setIdentifier(const std::string& identifier_as_hex);
64
66 uint16_t getHType() const {
67 return (htype_);
68 }
69
71 void setHType(const uint16_t htype) {
72 htype_ = htype;
73 }
74
76 uint32_t getTime() const {
77 return (time_);
78 }
79
81 void setTime(const uint32_t new_time) {
82 time_ = new_time;
83 }
84
86 uint32_t getEnterpriseId() const {
87 return (enterprise_id_);
88 }
89
93 void setEnterpriseId(const uint32_t enterprise_id) {
94 enterprise_id_ = enterprise_id;
95 }
96
101 bool persist() const {
102 return (persist_);
103 }
104
109 void setPersist(const bool persist) {
110 persist_ = persist;
111 }
112
120 DuidPtr create(const std::string& duid_file_path);
121
125 virtual isc::data::ElementPtr toElement() const;
126
130 const DuidPtr getCurrentDuid() const {
131 return (current_duid_);
132 }
133
134private:
135
137 DUID::DUIDType type_;
138
140 std::vector<uint8_t> identifier_;
141
143 uint16_t htype_;
144
146 uint32_t time_;
147
149 uint32_t enterprise_id_;
150
153 bool persist_;
154
155 DuidPtr current_duid_;
156};
157
159
160
161typedef boost::shared_ptr<CfgDUID> CfgDUIDPtr;
162
164typedef boost::shared_ptr<const CfgDUID> ConstCfgDUIDPtr;
165
167
168}
169}
170
171#endif // CFG_DUID_H
Holds manual configuration of the server identifier (DUID).
Definition: cfg_duid.h:30
void setPersist(const bool persist)
Sets a boolean flag indicating if the server identifier should be stored on the disk (if true) or not...
Definition: cfg_duid.h:109
std::vector< uint8_t > getIdentifier() const
Returns identifier.
Definition: cfg_duid.h:55
CfgDUID()
Constructor.
Definition: cfg_duid.cc:25
DUID::DUIDType getType() const
Returns DUID type.
Definition: cfg_duid.h:37
void setEnterpriseId(const uint32_t enterprise_id)
Sets new enterprise id.
Definition: cfg_duid.h:93
void setTime(const uint32_t new_time)
Sets new time for DUID-LLT.
Definition: cfg_duid.h:81
void setIdentifier(const std::string &identifier_as_hex)
Sets new identifier as hex string.
Definition: cfg_duid.cc:31
DuidPtr create(const std::string &duid_file_path)
Creates instance of a DUID from the current configuration.
Definition: cfg_duid.cc:55
uint32_t getEnterpriseId() const
Returns enterprise id for the DUID-EN.
Definition: cfg_duid.h:86
void setHType(const uint16_t htype)
Sets new hardware type for DUID-LLT and DUID-LL.
Definition: cfg_duid.h:71
const DuidPtr getCurrentDuid() const
Fetches the duid created by create()
Definition: cfg_duid.h:130
uint32_t getTime() const
Returns time for the DUID-LLT.
Definition: cfg_duid.h:76
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition: cfg_duid.cc:86
uint16_t getHType() const
Returns hardware type for DUID-LLT and DUID-LL.
Definition: cfg_duid.h:66
bool persist() const
Checks if server identifier should be stored on disk.
Definition: cfg_duid.h:101
void setType(const DUID::DUIDType &type)
Sets DUID type.
Definition: cfg_duid.h:42
DUIDType
specifies DUID type
Definition: duid.h:158
boost::shared_ptr< Element > ElementPtr
Definition: data.h:28
boost::shared_ptr< CfgDUID > CfgDUIDPtr
Pointer to the Non-const object.
Definition: cfg_duid.h:161
boost::shared_ptr< const CfgDUID > ConstCfgDUIDPtr
Pointer to the const object.
Definition: cfg_duid.h:164
boost::shared_ptr< DUID > DuidPtr
Definition: duid.h:136
Defines the logger used by the top-level component of kea-lfc.
Abstract class for configuration Cfg_* classes.
Base class for user context.
Definition: user_context.h:22