Kea  1.5.0
cfg_duid.h
Go to the documentation of this file.
1 // Copyright (C) 2015-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 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 
17 namespace isc {
18 namespace dhcp {
19 
31 public:
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 
117  DuidPtr create(const std::string& duid_file_path) const;
118 
122  virtual isc::data::ElementPtr toElement() const;
123 
124 private:
125 
127  DUID::DUIDType type_;
128 
130  std::vector<uint8_t> identifier_;
131 
133  uint16_t htype_;
134 
136  uint32_t time_;
137 
139  uint32_t enterprise_id_;
140 
143  bool persist_;
144 };
145 
147 
148 typedef boost::shared_ptr<CfgDUID> CfgDUIDPtr;
150 
152 typedef boost::shared_ptr<const CfgDUID> ConstCfgDUIDPtr;
153 
155 
156 }
157 }
158 
159 #endif // CFG_DUID_H
DuidPtr create(const std::string &duid_file_path) const
Creates instance of a DUID from the current configuration.
Definition: cfg_duid.cc:55
boost::shared_ptr< DUID > DuidPtr
Definition: duid.h:20
std::vector< uint8_t > getIdentifier() const
Returns identifier.
Definition: cfg_duid.h:55
uint16_t getHType() const
Returns hardware type for DUID-LLT and DUID-LL.
Definition: cfg_duid.h:66
Base class for user context.
Definition: user_context.h:22
boost::shared_ptr< Element > ElementPtr
Definition: data.h:20
bool persist() const
Checks if server identifier should be stored on disk.
Definition: cfg_duid.h:101
boost::shared_ptr< const CfgDUID > ConstCfgDUIDPtr
Pointer to the const object.
Definition: cfg_duid.h:152
void setType(const DUID::DUIDType &type)
Sets DUID type.
Definition: cfg_duid.h:42
void setHType(const uint16_t htype)
Sets new hardware type for DUID-LLT and DUID-LL.
Definition: cfg_duid.h:71
DUIDType
specifies DUID type
Definition: duid.h:38
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition: cfg_duid.cc:80
Abstract class for configuration Cfg_* classes.
CfgDUID()
Constructor.
Definition: cfg_duid.cc:25
void setTime(const uint32_t new_time)
Sets new time for DUID-LLT.
Definition: cfg_duid.h:81
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
void setEnterpriseId(const uint32_t enterprise_id)
Sets new enterprise id.
Definition: cfg_duid.h:93
uint32_t getTime() const
Returns time for the DUID-LLT.
Definition: cfg_duid.h:76
Defines the logger used by the top-level component of kea-dhcp-ddns.
boost::shared_ptr< CfgDUID > CfgDUIDPtr
Pointer to the Non-const object.
Definition: cfg_duid.h:149
uint32_t getEnterpriseId() const
Returns enterprise id for the DUID-EN.
Definition: cfg_duid.h:86
DUID::DUIDType getType() const
Returns DUID type.
Definition: cfg_duid.h:37
void setIdentifier(const std::string &identifier_as_hex)
Sets new identifier as hex string.
Definition: cfg_duid.cc:31
Holds manual configuration of the server identifier (DUID).
Definition: cfg_duid.h:30