line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: Network.pm 73 2015-01-14 06:42:49Z gomor $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::OSPF::Lsa::Network; |
5
|
14
|
|
|
14
|
|
5673
|
use strict; use warnings; |
|
14
|
|
|
14
|
|
21
|
|
|
14
|
|
|
|
|
518
|
|
|
14
|
|
|
|
|
69
|
|
|
14
|
|
|
|
|
18
|
|
|
14
|
|
|
|
|
450
|
|
6
|
|
|
|
|
|
|
|
7
|
14
|
|
|
14
|
|
514
|
use Net::Frame::Layer qw(:consts :subs); |
|
14
|
|
|
|
|
53870
|
|
|
14
|
|
|
|
|
3916
|
|
8
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @AS = qw( |
11
|
|
|
|
|
|
|
netmask |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
our @AA = qw( |
14
|
|
|
|
|
|
|
routerList |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
17
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
18
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsArray (\@AA); |
19
|
|
|
|
|
|
|
|
20
|
14
|
|
|
14
|
|
605
|
use Net::Frame::Layer::OSPF qw(:consts); |
|
14
|
|
|
|
|
22
|
|
|
14
|
|
|
|
|
8781
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub new { |
23
|
|
|
|
|
|
|
shift->SUPER::new( |
24
|
1
|
|
|
1
|
1
|
31
|
netmask => '255.255.255.0', |
25
|
|
|
|
|
|
|
routerList => [], |
26
|
|
|
|
|
|
|
@_, |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub getLength { |
31
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
32
|
0
|
|
|
|
|
0
|
my $len = 4; |
33
|
0
|
|
|
|
|
0
|
$len += 4 for $self->routerList; |
34
|
0
|
|
|
|
|
0
|
$len; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub pack { |
38
|
1
|
|
|
1
|
1
|
279
|
my $self = shift; |
39
|
|
|
|
|
|
|
|
40
|
1
|
50
|
|
|
|
7
|
my $raw = $self->SUPER::pack('a4', inetAton($self->netmask)) |
41
|
|
|
|
|
|
|
or return undef; |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
|
|
84
|
for ($self->routerList) { |
44
|
0
|
0
|
|
|
|
0
|
$raw .= $self->SUPER::pack('a4', inetAton($_)) |
45
|
|
|
|
|
|
|
or return undef; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
33
|
$self->raw($raw); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub unpack { |
52
|
1
|
|
|
1
|
1
|
18
|
my $self = shift; |
53
|
|
|
|
|
|
|
|
54
|
1
|
50
|
|
|
|
6
|
my ($netmask, $payload) = $self->SUPER::unpack('a4 a*', $self->raw) |
55
|
|
|
|
|
|
|
or return undef; |
56
|
|
|
|
|
|
|
|
57
|
1
|
|
|
|
|
38
|
$self->netmask(inetNtoa($netmask)); |
58
|
|
|
|
|
|
|
|
59
|
1
|
|
|
|
|
20
|
my @routerList; |
60
|
1
|
|
33
|
|
|
11
|
while ($payload && length($payload) > 3) { |
61
|
0
|
|
|
|
|
0
|
my $ip; |
62
|
0
|
0
|
|
|
|
0
|
($ip, $payload) = $self->SUPER::unpack('a4 a*', $payload) |
63
|
|
|
|
|
|
|
or return undef; |
64
|
0
|
|
|
|
|
0
|
push @routerList, inetNtoa($ip); |
65
|
|
|
|
|
|
|
} |
66
|
1
|
|
|
|
|
5
|
$self->routerList(\@routerList); |
67
|
|
|
|
|
|
|
|
68
|
1
|
|
|
|
|
21
|
$self->payload($payload); |
69
|
|
|
|
|
|
|
|
70
|
1
|
|
|
|
|
12
|
$self; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub print { |
74
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
my $l = $self->layer; |
77
|
0
|
|
|
|
|
|
my $buf = sprintf |
78
|
|
|
|
|
|
|
"$l: netmask:%s", |
79
|
|
|
|
|
|
|
$self->netmask, |
80
|
|
|
|
|
|
|
; |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
for ($self->routerList) { |
83
|
0
|
|
|
|
|
|
$buf .= sprintf "\n$l: router: %s", $_; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
$buf; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
__END__ |