line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: TrustBitmap.pm 1640 2013-03-28 17:58:27Z VinsWorldcom $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::CDP::TrustBitmap; |
5
|
19
|
|
|
19
|
|
8754
|
use strict; use warnings; |
|
19
|
|
|
19
|
|
44
|
|
|
19
|
|
|
|
|
784
|
|
|
19
|
|
|
|
|
92
|
|
|
19
|
|
|
|
|
27
|
|
|
19
|
|
|
|
|
507
|
|
6
|
|
|
|
|
|
|
|
7
|
19
|
|
|
19
|
|
938
|
use Net::Frame::Layer qw(:consts :subs); |
|
19
|
|
|
|
|
89126
|
|
|
19
|
|
|
|
|
3587
|
|
8
|
19
|
|
|
19
|
|
113
|
use Exporter; |
|
19
|
|
|
|
|
28
|
|
|
19
|
|
|
|
|
2145
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer Exporter); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
12
|
|
|
|
|
|
|
consts => [qw( |
13
|
|
|
|
|
|
|
NF_CDP_TYPE_TRUST_BITMAP_NOTTRUST |
14
|
|
|
|
|
|
|
NF_CDP_TYPE_TRUST_BITMAP_TRUSTED |
15
|
|
|
|
|
|
|
)], |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
our @EXPORT_OK = ( |
18
|
|
|
|
|
|
|
@{$EXPORT_TAGS{consts}}, |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
19
|
|
|
19
|
|
196
|
use constant NF_CDP_TYPE_TRUST_BITMAP_NOTTRUST => 0x00; |
|
19
|
|
|
|
|
33
|
|
|
19
|
|
|
|
|
1220
|
|
22
|
19
|
|
|
19
|
|
98
|
use constant NF_CDP_TYPE_TRUST_BITMAP_TRUSTED => 0x01; |
|
19
|
|
|
|
|
180
|
|
|
19
|
|
|
|
|
1699
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our @AS = qw( |
25
|
|
|
|
|
|
|
type |
26
|
|
|
|
|
|
|
length |
27
|
|
|
|
|
|
|
trustBitmap |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
30
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
#no strict 'vars'; |
33
|
|
|
|
|
|
|
|
34
|
19
|
|
|
19
|
|
864
|
use Net::Frame::Layer::CDP::Constants qw(:consts); |
|
19
|
|
|
|
|
30
|
|
|
19
|
|
|
|
|
10387
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub new { |
37
|
|
|
|
|
|
|
shift->SUPER::new( |
38
|
2
|
|
|
2
|
1
|
230
|
type => NF_CDP_TYPE_TRUST_BITMAP, |
39
|
|
|
|
|
|
|
length => 5, |
40
|
|
|
|
|
|
|
trustBitmap => NF_CDP_TYPE_TRUST_BITMAP_NOTTRUST, |
41
|
|
|
|
|
|
|
@_, |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
0
|
1
|
0
|
sub getLength { 5 } |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub pack { |
48
|
1
|
|
|
1
|
1
|
262
|
my $self = shift; |
49
|
|
|
|
|
|
|
|
50
|
1
|
50
|
|
|
|
4
|
my $raw = $self->SUPER::pack('nnC', |
51
|
|
|
|
|
|
|
$self->type, |
52
|
|
|
|
|
|
|
$self->length, |
53
|
|
|
|
|
|
|
$self->trustBitmap, |
54
|
|
|
|
|
|
|
) or return; |
55
|
|
|
|
|
|
|
|
56
|
1
|
|
|
|
|
68
|
return $self->raw($raw); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub unpack { |
60
|
1
|
|
|
1
|
1
|
16
|
my $self = shift; |
61
|
|
|
|
|
|
|
|
62
|
1
|
50
|
|
|
|
3
|
my ($type, $length, $trustBitmap, $payload) = |
63
|
|
|
|
|
|
|
$self->SUPER::unpack('nnC a*', $self->raw) |
64
|
|
|
|
|
|
|
or return; |
65
|
|
|
|
|
|
|
|
66
|
1
|
|
|
|
|
36
|
$self->type($type); |
67
|
1
|
|
|
|
|
16
|
$self->length($length); |
68
|
1
|
|
|
|
|
12
|
$self->trustBitmap($trustBitmap); |
69
|
|
|
|
|
|
|
|
70
|
1
|
|
|
|
|
18
|
$self->payload($payload); |
71
|
|
|
|
|
|
|
|
72
|
1
|
|
|
|
|
11
|
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
|
12
|
my $self = shift; |
85
|
|
|
|
|
|
|
|
86
|
3
|
|
|
|
|
13
|
my $l = $self->layer; |
87
|
3
|
50
|
|
|
|
36
|
my $buf = sprintf |
88
|
|
|
|
|
|
|
"$l: type:0x%04x length:%d trustBitmap:0x%02x (%s)", |
89
|
|
|
|
|
|
|
$self->type, $self->length, $self->trustBitmap, |
90
|
|
|
|
|
|
|
($self->trustBitmap == NF_CDP_TYPE_TRUST_BITMAP_TRUSTED) ? "trusted" : "noTrust"; |
91
|
|
|
|
|
|
|
|
92
|
3
|
|
|
|
|
645
|
return $buf; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__END__ |