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