line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: LinkStateUpdate.pm 73 2015-01-14 06:42:49Z gomor $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::OSPF::LinkStateUpdate; |
5
|
14
|
|
|
14
|
|
4394
|
use strict; use warnings; |
|
14
|
|
|
14
|
|
19
|
|
|
14
|
|
|
|
|
515
|
|
|
14
|
|
|
|
|
64
|
|
|
14
|
|
|
|
|
22
|
|
|
14
|
|
|
|
|
503
|
|
6
|
|
|
|
|
|
|
|
7
|
14
|
|
|
14
|
|
579
|
use Net::Frame::Layer qw(:consts :subs); |
|
14
|
|
|
|
|
58174
|
|
|
14
|
|
|
|
|
3886
|
|
8
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @AS = qw( |
11
|
|
|
|
|
|
|
lsaNumber |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
our @AA = qw( |
14
|
|
|
|
|
|
|
lsaList |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
17
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
18
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsArray (\@AA); |
19
|
|
|
|
|
|
|
|
20
|
14
|
|
|
14
|
|
615
|
use Net::Frame::Layer::OSPF qw(:consts); |
|
14
|
|
|
|
|
27
|
|
|
14
|
|
|
|
|
8529
|
|
21
|
|
|
|
|
|
|
require Net::Frame::Layer::OSPF::Lsa; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new { |
24
|
|
|
|
|
|
|
shift->SUPER::new( |
25
|
1
|
|
|
1
|
1
|
30
|
lsaNumber => 0, |
26
|
|
|
|
|
|
|
lsaList => [], |
27
|
|
|
|
|
|
|
@_, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub getLength { |
32
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
33
|
0
|
|
|
|
|
0
|
my $len = 4; |
34
|
0
|
|
|
|
|
0
|
for ($self->lsaList) { |
35
|
0
|
|
|
|
|
0
|
$len += $_->getLength; |
36
|
|
|
|
|
|
|
} |
37
|
0
|
|
|
|
|
0
|
$len; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub pack { |
41
|
1
|
|
|
1
|
1
|
214
|
my $self = shift; |
42
|
|
|
|
|
|
|
|
43
|
1
|
50
|
|
|
|
5
|
my $raw = $self->SUPER::pack('N', $self->lsaNumber) |
44
|
|
|
|
|
|
|
or return undef; |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
43
|
for ($self->lsaList) { |
47
|
0
|
|
|
|
|
0
|
$raw .= $_->pack; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
20
|
$self->raw($raw); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub unpack { |
54
|
1
|
|
|
1
|
1
|
12
|
my $self = shift; |
55
|
|
|
|
|
|
|
|
56
|
1
|
50
|
|
|
|
4
|
my ($lsaNumber, $payload) = $self->SUPER::unpack('N a*', $self->raw) |
57
|
|
|
|
|
|
|
or return undef; |
58
|
|
|
|
|
|
|
|
59
|
1
|
|
|
|
|
28
|
$self->lsaNumber($lsaNumber); |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
7
|
my @lsaList = (); |
62
|
1
|
|
33
|
|
|
8
|
while ($payload && length($payload) > 0) { |
63
|
0
|
|
|
|
|
0
|
my $lsa = Net::Frame::Layer::OSPF::Lsa->new(raw => $payload); |
64
|
0
|
|
|
|
|
0
|
$lsa->unpack; |
65
|
0
|
|
|
|
|
0
|
push @lsaList, $lsa; |
66
|
0
|
|
|
|
|
0
|
$payload = $lsa->payload; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
1
|
|
|
|
|
3
|
$self->lsaList(\@lsaList); |
70
|
1
|
|
|
|
|
12
|
$self->payload($payload); |
71
|
|
|
|
|
|
|
|
72
|
1
|
|
|
|
|
7
|
$self; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub print { |
76
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
my $l = $self->layer; |
79
|
0
|
|
|
|
|
|
my $buf = sprintf |
80
|
|
|
|
|
|
|
"$l: lsaNumber:%d", |
81
|
|
|
|
|
|
|
$self->lsaNumber, |
82
|
|
|
|
|
|
|
; |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
for ($self->lsaList) { |
85
|
0
|
|
|
|
|
|
$buf .= "\n".$_->print; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
$buf; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
__END__ |