| 1 | #!/bin/false | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: UNICAST option (code 12) -- server IPv6 address | ||||||||||||||||||||||||||||
| 3 | # PODNAME: Net::DHCPv6::Option::Unicast | ||||||||||||||||||||||||||||
| 4 | 15 | ▶ | use strictures 2; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | package Net::DHCPv6::Option::Unicast; | ||||||||||||||||||||||||||||
| 7 | 15 | $Net::DHCPv6::Option::Unicast::VERSION = '0.002'; | |||||||||||||||||||||||||||
| 8 | 15 | ▶ | use Net::DHCPv6::OptionList; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 15 | ▶ | use Carp qw( croak ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 15 | ▶ | use Net::DHCPv6::Constants; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 15 | ▶ | use Net::DHCPv6::X::Truncated; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 15 | ▶ | use parent 'Net::DHCPv6::Option'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 15 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | sub new { | ||||||||||||||||||||||||||||
| 16 | 6 | ▶ | my ( $class, %args ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 17 | 6 | my $addr = $class->_pick_addr( \%args, 'address' ); | |||||||||||||||||||||||||||
| 18 | 5 | ▶ | croak 'Unicast requires address' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$addr and length $addr == $Net::DHCPv6::Option::Unicast::IPV6_ADDR_LEN
MC/DC50%1/2
$addr and length $addr == $Net::DHCPv6::Option::Unicast::IPV6_ADDR_LEN
$addr
length $addr == $Net::DHCPv6::Option::Unicast::IPV6_ADDR_LEN
Truth table66%2/3
A and B
A= $addrB= length $addr == $Net::DHCPv6::Option::Unicast::IPV6_ADDR_LEN
| |||||||||||||||||||||||||||||
| 19 | unless $addr && CORE::length( $addr ) == $IPV6_ADDR_LEN; | ||||||||||||||||||||||||||||
| 20 | 4 | $args{code} = $OPTION_UNICAST; | |||||||||||||||||||||||||||
| 21 | 4 | $args{data} = $addr; | |||||||||||||||||||||||||||
| 22 | 4 | my $self = $class->SUPER::new( %args ); | |||||||||||||||||||||||||||
| 23 | 4 | $self->{address} = $addr; | |||||||||||||||||||||||||||
| 24 | 4 | return bless $self, $class; | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 2 | ▶ | sub address_raw { return shift->{address} } | ||||||||||||||||||||||||||
|
Subroutine
address_raw: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | sub address { | ||||||||||||||||||||||||||||
| 30 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
address: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 31 | 2 | return $self->_format_ipv6( $self->{address} ); | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | sub from_bytes_inner { | ||||||||||||||||||||||||||||
| 35 | 2 | ▶ | my ( $class, $code, $payload ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
from_bytes_inner: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 36 | 2 | ▶ | Net::DHCPv6::X::Truncated->throw( message => 'Truncated Unicast option' ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | if CORE::length( $payload ) < $IPV6_ADDR_LEN; | ||||||||||||||||||||||||||||
| 38 | 2 | return $class->new( address_raw => substr( $payload, 0, $IPV6_ADDR_LEN ) ); | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 15 | $Net::DHCPv6::OptionList::OPTION_CLASS{$OPTION_UNICAST} = __PACKAGE__; | |||||||||||||||||||||||||||
| 42 | 15 | 1; | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | __END__ | ||||||||||||||||||||||||||||