Net::Packet::DescL2 - object for a link layer (layer 2) descriptor


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

Index


Code Index:

NAME

Top

Net::Packet::DescL2 - object for a link layer (layer 2) descriptor

SYNOPSIS

Top

   require Net::Packet::DescL2;

   # Usually, you use it to send ARP frames, that is crafted from ETH layer
   my $d2 = Net::Packet::DescL2->new(
      dev => 'eth0',
   );

   $d2->send($rawStringToNetwork);

DESCRIPTION

Top

See also Net::Packet::Desc for other attributes and methods.

METHODS

Top

new

Create the object, using default $Env object values for dev, ip, ip6 and mac (see Net::Packet::Env). When the object is created, the $Env global object has its desc attributes set to it. You can avoid this behaviour by setting noDescAutoSet in $Env object (see Net::Packet::Env).

Default values for attributes:

dev: $Env->dev

ip: $Env->ip

ip6: $Env->ip6

mac: $Env->mac

AUTHOR

Top

Patrice <GomoR> Auffret

COPYRIGHT AND LICENSE

Top

RELATED MODULES

Top


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

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

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

no strict 'vars';

require Net::Write::Layer2;

sub new {
   my $self = shift->SUPER::new(@_);

   my $nwrite = Net::Write::Layer2->new(
      dev => $self->[$__dev],
   );
   $nwrite->open;

   $self->[$___io] = $nwrite;

   $self;
}

1;

__END__