Kea  2.3.4-git
duid_factory.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 DUID_FACTORY_H
8 #define DUID_FACTORY_H
9 
10 #include <dhcp/duid.h>
11 #include <boost/noncopyable.hpp>
12 #include <stdint.h>
13 #include <string>
14 #include <vector>
15 
16 namespace isc {
17 namespace dhcp {
18 
63 class DUIDFactory : public boost::noncopyable {
64 public:
65 
70  DUIDFactory(const std::string& storage_location = "");
71 
76  bool isStored() const;
77 
97  void createLLT(const uint16_t htype, const uint32_t time_in,
98  const std::vector<uint8_t>& ll_identifier);
99 
111  void createEN(const uint32_t enterprise_id,
112  const std::vector<uint8_t>& identifier);
113 
130  void createLL(const uint16_t htype,
131  const std::vector<uint8_t>& ll_identifier);
132 
147  DuidPtr get();
148 
149 private:
150 
160  void createLinkLayerId(std::vector<uint8_t>& identifier,
161  uint16_t& htype) const;
162 
169  void set(const std::vector<uint8_t>& duid_vector);
170 
172  void readFromFile();
173 
175  std::string storage_location_;
176 
178  DuidPtr duid_;
179 
180 };
181 
182 }; // end of isc::dhcp namespace
183 }; // end of isc namespace
184 
185 #endif /* DUID_FACTORY_H */
boost::shared_ptr< DUID > DuidPtr
Definition: duid.h:20
void createLLT(const uint16_t htype, const uint32_t time_in, const std::vector< uint8_t > &ll_identifier)
Generates DUID-LLT.
Definition: duid_factory.cc:53
void createLL(const uint16_t htype, const std::vector< uint8_t > &ll_identifier)
Generates DUID-LL.
bool isStored() const
Checks if generated DUID will be stored in the file.
Definition: duid_factory.cc:48
DUIDFactory(const std::string &storage_location="")
Constructor.
Definition: duid_factory.cc:43
Defines the logger used by the top-level component of kea-lfc.
void createEN(const uint32_t enterprise_id, const std::vector< uint8_t > &identifier)
Generates DUID-EN.
Factory for generating DUIDs (DHCP Unique Identifiers).
Definition: duid_factory.h:63