line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: LLC.pm 20 2015-01-13 18:34:19Z gomor $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::LLC; |
5
|
3
|
|
|
3
|
|
9960
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
118
|
|
6
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
150
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.03'; |
9
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
1264
|
use Net::Frame::Layer qw(:consts); |
|
3
|
|
|
|
|
132329
|
|
|
3
|
|
|
|
|
738
|
|
11
|
|
|
|
|
|
|
require Exporter; |
12
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer Exporter); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
15
|
|
|
|
|
|
|
consts => [qw( |
16
|
|
|
|
|
|
|
NF_LLC_HDR_LEN |
17
|
|
|
|
|
|
|
NF_LLC_DSAP_STP |
18
|
|
|
|
|
|
|
NF_LLC_SSAP_STP |
19
|
|
|
|
|
|
|
NF_LLC_DSAP_SNAP |
20
|
|
|
|
|
|
|
NF_LLC_SSAP_SNAP |
21
|
|
|
|
|
|
|
NF_LLC_DSAP_IPX |
22
|
|
|
|
|
|
|
NF_LLC_SSAP_IPX |
23
|
|
|
|
|
|
|
NF_LLC_DSAP_HPEXTLLC |
24
|
|
|
|
|
|
|
NF_LLC_SSAP_HPEXTLLC |
25
|
|
|
|
|
|
|
NF_LLC_SNAP_HDR_LEN |
26
|
|
|
|
|
|
|
NF_LLC_SNAP_OUI_CISCO |
27
|
|
|
|
|
|
|
NF_LLC_SNAP_PID_CDP |
28
|
|
|
|
|
|
|
NF_LLC_SNAP_PID_STP |
29
|
|
|
|
|
|
|
NF_LLC_SNAP_PID_IPX |
30
|
|
|
|
|
|
|
)], |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
our @EXPORT_OK = ( |
33
|
|
|
|
|
|
|
@{$EXPORT_TAGS{consts}}, |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
3
|
|
|
3
|
|
24
|
use constant NF_LLC_HDR_LEN => 3; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
183
|
|
37
|
3
|
|
|
3
|
|
14
|
use constant NF_LLC_DSAP_STP => 0x21; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
138
|
|
38
|
3
|
|
|
3
|
|
14
|
use constant NF_LLC_SSAP_STP => 0x21; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
110
|
|
39
|
3
|
|
|
3
|
|
10
|
use constant NF_LLC_DSAP_SNAP => 0x55; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
101
|
|
40
|
3
|
|
|
3
|
|
11
|
use constant NF_LLC_SSAP_SNAP => 0x55; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
98
|
|
41
|
3
|
|
|
3
|
|
17
|
use constant NF_LLC_DSAP_IPX => 0x70; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
115
|
|
42
|
3
|
|
|
3
|
|
19
|
use constant NF_LLC_SSAP_IPX => 0x70; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
122
|
|
43
|
3
|
|
|
3
|
|
12
|
use constant NF_LLC_DSAP_HPEXTLLC => 0x7c; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
98
|
|
44
|
3
|
|
|
3
|
|
11
|
use constant NF_LLC_SSAP_HPEXTLLC => 0x7c; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
109
|
|
45
|
|
|
|
|
|
|
|
46
|
3
|
|
|
3
|
|
15
|
use constant NF_LLC_SNAP_HDR_LEN => 5; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
115
|
|
47
|
3
|
|
|
3
|
|
15
|
use constant NF_LLC_SNAP_OUI_CISCO => 0x00000c; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
119
|
|
48
|
3
|
|
|
3
|
|
10
|
use constant NF_LLC_SNAP_PID_CDP => 0x2000; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
116
|
|
49
|
3
|
|
|
3
|
|
13
|
use constant NF_LLC_SNAP_PID_STP => 0x010b; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
154
|
|
50
|
3
|
|
|
3
|
|
15
|
use constant NF_LLC_SNAP_PID_IPX => 0x8137; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
227
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
our @AS = qw( |
53
|
|
|
|
|
|
|
dsap |
54
|
|
|
|
|
|
|
ig |
55
|
|
|
|
|
|
|
ssap |
56
|
|
|
|
|
|
|
cr |
57
|
|
|
|
|
|
|
control |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
60
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
61
|
|
|
|
|
|
|
|
62
|
3
|
|
|
3
|
|
15
|
no strict 'vars'; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
1559
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
require Bit::Vector; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub new { |
67
|
|
|
|
|
|
|
shift->SUPER::new( |
68
|
1
|
|
|
1
|
1
|
21
|
dsap => NF_LLC_DSAP_SNAP, |
69
|
|
|
|
|
|
|
ig => 1, |
70
|
|
|
|
|
|
|
ssap => NF_LLC_SSAP_SNAP, |
71
|
|
|
|
|
|
|
cr => 1, |
72
|
|
|
|
|
|
|
control => 0x03, |
73
|
|
|
|
|
|
|
@_, |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
0
|
1
|
0
|
sub getLength { NF_LLC_HDR_LEN } |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub pack { |
80
|
1
|
|
|
1
|
1
|
270
|
my $self = shift; |
81
|
|
|
|
|
|
|
|
82
|
1
|
|
|
|
|
27
|
my $dsap = Bit::Vector->new_Dec(7, $self->[$__dsap]); |
83
|
1
|
|
|
|
|
5
|
my $ig = Bit::Vector->new_Dec(1, $self->[$__ig]); |
84
|
1
|
|
|
|
|
5
|
my $ssap = Bit::Vector->new_Dec(7, $self->[$__ssap]); |
85
|
1
|
|
|
|
|
5
|
my $cr = Bit::Vector->new_Dec(1, $self->[$__cr]); |
86
|
1
|
|
|
|
|
7
|
my $v16 = $dsap->Concat_List($ig, $ssap, $cr); |
87
|
|
|
|
|
|
|
|
88
|
1
|
50
|
|
|
|
21
|
$self->[$__raw] = $self->SUPER::pack('nC', |
89
|
|
|
|
|
|
|
$v16->to_Dec, |
90
|
|
|
|
|
|
|
$self->[$__control], |
91
|
|
|
|
|
|
|
) or return undef; |
92
|
|
|
|
|
|
|
|
93
|
1
|
|
|
|
|
24
|
$self->[$__raw]; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub unpack { |
97
|
1
|
|
|
1
|
1
|
4
|
my $self = shift; |
98
|
|
|
|
|
|
|
|
99
|
1
|
50
|
|
|
|
5
|
my ($dsapIgSsapCr, $control, $payload) = |
100
|
|
|
|
|
|
|
$self->SUPER::unpack('nC a*', $self->[$__raw]) |
101
|
|
|
|
|
|
|
or return undef; |
102
|
|
|
|
|
|
|
|
103
|
1
|
|
|
|
|
17
|
my $v16 = Bit::Vector->new_Dec(16, $dsapIgSsapCr); |
104
|
1
|
|
|
|
|
6
|
$self->[$__dsap] = $v16->Chunk_Read(7, 9); |
105
|
1
|
|
|
|
|
4
|
$self->[$__ig] = $v16->Chunk_Read(1, 8); |
106
|
1
|
|
|
|
|
2
|
$self->[$__ssap] = $v16->Chunk_Read(7, 1); |
107
|
1
|
|
|
|
|
3
|
$self->[$__cr] = $v16->Chunk_Read(1, 0); |
108
|
|
|
|
|
|
|
|
109
|
1
|
|
|
|
|
1
|
$self->[$__control] = $control; |
110
|
|
|
|
|
|
|
|
111
|
1
|
|
|
|
|
2
|
$self->[$__payload] = $payload; |
112
|
|
|
|
|
|
|
|
113
|
1
|
|
|
|
|
3
|
$self; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub encapsulate { |
117
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
118
|
|
|
|
|
|
|
|
119
|
0
|
0
|
|
|
|
|
return $self->[$__nextLayer] if $self->[$__nextLayer]; |
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
my $types = { |
122
|
|
|
|
|
|
|
NF_LLC_DSAP_STP() => 'STP', |
123
|
|
|
|
|
|
|
NF_LLC_DSAP_IPX() => 'IPX', |
124
|
|
|
|
|
|
|
NF_LLC_DSAP_SNAP() => 'LLC::SNAP', |
125
|
|
|
|
|
|
|
NF_LLC_DSAP_HPEXTLLC() => 'HPEXTLLC', |
126
|
|
|
|
|
|
|
}; |
127
|
|
|
|
|
|
|
|
128
|
0
|
0
|
|
|
|
|
$types->{$self->[$__dsap]} || NF_LAYER_UNKNOWN; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub print { |
132
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
133
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
my $l = $self->layer; |
135
|
0
|
|
|
|
|
|
sprintf "$l: dsap:0x%02x ig:%d ssap:0x%02x cr:%d control:0x%02x", |
136
|
|
|
|
|
|
|
$self->[$__dsap], $self->[$__ig], $self->[$__ssap], $self->[$__cr], |
137
|
|
|
|
|
|
|
$self->[$__control]; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
1; |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
__END__ |