Net::Packet::STP
Section: User Contributed Perl Documentation (3pm)
Updated: 2009-11-09
Index
Return to Main Contents
NAME
Net::Packet::STP - Spanning Tree Protocol layer 4 object
SYNOPSIS
use Net::Packet::Consts qw(:stp);
require Net::Packet::STP;
# Build a layer
my $layer = Net::Packet::STP->new(
protocolIdentifier => NP_STP_PROTOCOL_IDENTIFIER_STP,
protocolVersionIdentifier => 0,
bpduType => 0x00,
bpduFlags => 0x00,
rootIdentifier => '1/00:11:22:33:44:55',
rootPathCost => 1,
bridgeIdentifier => '2/11:22:33:44:55:66',
portIdentifier => 0x0001,
messageAge => 1,
maxAge => 10,
helloTime => 1,
forwardDelay => 10,
);
$layer->pack;
print 'RAW: '.unpack('H*', $layer->raw)."\n";
# Read a raw layer
my $layer = Net::Packet::STP->new(raw => $raw);
print $layer->print."\n";
print 'PAYLOAD: '.unpack('H*', $layer->payload)."\n"
if $layer->payload;
DESCRIPTION
This modules implements the encoding and decoding of the Spanning Tree Protocol layer.
See also Net::Packet::Layer and Net::Packet::Layer4 for other attributes and methods.
ATTRIBUTES
- protocolIdentifier - 16 bits
-
- protocolVersionIdentifier - 8 bits
-
- bpduType - 8 bits
-
- bpduFlags - 8 bits
-
- rootIdentifier - 64 bits (16 + 56)
-
- rootPathCost - 32 bits
-
- bridgeIdentifier - 64 bits (16 + 56)
-
- portIdentifier - 16 bits
-
- messageAge - 16 bits
-
- maxAge - 16 bits
-
- helloTime - 16 bits
-
- forwardDelay - 16 bits
-
METHODS
- new
-
Object constructor. You can pass attributes that will overwrite default ones. Default values:
protocolIdentifier: NP_STP_PROTOCOL_IDENTIFIER_STP
protocolVersionIdentifier: 0
bpduType: 0x00
bpduFlags: 0x00
rootIdentifier: '1/00:11:22:33:44:55'
rootPathCost: 1
bridgeIdentifier: '2/11:22:33:44:55:66'
portIdentifier: 0x0001
messageAge: 1
maxAge: 10
helloTime: 1
forwardDelay: 10
- pack
-
Packs all attributes into a raw format, in order to inject to network. Returns 1 on success, undef otherwise.
- unpack
-
Unpacks raw data from network and stores attributes into the object. Returns 1 on success, undef otherwise.
CONSTANTS
Load them: use Net::Packet::Consts qw(:stp);
- NP_STP_HDR_LEN
-
STP header length.
- NP_STP_PROTOCOL_IDENTIFIER_STP
-
Various supported STP protocol identifiers.
AUTHOR
Patrice <GomoR> Auffret
COPYRIGHT AND LICENSE
Copyright (c) 2004-2009, Patrice <GomoR> Auffret
You may distribute this module under the terms of the Artistic license.
See LICENSE.Artistic file in the source distribution archive.
RELATED MODULES
NetPacket, Net::RawIP, Net::RawSock
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- ATTRIBUTES
-
- METHODS
-
- CONSTANTS
-
- AUTHOR
-
- COPYRIGHT AND LICENSE
-
- RELATED MODULES
-
This document was created by