line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: NULL.pm,v ce68fbcc7f6d 2019/05/23 05:58:40 gomor $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::NULL; |
5
|
2
|
|
|
2
|
|
4914
|
use strict; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
48
|
|
6
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
47
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
360
|
use Net::Frame::Layer qw(:consts); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
371
|
|
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
|
|
15
|
use constant NF_NULL_HDR_LEN => 4; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
92
|
|
42
|
2
|
|
|
2
|
|
9
|
use constant NF_NULL_TYPE_IPv4 => 0x02000000; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
77
|
|
43
|
2
|
|
|
2
|
|
10
|
use constant NF_NULL_TYPE_ARP => 0x06080000; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
119
|
|
44
|
2
|
|
|
2
|
|
11
|
use constant NF_NULL_TYPE_CGMP => 0x01200000; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
71
|
|
45
|
2
|
|
|
2
|
|
36
|
use constant NF_NULL_TYPE_80211 => 0x52240000; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
79
|
|
46
|
2
|
|
|
2
|
|
10
|
use constant NF_NULL_TYPE_DDP => 0x9b800000; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
86
|
|
47
|
2
|
|
|
2
|
|
11
|
use constant NF_NULL_TYPE_AARP => 0xf3800000; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
71
|
|
48
|
2
|
|
|
2
|
|
9
|
use constant NF_NULL_TYPE_WCP => 0xff800000; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
72
|
|
49
|
2
|
|
|
2
|
|
8
|
use constant NF_NULL_TYPE_8021Q => 0x00810000; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
68
|
|
50
|
2
|
|
|
2
|
|
26
|
use constant NF_NULL_TYPE_IPX => 0x37810000; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
90
|
|
51
|
2
|
|
|
2
|
|
12
|
use constant NF_NULL_TYPE_STP => 0x81810000; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
72
|
|
52
|
2
|
|
|
2
|
|
9
|
use constant NF_NULL_TYPE_IPv6 => 0x1c000000; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
73
|
|
53
|
2
|
|
|
2
|
|
9
|
use constant NF_NULL_TYPE_WLCCP => 0x2d870000; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
81
|
|
54
|
2
|
|
|
2
|
|
11
|
use constant NF_NULL_TYPE_PPPoED => 0x63880000; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
77
|
|
55
|
2
|
|
|
2
|
|
10
|
use constant NF_NULL_TYPE_PPPoES => 0x64880000; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
82
|
|
56
|
2
|
|
|
2
|
|
10
|
use constant NF_NULL_TYPE_8021X => 0x8e880000; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
78
|
|
57
|
2
|
|
|
2
|
|
9
|
use constant NF_NULL_TYPE_AoE => 0xa2880000; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
76
|
|
58
|
2
|
|
|
2
|
|
9
|
use constant NF_NULL_TYPE_LLDP => 0xcc880000; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
73
|
|
59
|
2
|
|
|
2
|
|
9
|
use constant NF_NULL_TYPE_LOOP => 0x00900000; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
74
|
|
60
|
2
|
|
|
2
|
|
10
|
use constant NF_NULL_TYPE_VLAN => 0x00910000; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
84
|
|
61
|
2
|
|
|
2
|
|
10
|
use constant NF_NULL_TYPE_ETH => 0x58650000; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
166
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
our @AS = qw( |
64
|
|
|
|
|
|
|
type |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
67
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
68
|
|
|
|
|
|
|
|
69
|
2
|
|
|
2
|
|
12
|
no strict 'vars'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
688
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub new { |
72
|
|
|
|
|
|
|
shift->SUPER::new( |
73
|
1
|
|
|
1
|
1
|
19
|
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
|
194
|
my $self = shift; |
82
|
1
|
50
|
|
|
|
9
|
$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
|
3
|
my $self = shift; |
89
|
|
|
|
|
|
|
|
90
|
1
|
50
|
|
|
|
6
|
my ($type, $payload) = $self->SUPER::unpack('N a*', $self->[$__raw]) |
91
|
|
|
|
|
|
|
or return undef; |
92
|
|
|
|
|
|
|
|
93
|
1
|
|
|
|
|
2
|
$self->[$__type] = $type; |
94
|
1
|
|
|
|
|
2
|
$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
|
67
|
my $self = shift; |
124
|
|
|
|
|
|
|
|
125
|
1
|
50
|
|
|
|
5
|
return $self->[$__nextLayer] if $self->[$__nextLayer]; |
126
|
|
|
|
|
|
|
|
127
|
1
|
|
50
|
|
|
6
|
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
|
|
|
|
|
4
|
sprintf "$l: type:0x%08x", $self->type; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
1; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
__END__ |