Packet/PPPLCP.pm

filter: Statementstmt 47.3% 18 / 38 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 36.3% 4 / 11 Podpod 100% 7 / 7 totaltotal 46.7% 29 / 62 CC 4 SCAR 12.3
CC
4
Cov
41%
pack
6.0
unpack
6.0
encapsulate
6.0
CRAP 3.4
« Packet/LLC.pm ↑ Summary Packet/PPP.pm »
1 #
2 # $Id: PPPLCP.pm 2002 2015-02-15 16:50:35Z gomor $
3 #
4 package Net::Packet::PPPLCP;
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 require Net::Packet::Layer3;
9 1 our @ISA = qw(Net::Packet::Layer3);
10  
11 1 ▶use Net::Packet::Consts qw(:ppplcp :layer);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 our @AS = qw(
14 code
15 identifier
16 length
17 magicNumber
18 );
19 1 __PACKAGE__->cgBuildIndices;
20 1 __PACKAGE__->cgBuildAccessorsScalar(\@AS);
21  
22 1 ▶no strict 'vars';
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
25 shift->SUPER::new(
26 0 code => NP_PPPLCP_CODE_ECHO_REQUEST,
27 identifier => 1,
28 length => NP_PPPLCP_HDR_LEN,
29 magicNumber => 0xffffffff,
30 @_,
31 );
32 }
33  
34 0 ▶sub getLength { shift->[$__length] }
Subroutine getLength: not called CC=1 SCAR=6.9
Pod documented
35  
36 0 ▶sub getPayloadLength { shift->[$__length] - NP_PPPLCP_HDR_LEN }
Subroutine getPayloadLength: not called CC=1 SCAR=6.9
Pod documented
37  
38 0 ▶sub pack {
Subroutine pack: not called CC=2 SCAR=17.9
Pod documented
39 0 my $self = shift;
40  
41 0 ▶ $self->[$__raw] = $self->SUPER::pack('CCnN',
Branch: 1 branch
BranchTrueFalseTotal
$self->[$__raw] = $self->SUPER::pack("CCnN", $self->[$__code], $self->[$__identifier], $self->[$__length], $self->[$__magicNumber]) or return undef 0 0 0
42 $self->[$__code],
43 $self->[$__identifier],
44 $self->[$__length],
45 $self->[$__magicNumber],
46 ) or return undef;
47  
48 0 1;
49 }
50  
51 0 ▶sub unpack {
Subroutine unpack: not called CC=2 SCAR=17.9
Pod documented
52 0 my $self = shift;
53  
54 0 ▶ my ($code, $identifier, $length, $magicNumber, $payload) =
Branch: 1 branch
BranchTrueFalseTotal
() = $self->SUPER::unpack("CCnN a*", $self->[$__raw]) or return undef 0 0 0
55 $self->SUPER::unpack('CCnN a*', $self->[$__raw])
56 or return undef;
57  
58 0 $self->[$__code] = $code;
59 0 $self->[$__identifier] = $identifier;
60 0 $self->[$__length] = $length;
61 0 $self->[$__magicNumber] = $magicNumber;
62 0 $self->[$__payload] = $payload;
63  
64 0 1;
65 }
66  
67 0 ▶sub encapsulate {
Subroutine encapsulate: not called CC=2 SCAR=17.9
Pod documented
68 0 my $types = {
69 NP_LAYER_NONE() => NP_LAYER_NONE(),
70 };
71  
72 0 ▶ $types->{NP_LAYER_NONE()} || NP_LAYER_UNKNOWN();
Branch: 1 branch
BranchTrueFalseTotal
$types->{"NONE"} or "UNKNOWN" 0 0 0
73 }
74  
75 0 ▶sub print {
Subroutine print: not called CC=1 SCAR=6.9
Pod documented
76 0 my $self = shift;
77  
78 0 my $l = $self->layer;
79 0 my $i = $self->is;
80 0 sprintf "$l:+$i: code:0x%02x identifier:0x%02x length:%d ".
81 "magicNumber:0x%04x",
82 $self->[$__code], $self->[$__identifier], $self->[$__length],
83 $self->[$__magicNumber];
84 }
85  
86 1 1;
87  
88 __END__
« Packet/LLC.pm ↑ Summary Packet/PPP.pm »