line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: SNAP.pm 16 2010-06-03 12:46:53Z gomor $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::LLC::SNAP; |
5
|
1
|
|
|
1
|
|
6477
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
40
|
|
6
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
1194
|
use Net::Frame::Layer qw(:consts); |
|
1
|
|
|
|
|
118537
|
|
|
1
|
|
|
|
|
265
|
|
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
|
|
13
|
no strict 'vars'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
721
|
use Net::Frame::Layer::LLC qw(:consts); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
699
|
|
21
|
|
|
|
|
|
|
require Bit::Vector; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new { |
24
|
|
|
|
|
|
|
shift->SUPER::new( |
25
|
1
|
|
|
1
|
1
|
29
|
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
|
246
|
my $self = shift; |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
|
|
39
|
my $oui = Bit::Vector->new_Dec(24, $self->[$__oui]); |
37
|
|
|
|
|
|
|
|
38
|
1
|
50
|
|
|
|
21
|
$self->[$__raw] = $self->SUPER::pack('B24n', |
39
|
|
|
|
|
|
|
$oui->to_Bin, |
40
|
|
|
|
|
|
|
$self->[$__pid], |
41
|
|
|
|
|
|
|
) or return undef; |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
|
|
27
|
$self->[$__raw]; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub unpack { |
47
|
1
|
|
|
1
|
1
|
6
|
my $self = shift; |
48
|
|
|
|
|
|
|
|
49
|
1
|
50
|
|
|
|
10
|
my ($oui, $pid, $payload) = $self->SUPER::unpack('B24n a*', $self->[$__raw]) |
50
|
|
|
|
|
|
|
or return undef; |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
22
|
my $v24 = Bit::Vector->new_Bin(24, $oui); |
53
|
1
|
|
|
|
|
8
|
$self->[$__oui] = $v24->to_Dec; |
54
|
1
|
|
|
|
|
3
|
$self->[$__pid] = $pid; |
55
|
|
|
|
|
|
|
|
56
|
1
|
|
|
|
|
2
|
$self->[$__payload] = $payload; |
57
|
|
|
|
|
|
|
|
58
|
1
|
|
|
|
|
5
|
$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__ |