lib/Net/DHCPv6/Option/Auth.pm

filter: Statementstmt 100% 43 / 43 Branchbran 83.3% 5 / 6 Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 13 / 13 Podpod 100% 7 / 7 totaltotal 93.3% 70 / 75 CC 7 SCAR 10.0
CC
7
Cov
94%
new
6.1
from_bytes_inner
2.0
BEGIN
1.0
CRAP 2.7
« blib/lib/Net/DHCPv6/Option/ServerId.pm ↑ Summary lib/Net/DHCPv6/Option/IAPrefix.pm »
1 #!/usr/bin/false
2 # ABSTRACT: Authentication option (code 11) — protocol/algorithm/rdm/replay/auth-info
3 # PODNAME: Net::DHCPv6::Option::Auth
4 package Net::DHCPv6::Option::Auth;
5 15 $Net::DHCPv6::Option::Auth::VERSION = '0.001';
6 15 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 15 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 15 ▶use Net::DHCPv6::Constants;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 15 ▶use Net::DHCPv6::X::Truncated;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 15 ▶use parent 'Net::DHCPv6::Option';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 15 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 sub new {
14 6 ▶ my ( $class, %args ) = @_;
Subroutine new: called CC=6 SCAR=18.1
Pod documented
15 6 for my $field ( qw(protocol algorithm rdm replay) ) {
16 22 ▶ croak "Auth requires $field" unless defined $args{$field};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $args{$field} 2 20 22
17 }
18 croak 'Auth replay must be exactly 8 bytes'
19 4 ▶ if CORE::length( $args{replay} ) != 8;
Branch: 1 branch
BranchTrueFalseTotal
if length $args{"replay"} != 8 0 4 4
20 4 $args{code} = $OPTION_AUTH;
21 $args{data} =
22 4 ▶ pack( 'C C C a8 a*', $args{protocol}, $args{algorithm}, $args{rdm}, $args{replay}, $args{auth_info} // '' );
Condition50%1/2
$args{"auth_info"} // ""
l!l
40
MC/DC0%0/1
$args{"auth_info"} // ""
$args{"auth_info"}
Truth table50%1/2
A
A= $args{"auth_info"}
Aresult
11
00
23 4 my $self = $class->SUPER::new( %args );
24 4 $self->{protocol} = $args{protocol};
25 4 $self->{algorithm} = $args{algorithm};
26 4 $self->{rdm} = $args{rdm};
27 4 $self->{replay} = $args{replay};
28 4 ▶ $self->{auth_info} = $args{auth_info} // '';
Condition50%1/2
$args{"auth_info"} // ""
l!l
40
MC/DC0%0/1
$args{"auth_info"} // ""
$args{"auth_info"}
Truth table50%1/2
A
A= $args{"auth_info"}
Aresult
11
00
29 4 bless $self, $class;
30 }
31  
32 2 ▶sub protocol { shift->{protocol} }
Subroutine protocol: called CC=1 SCAR=0.0
Pod documented
33 2 ▶sub algorithm { shift->{algorithm} }
Subroutine algorithm: called CC=1 SCAR=0.0
Pod documented
34 2 ▶sub rdm { shift->{rdm} }
Subroutine rdm: called CC=1 SCAR=0.0
Pod documented
35 2 ▶sub replay { shift->{replay} }
Subroutine replay: called CC=1 SCAR=0.0
Pod documented
36 2 ▶sub auth_info { shift->{auth_info} }
Subroutine auth_info: called CC=1 SCAR=0.0
Pod documented
37  
38 sub from_bytes_inner {
39 3 ▶ my ( $class, $code, $data ) = @_;
Subroutine from_bytes_inner: called CC=2 SCAR=6.9
Pod documented
40 3 ▶ Net::DHCPv6::X::Truncated->throw( message => 'Truncated Auth option' )
Branch: 1 branch
BranchTrueFalseTotal
if length $data < 11 1 2 3
41 if CORE::length( $data ) < 11;
42 2 my ( $proto, $alg, $rdm, $replay, $info ) = unpack( 'C C C a8 a*', $data );
43 2 return $class->new(
44 protocol => $proto,
45 algorithm => $alg,
46 rdm => $rdm,
47 replay => $replay,
48 auth_info => $info,
49 );
50 }
51  
52 15 $Net::DHCPv6::OptionList::OPTION_CLASS{$OPTION_AUTH} = __PACKAGE__;
53 15 1;
54  
55 __END__
« blib/lib/Net/DHCPv6/Option/ServerId.pm ↑ Summary lib/Net/DHCPv6/Option/IAPrefix.pm »