line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: Power.pm 1640 2013-03-28 17:58:27Z VinsWorldcom $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::CDP::Power; |
5
|
19
|
|
|
19
|
|
6686
|
use strict; use warnings; |
|
19
|
|
|
19
|
|
33
|
|
|
19
|
|
|
|
|
590
|
|
|
19
|
|
|
|
|
104
|
|
|
19
|
|
|
|
|
43
|
|
|
19
|
|
|
|
|
612
|
|
6
|
|
|
|
|
|
|
|
7
|
19
|
|
|
19
|
|
1087
|
use Net::Frame::Layer qw(:consts :subs); |
|
19
|
|
|
|
|
101149
|
|
|
19
|
|
|
|
|
14155
|
|
8
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @AS = qw( |
11
|
|
|
|
|
|
|
type |
12
|
|
|
|
|
|
|
length |
13
|
|
|
|
|
|
|
power |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
16
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#no strict 'vars'; |
19
|
|
|
|
|
|
|
|
20
|
19
|
|
|
19
|
|
991
|
use Net::Frame::Layer::CDP::Constants qw(:consts); |
|
19
|
|
|
|
|
37
|
|
|
19
|
|
|
|
|
10376
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub new { |
23
|
|
|
|
|
|
|
shift->SUPER::new( |
24
|
2
|
|
|
2
|
1
|
252
|
type => NF_CDP_TYPE_POWER, |
25
|
|
|
|
|
|
|
length => 6, |
26
|
|
|
|
|
|
|
power => 6400, |
27
|
|
|
|
|
|
|
@_, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
0
|
1
|
0
|
sub getLength { 6 } |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub pack { |
34
|
1
|
|
|
1
|
1
|
262
|
my $self = shift; |
35
|
|
|
|
|
|
|
|
36
|
1
|
50
|
|
|
|
5
|
my $raw = $self->SUPER::pack('nnn', |
37
|
|
|
|
|
|
|
$self->type, |
38
|
|
|
|
|
|
|
$self->length, |
39
|
|
|
|
|
|
|
$self->power, |
40
|
|
|
|
|
|
|
) or return; |
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
|
|
75
|
return $self->raw($raw); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub unpack { |
46
|
1
|
|
|
1
|
1
|
16
|
my $self = shift; |
47
|
|
|
|
|
|
|
|
48
|
1
|
50
|
|
|
|
6
|
my ($type, $length, $power, $payload) = |
49
|
|
|
|
|
|
|
$self->SUPER::unpack('nnn a*', $self->raw) |
50
|
|
|
|
|
|
|
or return; |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
36
|
$self->type($type); |
53
|
1
|
|
|
|
|
13
|
$self->length($length); |
54
|
1
|
|
|
|
|
13
|
$self->power($power); |
55
|
|
|
|
|
|
|
|
56
|
1
|
|
|
|
|
16
|
$self->payload($payload); |
57
|
|
|
|
|
|
|
|
58
|
1
|
|
|
|
|
10
|
return $self; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub computeLengths { |
62
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
0
|
$self->length(6); |
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
|
|
|
|
|
37
|
my $buf = sprintf |
74
|
|
|
|
|
|
|
"$l: type:0x%04x length:%d power:%d mW", |
75
|
|
|
|
|
|
|
$self->type, $self->length, $self->power; |
76
|
|
|
|
|
|
|
|
77
|
3
|
|
|
|
|
545
|
return $buf; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__END__ |