line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: Hello.pm 12 2015-01-14 06:29:59Z gomor $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::LLTD::Hello; |
5
|
9
|
|
|
9
|
|
38
|
use strict; use warnings; |
|
9
|
|
|
9
|
|
12
|
|
|
9
|
|
|
|
|
307
|
|
|
9
|
|
|
|
|
39
|
|
|
9
|
|
|
|
|
10
|
|
|
9
|
|
|
|
|
309
|
|
6
|
|
|
|
|
|
|
|
7
|
9
|
|
|
9
|
|
52
|
use Net::Frame::Layer qw(:consts :subs); |
|
9
|
|
|
|
|
11
|
|
|
9
|
|
|
|
|
2186
|
|
8
|
|
|
|
|
|
|
require Exporter; |
9
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer Exporter); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @AS = qw( |
12
|
|
|
|
|
|
|
generationNumber |
13
|
|
|
|
|
|
|
currentMapperAddress |
14
|
|
|
|
|
|
|
apparentMapperAddress |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
our @AA = qw( |
17
|
|
|
|
|
|
|
tlvList |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
20
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
21
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsArray (\@AA); |
22
|
|
|
|
|
|
|
|
23
|
9
|
|
|
9
|
|
3902
|
use Net::Frame::Layer::LLTD::Tlv; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
4545
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub new { |
26
|
|
|
|
|
|
|
shift->SUPER::new( |
27
|
1
|
|
|
1
|
1
|
28
|
generationNumber => 0, |
28
|
|
|
|
|
|
|
currentMapperAddress => 'ff:ff:ff:ff:ff:ff', |
29
|
|
|
|
|
|
|
apparentMapperAddress => 'ff:ff:ff:ff:ff:ff', |
30
|
|
|
|
|
|
|
tlvList => [], |
31
|
|
|
|
|
|
|
@_, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub getTlvListLength { |
36
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
37
|
0
|
|
|
|
|
0
|
my $len = 0; |
38
|
0
|
|
|
|
|
0
|
for ($self->tlvList) { |
39
|
0
|
|
|
|
|
0
|
$len += $_->getLength; |
40
|
|
|
|
|
|
|
} |
41
|
0
|
|
|
|
|
0
|
$len; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub getLength { |
45
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
46
|
0
|
|
|
|
|
0
|
my $len = 14; |
47
|
0
|
0
|
|
|
|
0
|
$len += $self->getTlvListLength if $self->tlvList; |
48
|
0
|
|
|
|
|
0
|
$len; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub pack { |
52
|
1
|
|
|
1
|
1
|
307
|
my $self = shift; |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
|
|
5
|
(my $mac1 = $self->currentMapperAddress) =~ s/://g; |
55
|
1
|
|
|
|
|
49
|
(my $mac2 = $self->apparentMapperAddress) =~ s/://g; |
56
|
|
|
|
|
|
|
|
57
|
1
|
50
|
|
|
|
16
|
my $raw = $self->SUPER::pack('nH12H12', |
58
|
|
|
|
|
|
|
$self->generationNumber, |
59
|
|
|
|
|
|
|
$mac1, |
60
|
|
|
|
|
|
|
$mac2, |
61
|
|
|
|
|
|
|
) or return undef; |
62
|
|
|
|
|
|
|
|
63
|
1
|
|
|
|
|
44
|
for ($self->tlvList) { |
64
|
0
|
|
|
|
|
0
|
$raw .= $_->pack; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
1
|
|
|
|
|
33
|
$self->raw($raw); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub unpack { |
71
|
1
|
|
|
1
|
1
|
19
|
my $self = shift; |
72
|
|
|
|
|
|
|
|
73
|
1
|
50
|
|
|
|
5
|
my ($generationNumber, $mac1, $mac2, $payload) = |
74
|
|
|
|
|
|
|
$self->SUPER::unpack('nH12H12 a*', $self->raw) |
75
|
|
|
|
|
|
|
or return undef; |
76
|
|
|
|
|
|
|
|
77
|
1
|
|
|
|
|
43
|
$self->generationNumber($generationNumber); |
78
|
1
|
|
|
|
|
17
|
$self->currentMapperAddress(convertMac($mac1)); |
79
|
1
|
|
|
|
|
32
|
$self->apparentMapperAddress(convertMac($mac2)); |
80
|
|
|
|
|
|
|
|
81
|
1
|
|
|
|
|
21
|
my @tlvList = (); |
82
|
1
|
|
33
|
|
|
15
|
while ($payload && length($payload) > 2) { |
83
|
0
|
|
|
|
|
0
|
my $tlv = Net::Frame::Layer::LLTD::Tlv->new(raw => $payload); |
84
|
0
|
|
|
|
|
0
|
$tlv->unpack; |
85
|
0
|
|
|
|
|
0
|
push @tlvList, $tlv; |
86
|
0
|
|
|
|
|
0
|
$payload = $tlv->payload; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
1
|
|
|
|
|
5
|
$self->tlvList(\@tlvList); |
90
|
1
|
|
|
|
|
19
|
$self->payload($payload); |
91
|
|
|
|
|
|
|
|
92
|
1
|
|
|
|
|
12
|
$self; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
0
|
1
|
|
sub encapsulate { shift->nextLayer } |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub print { |
98
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
99
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
my $l = $self->layer; |
101
|
0
|
|
|
|
|
|
my $buf = sprintf |
102
|
|
|
|
|
|
|
"$l: generationNumber:%d\n". |
103
|
|
|
|
|
|
|
"$l: currentMapperAddress: %s\n". |
104
|
|
|
|
|
|
|
"$l: apparentMapperAddress: %s", |
105
|
|
|
|
|
|
|
$self->generationNumber, |
106
|
|
|
|
|
|
|
$self->currentMapperAddress, |
107
|
|
|
|
|
|
|
$self->apparentMapperAddress; |
108
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
for ($self->tlvList) { |
110
|
0
|
|
|
|
|
|
$buf .= "\n".$_->print; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
$buf; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
1; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
__END__ |