| 1 | #!/usr/bin/false | ||||||||||||
| 2 | # ABSTRACT: Vendor-specific Information option (code 17) — enterprise + sub-options | ||||||||||||
| 3 | # PODNAME: Net::DHCPv6::Option::VendorOpts | ||||||||||||
| 4 | package Net::DHCPv6::Option::VendorOpts; | ||||||||||||
| 5 | 15 | $Net::DHCPv6::Option::VendorOpts::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 Ref::Util qw(is_plain_arrayref); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 12 | 15 | ▶ | use namespace::clean; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 13 | |||||||||||||
| 14 | sub new { | ||||||||||||
| 15 | 3 | ▶ | my ( $class, %args ) = @_; | ||||||||||
|
Subroutine
new: called CC=4 SCAR=14.1
Pod
documented
| |||||||||||||
| 16 | 3 | ▶ | croak 'VendorOpts requires enterprise_number' unless defined $args{enterprise_number}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 17 | 2 | $args{code} = $OPTION_VENDOR_OPTS; | |||||||||||
| 18 | 2 | ▶ | my $sub_data = $args{sub_options} // ''; | ||||||||||
|
Condition50%1/2
$args{"sub_options"} // ""
MC/DC0%0/1
$args{"sub_options"} // ""
$args{"sub_options"}
Truth table50%1/2
A
A= $args{"sub_options"}
| |||||||||||||
| 19 | 2 | ▶ | $sub_data = join( '', map { $_->as_bytes } @$sub_data ) if is_plain_arrayref( $sub_data ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 20 | 2 | $args{data} = pack( 'N', $args{enterprise_number} ) . $sub_data; | |||||||||||
| 21 | 2 | my $self = $class->SUPER::new( %args ); | |||||||||||
| 22 | 2 | $self->{enterprise_number} = $args{enterprise_number}; | |||||||||||
| 23 | 2 | bless $self, $class; | |||||||||||
| 24 | } | ||||||||||||
| 25 | |||||||||||||
| 26 | 2 | ▶ | sub enterprise_number { shift->{enterprise_number} } | ||||||||||
|
Subroutine
enterprise_number: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 27 | |||||||||||||
| 28 | sub from_bytes_inner { | ||||||||||||
| 29 | 1 | ▶ | my ( $class, $code, $data ) = @_; | ||||||||||
|
Subroutine
from_bytes_inner: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||
| 30 | 1 | ▶ | Net::DHCPv6::X::Truncated->throw( message => 'Truncated VendorOpts option' ) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 31 | if CORE::length( $data ) < 4; | ||||||||||||
| 32 | 1 | my $en = unpack( 'N', substr( $data, 0, 4 ) ); | |||||||||||
| 33 | 1 | return $class->new( enterprise_number => $en, sub_options => substr( $data, 4 ) ); | |||||||||||
| 34 | } | ||||||||||||
| 35 | |||||||||||||
| 36 | 15 | $Net::DHCPv6::OptionList::OPTION_CLASS{$OPTION_VENDOR_OPTS} = __PACKAGE__; | |||||||||||
| 37 | 15 | 1; | |||||||||||
| 38 | |||||||||||||
| 39 | __END__ | ||||||||||||