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