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
isc::dhcp::CfgDUID::getIdentifier
std::vector< uint8_t > getIdentifier() const
Returns identifier.
Definition: cfg_duid.h:55
isc::dhcp::CfgDUID::create
DuidPtr create(const std::string &duid_file_path) const
Creates instance of a DUID from the current configuration.
Definition: cfg_duid.cc:55
user_context.h
isc::dhcp::CfgDUID::setIdentifier
void setIdentifier(const std::string &identifier_as_hex)
Sets new identifier as hex string.
Definition: cfg_duid.cc:31
isc::dhcp::CfgDUID::getEnterpriseId
uint32_t getEnterpriseId() const
Returns enterprise id for the DUID-EN.
Definition: cfg_duid.h:86
duid.h
isc::dhcp::DuidPtr
boost::shared_ptr< DUID > DuidPtr
Definition: duid.h:20
isc::data::CfgToElement
Abstract class for configuration Cfg_* classes.
Definition: cfg_to_element.h:29
isc::dhcp::CfgDUID::setHType
void setHType(const uint16_t htype)
Sets new hardware type for DUID-LLT and DUID-LL.
Definition: cfg_duid.h:71
isc::data::UserContext
Base class for user context.
Definition: user_context.h:22
isc::dhcp::CfgDUID::CfgDUID
CfgDUID()
Constructor.
Definition: cfg_duid.cc:25
isc::dhcp::CfgDUID::setType
void setType(const DUID::DUIDType &type)
Sets DUID type.
Definition: cfg_duid.h:42
isc::dhcp::CfgDUID::getHType
uint16_t getHType() const
Returns hardware type for DUID-LLT and DUID-LL.
Definition: cfg_duid.h:66
isc::dhcp::CfgDUID::persist
bool persist() const
Checks if server identifier should be stored on disk.
Definition: cfg_duid.h:101
isc::dhcp::CfgDUID::toElement
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition: cfg_duid.cc:80
isc
Defines the logger used by the top-level component of kea-dhcp-ddns.
Definition: agent_parser.cc:144
isc::dhcp::CfgDUID
Holds manual configuration of the server identifier (DUID).
Definition: cfg_duid.h:30
isc::dhcp::ConstCfgDUIDPtr
boost::shared_ptr< const CfgDUID > ConstCfgDUIDPtr
Pointer to the const object.
Definition: cfg_duid.h:152
isc::dhcp::CfgDUID::setPersist
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
isc::dhcp::DUID::DUIDType
DUIDType
specifies DUID type
Definition: duid.h:38
cfg_to_element.h
isc::dhcp::CfgDUID::getTime
uint32_t getTime() const
Returns time for the DUID-LLT.
Definition: cfg_duid.h:76
isc::dhcp::CfgDUID::setEnterpriseId
void setEnterpriseId(const uint32_t enterprise_id)
Sets new enterprise id.
Definition: cfg_duid.h:93
isc::data::ElementPtr
boost::shared_ptr< Element > ElementPtr
Definition: data.h:20
isc::dhcp::CfgDUID::setTime
void setTime(const uint32_t new_time)
Sets new time for DUID-LLT.
Definition: cfg_duid.h:81
isc::dhcp::CfgDUID::getType
DUID::DUIDType getType() const
Returns DUID type.
Definition: cfg_duid.h:37
isc::dhcp::CfgDUIDPtr
boost::shared_ptr< CfgDUID > CfgDUIDPtr
Pointer to the Non-const object.
Definition: cfg_duid.h:149