line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: LLTD.pm,v 1.2 2007/03/15 18:22:53 gomor Exp $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::LLTD; |
5
|
9
|
|
|
9
|
|
66860
|
use strict; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
347
|
|
6
|
9
|
|
|
9
|
|
49
|
use warnings; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
468
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.00'; |
9
|
|
|
|
|
|
|
|
10
|
9
|
|
|
9
|
|
8639
|
use Net::Frame::Layer qw(:consts :subs); |
|
9
|
|
|
|
|
23571994
|
|
|
9
|
|
|
|
|
4407
|
|
11
|
|
|
|
|
|
|
require Exporter; |
12
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer Exporter); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
15
|
|
|
|
|
|
|
consts => [qw( |
16
|
|
|
|
|
|
|
NF_LLTD_TOS_TOPOLOGY_DISCOVERY |
17
|
|
|
|
|
|
|
NF_LLTD_TOS_QUICK_DISCOVERY |
18
|
|
|
|
|
|
|
NF_LLTD_TOS_QOS_DIAGNOSTICS |
19
|
|
|
|
|
|
|
NF_LLTD_FUNCTION_DISCOVER |
20
|
|
|
|
|
|
|
NF_LLTD_FUNCTION_HELLO |
21
|
|
|
|
|
|
|
NF_LLTD_FUNCTION_EMIT |
22
|
|
|
|
|
|
|
NF_LLTD_FUNCTION_TRAIN |
23
|
|
|
|
|
|
|
NF_LLTD_FUNCTION_PROBE |
24
|
|
|
|
|
|
|
NF_LLTD_FUNCTION_ACK |
25
|
|
|
|
|
|
|
NF_LLTD_FUNCTION_QUERY |
26
|
|
|
|
|
|
|
NF_LLTD_FUNCTION_QUERY_RESP |
27
|
|
|
|
|
|
|
NF_LLTD_FUNCTION_RESET |
28
|
|
|
|
|
|
|
NF_LLTD_FUNCTION_CHARGE |
29
|
|
|
|
|
|
|
NF_LLTD_FUNCTION_FLAT |
30
|
|
|
|
|
|
|
NF_LLTD_FUNCTION_QUERY_LARGE_TLV |
31
|
|
|
|
|
|
|
NF_LLTD_FUNCTION_QUERY_LARGE_TLV_RESP |
32
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_EOP |
33
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_HOSTID |
34
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_CHARACTERISTICS |
35
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_PHYSICALMEDIUM |
36
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_WIRELESSMODE |
37
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_BSSID |
38
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_SSID |
39
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_IPv4ADDRESS |
40
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_IPv6ADDRESS |
41
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_MAXOPRATE |
42
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_PERFCOUNTER |
43
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_LINKSPEED |
44
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_RSSI |
45
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_ICONIMAGE |
46
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_MACHINENAME |
47
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_SUPPORTINFO |
48
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_FRIENDLYNAME |
49
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_UUID |
50
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_HARDWAREID |
51
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_QOSCHARACTERISTICS |
52
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_WIRELESSPHYSICALMEDIUM |
53
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_APTABLE |
54
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_DETAILEDICONIMAGE |
55
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_SEESLISTCOUNT |
56
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_COMPONENTTABLE |
57
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_REPEATERAP |
58
|
|
|
|
|
|
|
NF_LLTD_TLV_TYPE_REPEATERAPTABLE |
59
|
|
|
|
|
|
|
)], |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
our @EXPORT_OK = ( |
62
|
|
|
|
|
|
|
@{$EXPORT_TAGS{consts}}, |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
|
65
|
9
|
|
|
9
|
|
95
|
use constant NF_LLTD_TOS_TOPOLOGY_DISCOVERY => 0x00; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
629
|
|
66
|
9
|
|
|
9
|
|
45
|
use constant NF_LLTD_TOS_QUICK_DISCOVERY => 0x01; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
361
|
|
67
|
9
|
|
|
9
|
|
43
|
use constant NF_LLTD_TOS_QOS_DIAGNOSTICS => 0x02; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
340
|
|
68
|
|
|
|
|
|
|
|
69
|
9
|
|
|
9
|
|
41
|
use constant NF_LLTD_FUNCTION_DISCOVER => 0x00; |
|
9
|
|
|
|
|
24
|
|
|
9
|
|
|
|
|
482
|
|
70
|
9
|
|
|
9
|
|
46
|
use constant NF_LLTD_FUNCTION_HELLO => 0x01; |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
360
|
|
71
|
9
|
|
|
9
|
|
44
|
use constant NF_LLTD_FUNCTION_EMIT => 0x02; |
|
9
|
|
|
|
|
14
|
|
|
9
|
|
|
|
|
1227
|
|
72
|
9
|
|
|
9
|
|
160
|
use constant NF_LLTD_FUNCTION_TRAIN => 0x03; # No upper |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
481
|
|
73
|
9
|
|
|
9
|
|
41
|
use constant NF_LLTD_FUNCTION_PROBE => 0x04; # No upper |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
337
|
|
74
|
9
|
|
|
9
|
|
59
|
use constant NF_LLTD_FUNCTION_ACK => 0x05; # No upper |
|
9
|
|
|
|
|
33
|
|
|
9
|
|
|
|
|
385
|
|
75
|
9
|
|
|
9
|
|
41
|
use constant NF_LLTD_FUNCTION_QUERY => 0x06; # No upper |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
405
|
|
76
|
9
|
|
|
9
|
|
54
|
use constant NF_LLTD_FUNCTION_QUERY_RESP => 0x07; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
366
|
|
77
|
9
|
|
|
9
|
|
41
|
use constant NF_LLTD_FUNCTION_RESET => 0x08; # No upper |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
395
|
|
78
|
9
|
|
|
9
|
|
44
|
use constant NF_LLTD_FUNCTION_CHARGE => 0x09; # No upper |
|
9
|
|
|
|
|
14
|
|
|
9
|
|
|
|
|
400
|
|
79
|
9
|
|
|
9
|
|
43
|
use constant NF_LLTD_FUNCTION_FLAT => 0x0a; # XXX: TODO |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
349
|
|
80
|
9
|
|
|
9
|
|
56
|
use constant NF_LLTD_FUNCTION_QUERY_LARGE_TLV => 0x0b; # XXX: TODO |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
366
|
|
81
|
9
|
|
|
9
|
|
39
|
use constant NF_LLTD_FUNCTION_QUERY_LARGE_TLV_RESP => 0x0c; # XXX: TODO |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
626
|
|
82
|
|
|
|
|
|
|
|
83
|
9
|
|
|
9
|
|
90
|
use constant NF_LLTD_TLV_TYPE_EOP => 0x00; |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
482
|
|
84
|
9
|
|
|
9
|
|
41
|
use constant NF_LLTD_TLV_TYPE_HOSTID => 0x01; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
368
|
|
85
|
9
|
|
|
9
|
|
41
|
use constant NF_LLTD_TLV_TYPE_CHARACTERISTICS => 0x02; |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
666
|
|
86
|
9
|
|
|
9
|
|
45
|
use constant NF_LLTD_TLV_TYPE_PHYSICALMEDIUM => 0x03; |
|
9
|
|
|
|
|
13
|
|
|
9
|
|
|
|
|
488
|
|
87
|
9
|
|
|
9
|
|
43
|
use constant NF_LLTD_TLV_TYPE_WIRELESSMODE => 0x04; |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
401
|
|
88
|
9
|
|
|
9
|
|
41
|
use constant NF_LLTD_TLV_TYPE_BSSID => 0x05; |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
403
|
|
89
|
9
|
|
|
9
|
|
44
|
use constant NF_LLTD_TLV_TYPE_SSID => 0x06; |
|
9
|
|
|
|
|
46
|
|
|
9
|
|
|
|
|
363
|
|
90
|
9
|
|
|
9
|
|
42
|
use constant NF_LLTD_TLV_TYPE_IPv4ADDRESS => 0x07; |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
429
|
|
91
|
9
|
|
|
9
|
|
40
|
use constant NF_LLTD_TLV_TYPE_IPv6ADDRESS => 0x08; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
333
|
|
92
|
9
|
|
|
9
|
|
39
|
use constant NF_LLTD_TLV_TYPE_MAXOPRATE => 0x09; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
364
|
|
93
|
9
|
|
|
9
|
|
43
|
use constant NF_LLTD_TLV_TYPE_PERFCOUNTER => 0x0a; |
|
9
|
|
|
|
|
14
|
|
|
9
|
|
|
|
|
352
|
|
94
|
9
|
|
|
9
|
|
42
|
use constant NF_LLTD_TLV_TYPE_LINKSPEED => 0x0c; |
|
9
|
|
|
|
|
145
|
|
|
9
|
|
|
|
|
464
|
|
95
|
9
|
|
|
9
|
|
47
|
use constant NF_LLTD_TLV_TYPE_RSSI => 0x0d; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
3327
|
|
96
|
9
|
|
|
9
|
|
43
|
use constant NF_LLTD_TLV_TYPE_ICONIMAGE => 0x0e; |
|
9
|
|
|
|
|
2685
|
|
|
9
|
|
|
|
|
7968
|
|
97
|
9
|
|
|
9
|
|
53
|
use constant NF_LLTD_TLV_TYPE_MACHINENAME => 0x0f; |
|
9
|
|
|
|
|
13
|
|
|
9
|
|
|
|
|
357
|
|
98
|
9
|
|
|
9
|
|
44
|
use constant NF_LLTD_TLV_TYPE_SUPPORTINFO => 0x10; |
|
9
|
|
|
|
|
33
|
|
|
9
|
|
|
|
|
484
|
|
99
|
9
|
|
|
9
|
|
43
|
use constant NF_LLTD_TLV_TYPE_FRIENDLYNAME => 0x11; |
|
9
|
|
|
|
|
13
|
|
|
9
|
|
|
|
|
340
|
|
100
|
9
|
|
|
9
|
|
42
|
use constant NF_LLTD_TLV_TYPE_UUID => 0x12; |
|
9
|
|
|
|
|
14
|
|
|
9
|
|
|
|
|
326
|
|
101
|
9
|
|
|
9
|
|
39
|
use constant NF_LLTD_TLV_TYPE_HARDWAREID => 0x13; |
|
9
|
|
|
|
|
14
|
|
|
9
|
|
|
|
|
392
|
|
102
|
9
|
|
|
9
|
|
43
|
use constant NF_LLTD_TLV_TYPE_QOSCHARACTERISTICS => 0x14; |
|
9
|
|
|
|
|
12
|
|
|
9
|
|
|
|
|
331
|
|
103
|
9
|
|
|
9
|
|
40
|
use constant NF_LLTD_TLV_TYPE_WIRELESSPHYSICALMEDIUM => 0x15; |
|
9
|
|
|
|
|
14
|
|
|
9
|
|
|
|
|
335
|
|
104
|
9
|
|
|
9
|
|
40
|
use constant NF_LLTD_TLV_TYPE_APTABLE => 0x16; |
|
9
|
|
|
|
|
13
|
|
|
9
|
|
|
|
|
503
|
|
105
|
9
|
|
|
9
|
|
42
|
use constant NF_LLTD_TLV_TYPE_DETAILEDICONIMAGE => 0x18; |
|
9
|
|
|
|
|
13
|
|
|
9
|
|
|
|
|
575
|
|
106
|
9
|
|
|
9
|
|
56
|
use constant NF_LLTD_TLV_TYPE_SEESLISTCOUNT => 0x19; |
|
9
|
|
|
|
|
14
|
|
|
9
|
|
|
|
|
389
|
|
107
|
9
|
|
|
9
|
|
43
|
use constant NF_LLTD_TLV_TYPE_COMPONENTTABLE => 0x1a; |
|
9
|
|
|
|
|
13
|
|
|
9
|
|
|
|
|
391
|
|
108
|
9
|
|
|
9
|
|
47
|
use constant NF_LLTD_TLV_TYPE_REPEATERAP => 0x1b; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
566
|
|
109
|
9
|
|
|
9
|
|
41
|
use constant NF_LLTD_TLV_TYPE_REPEATERAPTABLE => 0x1c; |
|
9
|
|
|
|
|
14
|
|
|
9
|
|
|
|
|
826
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
#The following functions are valid for service type 0x02: |
112
|
|
|
|
|
|
|
#0x00 = QosInitializeSink |
113
|
|
|
|
|
|
|
#0x01 = QosReady |
114
|
|
|
|
|
|
|
#0x02 = QosProbe |
115
|
|
|
|
|
|
|
#0x03 = QosQuery |
116
|
|
|
|
|
|
|
#0x04 = QosQueryResp |
117
|
|
|
|
|
|
|
#0x05 = QosReset |
118
|
|
|
|
|
|
|
#0x06 = QosError |
119
|
|
|
|
|
|
|
#0x07 = QosAck |
120
|
|
|
|
|
|
|
#0x08 = QosCounterSnapshot |
121
|
|
|
|
|
|
|
#0x09 = QosCounterResult |
122
|
|
|
|
|
|
|
#0x0A = QosCounterLease |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
our @AS = qw( |
125
|
|
|
|
|
|
|
version |
126
|
|
|
|
|
|
|
tos |
127
|
|
|
|
|
|
|
reserved |
128
|
|
|
|
|
|
|
function |
129
|
|
|
|
|
|
|
networkAddress1 |
130
|
|
|
|
|
|
|
networkAddress2 |
131
|
|
|
|
|
|
|
identifier |
132
|
|
|
|
|
|
|
upperLayer |
133
|
|
|
|
|
|
|
); |
134
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
135
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
136
|
|
|
|
|
|
|
|
137
|
9
|
|
|
9
|
|
13905
|
use Net::Frame::Layer::LLTD::Discover; |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
417
|
|
138
|
9
|
|
|
9
|
|
16183
|
use Net::Frame::Layer::LLTD::Hello; |
|
9
|
|
|
|
|
26
|
|
|
9
|
|
|
|
|
590
|
|
139
|
9
|
|
|
9
|
|
6452
|
use Net::Frame::Layer::LLTD::Emit; |
|
9
|
|
|
|
|
24
|
|
|
9
|
|
|
|
|
2408
|
|
140
|
9
|
|
|
9
|
|
6304
|
use Net::Frame::Layer::LLTD::QueryResp; |
|
9
|
|
|
|
|
46
|
|
|
9
|
|
|
|
|
887080
|
|
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub new { |
143
|
|
|
|
|
|
|
shift->SUPER::new( |
144
|
1
|
|
|
1
|
1
|
21
|
version => 1, |
145
|
|
|
|
|
|
|
tos => NF_LLTD_TOS_TOPOLOGY_DISCOVERY, |
146
|
|
|
|
|
|
|
reserved => 0, |
147
|
|
|
|
|
|
|
function => NF_LLTD_FUNCTION_DISCOVER, |
148
|
|
|
|
|
|
|
networkAddress1 => 'ff:ff:ff:ff:ff:ff', |
149
|
|
|
|
|
|
|
networkAddress2 => 'ff:ff:ff:ff:ff:ff', |
150
|
|
|
|
|
|
|
identifier => getRandom16bitsInt(), |
151
|
|
|
|
|
|
|
@_, |
152
|
|
|
|
|
|
|
); |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub getLength { |
156
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
157
|
0
|
|
|
|
|
0
|
my $len = 18; |
158
|
0
|
0
|
|
|
|
0
|
$len += $self->upperLayer->getLength if $self->upperLayer; |
159
|
0
|
|
|
|
|
0
|
$len; |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub pack { |
163
|
1
|
|
|
1
|
1
|
345
|
my $self = shift; |
164
|
|
|
|
|
|
|
|
165
|
1
|
|
|
|
|
5
|
(my $dst = $self->networkAddress1) =~ s/://g; |
166
|
1
|
|
|
|
|
31
|
(my $src = $self->networkAddress2) =~ s/://g; |
167
|
|
|
|
|
|
|
|
168
|
1
|
50
|
|
|
|
14
|
my $raw = $self->SUPER::pack('CCCCH12H12n', |
169
|
|
|
|
|
|
|
$self->version, |
170
|
|
|
|
|
|
|
$self->tos, |
171
|
|
|
|
|
|
|
$self->reserved, |
172
|
|
|
|
|
|
|
$self->function, |
173
|
|
|
|
|
|
|
$dst, |
174
|
|
|
|
|
|
|
$src, |
175
|
|
|
|
|
|
|
$self->identifier, |
176
|
|
|
|
|
|
|
) or return undef; |
177
|
|
|
|
|
|
|
|
178
|
1
|
50
|
|
|
|
56
|
$raw .= $self->upperLayer->pack if $self->upperLayer; |
179
|
|
|
|
|
|
|
|
180
|
1
|
|
|
|
|
15
|
$self->raw($raw); |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
sub unpack { |
184
|
1
|
|
|
1
|
1
|
13
|
my $self = shift; |
185
|
|
|
|
|
|
|
|
186
|
1
|
50
|
|
|
|
4
|
my ($version, $tos, $reserved, $function, $dst, $src, $identifier, |
187
|
|
|
|
|
|
|
$payload) = $self->SUPER::unpack('CCCCH12H12n a*', $self->raw) |
188
|
|
|
|
|
|
|
or return undef; |
189
|
|
|
|
|
|
|
|
190
|
1
|
|
|
|
|
34
|
$self->version($version); |
191
|
1
|
|
|
|
|
10
|
$self->tos($tos); |
192
|
1
|
|
|
|
|
9
|
$self->reserved($reserved); |
193
|
1
|
|
|
|
|
10
|
$self->function($function); |
194
|
1
|
|
|
|
|
13
|
$self->networkAddress1(convertMac($dst)); |
195
|
1
|
|
|
|
|
25
|
$self->networkAddress2(convertMac($src)); |
196
|
1
|
|
|
|
|
21
|
$self->identifier($identifier); |
197
|
|
|
|
|
|
|
|
198
|
1
|
|
|
|
|
9
|
my $upperLayer; |
199
|
1
|
50
|
33
|
|
|
4
|
if ($self->tos == NF_LLTD_TOS_QUICK_DISCOVERY |
200
|
|
|
|
|
|
|
|| $self->tos == NF_LLTD_TOS_TOPOLOGY_DISCOVERY) { |
201
|
1
|
50
|
|
|
|
31
|
if ($self->function == NF_LLTD_FUNCTION_DISCOVER) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
202
|
1
|
|
|
|
|
21
|
$upperLayer = Net::Frame::Layer::LLTD::Discover->new(raw => $payload); |
203
|
|
|
|
|
|
|
} |
204
|
|
|
|
|
|
|
elsif ($self->function == NF_LLTD_FUNCTION_HELLO) { |
205
|
0
|
|
|
|
|
0
|
$upperLayer = Net::Frame::Layer::LLTD::Hello->new(raw => $payload); |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
elsif ($self->function == NF_LLTD_FUNCTION_EMIT) { |
208
|
0
|
|
|
|
|
0
|
$upperLayer = Net::Frame::Layer::LLTD::Emit->new(raw => $payload); |
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
elsif ($self->function == NF_LLTD_FUNCTION_QUERY_RESP) { |
211
|
0
|
|
|
|
|
0
|
$upperLayer = Net::Frame::Layer::LLTD::QueryResp->new(raw => $payload); |
212
|
|
|
|
|
|
|
} |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
|
215
|
1
|
50
|
|
|
|
210
|
if ($upperLayer) { |
216
|
1
|
|
|
|
|
18
|
$upperLayer->unpack; |
217
|
1
|
|
|
|
|
3
|
$self->upperLayer($upperLayer); |
218
|
1
|
|
|
|
|
9
|
$self->payload($upperLayer->payload); |
219
|
1
|
|
|
|
|
17
|
$upperLayer->payload(undef); |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
else { |
222
|
0
|
|
|
|
|
0
|
$self->payload($payload); |
223
|
|
|
|
|
|
|
} |
224
|
|
|
|
|
|
|
|
225
|
1
|
|
|
|
|
14
|
$self; |
226
|
|
|
|
|
|
|
} |
227
|
|
|
|
|
|
|
|
228
|
0
|
|
|
0
|
1
|
|
sub encapsulate { shift->nextLayer } |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
sub print { |
231
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
232
|
|
|
|
|
|
|
|
233
|
0
|
|
|
|
|
|
my $l = $self->layer; |
234
|
0
|
|
|
|
|
|
my $buf = sprintf |
235
|
|
|
|
|
|
|
"$l: version:%d tos:0x%02x reserved:%d function:0x%02x\n". |
236
|
|
|
|
|
|
|
"$l: networkAddress1: %s networkAddress2: %s\n". |
237
|
|
|
|
|
|
|
"$l: identifier:%d", |
238
|
|
|
|
|
|
|
$self->version, |
239
|
|
|
|
|
|
|
$self->tos, |
240
|
|
|
|
|
|
|
$self->reserved, |
241
|
|
|
|
|
|
|
$self->function, |
242
|
|
|
|
|
|
|
$self->networkAddress1, |
243
|
|
|
|
|
|
|
$self->networkAddress2, |
244
|
|
|
|
|
|
|
$self->identifier; |
245
|
|
|
|
|
|
|
|
246
|
0
|
0
|
|
|
|
|
$buf .= "\n".$self->upperLayer->print if $self->upperLayer; |
247
|
|
|
|
|
|
|
|
248
|
0
|
|
|
|
|
|
$buf; |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
1; |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
__END__ |