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