File Coverage

blib/lib/Net/DNS/RR/DHCID.pm
Criterion Covered Total %
statement 24 24 100.0
branch n/a
path n/a
condition 6 6 100.0
subroutine 10 10 100.0
pod 3 3 100.0
total 43 43 100.0


line stmt bran path cond sub pod time code
1               package Net::DNS::RR::DHCID;
2                
3 1       1   8 use strict;
  1           3  
  1           63  
4 1       1   8 use warnings;
  1           2  
  1           104  
5               our $VERSION = (qw$Id: DHCID.pm 2003 2025-01-21 12:06:06Z willem $)[2];
6                
7 1       1   8 use base qw(Net::DNS::RR);
  1           2  
  1           144  
8                
9                
10               =head1 NAME
11                
12               Net::DNS::RR::DHCID - DNS DHCID resource record
13                
14               =cut
15                
16 1       1   8 use integer;
  1           3  
  1           23  
17                
18 1       1   40 use MIME::Base64;
  1           2  
  1           410  
19                
20                
21               sub _format_rdata { ## format rdata portion of RR string.
22 3       3   7 my $self = shift;
23                
24 3           16 my @rdata = split /\s+/, encode_base64( $self->_encode_rdata );
25 3           10 return @rdata;
26               }
27                
28                
29               sub _parse_rdata { ## populate RR from rdata in argument list
30 3       3   8 my ( $self, @argument ) = @_;
31                
32 3           29 $self->rdata( MIME::Base64::decode( join "", @argument ) );
33 3           10 return;
34               }
35                
36                
37               # +------------------+------------------------------------------------+
38               # | Identifier Type | Identifier |
39               # | Code | |
40               # +------------------+------------------------------------------------+
41               # | 0x0000 | The 1-octet 'htype' followed by 'hlen' octets |
42               # | | of 'chaddr' from a DHCPv4 client's DHCPREQUEST |
43               # | | [7]. |
44               # | 0x0001 | The data octets (i.e., the Type and |
45               # | | Client-Identifier fields) from a DHCPv4 |
46               # | | client's Client Identifier option [10]. |
47               # | 0x0002 | The client's DUID (i.e., the data octets of a |
48               # | | DHCPv6 client's Client Identifier option [11] |
49               # | | or the DUID field from a DHCPv4 client's |
50               # | | Client Identifier option [6]). |
51               # | 0x0003 - 0xfffe | Undefined; available to be assigned by IANA. |
52               # | 0xffff | Undefined; RESERVED. |
53               # +------------------+------------------------------------------------+
54                
55 2     100 2 1 20 sub identifiertype { return unpack 'n', shift->{rdata} || return }
56                
57 2     100 2 1 1357 sub digesttype { return unpack 'x2C', shift->{rdata} || return }
58                
59 2     100 2 1 2459 sub digest { return unpack 'x3a*', shift->{rdata} || return }
60                
61                
62               1;
63               __END__