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