Net::Packet::STP - Spanning Tree Protocol layer 4 object
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;
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.
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
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.
Load them: use Net::Packet::Consts qw(:stp);
STP header length.
Various supported STP protocol identifiers.
Patrice <GomoR> Auffret
Copyright (c) 2004-2015, Patrice <GomoR> Auffret
You may distribute this module under the terms of the Artistic license. See LICENSE.Artistic file in the source distribution archive.
NetPacket, Net::RawIP, Net::RawSock
To install Net::Packet, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Packet
CPAN shell
perl -MCPAN -e shell install Net::Packet
For more information on module installation, please visit the detailed CPAN module installation guide.