OSPF/LinkStateAck.pm

filter: Statementstmt 41.8% 18 / 43 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 4 / 8 Podpod 100% 4 / 4 totaltotal 42.6% 26 / 61 CC 6 SCAR 19.3
CC
6
Cov
37%
pack
12.0
print
12.0
unpack
6.0
CRAP 6.9
« OSPF/Lsa/Router.pm ↑ Summary OSPF/Hello.pm »
1 #
2 # $Id: LinkStateAck.pm,v 1.2 2007/02/27 23:58:56 gomor Exp $
3 #
4 package Net::Frame::Layer::OSPF::LinkStateAck;
5 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 ▶use Net::Frame::Layer qw(:consts :subs);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 our @ISA = qw(Net::Frame::Layer);
10  
11 3 our @AA = qw(
12 lsaList
13 );
14 3 __PACKAGE__->cgBuildIndices;
15 3 __PACKAGE__->cgBuildAccessorsArray(\@AA);
16  
17 3 ▶use Net::Frame::Layer::OSPF qw(:consts);
Subroutine BEGIN: called CC=1 SCAR=0.0
18 3 require Net::Frame::Layer::OSPF::Lsa;
19  
20 sub new {
21 shift->SUPER::new(
22 0 ▶ lsaList => [],
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
23 @_,
24 );
25 }
26  
27 sub pack {
28 0 ▶ my $self = shift;
Subroutine pack: not called CC=3 SCAR=24.8
Pod documented
29  
30 0 my $raw = '';
31 0 for ($self->lsaList) {
32 0 ▶ $raw .= $_->pack or return undef;
Branch: 1 branch
BranchTrueFalseTotal
$raw .= $_->pack or return undef 0 0 0
33 }
34  
35 0 $self->raw($raw);
36 }
37  
38 sub unpack {
39 0 ▶ my $self = shift;
Subroutine unpack: not called CC=2 SCAR=17.9
Pod documented
40  
41 0 my $payload = $self->raw;
42  
43 0 my @lsaList = ();
44 0 ▶ while ($payload) {
Branch: 1 branch
BranchTrueFalseTotal
if ($payload) 0 0 0
45 0 my $lsa = Net::Frame::Layer::OSPF::Lsa->new(raw => $payload, full => 0);
46 0 $lsa->unpack;
47 0 push @lsaList, $lsa;
48 0 $payload = $lsa->payload;
49 }
50  
51 0 $self->lsaList(\@lsaList);
52 0 $self->payload($payload);
53  
54 0 $self;
55 }
56  
57 sub print {
58 0 ▶ my $self = shift;
Subroutine print: not called CC=3 SCAR=24.8
Pod documented
59  
60 0 my $buf = '';
61 0 my $first = 1;
62 0 for ($self->lsaList) {
63 0 ▶ $buf .= "\n" unless $first;
Branch: 1 branch
BranchTrueFalseTotal
unless $first 0 0 0
64 0 $first = 0;
65 0 $buf .= $_->print;
66 }
67  
68 0 $buf;
69 }
70  
71 3 1;
72  
73 __END__
« OSPF/Lsa/Router.pm ↑ Summary OSPF/Hello.pm »