PcapPlusPlus  22.11
pcpp::StpLayer Class Reference

#include <StpLayer.h>

Inheritance diagram for pcpp::StpLayer:
pcpp::Layer pcpp::IDataContainer pcpp::StpTopologyChangeBPDULayer pcpp::StpConfigurationBPDULayer pcpp::RapidStpLayer pcpp::MultipleStpLayer

Public Member Functions

stp_headergetStpHeader () const
 
uint16_t getProtoId () const
 
uint8_t getVersion () const
 
uint8_t getType () const
 
size_t getHeaderLen () const
 
void parseNextLayer ()
 Parses the next layer. STP is the always last so does nothing for this layer.
 
void computeCalculateFields ()
 Does nothing for this layer.
 
OsiModelLayer getOsiModelLayer () const
 
- Public Member Functions inherited from pcpp::Layer
virtual ~Layer ()
 
LayergetNextLayer () const
 
LayergetPrevLayer () const
 
ProtocolType getProtocol () const
 
uint8_t * getData () const
 
size_t getDataLen () const
 
uint8_t * getLayerPayload () const
 
size_t getLayerPayloadSize () const
 
bool isAllocatedToPacket () const
 
void copyData (uint8_t *toArr) const
 
uint8_t * getDataPtr (size_t offset=0) const
 
virtual std::string toString () const =0
 

Static Public Member Functions

static bool isDataValid (const uint8_t *data, size_t dataLen)
 
static StpLayerparseStpLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 

Static Public Attributes

static pcpp::MacAddress StpMulticastDstMAC
 STP protocol uses "01:80:C2:00:00:00" multicast address as destination MAC.
 
static pcpp::MacAddress StpUplinkFastMulticastDstMAC
 STP Uplink Fast protocol uses "01:00:0C:CD:CD:CD" as destination MAC.
 

Detailed Description

Represents an Spanning Tree Protocol Layer

Member Function Documentation

◆ getHeaderLen()

size_t pcpp::StpLayer::getHeaderLen ( ) const
inlinevirtual
Returns
The size of STP packet

Implements pcpp::Layer.

◆ getOsiModelLayer()

OsiModelLayer pcpp::StpLayer::getOsiModelLayer ( ) const
inlinevirtual
Returns
The OSI layer level of STP (Data Link Layer).

Implements pcpp::Layer.

◆ getProtoId()

uint16_t pcpp::StpLayer::getProtoId ( ) const
inline

Returns the protocol id. Fixed at 0x0 for STP messages which represents IEEE 802.1d

Returns
ID of the protocol

◆ getStpHeader()

stp_header* pcpp::StpLayer::getStpHeader ( ) const
inline

Get a pointer to base Spanning tree header

Returns
A pointer to spanning tree header

◆ getType()

uint8_t pcpp::StpLayer::getType ( ) const
inline

Returns the type of configuration message.

Returns
Type of configuration message

◆ getVersion()

uint8_t pcpp::StpLayer::getVersion ( ) const
inline

Returns the version. Fixed at 0x0 for STP messages

Returns
Version number

◆ isDataValid()

static bool pcpp::StpLayer::isDataValid ( const uint8_t *  data,
size_t  dataLen 
)
static

A static method that validates the input data

Parameters
[in]dataThe pointer to the beginning of a byte stream of an Spanning Tree packet
[in]dataLenThe length of the byte stream
Returns
True if the data is valid and can represent an Spanning Tree packet

◆ parseStpLayer()

static StpLayer* pcpp::StpLayer::parseStpLayer ( uint8_t *  data,
size_t  dataLen,
Layer prevLayer,
Packet packet 
)
static

A method to create STP layer from existing packet

Parameters
[in]dataA pointer to the raw data
[in]dataLenSize of the data in bytes
[in]prevLayerA pointer to the previous layer
[in]packetA pointer to the Packet instance where layer will be stored
Returns
A newly allocated STP layer of one of the following types (according to the message type): StpConfigurationBPDULayer, StpTopologyChangeBPDULayer, RapidStpLayer, MultipleStpLayer