Commit 2e7420da authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰
Browse files

[2414] Duid types moved to dhcp/duid.h

parent 61fc577d
......@@ -27,6 +27,7 @@
#include <exceptions/exceptions.h>
#include <util/io_utilities.h>
#include <util/range_utilities.h>
#include <dhcp/duid.h>
using namespace isc;
using namespace isc::asiolink;
......@@ -243,7 +244,7 @@ void Dhcpv6Srv::setServerID() {
seconds -= DUID_TIME_EPOCH;
OptionBuffer srvid(8 + iface->getMacLen());
writeUint16(DUID_LLT, &srvid[0]);
writeUint16(DUID::DUID_LLT, &srvid[0]);
writeUint16(HWTYPE_ETHERNET, &srvid[2]);
writeUint32(static_cast<uint32_t>(seconds), &srvid[4]);
memcpy(&srvid[0]+8, iface->getMac(), iface->getMacLen());
......@@ -259,7 +260,7 @@ void Dhcpv6Srv::setServerID() {
// See Section 9.3 of RFC3315 for details.
OptionBuffer srvid(12);
writeUint16(DUID_EN, &srvid[0]);
writeUint16(DUID::DUID_EN, &srvid[0]);
writeUint32(ENTERPRISE_ID_ISC, &srvid[2]);
// Length of the identifier is company specific. I hereby declare
......
......@@ -105,10 +105,11 @@ extern const int dhcpv6_type_name_max;
/* DUID type definitions (RFC3315 section 9).
*/
#define DUID_LLT 1
#define DUID_EN 2
#define DUID_LL 3
#define DUID_UUID 4
// see isc::dhcp::DUID::DUIDType enum in dhcp/duid.h
// #define DUID_LLT 1
// #define DUID_EN 2
// #define DUID_LL 3
// #define DUID_UUID 4
// Define hardware types
// Taken from http://www.iana.org/assignments/arp-parameters/
......
......@@ -23,6 +23,7 @@
#include <exceptions/exceptions.h>
#include <dhcp/iface_mgr.h>
#include <dhcp/duid.h>
#include "command_options.h"
using namespace std;
......@@ -567,8 +568,8 @@ CommandOptions::generateDuidTemplate() {
const uint8_t duid_template_len = 14;
duid_template_.resize(duid_template_len);
// The first four octets consist of DUID LLT and hardware type.
duid_template_[0] = DUID_LLT >> 8;
duid_template_[1] = DUID_LLT & 0xff;
duid_template_[0] = static_cast<uint8_t>(static_cast<uint16_t>(isc::dhcp::DUID::DUID_LLT) >> 8);
duid_template_[1] = static_cast<uint8_t>(static_cast<uint16_t>(isc::dhcp::DUID::DUID_LLT) & 0xff);
duid_template_[2] = HWTYPE_ETHERNET >> 8;
duid_template_[3] = HWTYPE_ETHERNET & 0xff;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment