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