Browse Source

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

Tomek Mrugalski 12 years ago
parent
commit
2e7420da8b
3 changed files with 11 additions and 8 deletions
  1. 3 2
      src/bin/dhcp6/dhcp6_srv.cc
  2. 5 4
      src/lib/dhcp/dhcp6.h
  3. 3 2
      tests/tools/perfdhcp/command_options.cc

+ 3 - 2
src/bin/dhcp6/dhcp6_srv.cc

@@ -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

+ 5 - 4
src/lib/dhcp/dhcp6.h

@@ -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/

+ 3 - 2
tests/tools/perfdhcp/command_options.cc

@@ -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;