Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Would like to share a new module for decoding the DHCPv6 DUID

14 views
Skip to first unread message

Tom

unread,
Nov 30, 2010, 7:32:48 PM11/30/10
to
Wrote a fairly simple module for doing some research, it gives a nice
OO interface for pulling various components of a DUID out and
formatting them in a few different ways. I though this may be useful
for other people, and would like to share it on CPAN.

I was considering calling the module: Net::DHCPv6::DUID::Parser;

I'd like some feedback on this please.

The DUID is described here:
http://tools.ietf.org/html/rfc3315#section-9

Here's the SYNOPSIS section from my POD:


use Net::DHCPv6::DUID::Parser;

my $p = new Net::DHCPv6::DUID::Parser;

# Decode an example DUID
$p->decode('000300010004ED9F7622');

# Print the type
print "TYPE: ".$p->type(format => 'text')."\n";

### prints 'TYPE: DUID-LL'

if ($p->type == 1 || $p->type == 3) {

# Format this like a MAC address if the link type was Ethernet
if ($p->iana_hw_type == 1) {
print "MAC ADDRESS: ".$p->local_link_address(format =>
'ethernet_mac')."\n";
} else {
print "LOCAL LINK ADDRESS: ".$p->local_link_address."\n";
}

}

### prints 'MAC ADDRESS: 00-04-ed-9f-76-22'

Tom

unread,
Dec 6, 2010, 12:42:13 AM12/6/10
to
0 new messages