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