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