|
@@ -12,11 +12,13 @@
|
|
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
// PERFORMANCE OF THIS SOFTWARE.
|
|
// PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
|
-#include <vector>
|
|
|
|
#include <exceptions/exceptions.h>
|
|
#include <exceptions/exceptions.h>
|
|
#include <stdint.h>
|
|
#include <stdint.h>
|
|
#include <util/io_utilities.h>
|
|
#include <util/io_utilities.h>
|
|
#include <dhcp/duid.h>
|
|
#include <dhcp/duid.h>
|
|
|
|
+#include <vector>
|
|
|
|
+#include <sstream>
|
|
|
|
+#include <iomanip>
|
|
|
|
|
|
namespace isc {
|
|
namespace isc {
|
|
namespace dhcp {
|
|
namespace dhcp {
|
|
@@ -53,6 +55,22 @@ DUID::DUIDType DUID::getType() const {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+std::string DUID::toText() const {
|
|
|
|
+ std::stringstream tmp;
|
|
|
|
+
|
|
|
|
+ bool delim = false;
|
|
|
|
+ for (std::vector<uint8_t>::const_iterator it = duid_.begin();
|
|
|
|
+ it != duid_.end(); ++it) {
|
|
|
|
+ if (delim) {
|
|
|
|
+ tmp << ":";
|
|
|
|
+ }
|
|
|
|
+ tmp.width(2);
|
|
|
|
+ tmp << std::hex << std::setfill('0') << static_cast<unsigned int>(*it);
|
|
|
|
+ delim = true;
|
|
|
|
+ }
|
|
|
|
+ return (tmp.str());
|
|
|
|
+}
|
|
|
|
+
|
|
bool DUID::operator == (const DUID& other) const {
|
|
bool DUID::operator == (const DUID& other) const {
|
|
return (this->duid_ == other.duid_);
|
|
return (this->duid_ == other.duid_);
|
|
}
|
|
}
|