line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: Duplex.pm 1640 2013-03-28 17:58:27Z VinsWorldcom $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::CDP::Duplex; |
5
|
19
|
|
|
19
|
|
7715
|
use strict; use warnings; |
|
19
|
|
|
19
|
|
37
|
|
|
19
|
|
|
|
|
574
|
|
|
19
|
|
|
|
|
89
|
|
|
19
|
|
|
|
|
33
|
|
|
19
|
|
|
|
|
551
|
|
6
|
|
|
|
|
|
|
|
7
|
19
|
|
|
19
|
|
1021
|
use Net::Frame::Layer qw(:consts :subs); |
|
19
|
|
|
|
|
87348
|
|
|
19
|
|
|
|
|
3617
|
|
8
|
19
|
|
|
19
|
|
110
|
use Exporter; |
|
19
|
|
|
|
|
37
|
|
|
19
|
|
|
|
|
2063
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer Exporter); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
12
|
|
|
|
|
|
|
consts => [qw( |
13
|
|
|
|
|
|
|
NF_CDP_TYPE_DUPLEX_HALF |
14
|
|
|
|
|
|
|
NF_CDP_TYPE_DUPLEX_FULL |
15
|
|
|
|
|
|
|
)], |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
our @EXPORT_OK = ( |
18
|
|
|
|
|
|
|
@{$EXPORT_TAGS{consts}}, |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
19
|
|
|
19
|
|
121
|
use constant NF_CDP_TYPE_DUPLEX_HALF => 0; |
|
19
|
|
|
|
|
34
|
|
|
19
|
|
|
|
|
1299
|
|
22
|
19
|
|
|
19
|
|
102
|
use constant NF_CDP_TYPE_DUPLEX_FULL => 1; |
|
19
|
|
|
|
|
48
|
|
|
19
|
|
|
|
|
1749
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our @AS = qw( |
25
|
|
|
|
|
|
|
type |
26
|
|
|
|
|
|
|
length |
27
|
|
|
|
|
|
|
duplex |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
30
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
#no strict 'vars'; |
33
|
|
|
|
|
|
|
|
34
|
19
|
|
|
19
|
|
719
|
use Net::Frame::Layer::CDP::Constants qw(:consts); |
|
19
|
|
|
|
|
33
|
|
|
19
|
|
|
|
|
11096
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub new { |
37
|
|
|
|
|
|
|
shift->SUPER::new( |
38
|
2
|
|
|
2
|
1
|
195
|
type => NF_CDP_TYPE_DUPLEX, |
39
|
|
|
|
|
|
|
length => 5, |
40
|
|
|
|
|
|
|
duplex => NF_CDP_TYPE_DUPLEX_FULL, |
41
|
|
|
|
|
|
|
@_, |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
0
|
1
|
0
|
sub getLength { 5 } |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub pack { |
48
|
1
|
|
|
1
|
1
|
222
|
my $self = shift; |
49
|
|
|
|
|
|
|
|
50
|
1
|
50
|
|
|
|
5
|
my $raw = $self->SUPER::pack('nnC', |
51
|
|
|
|
|
|
|
$self->type, |
52
|
|
|
|
|
|
|
$self->length, |
53
|
|
|
|
|
|
|
$self->duplex, |
54
|
|
|
|
|
|
|
) or return; |
55
|
|
|
|
|
|
|
|
56
|
1
|
|
|
|
|
61
|
return $self->raw($raw); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub unpack { |
60
|
1
|
|
|
1
|
1
|
14
|
my $self = shift; |
61
|
|
|
|
|
|
|
|
62
|
1
|
50
|
|
|
|
3
|
my ($type, $length, $duplex, $payload) = |
63
|
|
|
|
|
|
|
$self->SUPER::unpack('nnC a*', $self->raw) |
64
|
|
|
|
|
|
|
or return; |
65
|
|
|
|
|
|
|
|
66
|
1
|
|
|
|
|
28
|
$self->type($type); |
67
|
1
|
|
|
|
|
10
|
$self->length($length); |
68
|
1
|
|
|
|
|
9
|
$self->duplex($duplex); |
69
|
|
|
|
|
|
|
|
70
|
1
|
|
|
|
|
14
|
$self->payload($payload); |
71
|
|
|
|
|
|
|
|
72
|
1
|
|
|
|
|
8
|
return $self; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub computeLengths { |
76
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
0
|
$self->length(5); |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
0
|
return 1; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub print { |
84
|
3
|
|
|
3
|
1
|
10
|
my $self = shift; |
85
|
|
|
|
|
|
|
|
86
|
3
|
|
|
|
|
10
|
my $l = $self->layer; |
87
|
3
|
50
|
|
|
|
26
|
my $buf = sprintf |
88
|
|
|
|
|
|
|
"$l: type:0x%04x length:%d duplex:%d (%s)", |
89
|
|
|
|
|
|
|
$self->type, $self->length, $self->duplex, |
90
|
|
|
|
|
|
|
($self->duplex == NF_CDP_TYPE_DUPLEX_HALF) ? "half" : "full"; |
91
|
|
|
|
|
|
|
|
92
|
3
|
|
|
|
|
453
|
return $buf; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__END__ |