LLTD/Emit.pm

filter: Statementstmt 60.3% 32 / 53 Branchbran 37.5% 3 / 8 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 63.6% 7 / 11 Podpod 100% 7 / 7 totaltotal 59.5% 50 / 84 CC 9 SCAR 14.8
CC
9
Cov
56%
unpack
7.3
getEmiteeDescLength
6.0
getLength
6.0
CRAP 4.4
« LLTD/Discover.pm ↑ Summary LLTD/QueryResp.pm »
1 #
2 # $Id: Emit.pm 12 2015-01-14 06:29:59Z gomor $
3 #
4 package Net::Frame::Layer::LLTD::Emit;
5 10 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 10 ▶use Net::Frame::Layer qw(:consts);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 10 require Exporter;
9 10 our @ISA = qw(Net::Frame::Layer Exporter);
10  
11 10 our @AS = qw(
12 numDescs
13 );
14 10 our @AA = qw(
15 emiteeDescList
16 );
17 10 __PACKAGE__->cgBuildIndices;
18 10 __PACKAGE__->cgBuildAccessorsScalar(\@AS);
19 10 __PACKAGE__->cgBuildAccessorsArray (\@AA);
20  
21 10 ▶use Net::Frame::Layer::LLTD::EmiteeDesc;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
24 shift->SUPER::new(
25 1 numDescs => 0,
26 emiteeDescList => [],
27 @_,
28 );
29 }
30  
31 0 ▶sub getEmiteeDescLength {
Subroutine getEmiteeDescLength: not called CC=2 SCAR=17.9
Pod documented
32 0 my $self = shift;
33 0 my $len = 0;
34 0 for ($self->emiteeDescList) {
35 0 $len += $_->getLength;
36 }
37 0 $len;
38 }
39  
40 0 ▶sub getLength {
Subroutine getLength: not called CC=2 SCAR=17.9
Pod documented
41 0 my $self = shift;
42 0 my $len = 2;
43 0 ▶ $len += $self->getEmiteeDescLength if $self->emiteeDescList;
Branch: 1 branch
BranchTrueFalseTotal
if $self->emiteeDescList 0 0 0
44 0 $len;
45 }
46  
47 1 ▶sub pack {
Subroutine pack: called CC=2 SCAR=7.1
Pod documented
48 1 my $self = shift;
49  
50 1 ▶ $self->raw(
Branch: 1 branch
BranchTrueFalseTotal
$self->raw($self->SUPER::pack("n", $self->numDescs)) or return undef 1 0 1
51 $self->SUPER::pack('n',
52 $self->numDescs,
53 )
54 ) or return undef;
55  
56 1 $self->raw;
57 }
58  
59 1 ▶sub unpack {
Subroutine unpack: called CC=5 SCAR=19.8
Pod documented
60 1 my $self = shift;
61  
62 1 ▶ my ($numDescs, $payload) =
Branch: 1 branch
BranchTrueFalseTotal
() = $self->SUPER::unpack("n a*", $self->raw) or return undef 1 0 1
63 $self->SUPER::unpack('n a*', $self->raw)
64 or return undef;
65  
66 1 $self->numDescs($numDescs);
67  
68 1 my @emiteeDescList = ();
69 1 ▶ if ($self->numDescs && $self->numDescs > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->numDescs and $self->numDescs > 0) 0 1 1
Condition33%1/3
$self->numDescs and $self->numDescs > 0
!ll&&!rl&&r
100
MC/DC0%0/2
$self->numDescs and $self->numDescs > 0
$self->numDescs $self->numDescs > 0
Truth table33%1/3
A and B
A= $self->numDescsB= $self->numDescs > 0
ABresult
0X0
100
111
70 0 for (1..$self->numDescs) {
71 0 my $emitee = Net::Frame::Layer::LLTD::EmiteeDesc->new(raw => $payload);
72 0 $emitee->unpack;
73 0 push @emiteeDescList, $emitee;
74 0 $payload = $emitee->payload;
75 }
76 }
77  
78 1 $self->emiteeDescList(\@emiteeDescList);
79 1 $self->payload($payload);
80  
81 1 $self;
82 }
83  
84 0 ▶sub encapsulate { shift->nextLayer }
Subroutine encapsulate: not called CC=1 SCAR=6.9
Pod documented
85  
86 0 ▶sub print {
Subroutine print: not called CC=2 SCAR=17.9
Pod documented
87 0 my $self = shift;
88  
89 0 my $l = $self->layer;
90 0 my $buf = sprintf "$l: numDescs:%d", $self->numDescs;
91  
92 0 for ($self->emiteeDescList) {
93 0 $buf .= "\n".$_->print;
94 }
95  
96 0 $buf;
97 }
98  
99 10 1;
100  
101 __END__
« LLTD/Discover.pm ↑ Summary LLTD/QueryResp.pm »