NAME
Net::DHCPv6::DUID - DUID parse/emit and helper constructors
VERSION
version 0.001
SYNOPSIS
use Net::DHCPv6::DUID;
my $duid = Net::DHCPv6::DUID->new_llt(1, time, "\x00\x11\x22\x33\x44\x55");
my $bytes = $duid->as_bytes;
my $parsed = Net::DHCPv6::DUID->from_bytes($bytes);
print $parsed->duid_type; # 1
DESCRIPTION
Parses, constructs, and serializes DHCPv6 Unique Identifiers (DUIDs) as defined in RFC 8415 §11. Supports DUID-LLT, DUID-EN, DUID-LL, and DUID-UUID types. Unknown DUID types are stored opaquely.
ALPHA STATUS
ALPHA SOFTWARE. This is an early release. The interface is experimental and subject to change without notice.
CONSTRUCTORS
new(%params)
Generic constructor. Requires duid_type. Additional required fields depend on the type:
- DUID-LLT:
link_layer_type,time,identifier - DUID-EN:
enterprise_number,identifier - DUID-LL:
link_layer_type,identifier - DUID-UUID:
identifier(must be exactly 16 bytes) - Unknown types:
identifier(optional)
new_llt($link_layer_type, $time, $mac_bytes)
Convenience constructor for DUID-LLT (type 1).
new_en($enterprise_number, $identifier)
Convenience constructor for DUID-EN (type 2).
new_ll($link_layer_type, $mac_bytes)
Convenience constructor for DUID-LL (type 3).
new_uuid($uuid_bytes)
Convenience constructor for DUID-UUID (type 4).
from_bytes($bytes)
Parse a DUID from its wire-format representation. Reads the 2-byte type prefix and dispatches to the appropriate parser. Falls back to opaque storage for unknown types.
try_from_bytes($bytes)
Attempts to parse a DUID from wire bytes. Returns ($duid, $error). On truncation, $duid is a partial object with whatever fields could be decoded before the error, and $error is an error string. On success, $error is undef.
ACCESSORS
- duid_type
- link_layer_type
- time
- enterprise_number
- identifier
METHODS
- as_bytes
-
Serialize to wire format.
- as_string
-
Human-readable representation:
TYPE:hex. - length
-
Byte length of the wire-format representation.
SEE ALSO
Net::DHCPv6, RFC 8415 §11, RFC 6355
AUTHOR
Dean Hamstead <dean@fragfest.com.au>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2026 by Dean Hamstead.
This is free software, licensed under:
The MIT (X11) License