line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: Router.pm 73 2015-01-14 06:42:49Z gomor $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::OSPF::Lsa::Router; |
5
|
14
|
|
|
14
|
|
4940
|
use strict; use warnings; |
|
14
|
|
|
14
|
|
22
|
|
|
14
|
|
|
|
|
510
|
|
|
14
|
|
|
|
|
64
|
|
|
14
|
|
|
|
|
20
|
|
|
14
|
|
|
|
|
432
|
|
6
|
|
|
|
|
|
|
|
7
|
14
|
|
|
14
|
|
616
|
use Net::Frame::Layer qw(:consts :subs); |
|
14
|
|
|
|
|
61688
|
|
|
14
|
|
|
|
|
4364
|
|
8
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @AS = qw( |
11
|
|
|
|
|
|
|
flags |
12
|
|
|
|
|
|
|
zero |
13
|
|
|
|
|
|
|
nLink |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
our @AA = qw( |
16
|
|
|
|
|
|
|
linkList |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
19
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
20
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsArray (\@AA); |
21
|
|
|
|
|
|
|
|
22
|
14
|
|
|
14
|
|
723
|
use Net::Frame::Layer::OSPF qw(:consts); |
|
14
|
|
|
|
|
24
|
|
|
14
|
|
|
|
|
3387
|
|
23
|
14
|
|
|
14
|
|
6111
|
use Net::Frame::Layer::OSPF::Lsa::Router::Link; |
|
14
|
|
|
|
|
67
|
|
|
14
|
|
|
|
|
5951
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub new { |
26
|
|
|
|
|
|
|
shift->SUPER::new( |
27
|
1
|
|
|
1
|
1
|
23
|
flags => 0, |
28
|
|
|
|
|
|
|
zero => 0, |
29
|
|
|
|
|
|
|
nLink => 0, |
30
|
|
|
|
|
|
|
linkList => [], |
31
|
|
|
|
|
|
|
@_, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub getLength { |
36
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
37
|
0
|
|
|
|
|
0
|
my $len = 4; |
38
|
0
|
|
|
|
|
0
|
for ($self->linkList) { |
39
|
0
|
|
|
|
|
0
|
$len += $_->getLength; |
40
|
|
|
|
|
|
|
} |
41
|
0
|
|
|
|
|
0
|
$len; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub pack { |
45
|
1
|
|
|
1
|
1
|
214
|
my $self = shift; |
46
|
|
|
|
|
|
|
|
47
|
1
|
50
|
|
|
|
5
|
my $raw = $self->SUPER::pack('CCn', $self->flags, $self->zero, $self->nLink) |
48
|
|
|
|
|
|
|
or return undef; |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
55
|
for ($self->linkList) { |
51
|
0
|
|
|
|
|
0
|
$raw .= $_->pack; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
|
|
21
|
$self->raw($raw); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub unpack { |
58
|
1
|
|
|
1
|
1
|
11
|
my $self = shift; |
59
|
|
|
|
|
|
|
|
60
|
1
|
50
|
|
|
|
4
|
my ($flags, $zero, $nLink, $payload) = $self->SUPER::unpack('CCn a*', |
61
|
|
|
|
|
|
|
$self->raw) |
62
|
|
|
|
|
|
|
or return undef; |
63
|
|
|
|
|
|
|
|
64
|
1
|
|
|
|
|
30
|
$self->flags($flags); |
65
|
1
|
|
|
|
|
10
|
$self->zero($zero); |
66
|
1
|
|
|
|
|
7
|
$self->nLink($nLink); |
67
|
|
|
|
|
|
|
|
68
|
1
|
|
|
|
|
7
|
my @linkList = (); |
69
|
1
|
|
33
|
|
|
6
|
while ($payload && length($payload) > 0) { |
70
|
0
|
|
|
|
|
0
|
my $r = Net::Frame::Layer::OSPF::Lsa::Router::Link->new(raw => $payload); |
71
|
0
|
|
|
|
|
0
|
$r->unpack; |
72
|
0
|
|
|
|
|
0
|
$payload = $r->payload; |
73
|
0
|
|
|
|
|
0
|
push @linkList, $r; |
74
|
|
|
|
|
|
|
} |
75
|
1
|
|
|
|
|
4
|
$self->linkList(\@linkList); |
76
|
|
|
|
|
|
|
|
77
|
1
|
|
|
|
|
13
|
$self->payload($payload); |
78
|
|
|
|
|
|
|
|
79
|
1
|
|
|
|
|
7
|
$self; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub print { |
83
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
my $l = $self->layer; |
86
|
0
|
|
|
|
|
|
my $buf = sprintf |
87
|
|
|
|
|
|
|
"$l: flags:0x%02x zero:0x%02x nLink:%d", |
88
|
|
|
|
|
|
|
$self->flags, |
89
|
|
|
|
|
|
|
$self->zero, |
90
|
|
|
|
|
|
|
$self->nLink, |
91
|
|
|
|
|
|
|
; |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
for ($self->linkList) { |
94
|
0
|
|
|
|
|
|
$buf .= "\n".$_->print; |
95
|
|
|
|
|
|
|
} |
96
|
0
|
|
|
|
|
|
$buf; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
__END__ |