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