OSPF/Lsa/Router/Link.pm

filter: Statementstmt 50.0% 17 / 34 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 44.4% 4 / 9 Podpod 100% 5 / 5 totaltotal 50.0% 26 / 52 CC 3 SCAR 11.3
CC
3
Cov
45%
pack
6.0
unpack
6.0
new
2.0
CRAP 3.1
« OSPF/LinkStateUpdate.pm ↑ Summary OSPF/LinkStateRequest.pm »
1 #
2 # $Id: Link.pm,v 1.1 2007/03/08 16:32:02 gomor Exp $
3 #
4 package Net::Frame::Layer::OSPF::Lsa::Router::Link;
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 @AS = qw(
12 linkId
13 linkData
14 type
15 nTos
16 metric
17 );
18 3 __PACKAGE__->cgBuildIndices;
19 3 __PACKAGE__->cgBuildAccessorsScalar(\@AS);
20  
21 3 ▶use Net::Frame::Layer::OSPF qw(:consts);
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 sub new {
24 shift->SUPER::new(
25 0 ▶ linkId => '0.0.0.0',
Subroutine new: not called CC=1 SCAR=6.9
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 0 ▶ my $self = shift;
Subroutine pack: not called CC=2 SCAR=17.9
Pod documented
38  
39 0 ▶ $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 0 0
40 inetAton($self->linkId), inetAton($self->linkData), $self->type,
41 $self->nTos, $self->metric,
42 )) or return undef;
43  
44 0 $self->raw;
45 }
46  
47 sub unpack {
48 0 ▶ my $self = shift;
Subroutine unpack: not called CC=2 SCAR=17.9
Pod documented
49  
50 0 ▶ my ($linkId, $linkData, $type, $nTos, $metric, $payload)
Branch: 1 branch
BranchTrueFalseTotal
() = $self->SUPER::unpack("a4a4CCn a*", $self->raw) or return undef 0 0 0
51 = $self->SUPER::unpack('a4a4CCn a*', $self->raw)
52 or return undef;
53  
54 0 $self->linkId(inetNtoa($linkId));
55 0 $self->linkData(inetNtoa($linkData));
56 0 $self->type($type);
57 0 $self->nTos($nTos);
58 0 $self->metric($metric);
59  
60 0 $self->payload($payload);
61  
62 0 $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 3 1;
80  
81 __END__
« OSPF/LinkStateUpdate.pm ↑ Summary OSPF/LinkStateRequest.pm »