/usr/share/perl5/Net/Frame/Layer/NULL.pm is in libnet-frame-perl 1.16-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | #
# $Id: NULL.pm 360 2015-01-20 18:36:06Z gomor $
#
package Net::Frame::Layer::NULL;
use strict;
use warnings;
use Net::Frame::Layer qw(:consts);
require Exporter;
our @ISA = qw(Net::Frame::Layer Exporter);
our %EXPORT_TAGS = (
consts => [qw(
NF_NULL_HDR_LEN
NF_NULL_TYPE_IPv4
NF_NULL_TYPE_ARP
NF_NULL_TYPE_CGMP
NF_NULL_TYPE_80211
NF_NULL_TYPE_DDP
NF_NULL_TYPE_AARP
NF_NULL_TYPE_WCP
NF_NULL_TYPE_8021Q
NF_NULL_TYPE_IPX
NF_NULL_TYPE_STP
NF_NULL_TYPE_IPv6
NF_NULL_TYPE_WLCCP
NF_NULL_TYPE_PPPoED
NF_NULL_TYPE_PPPoES
NF_NULL_TYPE_8021X
NF_NULL_TYPE_AoE
NF_NULL_TYPE_LLDP
NF_NULL_TYPE_LOOP
NF_NULL_TYPE_VLAN
NF_NULL_TYPE_ETH
)],
);
our @EXPORT_OK = (
@{$EXPORT_TAGS{consts}},
);
use constant NF_NULL_HDR_LEN => 4;
use constant NF_NULL_TYPE_IPv4 => 0x02000000;
use constant NF_NULL_TYPE_ARP => 0x06080000;
use constant NF_NULL_TYPE_CGMP => 0x01200000;
use constant NF_NULL_TYPE_80211 => 0x52240000;
use constant NF_NULL_TYPE_DDP => 0x9b800000;
use constant NF_NULL_TYPE_AARP => 0xf3800000;
use constant NF_NULL_TYPE_WCP => 0xff800000;
use constant NF_NULL_TYPE_8021Q => 0x00810000;
use constant NF_NULL_TYPE_IPX => 0x37810000;
use constant NF_NULL_TYPE_STP => 0x81810000;
use constant NF_NULL_TYPE_IPv6 => 0x1c000000;
use constant NF_NULL_TYPE_WLCCP => 0x2d870000;
use constant NF_NULL_TYPE_PPPoED => 0x63880000;
use constant NF_NULL_TYPE_PPPoES => 0x64880000;
use constant NF_NULL_TYPE_8021X => 0x8e880000;
use constant NF_NULL_TYPE_AoE => 0xa2880000;
use constant NF_NULL_TYPE_LLDP => 0xcc880000;
use constant NF_NULL_TYPE_LOOP => 0x00900000;
use constant NF_NULL_TYPE_VLAN => 0x00910000;
use constant NF_NULL_TYPE_ETH => 0x58650000;
our @AS = qw(
type
);
__PACKAGE__->cgBuildIndices;
__PACKAGE__->cgBuildAccessorsScalar(\@AS);
no strict 'vars';
sub new {
shift->SUPER::new(
type => NF_NULL_TYPE_IPv4,
@_,
);
}
sub getLength { NF_NULL_HDR_LEN }
sub pack {
my $self = shift;
$self->[$__raw] = $self->SUPER::pack('N', $self->[$__type])
or return undef;
$self->[$__raw];
}
sub unpack {
my $self = shift;
my ($type, $payload) = $self->SUPER::unpack('N a*', $self->[$__raw])
or return undef;
$self->[$__type] = $type;
$self->[$__payload] = $payload;
$self;
}
our $Next = {
NF_NULL_TYPE_IPv4() => 'IPv4',
NF_NULL_TYPE_ARP() => 'ARP',
NF_NULL_TYPE_CGMP() => 'CGMP',
NF_NULL_TYPE_80211() => '80211',
NF_NULL_TYPE_DDP() => 'DDP',
NF_NULL_TYPE_AARP() => 'AARP',
NF_NULL_TYPE_WCP() => 'WCP',
NF_NULL_TYPE_8021Q() => '8021Q',
NF_NULL_TYPE_IPX() => 'IPX',
NF_NULL_TYPE_STP() => 'STP',
NF_NULL_TYPE_IPv6() => 'IPv6',
NF_NULL_TYPE_WLCCP() => 'WLCCP',
NF_NULL_TYPE_PPPoED() => 'PPPoED',
NF_NULL_TYPE_PPPoES() => 'PPPoES',
NF_NULL_TYPE_8021X() => '8021X',
NF_NULL_TYPE_AoE() => 'AoE',
NF_NULL_TYPE_LLDP() => 'LLDP',
NF_NULL_TYPE_LOOP() => 'LOOP',
NF_NULL_TYPE_VLAN() => 'VLAN',
NF_NULL_TYPE_ETH() => 'ETH',
};
sub encapsulate {
my $self = shift;
return $self->[$__nextLayer] if $self->[$__nextLayer];
return $Next->{$self->[$__type]} || NF_LAYER_UNKNOWN;
}
sub print {
my $self = shift;
my $l = $self->layer;
sprintf "$l: type:0x%08x", $self->type;
}
1;
__END__
=head1 NAME
Net::Frame::Layer::NULL - BSD loopback layer object
=head1 SYNOPSIS
use Net::Frame::Layer::NULL qw(:consts);
# Build a layer
my $layer = Net::Frame::Layer::NULL->new(
type => NF_NULL_TYPE_IPv4,
);
$layer->pack;
print 'RAW: '.$layer->dump."\n";
# Read a raw layer
my $layer = Net::Frame::Layer::NULL->new(raw => $raw);
print $layer->print."\n";
print 'PAYLOAD: '.unpack('H*', $layer->payload)."\n"
if $layer->payload;
=head1 DESCRIPTION
This modules implements the encoding and decoding of the BSD loopback layer.
See also B<Net::Frame::Layer> for other attributes and methods.
=head1 ATTRIBUTES
=over 4
=item B<type>
Stores the type of encapsulated layer.
=back
The following are inherited attributes. See B<Net::Frame::Layer> for more information.
=over 4
=item B<raw>
=item B<payload>
=item B<nextLayer>
=back
=head1 METHODS
=over 4
=item B<new>
=item B<new> (hash)
Object constructor. You can pass attributes that will overwrite default ones. See B<SYNOPSIS> for default values.
=back
The following are inherited methods. Some of them may be overridden in this layer, and some others may not be meaningful in this layer. See B<Net::Frame::Layer> for more information.
=over 4
=item B<layer>
=item B<computeLengths>
=item B<computeChecksums>
=item B<pack>
=item B<unpack>
=item B<encapsulate>
=item B<getLength>
=item B<getPayloadLength>
=item B<print>
=item B<dump>
=back
=head1 CONSTANTS
Load them: use Net::Frame::Layer::NULL qw(:consts);
=over 4
=item B<NF_NULL_TYPE_IPv4>
=item B<NF_NULL_TYPE_ARP>
=item B<NF_NULL_TYPE_CGMP>
=item B<NF_NULL_TYPE_80211>
=item B<NF_NULL_TYPE_DDP>
=item B<NF_NULL_TYPE_AARP>
=item B<NF_NULL_TYPE_WCP>
=item B<NF_NULL_TYPE_8021Q>
=item B<NF_NULL_TYPE_IPX>
=item B<NF_NULL_TYPE_STP>
=item B<NF_NULL_TYPE_IPv6>
=item B<NF_NULL_TYPE_WLCCP>
=item B<NF_NULL_TYPE_PPPoED>
=item B<NF_NULL_TYPE_PPPoES>
=item B<NF_NULL_TYPE_8021X>
=item B<NF_NULL_TYPE_AoE>
=item B<NF_NULL_TYPE_LLDP>
=item B<NF_NULL_TYPE_LOOP>
=item B<NF_NULL_TYPE_VLAN>
=item B<NF_NULL_TYPE_ETH>
Various supported encapsulated layer types.
=back
=head1 SEE ALSO
L<Net::Frame::Layer>
=head1 AUTHOR
Patrice E<lt>GomoRE<gt> Auffret
=head1 COPYRIGHT AND LICENSE
Copyright (c) 2006-2015, Patrice E<lt>GomoRE<gt> Auffret
You may distribute this module under the terms of the Artistic license.
See LICENSE.Artistic file in the source distribution archive.
=cut
|