| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# $Id: DatabaseDesc.pm,v 1.4 2007/03/13 18:14:43 gomor Exp $ |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
package Net::Frame::Layer::OSPF::DatabaseDesc; |
|
5
|
14
|
|
|
14
|
|
10721
|
use strict; |
|
|
14
|
|
|
|
|
31
|
|
|
|
14
|
|
|
|
|
655
|
|
|
6
|
14
|
|
|
14
|
|
77
|
use warnings; |
|
|
14
|
|
|
|
|
27
|
|
|
|
14
|
|
|
|
|
510
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
14
|
|
|
14
|
|
1289
|
use Net::Frame::Layer qw(:consts :subs); |
|
|
14
|
|
|
|
|
89304
|
|
|
|
14
|
|
|
|
|
5107
|
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer); |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @AS = qw( |
|
12
|
|
|
|
|
|
|
interfaceMtu |
|
13
|
|
|
|
|
|
|
options |
|
14
|
|
|
|
|
|
|
flags |
|
15
|
|
|
|
|
|
|
ddSequenceNumber |
|
16
|
|
|
|
|
|
|
lls |
|
17
|
|
|
|
|
|
|
); |
|
18
|
|
|
|
|
|
|
our @AA = qw( |
|
19
|
|
|
|
|
|
|
lsaList |
|
20
|
|
|
|
|
|
|
); |
|
21
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
|
22
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
|
23
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsArray (\@AA); |
|
24
|
|
|
|
|
|
|
|
|
25
|
14
|
|
|
14
|
|
881
|
use Net::Frame::Layer::OSPF qw(:consts); |
|
|
14
|
|
|
|
|
32
|
|
|
|
14
|
|
|
|
|
19990
|
|
|
26
|
|
|
|
|
|
|
require Net::Frame::Layer::OSPF::Lsa; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub new { |
|
29
|
|
|
|
|
|
|
shift->SUPER::new( |
|
30
|
1
|
|
|
1
|
1
|
26
|
interfaceMtu => 1500, |
|
31
|
|
|
|
|
|
|
options => 0, |
|
32
|
|
|
|
|
|
|
flags => 0, |
|
33
|
|
|
|
|
|
|
ddSequenceNumber => 1, |
|
34
|
|
|
|
|
|
|
lsaList => [], |
|
35
|
|
|
|
|
|
|
@_, |
|
36
|
|
|
|
|
|
|
); |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub getLength { |
|
40
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
41
|
0
|
|
|
|
|
0
|
my $len = 8; |
|
42
|
0
|
|
|
|
|
0
|
for ($self->lsaList) { |
|
43
|
0
|
|
|
|
|
0
|
$len += $_->getLength; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
0
|
0
|
|
|
|
0
|
if ($self->lls) { |
|
46
|
0
|
|
|
|
|
0
|
$len += $self->lls->getLength; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
0
|
|
|
|
|
0
|
$len; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub pack { |
|
52
|
1
|
|
|
1
|
1
|
277
|
my $self = shift; |
|
53
|
|
|
|
|
|
|
|
|
54
|
1
|
50
|
|
|
|
6
|
my $raw = $self->SUPER::pack('nCCN', |
|
55
|
|
|
|
|
|
|
$self->interfaceMtu, $self->options, $self->flags, |
|
56
|
|
|
|
|
|
|
$self->ddSequenceNumber, |
|
57
|
|
|
|
|
|
|
) or return undef; |
|
58
|
|
|
|
|
|
|
|
|
59
|
1
|
|
|
|
|
102
|
for ($self->lsaList) { |
|
60
|
0
|
0
|
|
|
|
0
|
$raw .= $_->pack or return undef; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
1
|
50
|
|
|
|
21
|
if ($self->lls) { |
|
64
|
0
|
0
|
|
|
|
0
|
$raw .= $self->lls->pack or return undef; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
1
|
|
|
|
|
17
|
$self->raw($raw); |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub unpack { |
|
71
|
1
|
|
|
1
|
1
|
15
|
my $self = shift; |
|
72
|
|
|
|
|
|
|
|
|
73
|
1
|
50
|
|
|
|
5
|
my ($interfaceMtu, $options, $flags, $ddSequenceNumber, $payload) = |
|
74
|
|
|
|
|
|
|
$self->SUPER::unpack('nCCN a*', $self->raw) |
|
75
|
|
|
|
|
|
|
or return undef; |
|
76
|
|
|
|
|
|
|
|
|
77
|
1
|
|
|
|
|
35
|
$self->interfaceMtu($interfaceMtu); |
|
78
|
1
|
|
|
|
|
12
|
$self->options($options); |
|
79
|
1
|
|
|
|
|
11
|
$self->flags($flags); |
|
80
|
1
|
|
|
|
|
12
|
$self->ddSequenceNumber($ddSequenceNumber); |
|
81
|
|
|
|
|
|
|
|
|
82
|
1
|
|
|
|
|
11
|
my @lsaList = (); |
|
83
|
1
|
50
|
|
|
|
4
|
if ($payload) { |
|
84
|
0
|
|
|
|
|
0
|
my $count; |
|
85
|
0
|
|
0
|
|
|
0
|
while ($payload || (++$count > 100)) { |
|
86
|
0
|
0
|
|
|
|
0
|
my $lsa = Net::Frame::Layer::OSPF::Lsa->new( |
|
87
|
|
|
|
|
|
|
raw => $payload, |
|
88
|
|
|
|
|
|
|
full => 0, |
|
89
|
|
|
|
|
|
|
) or last; |
|
90
|
0
|
|
|
|
|
0
|
$lsa->unpack; |
|
91
|
0
|
|
|
|
|
0
|
$payload = $lsa->payload; |
|
92
|
0
|
|
|
|
|
0
|
push @lsaList, $lsa; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
1
|
|
|
|
|
5
|
$self->lsaList(\@lsaList); |
|
97
|
|
|
|
|
|
|
|
|
98
|
1
|
|
|
|
|
17
|
$self->payload($payload); |
|
99
|
|
|
|
|
|
|
|
|
100
|
1
|
|
|
|
|
12
|
$self; |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub print { |
|
104
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
105
|
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
my $l = $self->layer; |
|
107
|
0
|
|
|
|
|
|
my $buf = sprintf |
|
108
|
|
|
|
|
|
|
"$l: interfaceMtu:%d options:0x%02x flags:0x%02x\n". |
|
109
|
|
|
|
|
|
|
"$l: ddSequenceNumber:%d", |
|
110
|
|
|
|
|
|
|
$self->interfaceMtu, |
|
111
|
|
|
|
|
|
|
$self->options, |
|
112
|
|
|
|
|
|
|
$self->flags, |
|
113
|
|
|
|
|
|
|
$self->ddSequenceNumber, |
|
114
|
|
|
|
|
|
|
; |
|
115
|
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
for ($self->lsaList) { |
|
117
|
0
|
|
|
|
|
|
$buf .= "\n".$_->print; |
|
118
|
|
|
|
|
|
|
} |
|
119
|
|
|
|
|
|
|
|
|
120
|
0
|
0
|
|
|
|
|
if ($self->lls) { |
|
121
|
0
|
|
|
|
|
|
$buf .= "\n".$self->lls->print; |
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
|
$buf; |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
1; |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
__END__ |