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