line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: SinFP3.pm 9 2012-11-22 19:13:54Z gomor $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::SinFP3; |
5
|
2
|
|
|
2
|
|
12702
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
74
|
|
6
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
106
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.01'; |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
9
|
use base qw(Net::Frame::Layer Exporter); |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
3917
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
13
|
|
|
|
|
|
|
consts => [qw( |
14
|
|
|
|
|
|
|
NF_SINFP3_VERSION1 |
15
|
|
|
|
|
|
|
NF_SINFP3_FLAG_FULL |
16
|
|
|
|
|
|
|
NF_SINFP3_FLAG_TRUSTED |
17
|
|
|
|
|
|
|
NF_SINFP3_FLAG_IPVERSION |
18
|
|
|
|
|
|
|
NF_SINFP3_FLAG_SYSTEMCLASS |
19
|
|
|
|
|
|
|
NF_SINFP3_FLAG_VENDOR |
20
|
|
|
|
|
|
|
NF_SINFP3_FLAG_OS |
21
|
|
|
|
|
|
|
NF_SINFP3_FLAG_OSVERSION |
22
|
|
|
|
|
|
|
NF_SINFP3_FLAG_OSVERSIONFAMILY |
23
|
|
|
|
|
|
|
NF_SINFP3_FLAG_MATCHTYPE |
24
|
|
|
|
|
|
|
NF_SINFP3_FLAG_MATCHMASK |
25
|
|
|
|
|
|
|
NF_SINFP3_FLAG_MATCHSCORE |
26
|
|
|
|
|
|
|
NF_SINFP3_FLAG_P1SIG |
27
|
|
|
|
|
|
|
NF_SINFP3_FLAG_P2SIG |
28
|
|
|
|
|
|
|
NF_SINFP3_FLAG_P3SIG |
29
|
|
|
|
|
|
|
NF_SINFP3_TYPE_REQUESTACTIVE |
30
|
|
|
|
|
|
|
NF_SINFP3_TYPE_REQUESTPASSIVE |
31
|
|
|
|
|
|
|
NF_SINFP3_TYPE_RESPONSEACTIVE |
32
|
|
|
|
|
|
|
NF_SINFP3_TYPE_RESPONSEPASSIVE |
33
|
|
|
|
|
|
|
NF_SINFP3_TLV_TYPE_FRAMEPROTOCOL |
34
|
|
|
|
|
|
|
NF_SINFP3_TLV_TYPE_FRAMEPASSIVE |
35
|
|
|
|
|
|
|
NF_SINFP3_TLV_TYPE_FRAMEACTIVEP1 |
36
|
|
|
|
|
|
|
NF_SINFP3_TLV_TYPE_FRAMEACTIVEP2 |
37
|
|
|
|
|
|
|
NF_SINFP3_TLV_TYPE_FRAMEACTIVEP3 |
38
|
|
|
|
|
|
|
NF_SINFP3_TLV_TYPE_FRAMEACTIVEP1R |
39
|
|
|
|
|
|
|
NF_SINFP3_TLV_TYPE_FRAMEACTIVEP2R |
40
|
|
|
|
|
|
|
NF_SINFP3_TLV_TYPE_FRAMEACTIVEP3R |
41
|
|
|
|
|
|
|
NF_SINFP3_TLV_TYPE_TRUSTED |
42
|
|
|
|
|
|
|
NF_SINFP3_TLV_TYPE_IPVERSION |
43
|
|
|
|
|
|
|
NF_SINFP3_TLV_TYPE_SYSTEMCLASS |
44
|
|
|
|
|
|
|
NF_SINFP3_TLV_TYPE_VENDOR |
45
|
|
|
|
|
|
|
NF_SINFP3_TLV_TYPE_OS |
46
|
|
|
|
|
|
|
NF_SINFP3_TLV_TYPE_OSVERSION |
47
|
|
|
|
|
|
|
NF_SINFP3_TLV_TYPE_OSVERSIONFAMILY |
48
|
|
|
|
|
|
|
NF_SINFP3_TLV_TYPE_MATCHTYPE |
49
|
|
|
|
|
|
|
NF_SINFP3_TLV_TYPE_MATCHMASK |
50
|
|
|
|
|
|
|
NF_SINFP3_TLV_TYPE_MATCHSCORE |
51
|
|
|
|
|
|
|
NF_SINFP3_TLV_TYPE_P1SIG |
52
|
|
|
|
|
|
|
NF_SINFP3_TLV_TYPE_P2SIG |
53
|
|
|
|
|
|
|
NF_SINFP3_TLV_TYPE_P3SIG |
54
|
|
|
|
|
|
|
NF_SINFP3_TLV_VALUE_ETH |
55
|
|
|
|
|
|
|
NF_SINFP3_TLV_VALUE_IPv4 |
56
|
|
|
|
|
|
|
NF_SINFP3_TLV_VALUE_IPv6 |
57
|
|
|
|
|
|
|
NF_SINFP3_TLV_VALUE_TCP |
58
|
|
|
|
|
|
|
NF_SINFP3_CODE_SUCCESSUNKNOWN |
59
|
|
|
|
|
|
|
NF_SINFP3_CODE_SUCCESSRESULT |
60
|
|
|
|
|
|
|
NF_SINFP3_CODE_BADVERSION |
61
|
|
|
|
|
|
|
NF_SINFP3_CODE_BADTYPE |
62
|
|
|
|
|
|
|
NF_SINFP3_CODE_BADTLVCOUNT |
63
|
|
|
|
|
|
|
NF_SINFP3_CODE_BADTLV |
64
|
|
|
|
|
|
|
)], |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
our @EXPORT_OK = ( |
67
|
|
|
|
|
|
|
@{$EXPORT_TAGS{consts}}, |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
|
70
|
2
|
|
|
2
|
|
253396
|
use constant NF_SINFP3_VERSION1 => 0x01; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
138
|
|
71
|
|
|
|
|
|
|
|
72
|
2
|
|
|
2
|
|
12
|
use constant NF_SINFP3_FLAG_FULL => 0x0000; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
98
|
|
73
|
2
|
|
|
2
|
|
12
|
use constant NF_SINFP3_FLAG_TRUSTED => 0x0001; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
88
|
|
74
|
2
|
|
|
2
|
|
10
|
use constant NF_SINFP3_FLAG_IPVERSION => 0x0002; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
88
|
|
75
|
2
|
|
|
2
|
|
9
|
use constant NF_SINFP3_FLAG_SYSTEMCLASS => 0x0004; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
83
|
|
76
|
2
|
|
|
2
|
|
10
|
use constant NF_SINFP3_FLAG_VENDOR => 0x0008; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
88
|
|
77
|
2
|
|
|
2
|
|
20
|
use constant NF_SINFP3_FLAG_OS => 0x0010; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
101
|
|
78
|
2
|
|
|
2
|
|
11
|
use constant NF_SINFP3_FLAG_OSVERSION => 0x0020; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
76
|
|
79
|
2
|
|
|
2
|
|
11
|
use constant NF_SINFP3_FLAG_OSVERSIONFAMILY => 0x0040; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
95
|
|
80
|
2
|
|
|
2
|
|
10
|
use constant NF_SINFP3_FLAG_MATCHTYPE => 0x0080; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
110
|
|
81
|
2
|
|
|
2
|
|
19
|
use constant NF_SINFP3_FLAG_MATCHMASK => 0x0100; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
72
|
|
82
|
2
|
|
|
2
|
|
8
|
use constant NF_SINFP3_FLAG_MATCHSCORE => 0x0200; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
78
|
|
83
|
2
|
|
|
2
|
|
9
|
use constant NF_SINFP3_FLAG_P1SIG => 0x0400; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
72
|
|
84
|
2
|
|
|
2
|
|
11
|
use constant NF_SINFP3_FLAG_P2SIG => 0x0800; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
114
|
|
85
|
2
|
|
|
2
|
|
11
|
use constant NF_SINFP3_FLAG_P3SIG => 0x1000; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
91
|
|
86
|
|
|
|
|
|
|
|
87
|
2
|
|
|
2
|
|
10
|
use constant NF_SINFP3_TYPE_REQUESTACTIVE => 0x01; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
91
|
|
88
|
2
|
|
|
2
|
|
17
|
use constant NF_SINFP3_TYPE_REQUESTPASSIVE => 0x02; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
87
|
|
89
|
2
|
|
|
2
|
|
10
|
use constant NF_SINFP3_TYPE_RESPONSEACTIVE => 0x03; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
73
|
|
90
|
2
|
|
|
2
|
|
10
|
use constant NF_SINFP3_TYPE_RESPONSEPASSIVE => 0x04; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
88
|
|
91
|
|
|
|
|
|
|
|
92
|
2
|
|
|
2
|
|
10
|
use constant NF_SINFP3_TLV_TYPE_FRAMEPROTOCOL => 0x01; |
|
2
|
|
|
|
|
18
|
|
|
2
|
|
|
|
|
82
|
|
93
|
2
|
|
|
2
|
|
9
|
use constant NF_SINFP3_TLV_TYPE_FRAMEPASSIVE => 0x02; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
79
|
|
94
|
2
|
|
|
2
|
|
11
|
use constant NF_SINFP3_TLV_TYPE_FRAMEACTIVEP1 => 0x03; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
98
|
|
95
|
2
|
|
|
2
|
|
11
|
use constant NF_SINFP3_TLV_TYPE_FRAMEACTIVEP2 => 0x04; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
78
|
|
96
|
2
|
|
|
2
|
|
9
|
use constant NF_SINFP3_TLV_TYPE_FRAMEACTIVEP3 => 0x05; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
90
|
|
97
|
2
|
|
|
2
|
|
15
|
use constant NF_SINFP3_TLV_TYPE_FRAMEACTIVEP1R => 0x06; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
74
|
|
98
|
2
|
|
|
2
|
|
10
|
use constant NF_SINFP3_TLV_TYPE_FRAMEACTIVEP2R => 0x07; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
79
|
|
99
|
2
|
|
|
2
|
|
7
|
use constant NF_SINFP3_TLV_TYPE_FRAMEACTIVEP3R => 0x08; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
77
|
|
100
|
2
|
|
|
2
|
|
9
|
use constant NF_SINFP3_TLV_TYPE_P1SIG => 0x09; |
|
2
|
|
|
|
|
20
|
|
|
2
|
|
|
|
|
95
|
|
101
|
2
|
|
|
2
|
|
9
|
use constant NF_SINFP3_TLV_TYPE_P2SIG => 0x0a; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
85
|
|
102
|
2
|
|
|
2
|
|
10
|
use constant NF_SINFP3_TLV_TYPE_P3SIG => 0x0b; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
82
|
|
103
|
|
|
|
|
|
|
|
104
|
2
|
|
|
2
|
|
8
|
use constant NF_SINFP3_TLV_VALUE_ETH => 0x01; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
75
|
|
105
|
2
|
|
|
2
|
|
1434
|
use constant NF_SINFP3_TLV_VALUE_IPv4 => 0x02; |
|
2
|
|
|
|
|
19
|
|
|
2
|
|
|
|
|
91
|
|
106
|
2
|
|
|
2
|
|
10
|
use constant NF_SINFP3_TLV_VALUE_IPv6 => 0x03; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
69
|
|
107
|
2
|
|
|
2
|
|
10
|
use constant NF_SINFP3_TLV_VALUE_TCP => 0x04; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
74
|
|
108
|
|
|
|
|
|
|
|
109
|
2
|
|
|
2
|
|
8
|
use constant NF_SINFP3_TLV_TYPE_TRUSTED => 0x20; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
69
|
|
110
|
2
|
|
|
2
|
|
9
|
use constant NF_SINFP3_TLV_TYPE_IPVERSION => 0x21; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
74
|
|
111
|
2
|
|
|
2
|
|
9
|
use constant NF_SINFP3_TLV_TYPE_SYSTEMCLASS => 0x22; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
122
|
|
112
|
2
|
|
|
2
|
|
12
|
use constant NF_SINFP3_TLV_TYPE_VENDOR => 0x23; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
88
|
|
113
|
2
|
|
|
2
|
|
10
|
use constant NF_SINFP3_TLV_TYPE_OS => 0x24; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
70
|
|
114
|
2
|
|
|
2
|
|
17
|
use constant NF_SINFP3_TLV_TYPE_OSVERSION => 0x25; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
63
|
|
115
|
2
|
|
|
2
|
|
7
|
use constant NF_SINFP3_TLV_TYPE_OSVERSIONFAMILY => 0x26; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
82
|
|
116
|
2
|
|
|
2
|
|
8
|
use constant NF_SINFP3_TLV_TYPE_MATCHTYPE => 0x27; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
67
|
|
117
|
2
|
|
|
2
|
|
7
|
use constant NF_SINFP3_TLV_TYPE_MATCHMASK => 0x28; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
72
|
|
118
|
2
|
|
|
2
|
|
8
|
use constant NF_SINFP3_TLV_TYPE_MATCHSCORE => 0x29; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
72
|
|
119
|
|
|
|
|
|
|
|
120
|
2
|
|
|
2
|
|
8
|
use constant NF_SINFP3_CODE_SUCCESSUNKNOWN => 0x00; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
82
|
|
121
|
2
|
|
|
2
|
|
1336
|
use constant NF_SINFP3_CODE_SUCCESSRESULT => 0x01; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
73
|
|
122
|
2
|
|
|
2
|
|
9
|
use constant NF_SINFP3_CODE_BADVERSION => 0x02; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
76
|
|
123
|
2
|
|
|
2
|
|
8
|
use constant NF_SINFP3_CODE_BADTYPE => 0x03; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
73
|
|
124
|
2
|
|
|
2
|
|
9
|
use constant NF_SINFP3_CODE_BADTLVCOUNT => 0x04; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
88
|
|
125
|
2
|
|
|
2
|
|
11
|
use constant NF_SINFP3_CODE_BADTLV => 0x05; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
215
|
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
our @AS = qw( |
128
|
|
|
|
|
|
|
version |
129
|
|
|
|
|
|
|
type |
130
|
|
|
|
|
|
|
flags |
131
|
|
|
|
|
|
|
code |
132
|
|
|
|
|
|
|
tlvCount |
133
|
|
|
|
|
|
|
length |
134
|
|
|
|
|
|
|
); |
135
|
|
|
|
|
|
|
our @AA = qw( |
136
|
|
|
|
|
|
|
tlvList |
137
|
|
|
|
|
|
|
); |
138
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
139
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
140
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsArray (\@AA); |
141
|
|
|
|
|
|
|
|
142
|
2
|
|
|
2
|
|
1800
|
use Net::Frame::Layer::SinFP3::Tlv; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
2370
|
|
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub new { |
145
|
1
|
|
|
1
|
1
|
26
|
my $self = shift->SUPER::new( |
146
|
|
|
|
|
|
|
version => NF_SINFP3_VERSION1, |
147
|
|
|
|
|
|
|
type => NF_SINFP3_TYPE_RESPONSEPASSIVE, |
148
|
|
|
|
|
|
|
flags => NF_SINFP3_FLAG_FULL, |
149
|
|
|
|
|
|
|
code => NF_SINFP3_CODE_SUCCESSRESULT, |
150
|
|
|
|
|
|
|
tlvCount => 0, |
151
|
|
|
|
|
|
|
length => 0, |
152
|
|
|
|
|
|
|
tlvList => [], |
153
|
|
|
|
|
|
|
@_, |
154
|
|
|
|
|
|
|
); |
155
|
|
|
|
|
|
|
|
156
|
1
|
|
|
|
|
349
|
return $self; |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
sub getLength { |
160
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
161
|
|
|
|
|
|
|
|
162
|
0
|
|
|
|
|
0
|
my $len = 8; # 8-byte header |
163
|
|
|
|
|
|
|
|
164
|
0
|
|
|
|
|
0
|
for my $tlv ($self->tlvList) { |
165
|
0
|
|
|
|
|
0
|
$len += $tlv->getLength; |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
|
168
|
0
|
|
|
|
|
0
|
return $len; |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub pack { |
172
|
1
|
|
|
1
|
1
|
6
|
my $self = shift; |
173
|
|
|
|
|
|
|
|
174
|
1
|
50
|
|
|
|
6
|
my $raw = $self->SUPER::pack('CCnCCn', |
175
|
|
|
|
|
|
|
$self->version, |
176
|
|
|
|
|
|
|
$self->type, |
177
|
|
|
|
|
|
|
$self->flags, |
178
|
|
|
|
|
|
|
$self->code, |
179
|
|
|
|
|
|
|
$self->tlvCount, |
180
|
|
|
|
|
|
|
$self->length, |
181
|
|
|
|
|
|
|
) or return; |
182
|
|
|
|
|
|
|
|
183
|
1
|
|
|
|
|
179
|
for my $tlv ($self->tlvList) { |
184
|
0
|
0
|
|
|
|
0
|
$raw .= $tlv->pack or return; |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
|
187
|
1
|
|
|
|
|
28
|
return $self->raw($raw); |
188
|
|
|
|
|
|
|
} |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
sub unpack { |
191
|
1
|
|
|
1
|
1
|
15
|
my $self = shift; |
192
|
|
|
|
|
|
|
|
193
|
1
|
50
|
|
|
|
4
|
my ($version, $type, $flags, $code, $tlvCount, $length, $payload) = |
194
|
|
|
|
|
|
|
$self->SUPER::unpack('CCnCCn a*', $self->raw) |
195
|
|
|
|
|
|
|
or return; |
196
|
|
|
|
|
|
|
|
197
|
1
|
|
|
|
|
34
|
$self->version($version); |
198
|
1
|
|
|
|
|
12
|
$self->type($type); |
199
|
1
|
|
|
|
|
11
|
$self->flags($flags); |
200
|
1
|
|
|
|
|
10
|
$self->code($code); |
201
|
1
|
|
|
|
|
11
|
$self->tlvCount($tlvCount); |
202
|
1
|
|
|
|
|
11
|
$self->length($length); |
203
|
|
|
|
|
|
|
|
204
|
1
|
50
|
33
|
|
|
18
|
if (defined($payload) && length($payload) >= $length) { |
205
|
1
|
|
|
|
|
4
|
my $tlv = substr($payload, 0, $length); |
206
|
1
|
|
|
|
|
2
|
$payload = substr($payload, $length); |
207
|
1
|
|
|
|
|
2
|
my @tlvList = (); |
208
|
1
|
|
33
|
|
|
10
|
while (defined($tlv) && length($tlv)) { |
209
|
0
|
|
|
|
|
0
|
my $new = Net::Frame::Layer::SinFP3::Tlv->new( |
210
|
|
|
|
|
|
|
raw => $tlv, |
211
|
|
|
|
|
|
|
)->unpack; |
212
|
0
|
|
|
|
|
0
|
$tlv = $new->payload; |
213
|
0
|
|
|
|
|
0
|
$new->payload(undef); |
214
|
0
|
|
|
|
|
0
|
push @tlvList, $new; |
215
|
|
|
|
|
|
|
} |
216
|
1
|
|
|
|
|
3
|
$self->tlvList(\@tlvList); |
217
|
|
|
|
|
|
|
} |
218
|
|
|
|
|
|
|
|
219
|
1
|
|
|
|
|
19
|
$self->payload($payload); |
220
|
|
|
|
|
|
|
|
221
|
1
|
|
|
|
|
11
|
return $self; |
222
|
|
|
|
|
|
|
} |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
sub computeLengths { |
225
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
226
|
|
|
|
|
|
|
|
227
|
0
|
|
|
|
|
|
my $tlvCount = 0; |
228
|
|
|
|
|
|
|
# Request types, tlvCount is the total number of TLVs |
229
|
0
|
0
|
0
|
|
|
|
if ($self->type == NF_SINFP3_TYPE_REQUESTACTIVE |
|
|
0
|
0
|
|
|
|
|
230
|
|
|
|
|
|
|
|| $self->type == NF_SINFP3_TYPE_REQUESTPASSIVE) { |
231
|
0
|
|
|
|
|
|
$tlvCount = scalar($self->tlvList); |
232
|
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
# Response types, tlvCount is the number of TLV per result |
234
|
|
|
|
|
|
|
elsif ($self->type == NF_SINFP3_TYPE_RESPONSEACTIVE |
235
|
|
|
|
|
|
|
|| $self->type == NF_SINFP3_TYPE_RESPONSEPASSIVE) { |
236
|
0
|
0
|
0
|
|
|
|
if ($self->type == NF_SINFP3_TYPE_RESPONSEACTIVE && $self->flags == NF_SINFP3_FLAG_FULL) { |
|
|
0
|
0
|
|
|
|
|
237
|
0
|
|
|
|
|
|
$tlvCount = 13; |
238
|
|
|
|
|
|
|
} |
239
|
|
|
|
|
|
|
elsif ($self->type == NF_SINFP3_TYPE_RESPONSEPASSIVE && $self->flags == NF_SINFP3_FLAG_FULL) { |
240
|
0
|
|
|
|
|
|
$tlvCount = 11; |
241
|
|
|
|
|
|
|
} |
242
|
|
|
|
|
|
|
else { |
243
|
0
|
|
|
|
|
|
for my $flag ( |
244
|
|
|
|
|
|
|
NF_SINFP3_FLAG_TRUSTED, |
245
|
|
|
|
|
|
|
NF_SINFP3_FLAG_IPVERSION, |
246
|
|
|
|
|
|
|
NF_SINFP3_FLAG_SYSTEMCLASS, |
247
|
|
|
|
|
|
|
NF_SINFP3_FLAG_VENDOR, |
248
|
|
|
|
|
|
|
NF_SINFP3_FLAG_OS, |
249
|
|
|
|
|
|
|
NF_SINFP3_FLAG_OSVERSION, |
250
|
|
|
|
|
|
|
NF_SINFP3_FLAG_OSVERSIONFAMILY, |
251
|
|
|
|
|
|
|
NF_SINFP3_FLAG_MATCHTYPE, |
252
|
|
|
|
|
|
|
NF_SINFP3_FLAG_MATCHMASK, |
253
|
|
|
|
|
|
|
NF_SINFP3_FLAG_MATCHSCORE, |
254
|
|
|
|
|
|
|
NF_SINFP3_FLAG_P1SIG, |
255
|
|
|
|
|
|
|
NF_SINFP3_FLAG_P2SIG, |
256
|
|
|
|
|
|
|
NF_SINFP3_FLAG_P3SIG, |
257
|
|
|
|
|
|
|
) { |
258
|
0
|
0
|
|
|
|
|
if ($self->flags & $flag) { |
259
|
0
|
|
|
|
|
|
$tlvCount++; |
260
|
|
|
|
|
|
|
} |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
} |
264
|
0
|
|
|
|
|
|
$self->tlvCount($tlvCount); |
265
|
|
|
|
|
|
|
|
266
|
0
|
|
|
|
|
|
my $len = 0; |
267
|
0
|
|
|
|
|
|
for my $tlv ($self->tlvList) { |
268
|
0
|
|
|
|
|
|
$tlv->computeLengths; |
269
|
0
|
|
|
|
|
|
$len += $tlv->getLength; |
270
|
|
|
|
|
|
|
} |
271
|
0
|
|
|
|
|
|
$self->length($len); |
272
|
|
|
|
|
|
|
|
273
|
0
|
|
|
|
|
|
return 1; |
274
|
|
|
|
|
|
|
} |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
sub print { |
277
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
278
|
|
|
|
|
|
|
|
279
|
0
|
|
|
|
|
|
my $l = $self->layer; |
280
|
0
|
|
|
|
|
|
my $buf = sprintf("$l: version:%d type:0x%02x flags:0x%04x\n". |
281
|
|
|
|
|
|
|
"$l: code:0x%02x tlvCount:%d length:%d", |
282
|
|
|
|
|
|
|
$self->version, |
283
|
|
|
|
|
|
|
$self->type, |
284
|
|
|
|
|
|
|
$self->flags, |
285
|
|
|
|
|
|
|
$self->code, |
286
|
|
|
|
|
|
|
$self->tlvCount, |
287
|
|
|
|
|
|
|
$self->length, |
288
|
|
|
|
|
|
|
); |
289
|
|
|
|
|
|
|
|
290
|
0
|
|
|
|
|
|
for my $tlv ($self->tlvList) { |
291
|
0
|
|
|
|
|
|
$buf .= "\n".$tlv->print; |
292
|
|
|
|
|
|
|
} |
293
|
|
|
|
|
|
|
|
294
|
0
|
|
|
|
|
|
return $buf; |
295
|
|
|
|
|
|
|
} |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
1; |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
__END__ |