« blib/lib/Net/DHCPv6/Option/BootfileParam.pm
↑ Summary
blib/lib/Net/DHCPv6/Option/CaptivePortal.pm »
| 1 | #!/bin/false | ||
| 2 | # ABSTRACT: Boot File URL option (code 59) -- URL for network boot | ||
| 3 | # PODNAME: Net::DHCPv6::Option::BootfileUrl | ||
| 4 | use strictures 2; | ||
| 5 | |||
| 6 | package Net::DHCPv6::Option::BootfileUrl; | ||
| 7 | $Net::DHCPv6::Option::BootfileUrl::VERSION = '0.002'; | ||
| 8 | use Net::DHCPv6::OptionList; | ||
| 9 | use Carp qw( croak ); | ||
| 10 | use Net::DHCPv6::Constants; | ||
| 11 | use Net::DHCPv6::X::Truncated; | ||
| 12 | use parent 'Net::DHCPv6::Option'; | ||
| 13 | use namespace::clean; | ||
| 14 | |||
| 15 | sub new { | ||
| 16 | my ( $class, %args ) = @_; | ||
| 17 | croak 'BootfileUrl requires url' unless defined $args{url}; | ||
| 18 | $args{code} = $OPTION_BOOTFILE_URL; | ||
| 19 | $args{data} = $args{url}; | ||
| 20 | my $self = $class->SUPER::new( %args ); | ||
| 21 | $self->{url} = $args{url}; | ||
| 22 | return bless $self, $class; | ||
| 23 | } | ||
| 24 | |||
| 25 | sub url { return shift->{url} } | ||
| 26 | |||
| 27 | sub from_bytes_inner { | ||
| 28 | my ( $class, $code, $payload ) = @_; | ||
| 29 | Net::DHCPv6::X::Truncated->throw( message => 'Truncated BootfileUrl option' ) | ||
| 30 | if CORE::length( $payload ) == 0; | ||
| 31 | return $class->new( url => $payload ); | ||
| 32 | } | ||
| 33 | |||
| 34 | $Net::DHCPv6::OptionList::OPTION_CLASS{$OPTION_BOOTFILE_URL} = __PACKAGE__; | ||
| 35 | 1; | ||
| 36 | |||
| 37 | __END__ |