OSPF/Lsa/Router/Link.pm

filter: Statementstmt 88.2% 30 / 34 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 77.7% 7 / 9 Podpod 100% 5 / 5 totaltotal 84.6% 44 / 52 CC 3 SCAR 4.4
CC
3
Cov
84%
pack
2.0
unpack
2.0
getLength
2.0
CRAP 1.6
« OSPF/LinkStateRequest.pm ↑ Summary OSPF/Lsa/SummaryIp.pm »
1 #
2 # $Id: Link.pm 73 2015-01-14 06:42:49Z gomor $
3 #
4 package Net::Frame::Layer::OSPF::Lsa::Router::Link;
5 15 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 15 ▶use Net::Frame::Layer qw(:consts :subs);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 15 our @ISA = qw(Net::Frame::Layer);
9  
10 15 our @AS = qw(
11 linkId
12 linkData
13 type
14 nTos
15 metric
16 );
17 15 __PACKAGE__->cgBuildIndices;
18 15 __PACKAGE__->cgBuildAccessorsScalar(\@AS);
19  
20 15 ▶use Net::Frame::Layer::OSPF qw(:consts);
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
23 shift->SUPER::new(
24 1 linkId => '0.0.0.0',
25 linkData => '0.0.0.0',
26 type => 0,
27 nTos => 0,
28 metric => 0,
29 @_,
30 );
31 }
32  
33 0 ▶sub getLength { 12 }
Subroutine getLength: not called CC=1 SCAR=6.9
Pod documented
34  
35 1 ▶sub pack {
Subroutine pack: called CC=2 SCAR=7.1
Pod documented
36 1 my $self = shift;
37  
38 1 ▶ $self->raw($self->SUPER::pack('a4a4CCn',
Branch: 1 branch
BranchTrueFalseTotal
$self->raw($self->SUPER::pack("a4a4CCn", inetAton($self->linkId), inetAton($self->linkData), $self->type, $self->nTos, $self->metric)) or return undef 1 0 1
39 inetAton($self->linkId), inetAton($self->linkData), $self->type,
40 $self->nTos, $self->metric,
41 )) or return undef;
42  
43 1 $self->raw;
44 }
45  
46 1 ▶sub unpack {
Subroutine unpack: called CC=2 SCAR=6.9
Pod documented
47 1 my $self = shift;
48  
49 1 ▶ my ($linkId, $linkData, $type, $nTos, $metric, $payload)
Branch: 1 branch
BranchTrueFalseTotal
() = $self->SUPER::unpack("a4a4CCn a*", $self->raw) or return undef 1 0 1
50 = $self->SUPER::unpack('a4a4CCn a*', $self->raw)
51 or return undef;
52  
53 1 $self->linkId(inetNtoa($linkId));
54 1 $self->linkData(inetNtoa($linkData));
55 1 $self->type($type);
56 1 $self->nTos($nTos);
57 1 $self->metric($metric);
58  
59 1 $self->payload($payload);
60  
61 1 $self;
62 }
63  
64 0 ▶sub print {
Subroutine print: not called CC=1 SCAR=6.9
Pod documented
65 0 my $self = shift;
66  
67 0 my $l = $self->layer;
68 0 sprintf
69 "$l: linkId:%s linkData:%s type:0x%02x nTos:%d metric:%d",
70 $self->linkId,
71 $self->linkData,
72 $self->type,
73 $self->nTos,
74 $self->metric,
75 ;
76 }
77  
78 15 1;
79  
80 __END__
« OSPF/LinkStateRequest.pm ↑ Summary OSPF/Lsa/SummaryIp.pm »