OSPF/LinkStateRequest.pm

filter: Statementstmt 87.5% 28 / 32 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 77.7% 7 / 9 Podpod 100% 5 / 5 totaltotal 84.0% 42 / 50 SCAR 11.1
CC
3
Cov
83%
pack
2.0
unpack
2.0
getLength
2.0
CRAP 3.0
« OSPF/Lsa/Opaque.pm ↑ Summary OSPF/Lsa/Router/Link.pm »
1 #
2 # $Id: LinkStateRequest.pm,v 1.3 2007/03/13 18:18:21 gomor Exp $
3 #
4 package Net::Frame::Layer::OSPF::LinkStateRequest;
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 lsType
13 linkStateId
14 advertisingRouter
15 );
16 15 __PACKAGE__->cgBuildIndices;
17 15 __PACKAGE__->cgBuildAccessorsScalar(\@AS);
18  
19 15 ▶use Net::Frame::Layer::OSPF qw(:consts);
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 sub new {
22 shift->SUPER::new(
23 1 ▶ lsType => 0,
Subroutine new: called CC=1 SCAR=0.0
Pod documented
24 linkStateId => '0.0.0.0',
25 advertisingRouter => '0.0.0.0',
26 @_,
27 );
28 }
29  
30 0 ▶sub getLength { 12 }
Subroutine getLength: not called CC=1 SCAR=6.9
Pod documented
31  
32 sub pack {
33 1 ▶ my $self = shift;
Subroutine pack: called CC=2 SCAR=7.1
Pod documented
34  
35 1 ▶ $self->raw($self->SUPER::pack('Na4a4',
Branch: 1 branch
BranchTrueFalseTotal
$self->raw($self->SUPER::pack("Na4a4", $self->lsType, inetAton($self->linkStateId), inetAton($self->advertisingRouter))) or return undef 0 1 1
36 $self->lsType, inetAton($self->linkStateId),
37 inetAton($self->advertisingRouter),
38 )) or return undef;
39  
40 1 $self->raw;
41 }
42  
43 sub unpack {
44 1 ▶ my $self = shift;
Subroutine unpack: called CC=2 SCAR=7.0
Pod documented
45  
46 1 ▶ my ($lsType, $linkStateId, $advertisingRouter, $payload) =
Branch: 1 branch
BranchTrueFalseTotal
() = $self->SUPER::unpack("Na4a4 a*", $self->raw) or return undef 0 1 1
47 $self->SUPER::unpack('Na4a4 a*', $self->raw)
48 or return undef;
49  
50 1 $self->lsType($lsType);
51 1 $self->linkStateId(inetNtoa($linkStateId));
52 1 $self->advertisingRouter(inetNtoa($advertisingRouter));
53  
54 1 $self->payload($payload);
55  
56 1 $self;
57 }
58  
59 sub print {
60 0 ▶ my $self = shift;
Subroutine print: not called CC=1 SCAR=6.9
Pod documented
61  
62 0 my $l = $self->layer;
63 0 sprintf "$l: lsType:0x%08x linkStateId:%s\n".
64 "$l: advertisingRouter:%s",
65 $self->lsType, $self->linkStateId, $self->advertisingRouter,
66 ;
67 }
68  
69 15 1;
70  
71 __END__
« OSPF/Lsa/Opaque.pm ↑ Summary OSPF/Lsa/Router/Link.pm »