26 static_assert(
sizeof(
stp_tcn_bpdu) == 4,
"stp_tcn_bpdu size is not 4 bytes");
30 static_assert(
sizeof(
stp_header) == 4,
"stp_header size is not 4 bytes");
57 static_assert(
sizeof(
stp_conf_bpdu) == 35,
"stp_conf_bpdu size is not 35 bytes");
68 static_assert(
sizeof(
rstp_conf_bpdu) == 36,
"rstp_conf_bpdu size is not 36 bytes");
93 static_assert(
sizeof(
mstp_conf_bpdu) == 102,
"mstp_conf_bpdu size is not 102 bytes");
115 static_assert(
sizeof(
msti_conf_msg) == 16,
"msti_conf_msg size is not 16 bytes");
123 :
Layer(data, dataLen, prevLayer, packet,
STP)
240 :
StpLayer(data, dataLen, prevLayer, packet)
268 return "Spanning Tree Topology Change Notification";
278 return canReinterpretAs<stp_tcn_bpdu>(data, dataLen);
457 return "Spanning Tree Configuration";
466 return canReinterpretAs<stp_conf_bpdu>(data, dataLen);
527 return "Rapid Spanning Tree";
536 return canReinterpretAs<rstp_conf_bpdu>(data, dataLen);
695 return "Multiple Spanning Tree";
704 return canReinterpretAs<mstp_conf_bpdu>(data, dataLen);
void allocData(size_t dataLen, bool zeroInit=true)
Requests the layer to allocate a new data buffer of the specified length.
Definition: MacAddress.h:24
Definition: StpLayer.h:544
void setMstConfigRevision(uint16_t value)
uint8_t getNumberOfMSTIConfMessages() const
Definition: StpLayer.h:675
uint32_t getCISTIrpc() const
void setRemainingHopCount(uint8_t value)
Definition: StpLayer.h:668
void parseNextLayer() override
Parses next layer.
Definition: StpLayer.h:689
mstp_conf_bpdu * getMstpHeader() const
Definition: StpLayer.h:561
uint64_t getCISTBridgeId() const
void setCISTBridgeSystemIDExtension(uint16_t value)
uint16_t getCISTBridgePriority() const
uint16_t getMstConfigRevision() const
void setMstConfigDigest(const uint8_t *value, uint8_t len)
uint8_t getMstConfigurationFormatSelector() const
Definition: StpLayer.h:575
uint8_t * getMstConfigDigest() const
Definition: StpLayer.h:606
msti_conf_msg * getMstiConfMessages() const
void setCISTBridgeId(uint64_t value)
void setCISTBridgeSystemID(const pcpp::MacAddress &value)
void setVersion3Len(uint16_t value)
std::string getMstConfigurationName() const
void setMstConfigurationName(const std::string &value)
pcpp::MacAddress getCISTBridgeSystemID() const
Definition: StpLayer.h:650
void setCISTBridgePriority(uint16_t value)
void setCISTIrpc(uint32_t value)
uint16_t getCISTBridgeSystemIDExtension() const
MultipleStpLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: StpLayer.h:551
uint16_t getVersion3Len() const
std::string toString() const override
Definition: StpLayer.h:693
void setMstConfigurationFormatSelector(uint8_t value)
Definition: StpLayer.h:582
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: StpLayer.h:702
uint8_t getRemainingHopCount() const
Definition: StpLayer.h:661
Definition: StpLayer.h:473
uint8_t getVersion1Len() const
Definition: StpLayer.h:501
void parseNextLayer() override
Parses next layer.
std::string toString() const override
Definition: StpLayer.h:525
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: StpLayer.h:534
rstp_conf_bpdu * getRstpConfHeader() const
Definition: StpLayer.h:494
RapidStpLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: StpLayer.h:484
void setVersion1Len(uint8_t value)
Definition: StpLayer.h:508
size_t getHeaderLen() const override
Definition: StpLayer.h:516
Definition: StpLayer.h:285
void setBridgePriority(uint16_t value)
StpConfigurationBPDULayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: StpLayer.h:296
uint8_t getFlag() const
Definition: StpLayer.h:313
void setPathCost(uint32_t value)
size_t getHeaderLen() const override
Definition: StpLayer.h:446
StpConfigurationBPDULayer()
uint64_t getBridgeId() const
void setRootId(uint64_t value)
void setForwardDelay(double value)
pcpp::MacAddress getRootSystemID() const
Definition: StpLayer.h:351
uint16_t getPortId() const
void setMaximumAge(double value)
double getForwardDelay() const
void parseNextLayer() override
Parses next layer.
void setRootPriority(uint16_t value)
uint16_t getBridgeSystemIDExtension() const
void setBridgeSystemIDExtension(uint16_t value)
void setBridgeSystemID(const pcpp::MacAddress &value)
void setMessageAge(double value)
double getTransmissionInterval() const
stp_conf_bpdu * getStpConfHeader() const
Definition: StpLayer.h:306
double getMessageAge() const
uint16_t getBridgePriority() const
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: StpLayer.h:464
uint16_t getRootSystemIDExtension() const
void setFlag(uint8_t value)
Definition: StpLayer.h:320
void setRootSystemID(const pcpp::MacAddress &value)
double getMaximumAge() const
void setRootSystemIDExtension(uint16_t value)
pcpp::MacAddress getBridgeSystemID() const
Definition: StpLayer.h:394
uint32_t getPathCost() const
uint64_t getRootId() const
void setTransmissionInterval(double value)
void setBridgeId(uint64_t value)
std::string toString() const override
Definition: StpLayer.h:455
void setPortId(uint16_t value)
uint16_t getRootPriority() const
Definition: StpLayer.h:120
static StpLayer * parseStpLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
uint8_t getVersion() const
Definition: StpLayer.h:165
uint8_t getType() const
Definition: StpLayer.h:179
static pcpp::MacAddress StpUplinkFastMulticastDstMAC
STP Uplink Fast protocol uses "01:00:0C:CD:CD:CD" as destination MAC.
Definition: StpLayer.h:139
void setProtoId(uint16_t value)
Definition: StpLayer.h:158
void setType(uint8_t value)
Definition: StpLayer.h:186
uint16_t getProtoId() const
Definition: StpLayer.h:150
size_t getHeaderLen() const override
Definition: StpLayer.h:194
stp_header * getStpHeader() const
Definition: StpLayer.h:143
static pcpp::MacAddress StpMulticastDstMAC
STP protocol uses "01:80:C2:00:00:00" multicast address as destination MAC.
Definition: StpLayer.h:137
OsiModelLayer getOsiModelLayer() const override
Definition: StpLayer.h:204
void setVersion(uint8_t value)
Definition: StpLayer.h:172
void computeCalculateFields() override
Does nothing for this layer.
Definition: StpLayer.h:200
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: StpLayer.h:228
StpTopologyChangeBPDULayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: StpLayer.h:239
std::string toString() const override
Definition: StpLayer.h:266
StpTopologyChangeBPDULayer()
stp_tcn_bpdu * getStpTcnHeader()
Definition: StpLayer.h:249
size_t getHeaderLen() const override
Definition: StpLayer.h:257
void parseNextLayer() override
Parses next layer.
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: StpLayer.h:276
const ProtocolType STP
Spanning Tree Protocol.
Definition: ProtocolType.h:195
The main namespace for the PcapPlusPlus lib.
Definition: AssertionUtils.h:19
OsiModelLayer
An enum representing OSI model layers.
Definition: ProtocolType.h:267
@ OsiModelDataLinkLayer
Data link layer (layer 2)
Definition: ProtocolType.h:271
stp_tcn_bpdu stp_header
Spanning Tree protocol common header.
Definition: StpLayer.h:26
Definition: StpLayer.h:100
uint8_t portPriority
Priority value of port.
Definition: StpLayer.h:110
uint8_t bridgePriority
Priority value of switching device.
Definition: StpLayer.h:108
uint8_t flags
MSTI flags.
Definition: StpLayer.h:102
uint8_t remainingHops
Remaining hops of BPDU.
Definition: StpLayer.h:112
uint64_t regionalRootId
Regional root switching id (Priority (4 bits) + ID (12 bits) + Regional root (48 bits - MAC address))
Definition: StpLayer.h:104
uint32_t pathCost
Total path cost from local port to regional port.
Definition: StpLayer.h:106
Definition: StpLayer.h:74
uint8_t mstConfigFormatSelector
Configuration id format selector.
Definition: StpLayer.h:78
uint32_t irpc
CIST internal root path cost.
Definition: StpLayer.h:86
uint16_t version3Len
Version3 length.
Definition: StpLayer.h:76
uint8_t mstConfigName[32]
Configuration id name.
Definition: StpLayer.h:80
uint64_t cistBridgeId
CIST bridge id.
Definition: StpLayer.h:88
uint8_t remainId
CIST remaining hop count.
Definition: StpLayer.h:90
uint8_t mstConfigDigest[16]
Configuration id digest.
Definition: StpLayer.h:84
uint16_t mstConfigRevision
Configuration id revision.
Definition: StpLayer.h:82
Definition: StpLayer.h:63
uint8_t version1Len
Version1 length. The value is 0x0.
Definition: StpLayer.h:65
Definition: StpLayer.h:36
uint8_t flag
Flag for indicate purpose of BPDU.
Definition: StpLayer.h:38
uint64_t rootId
Root bridge ID.
Definition: StpLayer.h:40
uint64_t bridgeId
Bridge ID.
Definition: StpLayer.h:44
uint16_t helloTime
BPDU transmission interval.
Definition: StpLayer.h:52
uint16_t msgAge
Age of the BPDU.
Definition: StpLayer.h:48
uint16_t portId
Port ID.
Definition: StpLayer.h:46
uint16_t maxAge
Maximum age of the BPDU.
Definition: StpLayer.h:50
uint32_t pathCost
Cost of path.
Definition: StpLayer.h:42
uint16_t forwardDelay
Delay for STP.
Definition: StpLayer.h:54
Definition: StpLayer.h:17
uint8_t version
Protocol version. 0x0 for STP, 0x2 for RSTP, 0x3 for MSTP.
Definition: StpLayer.h:21
uint16_t protoId
Protocol ID. Fixed at 0x0, which represents IEEE 802.1d.
Definition: StpLayer.h:19
uint8_t type
Type of the BPDU. 0x0 for configuration, 0x2 for RSTP/MSTP, 0x80 for TCN.
Definition: StpLayer.h:23