line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: MTU.pm 1640 2013-03-28 17:58:27Z VinsWorldcom $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::CDP::MTU; |
5
|
19
|
|
|
19
|
|
7957
|
use strict; use warnings; |
|
19
|
|
|
19
|
|
113
|
|
|
19
|
|
|
|
|
628
|
|
|
19
|
|
|
|
|
188
|
|
|
19
|
|
|
|
|
44
|
|
|
19
|
|
|
|
|
596
|
|
6
|
|
|
|
|
|
|
|
7
|
19
|
|
|
19
|
|
1117
|
use Net::Frame::Layer qw(:consts :subs); |
|
19
|
|
|
|
|
96853
|
|
|
19
|
|
|
|
|
5065
|
|
8
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @AS = qw( |
11
|
|
|
|
|
|
|
type |
12
|
|
|
|
|
|
|
length |
13
|
|
|
|
|
|
|
mtu |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
16
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#no strict 'vars'; |
19
|
|
|
|
|
|
|
|
20
|
19
|
|
|
19
|
|
890
|
use Net::Frame::Layer::CDP::Constants qw(:consts); |
|
19
|
|
|
|
|
49
|
|
|
19
|
|
|
|
|
10902
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub new { |
23
|
|
|
|
|
|
|
shift->SUPER::new( |
24
|
2
|
|
|
2
|
1
|
264
|
type => NF_CDP_TYPE_MTU, |
25
|
|
|
|
|
|
|
length => 8, |
26
|
|
|
|
|
|
|
mtu => 1500, |
27
|
|
|
|
|
|
|
@_, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
0
|
1
|
0
|
sub getLength { 8 } |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub pack { |
34
|
1
|
|
|
1
|
1
|
254
|
my $self = shift; |
35
|
|
|
|
|
|
|
|
36
|
1
|
50
|
|
|
|
6
|
my $raw = $self->SUPER::pack('nnN', |
37
|
|
|
|
|
|
|
$self->type, |
38
|
|
|
|
|
|
|
$self->length, |
39
|
|
|
|
|
|
|
$self->mtu, |
40
|
|
|
|
|
|
|
) or return; |
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
|
|
74
|
return $self->raw($raw); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub unpack { |
46
|
1
|
|
|
1
|
1
|
15
|
my $self = shift; |
47
|
|
|
|
|
|
|
|
48
|
1
|
50
|
|
|
|
4
|
my ($type, $length, $mtu, $payload) = |
49
|
|
|
|
|
|
|
$self->SUPER::unpack('nnN a*', $self->raw) |
50
|
|
|
|
|
|
|
or return; |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
29
|
$self->type($type); |
53
|
1
|
|
|
|
|
10
|
$self->length($length); |
54
|
1
|
|
|
|
|
11
|
$self->mtu($mtu); |
55
|
|
|
|
|
|
|
|
56
|
1
|
|
|
|
|
15
|
$self->payload($payload); |
57
|
|
|
|
|
|
|
|
58
|
1
|
|
|
|
|
11
|
return $self; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub computeLengths { |
62
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
0
|
$self->length(8); |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
0
|
return 1; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub print { |
70
|
3
|
|
|
3
|
1
|
12
|
my $self = shift; |
71
|
|
|
|
|
|
|
|
72
|
3
|
|
|
|
|
14
|
my $l = $self->layer; |
73
|
3
|
|
|
|
|
33
|
my $buf = sprintf |
74
|
|
|
|
|
|
|
"$l: type:0x%04x length:%d mtu:%d", |
75
|
|
|
|
|
|
|
$self->type, $self->length, $self->mtu; |
76
|
|
|
|
|
|
|
|
77
|
3
|
|
|
|
|
555
|
return $buf; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__END__ |