
Net::Packet::VLAN - 802.1Q layer 3 object

use Net::Packet::Consts qw(:vlan);
require Net::Packet::VLAN;
# Build a layer
my $layer = Net::Packet::VLAN->new(
priority => 0,
cfi => 0,
id => 0,
type => NP_VLAN_TYPE_IPv4,
);
$layer->pack;
print 'RAW: '.unpack('H*', $layer->raw)."\n";
# Read a raw layer
my $layer = Net::Packet::VLAN->new(raw => $raw);
print $layer->print."\n";
print 'PAYLOAD: '.unpack('H*', $layer->payload)."\n"
if $layer->payload;

This modules implements the encoding and decoding of the Virtual LAN/802.1Q layer.
Details: http://standards.ieee.org/getieee802/802.1.html
See also Net::Packet::Layer and Net::Packet::Layer3 for other attributes and methods.

The priority field.
The cfi field. It is only one bit long, so set it to 0 or 1.
VLAN tag id. You'll love it.
Which type the next encapsulated layer is.
This is a Net::Packet::Frame object, built it like any other such frame. Just to mention that you should use dnoFexLien attribute if you put in a Net::Packet::IPv4 layer.

Object constructor. You can pass attributes that will overwrite default ones. Default values:
priority: 0
cfi: 0
id: 0
type: NP_VLAN_TYPE_IPv4
Packs all attributes into a raw format, in order to inject to network. Returns 1 on success, undef otherwise.
Unpacks raw data from network and stores attributes into the object. Returns 1 on success, undef otherwise.
Helper methods. Return true is the encapsulated layer is of specified type, false otherwise.

Load them: use Net::Packet::Consts qw(:vlan);
Various supported encapsulated frame types.

Patrice <GomoR> Auffret

Copyright (c) 2004-2006, Patrice <GomoR> Auffret
You may distribute this module under the terms of the Artistic license. See LICENSE.Artistic file in the source distribution archive.
