line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: Tlv.pm 9 2012-11-22 19:13:54Z gomor $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::SinFP3::Tlv; |
5
|
3
|
|
|
3
|
|
7818
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
121
|
|
6
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
103
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
16
|
use base qw(Net::Frame::Layer); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1484
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @AS = qw( |
11
|
|
|
|
|
|
|
type |
12
|
|
|
|
|
|
|
length |
13
|
|
|
|
|
|
|
value |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
16
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
17
|
|
|
|
|
|
|
|
18
|
3
|
|
|
3
|
|
122628
|
use Net::Frame::Layer qw(:consts :subs); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
2463
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
1
|
|
|
1
|
1
|
27
|
my $self = shift->SUPER::new( |
22
|
|
|
|
|
|
|
type => 0, |
23
|
|
|
|
|
|
|
length => 0, |
24
|
|
|
|
|
|
|
value => '', |
25
|
|
|
|
|
|
|
@_, |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
283
|
return $self; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub getLength { |
32
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
0
|
return 2 + $self->length; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub computeLengths { |
38
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
0
|
my $len = length($self->value); |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
0
|
return $self->length($len); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub pack { |
46
|
1
|
|
|
1
|
1
|
6
|
my $self = shift; |
47
|
|
|
|
|
|
|
|
48
|
1
|
50
|
|
|
|
6
|
my $raw = $self->SUPER::pack('CCa*', |
49
|
|
|
|
|
|
|
#my $raw = $self->SUPER::pack('CCC', |
50
|
|
|
|
|
|
|
$self->type, |
51
|
|
|
|
|
|
|
$self->length, |
52
|
|
|
|
|
|
|
#CORE::pack('C', $self->value), |
53
|
|
|
|
|
|
|
$self->value, |
54
|
|
|
|
|
|
|
) or return; |
55
|
|
|
|
|
|
|
|
56
|
1
|
|
|
|
|
73
|
return $self->raw($raw); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub unpack { |
60
|
1
|
|
|
1
|
1
|
16
|
my $self = shift; |
61
|
|
|
|
|
|
|
|
62
|
1
|
50
|
|
|
|
5
|
my ($type, $length, $tail) = $self->SUPER::unpack("CC a*", $self->raw) |
63
|
|
|
|
|
|
|
or return; |
64
|
|
|
|
|
|
|
|
65
|
1
|
|
|
|
|
30
|
my $bLen = $length; |
66
|
1
|
50
|
|
|
|
6
|
my ($value, $payload) = $self->SUPER::unpack("a$bLen a*", $tail) |
67
|
|
|
|
|
|
|
or return; |
68
|
|
|
|
|
|
|
|
69
|
1
|
|
|
|
|
17
|
$self->type($type); |
70
|
1
|
|
|
|
|
12
|
$self->length($length); |
71
|
1
|
|
|
|
|
11
|
$self->value($value); |
72
|
|
|
|
|
|
|
|
73
|
1
|
|
|
|
|
17
|
$self->payload($payload); |
74
|
|
|
|
|
|
|
|
75
|
1
|
|
|
|
|
10
|
return $self; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub print { |
79
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
my $l = $self->layer; |
82
|
0
|
|
|
|
|
|
my $buf = sprintf("$l: type:0x%02x length:%d value:%s", |
83
|
|
|
|
|
|
|
$self->type, |
84
|
|
|
|
|
|
|
$self->length, |
85
|
|
|
|
|
|
|
CORE::unpack("H*", $self->value), |
86
|
|
|
|
|
|
|
); |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
my $type = $self->type; |
89
|
0
|
0
|
0
|
|
|
|
if ($type == &Net::Frame::Layer::SinFP3::NF_SINFP3_TLV_TYPE_SYSTEMCLASS |
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
90
|
|
|
|
|
|
|
|| $type == &Net::Frame::Layer::SinFP3::NF_SINFP3_TLV_TYPE_VENDOR |
91
|
|
|
|
|
|
|
|| $type == &Net::Frame::Layer::SinFP3::NF_SINFP3_TLV_TYPE_OS |
92
|
|
|
|
|
|
|
|| $type == &Net::Frame::Layer::SinFP3::NF_SINFP3_TLV_TYPE_OSVERSION |
93
|
|
|
|
|
|
|
|| $type == &Net::Frame::Layer::SinFP3::NF_SINFP3_TLV_TYPE_OSVERSIONFAMILY |
94
|
|
|
|
|
|
|
|| $type == &Net::Frame::Layer::SinFP3::NF_SINFP3_TLV_TYPE_MATCHTYPE |
95
|
|
|
|
|
|
|
|| $type == &Net::Frame::Layer::SinFP3::NF_SINFP3_TLV_TYPE_MATCHMASK |
96
|
|
|
|
|
|
|
|| $type == &Net::Frame::Layer::SinFP3::NF_SINFP3_TLV_TYPE_P1SIG |
97
|
|
|
|
|
|
|
|| $type == &Net::Frame::Layer::SinFP3::NF_SINFP3_TLV_TYPE_P2SIG |
98
|
|
|
|
|
|
|
|| $type == &Net::Frame::Layer::SinFP3::NF_SINFP3_TLV_TYPE_P2SIG) { |
99
|
0
|
|
|
|
|
|
$buf .= " [".CORE::unpack("a*", $self->value)."]"; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
elsif ($type == &Net::Frame::Layer::SinFP3::NF_SINFP3_TLV_TYPE_TRUSTED) { |
102
|
0
|
|
|
|
|
|
$buf .= " [trusted]"; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
elsif ($type == &Net::Frame::Layer::SinFP3::NF_SINFP3_TLV_TYPE_MATCHSCORE) { |
105
|
0
|
|
|
|
|
|
$buf .= " [".CORE::unpack("C", $self->value).'%]'; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
return $buf; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
1; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
__END__ |