line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: v1.pm 49 2009-05-31 13:15:34Z VinsWorldcom $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::RIP::v1; |
5
|
8
|
|
|
8
|
|
17369
|
use strict; use warnings; |
|
8
|
|
|
8
|
|
17
|
|
|
8
|
|
|
|
|
294
|
|
|
8
|
|
|
|
|
45
|
|
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
773
|
|
6
|
|
|
|
|
|
|
|
7
|
8
|
|
|
8
|
|
14523
|
use Net::Frame::Layer qw(:consts :subs); |
|
8
|
|
|
|
|
94078
|
|
|
8
|
|
|
|
|
2441
|
|
8
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer Exporter); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
11
|
|
|
|
|
|
|
consts => [qw( |
12
|
|
|
|
|
|
|
NF_RIP_V1_ADDRESSFAMILY_IPV4 |
13
|
|
|
|
|
|
|
NF_RIP_V1_METRIC_INFINITY |
14
|
|
|
|
|
|
|
)], |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
our @EXPORT_OK = ( |
17
|
|
|
|
|
|
|
@{$EXPORT_TAGS{consts}}, |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
8
|
|
|
8
|
|
56
|
use constant NF_RIP_V1_ADDRESSFAMILY_IPV4 => 2; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
572
|
|
21
|
8
|
|
|
8
|
|
41
|
use constant NF_RIP_V1_METRIC_INFINITY => 16; |
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
5176
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our @AS = qw( |
24
|
|
|
|
|
|
|
addressFamily |
25
|
|
|
|
|
|
|
reserved1 |
26
|
|
|
|
|
|
|
address |
27
|
|
|
|
|
|
|
reserved2 |
28
|
|
|
|
|
|
|
reserved3 |
29
|
|
|
|
|
|
|
metric |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
32
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub new { |
35
|
|
|
|
|
|
|
shift->SUPER::new( |
36
|
3
|
|
|
3
|
1
|
240
|
addressFamily => NF_RIP_V1_ADDRESSFAMILY_IPV4, |
37
|
|
|
|
|
|
|
reserved1 => 0, |
38
|
|
|
|
|
|
|
address => '0.0.0.0', |
39
|
|
|
|
|
|
|
reserved2 => 0, |
40
|
|
|
|
|
|
|
reserved3 => 0, |
41
|
|
|
|
|
|
|
metric => 1, |
42
|
|
|
|
|
|
|
@_, |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub full { |
47
|
|
|
|
|
|
|
shift->SUPER::new( |
48
|
2
|
|
|
2
|
1
|
446
|
addressFamily => 0, |
49
|
|
|
|
|
|
|
reserved1 => 0, |
50
|
|
|
|
|
|
|
address => '0.0.0.0', |
51
|
|
|
|
|
|
|
reserved2 => 0, |
52
|
|
|
|
|
|
|
reserved3 => 0, |
53
|
|
|
|
|
|
|
metric => NF_RIP_V1_METRIC_INFINITY, |
54
|
|
|
|
|
|
|
@_, |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
0
|
1
|
0
|
sub getLength { 20 } |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub pack { |
61
|
5
|
|
|
5
|
1
|
21777
|
my $self = shift; |
62
|
|
|
|
|
|
|
|
63
|
5
|
50
|
|
|
|
29
|
$self->raw($self->SUPER::pack('nna4NNN', |
64
|
|
|
|
|
|
|
$self->addressFamily, |
65
|
|
|
|
|
|
|
$self->reserved1, |
66
|
|
|
|
|
|
|
inetAton($self->address), |
67
|
|
|
|
|
|
|
$self->reserved2, |
68
|
|
|
|
|
|
|
$self->reserved3, |
69
|
|
|
|
|
|
|
$self->metric |
70
|
|
|
|
|
|
|
)) or return; |
71
|
|
|
|
|
|
|
|
72
|
5
|
|
|
|
|
543
|
return $self->raw; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub unpack { |
76
|
1
|
|
|
1
|
1
|
14
|
my $self = shift; |
77
|
|
|
|
|
|
|
|
78
|
1
|
50
|
|
|
|
5
|
my ($addressFamily, $reserved1, $address, $reserved2, $reserved3, $metric, $payload) = |
79
|
|
|
|
|
|
|
$self->SUPER::unpack('nna4NNN a*', $self->raw) |
80
|
|
|
|
|
|
|
or return; |
81
|
|
|
|
|
|
|
|
82
|
1
|
|
|
|
|
37
|
$self->addressFamily($addressFamily); |
83
|
1
|
|
|
|
|
12
|
$self->reserved1($reserved1); |
84
|
1
|
|
|
|
|
13
|
$self->address(inetNtoa($address)); |
85
|
1
|
|
|
|
|
21
|
$self->reserved2($reserved2); |
86
|
1
|
|
|
|
|
11
|
$self->reserved3($reserved3); |
87
|
1
|
|
|
|
|
11
|
$self->metric($metric); |
88
|
|
|
|
|
|
|
|
89
|
1
|
|
|
|
|
17
|
$self->payload($payload); |
90
|
|
|
|
|
|
|
|
91
|
1
|
|
|
|
|
11
|
return $self; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub encapsulate { |
95
|
1
|
|
|
1
|
1
|
8
|
my $self = shift; |
96
|
|
|
|
|
|
|
|
97
|
1
|
50
|
|
|
|
203
|
return $self->nextLayer if $self->nextLayer; |
98
|
|
|
|
|
|
|
|
99
|
1
|
50
|
|
|
|
21
|
if ($self->payload) { |
100
|
0
|
|
|
|
|
0
|
return "RIP::v1"; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
1
|
|
|
|
|
15
|
NF_LAYER_NONE; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub print { |
107
|
5
|
|
|
5
|
1
|
678
|
my $self = shift; |
108
|
|
|
|
|
|
|
|
109
|
5
|
|
|
|
|
30
|
my $l = $self->layer; |
110
|
5
|
|
|
|
|
75
|
my $buf = sprintf |
111
|
|
|
|
|
|
|
"$l: addressFamily:%d reserved1:%d\n". |
112
|
|
|
|
|
|
|
"$l: address:%s reserved2:%d reserved3:%d\n". |
113
|
|
|
|
|
|
|
"$l: metric:%d", |
114
|
|
|
|
|
|
|
$self->addressFamily, $self->reserved1, |
115
|
|
|
|
|
|
|
$self->address, $self->reserved2, $self->reserved3, |
116
|
|
|
|
|
|
|
$self->metric; |
117
|
|
|
|
|
|
|
|
118
|
5
|
|
|
|
|
1636
|
return $buf; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
1; |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
__END__ |