line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: SNAP.pm 20 2015-01-13 18:34:19Z gomor $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::LLC::SNAP; |
5
|
1
|
|
|
1
|
|
5240
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
33
|
|
6
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
454
|
use Net::Frame::Layer qw(:consts); |
|
1
|
|
|
|
|
57708
|
|
|
1
|
|
|
|
|
273
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @AS = qw( |
12
|
|
|
|
|
|
|
oui |
13
|
|
|
|
|
|
|
pid |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
16
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
8
|
no strict 'vars'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
439
|
use Net::Frame::Layer::LLC qw(:consts); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
483
|
|
21
|
|
|
|
|
|
|
require Bit::Vector; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new { |
24
|
|
|
|
|
|
|
shift->SUPER::new( |
25
|
1
|
|
|
1
|
1
|
21
|
oui => NF_LLC_SNAP_OUI_CISCO, |
26
|
|
|
|
|
|
|
pid => NF_LLC_SNAP_PID_CDP, |
27
|
|
|
|
|
|
|
@_, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
0
|
1
|
0
|
sub getLength { NF_LLC_SNAP_HDR_LEN } |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub pack { |
34
|
1
|
|
|
1
|
1
|
179
|
my $self = shift; |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
|
|
29
|
my $oui = Bit::Vector->new_Dec(24, $self->[$__oui]); |
37
|
|
|
|
|
|
|
|
38
|
1
|
50
|
|
|
|
14
|
$self->[$__raw] = $self->SUPER::pack('B24n', |
39
|
|
|
|
|
|
|
$oui->to_Bin, |
40
|
|
|
|
|
|
|
$self->[$__pid], |
41
|
|
|
|
|
|
|
) or return undef; |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
|
|
23
|
$self->[$__raw]; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub unpack { |
47
|
1
|
|
|
1
|
1
|
5
|
my $self = shift; |
48
|
|
|
|
|
|
|
|
49
|
1
|
50
|
|
|
|
7
|
my ($oui, $pid, $payload) = $self->SUPER::unpack('B24n a*', $self->[$__raw]) |
50
|
|
|
|
|
|
|
or return undef; |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
20
|
my $v24 = Bit::Vector->new_Bin(24, $oui); |
53
|
1
|
|
|
|
|
7
|
$self->[$__oui] = $v24->to_Dec; |
54
|
1
|
|
|
|
|
2
|
$self->[$__pid] = $pid; |
55
|
|
|
|
|
|
|
|
56
|
1
|
|
|
|
|
2
|
$self->[$__payload] = $payload; |
57
|
|
|
|
|
|
|
|
58
|
1
|
|
|
|
|
4
|
$self; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub encapsulate { |
62
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
63
|
|
|
|
|
|
|
|
64
|
0
|
0
|
|
|
|
|
return $self->[$__nextLayer] if $self->[$__nextLayer]; |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
my $types = { |
67
|
|
|
|
|
|
|
NF_LLC_SNAP_PID_CDP() => 'CDP', |
68
|
|
|
|
|
|
|
NF_LLC_SNAP_PID_STP() => 'STP', |
69
|
|
|
|
|
|
|
NF_LLC_SNAP_PID_IPX() => 'IPX', |
70
|
|
|
|
|
|
|
}; |
71
|
|
|
|
|
|
|
|
72
|
0
|
0
|
|
|
|
|
$types->{$self->[$__pid]} || NF_LAYER_UNKNOWN; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub print { |
76
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
my $l = $self->layer; |
79
|
0
|
|
|
|
|
|
sprintf "$l: oui:0x%06x pid:0x%04x", |
80
|
|
|
|
|
|
|
$self->[$__oui], $self->[$__pid]; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
__END__ |