Kea 2.7.5
duid_factory.h
Go to the documentation of this file.
1// Copyright (C) 2015-2024 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
16namespace isc {
17namespace dhcp {
18
63class DUIDFactory : public boost::noncopyable {
64public:
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
149private:
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 */
Factory for generating DUIDs (DHCP Unique Identifiers).
bool isStored() const
Checks if generated DUID will be stored in the file.
DUIDFactory(const std::string &storage_location="")
Constructor.
void createLLT(const uint16_t htype, const uint32_t time_in, const std::vector< uint8_t > &ll_identifier)
Generates DUID-LLT.
void createEN(const uint32_t enterprise_id, const std::vector< uint8_t > &identifier)
Generates DUID-EN.
DuidPtr get()
Returns current DUID.
void createLL(const uint16_t htype, const std::vector< uint8_t > &ll_identifier)
Generates DUID-LL.
boost::shared_ptr< DUID > DuidPtr
Definition duid.h:136
Defines the logger used by the top-level component of kea-lfc.