LLTD/EmiteeDesc.pm

filter: Statementstmt 87.5% 28 / 32 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 6 / 8 Podpod 100% 5 / 5 totaltotal 83.6% 41 / 49 SCAR 11.1
CC
3
Cov
83%
pack
2.0
unpack
2.0
getLength
2.0
CRAP 3.0
« LLTD/Tlv.pm ↑ Summary LLTD/RecveeDesc.pm »
1 #
2 # $Id: EmiteeDesc.pm,v 1.2 2007/03/15 18:23:26 gomor Exp $
3 #
4 package Net::Frame::Layer::LLTD::EmiteeDesc;
5 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 10 ▶use Net::Frame::Layer qw(:consts :subs);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 10 our @ISA = qw(Net::Frame::Layer);
10  
11 10 our @AS = qw(
12 type
13 pause
14 sourceAddress
15 destinationAddress
16 );
17 10 __PACKAGE__->cgBuildIndices;
18 10 __PACKAGE__->cgBuildAccessorsScalar(\@AS);
19  
20 sub new {
21 shift->SUPER::new(
22 1 ▶ type => 0,
Subroutine new: called CC=1 SCAR=0.0
Pod documented
23 pause => 0,
24 sourceAddress => 'ff:ff:ff:ff:ff:ff',
25 destinationAddress => 'ff:ff:ff:ff:ff:ff',
26 @_,
27 );
28 }
29  
30 0 ▶sub getLength { 14 }
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.0
Pod documented
34  
35 1 (my $sourceAddress = $self->sourceAddress) =~ s/://g;
36 1 (my $destinationAddress = $self->destinationAddress) =~ s/://g;
37  
38 1 ▶ $self->raw($self->SUPER::pack('CCH12H12',
Branch: 1 branch
BranchTrueFalseTotal
$self->raw($self->SUPER::pack("CCH12H12", $self->type, $self->pause, $sourceAddress, $destinationAddress)) or return undef 0 1 1
39 $self->type, $self->pause, $sourceAddress, $destinationAddress,
40 )) or return undef;
41  
42 1 $self->raw;
43 }
44  
45 sub unpack {
46 1 ▶ my $self = shift;
Subroutine unpack: called CC=2 SCAR=7.0
Pod documented
47  
48 1 ▶ my ($type, $pause, $src, $dst, $payload) =
Branch: 1 branch
BranchTrueFalseTotal
() = $self->SUPER::unpack("CCH12H12 a*", $self->raw) or return undef 0 1 1
49 $self->SUPER::unpack('CCH12H12 a*', $self->raw)
50 or return undef;
51  
52 1 $self->type($type);
53 1 $self->pause($pause);
54 1 $self->sourceAddress(convertMac($src));
55 1 $self->destinationAddress(convertMac($dst));
56  
57 1 $self->payload($payload);
58  
59 1 $self;
60 }
61  
62 sub print {
63 0 ▶ my $self = shift;
Subroutine print: not called CC=1 SCAR=6.9
Pod documented
64  
65 0 my $l = $self->layer;
66 0 sprintf
67 "$l: type:%02x pause:%02x\n".
68 "$l: sourceAddress: %s\n".
69 "$l: destinationAddress: %s",
70 $self->type,
71 $self->pause,
72 $self->sourceAddress,
73 $self->destinationAddress;
74 }
75  
76 10 1;
77  
78 __END__
« LLTD/Tlv.pm ↑ Summary LLTD/RecveeDesc.pm »