Net::Packet::Layer3 - base class for all layer 3 modules


Net-Packet documentation Contained in the Net-Packet distribution.

Index


Code Index:

NAME

Top

Net::Packet::Layer3 - base class for all layer 3 modules

DESCRIPTION

Top

This is the base class for Net::Packet::Layer3 subclasses.

It just provides those layers with inheritable attributes and methods.

METHODS

Top

isIpv4
isIpv6
isIp - is IPv4 or IPv6
isArp
isVlan

Returns true if Layer3 is of specified type, false otherwise.

AUTHOR

Top

Patrice <GomoR> Auffret

COPYRIGHT AND LICENSE

Top

RELATED MODULES

Top


Net-Packet documentation Contained in the Net-Packet distribution.

#
# $Id: Layer3.pm 1640 2009-11-09 17:58:27Z gomor $
#
package Net::Packet::Layer3;
use strict;
use warnings;

require Net::Packet::Layer;
our @ISA = qw(Net::Packet::Layer);
__PACKAGE__->cgBuildIndices;

use Net::Packet::Consts qw(:layer);

sub layer { NP_LAYER_N_3 }

sub _is    { (shift->is eq shift()) ? 1 : 0                   }
sub isIp   { my $self = shift; $self->isIpv4 || $self->isIpv6 }
sub isIpv4 { shift->_is(NP_LAYER_IPv4)                        }
sub isIpv6 { shift->_is(NP_LAYER_IPv6)                        }
sub isArp  { shift->_is(NP_LAYER_ARP)                         }
sub isVlan { shift->_is(NP_LAYER_VLAN)                        }

1;

__END__