line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: LinkStateUpdate.pm,v 1.3 2007/02/28 21:03:11 gomor Exp $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::OSPF::LinkStateUpdate; |
5
|
2
|
|
|
2
|
|
7
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
42
|
|
6
|
2
|
|
|
2
|
|
7
|
use warnings; |
|
2
|
|
|
|
|
1
|
|
|
2
|
|
|
|
|
45
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
6
|
use Net::Frame::Layer qw(:consts :subs); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
329
|
|
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
|
2
|
|
|
2
|
|
8
|
use Net::Frame::Layer::OSPF qw(:consts); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
808
|
|
22
|
|
|
|
|
|
|
require Net::Frame::Layer::OSPF::Lsa; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub new { |
25
|
|
|
|
|
|
|
shift->SUPER::new( |
26
|
1
|
|
|
1
|
1
|
11
|
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
|
103
|
my $self = shift; |
43
|
|
|
|
|
|
|
|
44
|
1
|
50
|
|
|
|
3
|
my $raw = $self->SUPER::pack('N', $self->lsaNumber) |
45
|
|
|
|
|
|
|
or return undef; |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
26
|
for ($self->lsaList) { |
48
|
0
|
|
|
|
|
0
|
$raw .= $_->pack; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
12
|
$self->raw($raw); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub unpack { |
55
|
1
|
|
|
1
|
1
|
8
|
my $self = shift; |
56
|
|
|
|
|
|
|
|
57
|
1
|
50
|
|
|
|
3
|
my ($lsaNumber, $payload) = $self->SUPER::unpack('N a*', $self->raw) |
58
|
|
|
|
|
|
|
or return undef; |
59
|
|
|
|
|
|
|
|
60
|
1
|
|
|
|
|
15
|
$self->lsaNumber($lsaNumber); |
61
|
|
|
|
|
|
|
|
62
|
1
|
|
|
|
|
6
|
my @lsaList = (); |
63
|
1
|
|
33
|
|
|
3
|
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
|
|
|
|
|
3
|
$self->lsaList(\@lsaList); |
71
|
1
|
|
|
|
|
8
|
$self->payload($payload); |
72
|
|
|
|
|
|
|
|
73
|
1
|
|
|
|
|
5
|
$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__ |