line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: NULL.pm,v 7609c9d085d3 2018/03/15 15:17:19 gomor $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::NULL; |
5
|
2
|
|
|
2
|
|
6382
|
use strict; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
69
|
|
6
|
2
|
|
|
2
|
|
14
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
73
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
496
|
use Net::Frame::Layer qw(:consts); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
448
|
|
9
|
|
|
|
|
|
|
require Exporter; |
10
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer Exporter); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
13
|
|
|
|
|
|
|
consts => [qw( |
14
|
|
|
|
|
|
|
NF_NULL_HDR_LEN |
15
|
|
|
|
|
|
|
NF_NULL_TYPE_IPv4 |
16
|
|
|
|
|
|
|
NF_NULL_TYPE_ARP |
17
|
|
|
|
|
|
|
NF_NULL_TYPE_CGMP |
18
|
|
|
|
|
|
|
NF_NULL_TYPE_80211 |
19
|
|
|
|
|
|
|
NF_NULL_TYPE_DDP |
20
|
|
|
|
|
|
|
NF_NULL_TYPE_AARP |
21
|
|
|
|
|
|
|
NF_NULL_TYPE_WCP |
22
|
|
|
|
|
|
|
NF_NULL_TYPE_8021Q |
23
|
|
|
|
|
|
|
NF_NULL_TYPE_IPX |
24
|
|
|
|
|
|
|
NF_NULL_TYPE_STP |
25
|
|
|
|
|
|
|
NF_NULL_TYPE_IPv6 |
26
|
|
|
|
|
|
|
NF_NULL_TYPE_WLCCP |
27
|
|
|
|
|
|
|
NF_NULL_TYPE_PPPoED |
28
|
|
|
|
|
|
|
NF_NULL_TYPE_PPPoES |
29
|
|
|
|
|
|
|
NF_NULL_TYPE_8021X |
30
|
|
|
|
|
|
|
NF_NULL_TYPE_AoE |
31
|
|
|
|
|
|
|
NF_NULL_TYPE_LLDP |
32
|
|
|
|
|
|
|
NF_NULL_TYPE_LOOP |
33
|
|
|
|
|
|
|
NF_NULL_TYPE_VLAN |
34
|
|
|
|
|
|
|
NF_NULL_TYPE_ETH |
35
|
|
|
|
|
|
|
)], |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
our @EXPORT_OK = ( |
38
|
|
|
|
|
|
|
@{$EXPORT_TAGS{consts}}, |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
2
|
|
|
2
|
|
16
|
use constant NF_NULL_HDR_LEN => 4; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
122
|
|
42
|
2
|
|
|
2
|
|
12
|
use constant NF_NULL_TYPE_IPv4 => 0x02000000; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
94
|
|
43
|
2
|
|
|
2
|
|
12
|
use constant NF_NULL_TYPE_ARP => 0x06080000; |
|
2
|
|
|
|
|
46
|
|
|
2
|
|
|
|
|
117
|
|
44
|
2
|
|
|
2
|
|
17
|
use constant NF_NULL_TYPE_CGMP => 0x01200000; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
103
|
|
45
|
2
|
|
|
2
|
|
55
|
use constant NF_NULL_TYPE_80211 => 0x52240000; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
101
|
|
46
|
2
|
|
|
2
|
|
12
|
use constant NF_NULL_TYPE_DDP => 0x9b800000; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
78
|
|
47
|
2
|
|
|
2
|
|
11
|
use constant NF_NULL_TYPE_AARP => 0xf3800000; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
97
|
|
48
|
2
|
|
|
2
|
|
18
|
use constant NF_NULL_TYPE_WCP => 0xff800000; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
117
|
|
49
|
2
|
|
|
2
|
|
12
|
use constant NF_NULL_TYPE_8021Q => 0x00810000; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
103
|
|
50
|
2
|
|
|
2
|
|
12
|
use constant NF_NULL_TYPE_IPX => 0x37810000; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
87
|
|
51
|
2
|
|
|
2
|
|
11
|
use constant NF_NULL_TYPE_STP => 0x81810000; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
88
|
|
52
|
2
|
|
|
2
|
|
10
|
use constant NF_NULL_TYPE_IPv6 => 0x1c000000; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
107
|
|
53
|
2
|
|
|
2
|
|
11
|
use constant NF_NULL_TYPE_WLCCP => 0x2d870000; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
104
|
|
54
|
2
|
|
|
2
|
|
12
|
use constant NF_NULL_TYPE_PPPoED => 0x63880000; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
97
|
|
55
|
2
|
|
|
2
|
|
14
|
use constant NF_NULL_TYPE_PPPoES => 0x64880000; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
113
|
|
56
|
2
|
|
|
2
|
|
13
|
use constant NF_NULL_TYPE_8021X => 0x8e880000; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
90
|
|
57
|
2
|
|
|
2
|
|
11
|
use constant NF_NULL_TYPE_AoE => 0xa2880000; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
101
|
|
58
|
2
|
|
|
2
|
|
11
|
use constant NF_NULL_TYPE_LLDP => 0xcc880000; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
98
|
|
59
|
2
|
|
|
2
|
|
11
|
use constant NF_NULL_TYPE_LOOP => 0x00900000; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
88
|
|
60
|
2
|
|
|
2
|
|
11
|
use constant NF_NULL_TYPE_VLAN => 0x00910000; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
104
|
|
61
|
2
|
|
|
2
|
|
14
|
use constant NF_NULL_TYPE_ETH => 0x58650000; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
216
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
our @AS = qw( |
64
|
|
|
|
|
|
|
type |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
67
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
68
|
|
|
|
|
|
|
|
69
|
2
|
|
|
2
|
|
16
|
no strict 'vars'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
822
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub new { |
72
|
|
|
|
|
|
|
shift->SUPER::new( |
73
|
1
|
|
|
1
|
1
|
20
|
type => NF_NULL_TYPE_IPv4, |
74
|
|
|
|
|
|
|
@_, |
75
|
|
|
|
|
|
|
); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
0
|
1
|
0
|
sub getLength { NF_NULL_HDR_LEN } |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub pack { |
81
|
1
|
|
|
1
|
1
|
260
|
my $self = shift; |
82
|
1
|
50
|
|
|
|
19
|
$self->[$__raw] = $self->SUPER::pack('N', $self->[$__type]) |
83
|
|
|
|
|
|
|
or return undef; |
84
|
1
|
|
|
|
|
3
|
$self->[$__raw]; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub unpack { |
88
|
1
|
|
|
1
|
1
|
7
|
my $self = shift; |
89
|
|
|
|
|
|
|
|
90
|
1
|
50
|
|
|
|
8
|
my ($type, $payload) = $self->SUPER::unpack('N a*', $self->[$__raw]) |
91
|
|
|
|
|
|
|
or return undef; |
92
|
|
|
|
|
|
|
|
93
|
1
|
|
|
|
|
3
|
$self->[$__type] = $type; |
94
|
1
|
|
|
|
|
3
|
$self->[$__payload] = $payload; |
95
|
|
|
|
|
|
|
|
96
|
1
|
|
|
|
|
2
|
$self; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
our $Next = { |
100
|
|
|
|
|
|
|
NF_NULL_TYPE_IPv4() => 'IPv4', |
101
|
|
|
|
|
|
|
NF_NULL_TYPE_ARP() => 'ARP', |
102
|
|
|
|
|
|
|
NF_NULL_TYPE_CGMP() => 'CGMP', |
103
|
|
|
|
|
|
|
NF_NULL_TYPE_80211() => '80211', |
104
|
|
|
|
|
|
|
NF_NULL_TYPE_DDP() => 'DDP', |
105
|
|
|
|
|
|
|
NF_NULL_TYPE_AARP() => 'AARP', |
106
|
|
|
|
|
|
|
NF_NULL_TYPE_WCP() => 'WCP', |
107
|
|
|
|
|
|
|
NF_NULL_TYPE_8021Q() => '8021Q', |
108
|
|
|
|
|
|
|
NF_NULL_TYPE_IPX() => 'IPX', |
109
|
|
|
|
|
|
|
NF_NULL_TYPE_STP() => 'STP', |
110
|
|
|
|
|
|
|
NF_NULL_TYPE_IPv6() => 'IPv6', |
111
|
|
|
|
|
|
|
NF_NULL_TYPE_WLCCP() => 'WLCCP', |
112
|
|
|
|
|
|
|
NF_NULL_TYPE_PPPoED() => 'PPPoED', |
113
|
|
|
|
|
|
|
NF_NULL_TYPE_PPPoES() => 'PPPoES', |
114
|
|
|
|
|
|
|
NF_NULL_TYPE_8021X() => '8021X', |
115
|
|
|
|
|
|
|
NF_NULL_TYPE_AoE() => 'AoE', |
116
|
|
|
|
|
|
|
NF_NULL_TYPE_LLDP() => 'LLDP', |
117
|
|
|
|
|
|
|
NF_NULL_TYPE_LOOP() => 'LOOP', |
118
|
|
|
|
|
|
|
NF_NULL_TYPE_VLAN() => 'VLAN', |
119
|
|
|
|
|
|
|
NF_NULL_TYPE_ETH() => 'ETH', |
120
|
|
|
|
|
|
|
}; |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub encapsulate { |
123
|
1
|
|
|
1
|
1
|
294
|
my $self = shift; |
124
|
|
|
|
|
|
|
|
125
|
1
|
50
|
|
|
|
8
|
return $self->[$__nextLayer] if $self->[$__nextLayer]; |
126
|
|
|
|
|
|
|
|
127
|
1
|
|
50
|
|
|
10
|
return $Next->{$self->[$__type]} || NF_LAYER_UNKNOWN; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub print { |
131
|
1
|
|
|
1
|
1
|
5
|
my $self = shift; |
132
|
|
|
|
|
|
|
|
133
|
1
|
|
|
|
|
5
|
my $l = $self->layer; |
134
|
1
|
|
|
|
|
5
|
sprintf "$l: type:0x%08x", $self->type; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
1; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
__END__ |