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