| 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
| |||||||||||||
| 17 | } | ||||||||||||
| 18 | croak 'Auth replay must be exactly 8 bytes' | ||||||||||||
| 19 | 4 | ▶ | if CORE::length( $args{replay} ) != 8; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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"} // ""
MC/DC0%0/1
$args{"auth_info"} // ""
$args{"auth_info"}
Truth table50%1/2
A
A= $args{"auth_info"}
| |||||||||||||
| 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"} // ""
MC/DC0%0/1
$args{"auth_info"} // ""
$args{"auth_info"}
Truth table50%1/2
A
A= $args{"auth_info"}
| |||||||||||||
| 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
| |||||||||||||
| 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__ | ||||||||||||