line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: Hello.pm,v 1.4 2007/03/13 18:17:50 gomor Exp $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::OSPF::Hello; |
5
|
14
|
|
|
14
|
|
17313
|
use strict; |
|
14
|
|
|
|
|
28
|
|
|
14
|
|
|
|
|
591
|
|
6
|
14
|
|
|
14
|
|
140
|
use warnings; |
|
14
|
|
|
|
|
23
|
|
|
14
|
|
|
|
|
528
|
|
7
|
|
|
|
|
|
|
|
8
|
14
|
|
|
14
|
|
920
|
use Net::Frame::Layer qw(:consts :subs); |
|
14
|
|
|
|
|
158400
|
|
|
14
|
|
|
|
|
24700
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @AS = qw( |
12
|
|
|
|
|
|
|
networkMask |
13
|
|
|
|
|
|
|
helloInterval |
14
|
|
|
|
|
|
|
options |
15
|
|
|
|
|
|
|
routerPri |
16
|
|
|
|
|
|
|
routerDeadInterval |
17
|
|
|
|
|
|
|
designatedRouter |
18
|
|
|
|
|
|
|
backupDesignatedRouter |
19
|
|
|
|
|
|
|
lls |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
our @AA = qw( |
22
|
|
|
|
|
|
|
neighborList |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
25
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
26
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsArray (\@AA); |
27
|
|
|
|
|
|
|
|
28
|
14
|
|
|
14
|
|
899
|
use Net::Frame::Layer::OSPF qw(:consts); |
|
14
|
|
|
|
|
27
|
|
|
14
|
|
|
|
|
28392
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub new { |
31
|
|
|
|
|
|
|
shift->SUPER::new( |
32
|
1
|
|
|
1
|
1
|
27
|
networkMask => '255.255.255.0', |
33
|
|
|
|
|
|
|
helloInterval => 60, |
34
|
|
|
|
|
|
|
options => 0, |
35
|
|
|
|
|
|
|
routerPri => 0, |
36
|
|
|
|
|
|
|
routerDeadInterval => 120, |
37
|
|
|
|
|
|
|
designatedRouter => '0.0.0.0', |
38
|
|
|
|
|
|
|
backupDesignatedRouter => '0.0.0.0', |
39
|
|
|
|
|
|
|
neighborList => [], |
40
|
|
|
|
|
|
|
@_, |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub getLength { |
45
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
46
|
0
|
|
|
|
|
0
|
my $len = 20; |
47
|
0
|
|
|
|
|
0
|
for ($self->neighborList) { |
48
|
0
|
|
|
|
|
0
|
$len += 4; |
49
|
|
|
|
|
|
|
} |
50
|
0
|
|
|
|
|
0
|
$len; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub pack { |
54
|
1
|
|
|
1
|
1
|
346
|
my $self = shift; |
55
|
|
|
|
|
|
|
|
56
|
1
|
50
|
|
|
|
6
|
my $raw = $self->SUPER::pack('a4nCCNa4a4', |
57
|
|
|
|
|
|
|
inetAton($self->networkMask), $self->helloInterval, $self->options, |
58
|
|
|
|
|
|
|
$self->routerPri, $self->routerDeadInterval, |
59
|
|
|
|
|
|
|
inetAton($self->designatedRouter), |
60
|
|
|
|
|
|
|
inetAton($self->backupDesignatedRouter), |
61
|
|
|
|
|
|
|
) or return undef; |
62
|
|
|
|
|
|
|
|
63
|
1
|
|
|
|
|
136
|
for ($self->neighborList) { |
64
|
0
|
0
|
|
|
|
0
|
$raw .= $self->SUPER::pack('a4', inetAton($_)) or return undef; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
1
|
|
|
|
|
25
|
$self->raw($raw); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub unpack { |
71
|
1
|
|
|
1
|
1
|
16
|
my $self = shift; |
72
|
|
|
|
|
|
|
|
73
|
1
|
50
|
|
|
|
4
|
my ($netmask, $helloInt, $options, $pri, $deadInt, $desRouter, $backup, |
74
|
|
|
|
|
|
|
$payload) = $self->SUPER::unpack('a4nCCNa4a4 a*', $self->raw) |
75
|
|
|
|
|
|
|
or return undef; |
76
|
|
|
|
|
|
|
|
77
|
1
|
|
|
|
|
38
|
$self->networkMask(inetNtoa($netmask)); |
78
|
1
|
|
|
|
|
21
|
$self->helloInterval($helloInt); |
79
|
1
|
|
|
|
|
11
|
$self->options($options); |
80
|
1
|
|
|
|
|
11
|
$self->routerPri($pri); |
81
|
1
|
|
|
|
|
12
|
$self->routerDeadInterval($deadInt); |
82
|
1
|
|
|
|
|
12
|
$self->designatedRouter(inetNtoa($desRouter)); |
83
|
1
|
|
|
|
|
15
|
$self->backupDesignatedRouter(inetNtoa($backup)); |
84
|
|
|
|
|
|
|
|
85
|
1
|
|
|
|
|
14
|
my @neighborList = (); |
86
|
1
|
50
|
|
|
|
7
|
if ($payload) { |
87
|
0
|
|
|
|
|
0
|
while ($payload) { |
88
|
0
|
0
|
|
|
|
0
|
my ($neighbor, $tail) = $self->SUPER::unpack('a4 a*', $payload) |
89
|
|
|
|
|
|
|
or return undef; |
90
|
0
|
|
|
|
|
0
|
push @neighborList, inetNtoa($neighbor); |
91
|
0
|
|
|
|
|
0
|
$payload = $tail; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
1
|
|
|
|
|
5
|
$self->neighborList(\@neighborList); |
96
|
|
|
|
|
|
|
|
97
|
1
|
|
|
|
|
17
|
$self->payload($payload); |
98
|
|
|
|
|
|
|
|
99
|
1
|
|
|
|
|
10
|
$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: networkMask:%s helloInterval:%d\n". |
108
|
|
|
|
|
|
|
"$l: options:0x%02x routerPri:0x%02x routerDeadInterval:%d\n". |
109
|
|
|
|
|
|
|
"$l: designatedRouter:%s backupDesignatedRouter:%s", |
110
|
|
|
|
|
|
|
$self->networkMask, |
111
|
|
|
|
|
|
|
$self->helloInterval, |
112
|
|
|
|
|
|
|
$self->options, |
113
|
|
|
|
|
|
|
$self->routerPri, |
114
|
|
|
|
|
|
|
$self->routerDeadInterval, |
115
|
|
|
|
|
|
|
$self->designatedRouter, |
116
|
|
|
|
|
|
|
$self->backupDesignatedRouter, |
117
|
|
|
|
|
|
|
; |
118
|
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
for ($self->neighborList) { |
120
|
0
|
|
|
|
|
|
$buf .= "\n$l: neighbor: $_"; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
0
|
0
|
|
|
|
|
if ($self->lls) { |
124
|
0
|
|
|
|
|
|
$buf .= "\n".$self->lls->print; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
$buf; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
1; |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
__END__ |