ICMPv6/Option.pm

filter: Statementstmt 45.1% 14 / 31 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 37.5% 3 / 8 Podpod 100% 5 / 5 totaltotal 44.0% 22 / 50 CC 4 SCAR 16.5
CC
4
Cov
38%
unpack
12.0
pack
6.0
new
2.0
CRAP 5.2
« ICMPv6.pm ↑ Summary ICMPv6/NeighborSolicitation.pm »
1 #
2 # $Id: Option.pm 14 2009-05-31 15:12:43Z gomor $
3 #
4 package Net::Frame::Layer::ICMPv6::Option;
5 3 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use Net::Frame::Layer qw(:consts :subs);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 our @ISA = qw(Net::Frame::Layer);
9  
10 3 our @AS = qw(
11 type
12 length
13 value
14 );
15 3 __PACKAGE__->cgBuildIndices;
16 3 __PACKAGE__->cgBuildAccessorsScalar(\@AS);
17  
18 #no strict 'vars';
19  
20 sub new {
21 shift->SUPER::new(
22 0 ▶ type => 0,
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
23 length => 0,
24 value => '',
25 @_,
26 );
27 }
28  
29 0 ▶sub getLength { shift->length * 8 }
Subroutine getLength: not called CC=1 SCAR=6.9
Pod documented
30  
31 sub pack {
32 0 ▶ my $self = shift;
Subroutine pack: not called CC=2 SCAR=17.9
Pod documented
33  
34 0 ▶ $self->raw($self->SUPER::pack('CCa*',
Branch: 1 branch
BranchTrueFalseTotal
$self->raw($self->SUPER::pack("CCa*", $self->type, $self->length, $self->value)) or return undef 0 0 0
35 $self->type, $self->length, $self->value,
36 )) or return undef;
37  
38 0 $self->raw;
39 }
40  
41 sub unpack {
42 0 ▶ my $self = shift;
Subroutine unpack: not called CC=3 SCAR=24.8
Pod documented
43  
44 0 ▶ my ($type, $length, $tail) = $self->SUPER::unpack('CC a*', $self->raw)
Branch: 1 branch
BranchTrueFalseTotal
() = $self->SUPER::unpack("CC a*", $self->raw) or return undef 0 0 0
45 or return undef;
46  
47 0 my $bLen = $length * 8 - 2; # minus two bytes for type and length -pmv
48 0 ▶ my ($value, $payload) = $self->SUPER::unpack("a$bLen a*", $tail)
Branch: 1 branch
BranchTrueFalseTotal
() = $self->SUPER::unpack("a$bLen a*", $tail) or return undef 0 0 0
49 or return undef;
50  
51 0 $self->type($type);
52 0 $self->length($length);
53 0 $self->value($value);
54  
55 0 $self->payload($payload);
56  
57 0 $self;
58 }
59  
60 sub print {
61 0 ▶ my $self = shift;
Subroutine print: not called CC=1 SCAR=6.9
Pod documented
62  
63 0 my $l = $self->layer;
64 0 sprintf "$l: type:%02x length:%02x value:%s",
65 $self->type, $self->length, CORE::unpack('H*', $self->value);
66 }
67  
68 3 1;
69  
70 __END__
« ICMPv6.pm ↑ Summary ICMPv6/NeighborSolicitation.pm »