1 #ifndef PACKETPP_STP_LAYER 2 #define PACKETPP_STP_LAYER 87 uint8_t mstConfigName[32];
91 uint8_t mstConfigDigest[16];
105 #pragma pack(push, 1) 131 :
Layer(data, dataLen, prevLayer, packet)
139 m_Data =
new uint8_t[dataLen];
140 memset(m_Data, 0, dataLen);
163 uint16_t
getProtoId()
const {
return getStpHeader()->protoId; }
169 void setProtoId(uint16_t value) { getStpHeader()->protoId = value; }
175 uint8_t
getVersion()
const {
return getStpHeader()->version; }
181 void setVersion(uint8_t value) { getStpHeader()->version = value; }
187 uint8_t
getType()
const {
return getStpHeader()->type; }
193 void setType(uint8_t value) { getStpHeader()->type = value; }
216 static bool isDataValid(
const uint8_t *data,
size_t dataLen);
227 static StpLayer *parseStpLayer(uint8_t *data,
size_t dataLen,
Layer *prevLayer,
Packet *packet);
248 :
StpLayer(data, dataLen, prevLayer, packet)
272 void parseNextLayer();
277 std::string
toString()
const {
return "Spanning Tree Topology Change Notification"; }
326 uint8_t
getFlag()
const {
return getStpConfHeader()->flag; }
332 void setFlag(uint8_t value) { getStpConfHeader()->flag = value; }
338 uint64_t getRootId()
const;
344 void setRootId(uint64_t value);
350 uint16_t getRootPriority()
const;
356 void setRootPriority(uint16_t value);
362 uint16_t getRootSystemIDExtension()
const;
368 void setRootSystemIDExtension(uint16_t value);
386 uint32_t getPathCost()
const;
392 void setPathCost(uint32_t value);
398 uint64_t getBridgeId()
const;
404 void setBridgeId(uint64_t value);
410 uint16_t getBridgePriority()
const;
416 void setBridgePriority(uint16_t value);
422 uint16_t getBridgeSystemIDExtension()
const;
428 void setBridgeSystemIDExtension(uint16_t value);
446 uint16_t getPortId()
const;
452 void setPortId(uint16_t value);
458 double getMessageAge()
const;
464 void setMessageAge(
double value);
470 double getMaximumAge()
const;
476 void setMaximumAge(
double value);
482 double getTransmissionInterval()
const;
488 void setTransmissionInterval(
double value);
494 double getForwardDelay()
const;
500 void setForwardDelay(
double value);
510 void parseNextLayer();
515 std::string
toString()
const {
return "Spanning Tree Configuration"; }
583 void parseNextLayer();
588 std::string
toString()
const {
return "Rapid Spanning Tree"; }
636 uint16_t getVersion3Len()
const;
642 void setVersion3Len(uint16_t value);
660 std::string getMstConfigurationName()
const;
667 void setMstConfigurationName(
const std::string &value);
673 uint16_t getMstConfigRevision()
const;
679 void setMstConfigRevision(uint16_t value);
692 void setMstConfigDigest(
const uint8_t *value, uint8_t len);
698 uint32_t getCISTIrpc()
const;
704 void setCISTIrpc(uint32_t value);
710 uint64_t getCISTBridgeId()
const;
716 void setCISTBridgeId(uint64_t value);
722 uint16_t getCISTBridgePriority()
const;
728 void setCISTBridgePriority(uint16_t value);
734 uint16_t getCISTBridgeSystemIDExtension()
const;
740 void setCISTBridgeSystemIDExtension(uint16_t value);
787 std::string
toString()
const {
return "Multiple Spanning Tree"; }
Definition: StpLayer.h:80
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:333
Definition: StpLayer.h:606
uint16_t maxAge
Maximum age of the BPDU.
Definition: StpLayer.h:55
OsiModelLayer getOsiModelLayer() const
Definition: StpLayer.h:208
RapidStpLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: StpLayer.h:546
uint32_t pathCost
Cost of path.
Definition: StpLayer.h:47
void setProtoId(uint16_t value)
Definition: StpLayer.h:169
uint8_t getNumberOfMSTIConfMessages() const
Definition: StpLayer.h:770
void parseNextLayer()
Parses next layer.
Definition: StpLayer.h:782
uint16_t helloTime
BPDU transmission interval.
Definition: StpLayer.h:57
Definition: StpLayer.h:40
void setRemainingHopCount(uint8_t value)
Definition: StpLayer.h:764
void setVersion(uint8_t value)
Definition: StpLayer.h:181
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: StpLayer.h:596
stp_tcn_bpdu stp_header
Spanning Tree protocol common header.
Definition: StpLayer.h:33
Definition: ProtocolType.h:338
uint8_t remainId
CIST remaining hop count.
Definition: StpLayer.h:97
size_t getHeaderLen() const
Definition: StpLayer.h:507
uint8_t flags
MSTI flags.
Definition: StpLayer.h:109
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: StpLayer.h:795
uint16_t portId
Port ID.
Definition: StpLayer.h:51
Definition: StpLayer.h:292
size_t getHeaderLen() const
Definition: StpLayer.h:580
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: StpLayer.h:523
const ProtocolType STP
Definition: ProtocolType.h:278
uint8_t * getMstConfigDigest() const
Definition: StpLayer.h:685
void setVersion1Len(uint8_t value)
Definition: StpLayer.h:573
stp_conf_bpdu * getStpConfHeader() const
Definition: StpLayer.h:320
StpTopologyChangeBPDULayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: StpLayer.h:247
Definition: StpLayer.h:127
StpConfigurationBPDULayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: StpLayer.h:305
uint64_t regionalRootId
Regional root switching id (Priority (4 bits) + ID (12 bits) + Regional root (48 bits - MAC address))...
Definition: StpLayer.h:111
uint8_t getType() const
Definition: StpLayer.h:187
Definition: StpLayer.h:68
void setMstConfigurationFormatSelector(uint8_t value)
Definition: StpLayer.h:654
size_t getHeaderLen() const
Definition: StpLayer.h:269
void setType(uint8_t value)
Definition: StpLayer.h:193
std::string toString() const
Definition: StpLayer.h:787
void computeCalculateFields()
Does nothing for this layer.
Definition: StpLayer.h:203
uint8_t getVersion() const
Definition: StpLayer.h:175
uint8_t getVersion1Len() const
Definition: StpLayer.h:567
std::string toString() const
Definition: StpLayer.h:588
uint8_t portPriority
Priority value of port.
Definition: StpLayer.h:117
uint16_t mstConfigRevision
Configuration id revision.
Definition: StpLayer.h:89
Definition: StpLayer.h:21
uint64_t cistBridgeId
CIST bridge id.
Definition: StpLayer.h:95
uint8_t version1Len
Version1 length. The value is 0x0.
Definition: StpLayer.h:71
Definition: StpLayer.h:533
Definition: StpLayer.h:234
uint32_t pathCost
Total path cost from local port to regional port.
Definition: StpLayer.h:113
uint16_t msgAge
Age of the BPDU.
Definition: StpLayer.h:53
uint16_t version3Len
Version3 length.
Definition: StpLayer.h:83
stp_tcn_bpdu * getStpTcnHeader()
Definition: StpLayer.h:262
pcpp::MacAddress getRootSystemID() const
Definition: StpLayer.h:374
uint16_t protoId
Protocol ID. Fixed at 0x0, which represents IEEE 802.1d.
Definition: StpLayer.h:24
std::string toString() const
Definition: StpLayer.h:515
std::string toString() const
Definition: StpLayer.h:277
uint8_t version
Protocol version. 0x0 for STP, 0x2 for RSTP, 0x3 for MSTP.
Definition: StpLayer.h:26
uint8_t type
Type of the BPDU. 0x0 for configuration, 0x2 for RSTP/MSTP, 0x80 for TCN.
Definition: StpLayer.h:28
MultipleStpLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: StpLayer.h:616
pcpp::MacAddress getBridgeSystemID() const
Definition: StpLayer.h:434
uint64_t bridgeId
Bridge ID.
Definition: StpLayer.h:49
uint64_t rootId
Root bridge ID.
Definition: StpLayer.h:45
uint8_t getFlag() const
Definition: StpLayer.h:326
uint16_t getProtoId() const
Definition: StpLayer.h:163
Definition: StpLayer.h:106
static pcpp::MacAddress StpMulticastDstMAC
STP protocol uses "01:80:C2:00:00:00" multicast address as destination MAC.
Definition: StpLayer.h:149
mstp_conf_bpdu * getMstpHeader() const
Definition: StpLayer.h:631
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: StpLayer.h:285
uint8_t mstConfigFormatSelector
Configuration id format selector.
Definition: StpLayer.h:85
uint8_t remainingHops
Remaining hops of BPDU.
Definition: StpLayer.h:119
rstp_conf_bpdu * getRstpConfHeader() const
Definition: StpLayer.h:561
uint8_t getRemainingHopCount() const
Definition: StpLayer.h:758
pcpp::MacAddress getCISTBridgeSystemID() const
Definition: StpLayer.h:746
uint32_t irpc
CIST internal root path cost.
Definition: StpLayer.h:93
static pcpp::MacAddress StpUplinkFastMulticastDstMAC
STP Uplink Fast protocol uses "01:00:0C:CD:CD:CD" as destination MAC.
Definition: StpLayer.h:151
void setFlag(uint8_t value)
Definition: StpLayer.h:332
uint8_t flag
Flag for indicate purpose of BPDU.
Definition: StpLayer.h:43
uint8_t bridgePriority
Priority value of switching device.
Definition: StpLayer.h:115
Definition: MacAddress.h:28
stp_header * getStpHeader() const
Definition: StpLayer.h:157
size_t getHeaderLen() const
Definition: StpLayer.h:200
uint8_t getMstConfigurationFormatSelector() const
Definition: StpLayer.h:648
uint16_t forwardDelay
Delay for STP.
Definition: StpLayer.h:59