| Net-Frame-Layer-LLTD documentation | Contained in the Net-Frame-Layer-LLTD distribution. |
Net::Frame::Layer::LLTD::EmiteeDesc - LLTD EmiteeDesc object
use Net::Frame::Layer::LLTD::EmiteeDesc;
my $layer = Net::Frame::Layer::LLTD::EmiteeDesc->new(
type => 0,
pause => 0,
sourceAddress => 'ff:ff:ff:ff:ff:ff',
destinationAddress => 'ff:ff:ff:ff:ff:ff',
);
$layer->pack;
print 'RAW: '.$layer->dump."\n";
# Read a raw layer
my $layer = Net::Frame::Layer::LLTD::EmiteeDesc->new(raw => $raw);
$layer->unpack;
print $layer->print."\n";
print 'PAYLOAD: '.unpack('H*', $layer->payload)."\n"
if $layer->payload;
This modules implements the encoding and decoding of LLTD EmiteeDescs.
See also Net::Frame::Layer for other attributes and methods.
The following are inherited attributes. See Net::Frame::Layer for more information.
Object constructor. You can pass attributes that will overwrite default ones. See SYNOPSIS for default values.
The following are inherited methods. Some of them may be overriden in this layer, and some others may not be meaningful in this layer. See Net::Frame::Layer for more information.
Patrice <GomoR> Auffret
Copyright (c) 2006-2007, Patrice <GomoR> Auffret
You may distribute this module under the terms of the Artistic license. See LICENSE.Artistic file in the source distribution archive.
| Net-Frame-Layer-LLTD documentation | Contained in the Net-Frame-Layer-LLTD distribution. |
# # $Id: EmiteeDesc.pm,v 1.2 2007/03/15 18:23:26 gomor Exp $ # package Net::Frame::Layer::LLTD::EmiteeDesc; use strict; use warnings; use Net::Frame::Layer qw(:consts :subs); our @ISA = qw(Net::Frame::Layer); our @AS = qw( type pause sourceAddress destinationAddress ); __PACKAGE__->cgBuildIndices; __PACKAGE__->cgBuildAccessorsScalar(\@AS); sub new { shift->SUPER::new( type => 0, pause => 0, sourceAddress => 'ff:ff:ff:ff:ff:ff', destinationAddress => 'ff:ff:ff:ff:ff:ff', @_, ); } sub getLength { 14 } sub pack { my $self = shift; (my $sourceAddress = $self->sourceAddress) =~ s/://g; (my $destinationAddress = $self->destinationAddress) =~ s/://g; $self->raw($self->SUPER::pack('CCH12H12', $self->type, $self->pause, $sourceAddress, $destinationAddress, )) or return undef; $self->raw; } sub unpack { my $self = shift; my ($type, $pause, $src, $dst, $payload) = $self->SUPER::unpack('CCH12H12 a*', $self->raw) or return undef; $self->type($type); $self->pause($pause); $self->sourceAddress(convertMac($src)); $self->destinationAddress(convertMac($dst)); $self->payload($payload); $self; } sub print { my $self = shift; my $l = $self->layer; sprintf "$l: type:%02x pause:%02x\n". "$l: sourceAddress: %s\n". "$l: destinationAddress: %s", $self->type, $self->pause, $self->sourceAddress, $self->destinationAddress; } 1; __END__