| 1 | #!/bin/false | ||
| 2 | # ABSTRACT: Client System Architecture Type option (code 61) -- 16-bit architecture type | ||
| 3 | # PODNAME: Net::DHCPv6::Option::ClientArchType | ||
| 4 | use strictures 2; | ||
| 5 | |||
| 6 | package Net::DHCPv6::Option::ClientArchType; | ||
| 7 | $Net::DHCPv6::Option::ClientArchType::VERSION = '0.002'; | ||
| 8 | use Net::DHCPv6::OptionList; | ||
| 9 | use Carp qw( croak ); | ||
| 10 | use Net::DHCPv6::Constants; | ||
| 11 | use Net::DHCPv6::X::BadOption; | ||
| 12 | use parent 'Net::DHCPv6::Option'; | ||
| 13 | use namespace::clean; | ||
| 14 | |||
| 15 | sub new { | ||
| 16 | my ( $class, %args ) = @_; | ||
| 17 | croak 'ClientArchType requires type' unless defined $args{type}; | ||
| 18 | $args{code} = $OPTION_CLIENT_ARCH_TYPE; | ||
| 19 | $args{data} = pack( 'n', $args{type} ); | ||
| 20 | my $self = $class->SUPER::new( %args ); | ||
| 21 | $self->{type} = $args{type}; | ||
| 22 | return bless $self, $class; | ||
| 23 | } | ||
| 24 | |||
| 25 | sub type { return shift->{type} } | ||
| 26 | |||
| 27 | sub from_bytes_inner { | ||
| 28 | my ( $class, $code, $payload ) = @_; | ||
| 29 | Net::DHCPv6::X::BadOption->throw( message => 'ClientArchType must be exactly 2 bytes' ) | ||
| 30 | if CORE::length( $payload ) != 2; | ||
| 31 | my $type = unpack( 'n', $payload ); | ||
| 32 | return $class->new( type => $type ); | ||
| 33 | } | ||
| 34 | |||
| 35 | $Net::DHCPv6::OptionList::OPTION_CLASS{$OPTION_CLIENT_ARCH_TYPE} = __PACKAGE__; | ||
| 36 | 1; | ||
| 37 | |||
| 38 | __END__ |