Packet/CDP/TypeCapabilities.pm untested

filter: Statementstmt 0.0% 0 / 30 Branchbran n/a Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 48 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
pack
2.0
unpack
2.0
CRAP 2.0
1 #
2 # $Id: TypeCapabilities.pm 2002 2015-02-15 16:50:35Z gomor $
3 #
4 package Net::Packet::CDP::TypeCapabilities;
5 use strict;
6 use warnings;
7  
8 require Net::Packet::CDP::Type;
9 our @ISA = qw(Net::Packet::CDP::Type);
10  
11 use Net::Packet::Consts qw(:cdp);
12  
13 our @AS = qw(
14 capabilities
15 );
16 __PACKAGE__->cgBuildIndices;
17 __PACKAGE__->cgBuildAccessorsScalar(\@AS);
18  
19 #no strict 'vars';
20  
21 sub new {
22 shift->SUPER::new(
23 type => NP_CDP_TYPE_CAPABILITIES,
24 length => 8,
25 capabilities => 0x00000000,
26 @_,
27 );
28 }
29  
30 sub pack {
31 my $self = shift;
32  
33 $self->raw($self->SUPER::pack('nnN',
34 $self->type,
35 $self->length,
36 $self->capabilities,
37 )) or return undef;
38  
39 1;
40 }
41  
42 sub unpack {
43 my $self = shift;
44  
45 my ($type, $length, $capabilities, $payload) =
46 $self->SUPER::unpack('nnN a*', $self->raw)
47 or return undef;
48  
49 $self->type($type);
50 $self->length($length);
51 $self->capabilities($capabilities);
52  
53 $self->payload($payload);
54  
55 1;
56 }
57  
58 sub print {
59 my $self = shift;
60  
61 my $i = $self->is;
62 my $l = $self->layer;
63 sprintf "$l: $i: type:0x%04x length:%d capabilities:0x%08x",
64 $self->type, $self->length, $self->capabilities;
65 }
66  
67 1;
68  
69 __END__