| 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.003'; | |||||||||||||||||||||||||||
| 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 qw( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | $IPV6_ADDR_LEN $OPTION_UNICAST | ||||||||||||||||||||||||||||
| 12 | 15 | ); | |||||||||||||||||||||||||||
| 13 | 15 | ▶ | use Net::DHCPv6::X::Truncated (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 15 | ▶ | use parent 'Net::DHCPv6::Option'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 15 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 6 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 18 | 6 | my ( $class, %args ) = @_; | |||||||||||||||||||||||||||
| 19 | 6 | my $addr = $class->_pick_addr( \%args, 'address' ); | |||||||||||||||||||||||||||
| 20 | 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
| |||||||||||||||||||||||||||||
| 21 | unless $addr && CORE::length( $addr ) == $IPV6_ADDR_LEN; | ||||||||||||||||||||||||||||
| 22 | 4 | $args{code} = $OPTION_UNICAST; | |||||||||||||||||||||||||||
| 23 | 4 | $args{data} = $addr; | |||||||||||||||||||||||||||
| 24 | 4 | my $self = $class->SUPER::new( %args ); | |||||||||||||||||||||||||||
| 25 | 4 | $self->{address} = $addr; | |||||||||||||||||||||||||||
| 26 | 4 | return bless $self, $class; | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 2 | ▶ | sub address_raw { return shift->{address} } | ||||||||||||||||||||||||||
|
Subroutine
address_raw: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 2 | ▶ | sub address { | ||||||||||||||||||||||||||
|
Subroutine
address: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 32 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 33 | 2 | return $self->_format_ipv6( $self->{address} ); | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 2 | ▶ | sub from_bytes_inner { | ||||||||||||||||||||||||||
|
Subroutine
from_bytes_inner: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 37 | 2 | my ( $class, $code, $payload ) = @_; | |||||||||||||||||||||||||||
| 38 | 2 | ▶ | Net::DHCPv6::X::Truncated->throw( message => 'Truncated Unicast option' ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | if CORE::length( $payload ) < $IPV6_ADDR_LEN; | ||||||||||||||||||||||||||||
| 40 | 2 | return $class->new( address_raw => substr( $payload, 0, $IPV6_ADDR_LEN ) ); | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 15 | $Net::DHCPv6::OptionList::OPTION_CLASS{$OPTION_UNICAST} = __PACKAGE__; | |||||||||||||||||||||||||||
| 44 | 15 | 1; | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | __END__ | ||||||||||||||||||||||||||||