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