line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: RIPng.pm 49 2009-05-31 13:15:34Z VinsWorldcom $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::RIPng; |
5
|
5
|
|
|
5
|
|
267471
|
use strict; use warnings; |
|
5
|
|
|
5
|
|
12
|
|
|
5
|
|
|
|
|
178
|
|
|
5
|
|
|
|
|
27
|
|
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
216
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.02'; |
8
|
|
|
|
|
|
|
|
9
|
5
|
|
|
5
|
|
2984
|
use Net::Frame::Layer qw(:consts :subs); |
|
5
|
|
|
|
|
255910
|
|
|
5
|
|
|
|
|
1162
|
|
10
|
5
|
|
|
5
|
|
72
|
use Exporter; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
242
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer Exporter); |
12
|
|
|
|
|
|
|
|
13
|
5
|
|
|
5
|
|
3245
|
use Net::Frame::Layer::RIPng::v1 qw(:consts); |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
1136
|
|
14
|
|
|
|
|
|
|
my @consts; |
15
|
|
|
|
|
|
|
for my $c (sort(keys(%constant::declared))) { |
16
|
|
|
|
|
|
|
if ($c =~ /^Net::Frame::Layer::RIPng::v1::/) { |
17
|
|
|
|
|
|
|
$c =~ s/^Net::Frame::Layer::RIPng::v1:://; |
18
|
|
|
|
|
|
|
push @consts, $c |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
23
|
|
|
|
|
|
|
consts => [@consts, qw( |
24
|
|
|
|
|
|
|
NF_RIPNG_DEST_HWADDR |
25
|
|
|
|
|
|
|
NF_RIPNG_DEST_ADDR |
26
|
|
|
|
|
|
|
NF_RIPNG_DEST_PORT |
27
|
|
|
|
|
|
|
NF_RIPNG_COMMAND_REQUEST |
28
|
|
|
|
|
|
|
NF_RIPNG_COMMAND_RESPONSE |
29
|
|
|
|
|
|
|
)], |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
our @EXPORT_OK = ( |
32
|
|
|
|
|
|
|
@{$EXPORT_TAGS{consts}}, |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
5
|
|
|
5
|
|
28
|
use constant NF_RIPNG_DEST_HWADDR => '33:33:00:00:00:09'; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
228
|
|
36
|
5
|
|
|
5
|
|
102
|
use constant NF_RIPNG_DEST_ADDR => 'ff02::9'; |
|
5
|
|
|
|
|
18
|
|
|
5
|
|
|
|
|
219
|
|
37
|
5
|
|
|
5
|
|
22
|
use constant NF_RIPNG_DEST_PORT => 521; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
223
|
|
38
|
5
|
|
|
5
|
|
23
|
use constant NF_RIPNG_COMMAND_REQUEST => 1; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
190
|
|
39
|
5
|
|
|
5
|
|
21
|
use constant NF_RIPNG_COMMAND_RESPONSE => 2; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
2955
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
our @AS = qw( |
42
|
|
|
|
|
|
|
command |
43
|
|
|
|
|
|
|
version |
44
|
|
|
|
|
|
|
reserved |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
47
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
#no strict 'vars'; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
$Net::Frame::Layer::UDP::Next->{521} = "RIPng"; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub new { |
54
|
|
|
|
|
|
|
shift->SUPER::new( |
55
|
1
|
|
|
1
|
1
|
33
|
command => NF_RIPNG_COMMAND_REQUEST, |
56
|
|
|
|
|
|
|
version => 1, |
57
|
|
|
|
|
|
|
reserved => 0, |
58
|
|
|
|
|
|
|
@_, |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub match { |
63
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
64
|
0
|
|
|
|
|
0
|
my ($with) = @_; |
65
|
0
|
|
|
|
|
0
|
my $sVer = $self->version; |
66
|
0
|
|
|
|
|
0
|
my $wVer = $with->version; |
67
|
0
|
|
|
|
|
0
|
my $sCmd = $self->command; |
68
|
0
|
|
|
|
|
0
|
my $wCmd = $with->command; |
69
|
0
|
0
|
0
|
|
|
0
|
if (($sCmd == NF_RIPNG_COMMAND_REQUEST) |
|
|
|
0
|
|
|
|
|
70
|
|
|
|
|
|
|
&& ($wCmd == NF_RIPNG_COMMAND_RESPONSE) |
71
|
|
|
|
|
|
|
&& ($sVer == $wVer)) { |
72
|
0
|
|
|
|
|
0
|
return 1; |
73
|
|
|
|
|
|
|
} |
74
|
0
|
|
|
|
|
0
|
0; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# XXX: may be better, by keying on type also |
78
|
0
|
|
|
0
|
1
|
0
|
sub getKey { shift->layer } |
79
|
0
|
|
|
0
|
1
|
0
|
sub getKeyReverse { shift->layer } |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
0
|
1
|
0
|
sub getLength { 4 } |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub pack { |
84
|
1
|
|
|
1
|
1
|
285
|
my $self = shift; |
85
|
|
|
|
|
|
|
|
86
|
1
|
50
|
|
|
|
6
|
my $raw = $self->SUPER::pack('CCn', |
87
|
|
|
|
|
|
|
$self->command, |
88
|
|
|
|
|
|
|
$self->version, |
89
|
|
|
|
|
|
|
$self->reserved |
90
|
|
|
|
|
|
|
) or return; |
91
|
|
|
|
|
|
|
|
92
|
1
|
|
|
|
|
83
|
return $self->raw($raw); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub unpack { |
96
|
1
|
|
|
1
|
1
|
17
|
my $self = shift; |
97
|
|
|
|
|
|
|
|
98
|
1
|
50
|
|
|
|
5
|
my ($command, $version, $reserved, $payload) = |
99
|
|
|
|
|
|
|
$self->SUPER::unpack('CCn a*', $self->raw) |
100
|
|
|
|
|
|
|
or return; |
101
|
|
|
|
|
|
|
|
102
|
1
|
|
|
|
|
41
|
$self->command($command); |
103
|
1
|
|
|
|
|
13
|
$self->version($version); |
104
|
1
|
|
|
|
|
12
|
$self->reserved($reserved); |
105
|
|
|
|
|
|
|
|
106
|
1
|
|
|
|
|
16
|
$self->payload($payload); |
107
|
|
|
|
|
|
|
|
108
|
1
|
|
|
|
|
12
|
return $self; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub encapsulate { |
112
|
1
|
|
|
1
|
1
|
8
|
my $self = shift; |
113
|
|
|
|
|
|
|
|
114
|
1
|
50
|
|
|
|
11
|
return $self->nextLayer if $self->nextLayer; |
115
|
|
|
|
|
|
|
|
116
|
1
|
50
|
|
|
|
17
|
if ($self->payload) { |
117
|
0
|
0
|
|
|
|
0
|
if ($self->version == 1) { |
118
|
0
|
|
|
|
|
0
|
return 'RIPng::v1'; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
1
|
|
|
|
|
15
|
NF_LAYER_NONE; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub print { |
126
|
1
|
|
|
1
|
1
|
6
|
my $self = shift; |
127
|
|
|
|
|
|
|
|
128
|
1
|
|
|
|
|
10
|
my $l = $self->layer; |
129
|
1
|
|
|
|
|
16
|
my $buf = sprintf |
130
|
|
|
|
|
|
|
"$l: command:%d version:%d reserved:%d", |
131
|
|
|
|
|
|
|
$self->command, $self->version, $self->reserved; |
132
|
|
|
|
|
|
|
|
133
|
1
|
|
|
|
|
518
|
return $buf; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
1; |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
__END__ |