| 1 | #!/usr/bin/false | ||||||||||
| 2 | # ABSTRACT: Server Identifier option (code 2) | ||||||||||
| 3 | # PODNAME: Net::DHCPv6::Option::ServerId | ||||||||||
| 4 | package Net::DHCPv6::Option::ServerId; | ||||||||||
| 5 | 16 | $Net::DHCPv6::Option::ServerId::VERSION = '0.001'; | |||||||||
| 6 | 16 | ▶ | use strictures 2; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 16 | ▶ | use Carp qw(croak); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 16 | ▶ | use Net::DHCPv6::Constants; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 16 | ▶ | use parent 'Net::DHCPv6::Option'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 16 | ▶ | use namespace::clean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | sub new { | ||||||||||
| 13 | 50 | ▶ | my ( $class, %args ) = @_; | ||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 14 | 50 | ▶ | croak 'ServerId requires a duid' unless $args{duid}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 15 | 49 | $args{code} = $OPTION_SERVERID; | |||||||||
| 16 | 49 | $args{data} = $args{duid}->as_bytes; | |||||||||
| 17 | 49 | my $self = $class->SUPER::new( %args ); | |||||||||
| 18 | 49 | $self->{duid} = $args{duid}; | |||||||||
| 19 | 49 | bless $self, $class; | |||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | 15 | ▶ | sub duid { shift->{duid} } | ||||||||
|
Subroutine
duid: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 23 | |||||||||||
| 24 | sub from_bytes_inner { | ||||||||||
| 25 | 47 | ▶ | my ( $class, $code, $data ) = @_; | ||||||||
|
Subroutine
from_bytes_inner: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 26 | 47 | my $duid = Net::DHCPv6::DUID->from_bytes( $data ); | |||||||||
| 27 | 46 | return $class->new( duid => $duid ); | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | sub as_bytes { | ||||||||||
| 31 | 7 | ▶ | my $self = shift; | ||||||||
|
Subroutine
as_bytes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 32 | 7 | my $data = $self->{duid}->as_bytes; | |||||||||
| 33 | 7 | return pack( 'nn', $self->{code}, CORE::length( $data ) ) . $data; | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 16 | $Net::DHCPv6::OptionList::OPTION_CLASS{$OPTION_SERVERID} = __PACKAGE__; | |||||||||
| 37 | |||||||||||
| 38 | 16 | 1; | |||||||||
| 39 | |||||||||||
| 40 | __END__ | ||||||||||