PcapPlusPlus  Next
StpLayer.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Layer.h"
4 #include "MacAddress.h"
5 #include <cstring>
6 
8 
11 namespace pcpp
12 {
15 #pragma pack(push, 1)
16  struct stp_tcn_bpdu
17  {
19  uint16_t protoId;
21  uint8_t version;
23  uint8_t type;
24  };
25 #pragma pack(pop)
26  static_assert(sizeof(stp_tcn_bpdu) == 4, "stp_tcn_bpdu size is not 4 bytes");
27 
30  static_assert(sizeof(stp_header) == 4, "stp_header size is not 4 bytes");
31 
34 #pragma pack(push, 1)
36  {
38  uint8_t flag;
40  uint64_t rootId;
42  uint32_t pathCost;
44  uint64_t bridgeId;
46  uint16_t portId;
48  uint16_t msgAge;
50  uint16_t maxAge;
52  uint16_t helloTime;
54  uint16_t forwardDelay;
55  };
56 #pragma pack(pop)
57  static_assert(sizeof(stp_conf_bpdu) == 35, "stp_conf_bpdu size is not 35 bytes");
58 
61 #pragma pack(push, 1)
63  {
65  uint8_t version1Len;
66  };
67 #pragma pack(pop)
68  static_assert(sizeof(rstp_conf_bpdu) == 36, "rstp_conf_bpdu size is not 36 bytes");
69 
72 #pragma pack(push, 1)
74  {
76  uint16_t version3Len;
80  uint8_t mstConfigName[32];
84  uint8_t mstConfigDigest[16];
86  uint32_t irpc;
88  uint64_t cistBridgeId;
90  uint8_t remainId;
91  };
92 #pragma pack(pop)
93  static_assert(sizeof(mstp_conf_bpdu) == 102, "mstp_conf_bpdu size is not 102 bytes");
94 
98 #pragma pack(push, 1)
100  {
102  uint8_t flags;
104  uint64_t regionalRootId;
106  uint32_t pathCost;
108  uint8_t bridgePriority;
110  uint8_t portPriority;
112  uint8_t remainingHops;
113  };
114 #pragma pack(pop)
115  static_assert(sizeof(msti_conf_msg) == 16, "msti_conf_msg size is not 16 bytes");
116 
119  class StpLayer : public Layer
120  {
121  protected:
122  StpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet)
123  : Layer(data, dataLen, prevLayer, packet, STP)
124  {}
125 
126  explicit StpLayer(size_t dataLen)
127  {
128  allocData(dataLen);
129  m_Protocol = STP;
130  }
131 
132  static pcpp::MacAddress IDtoMacAddress(uint64_t id);
133  static uint64_t macAddressToID(const pcpp::MacAddress& addr);
134 
135  void serializeLayer(ObjectScope& serializer) const override;
136 
137  public:
140  {
142  static std::vector<FieldDescriptor> all()
143  {
144  auto result = Layer::SerializedFields::all();
145  std::initializer_list<FieldDescriptor> extra{ ProtoId, Version, Type };
146  std::copy(extra.begin(), extra.end(), std::back_inserter(result));
147  return result;
148  }
149 
151  static const FieldDescriptor ProtoId;
152 
154  static const FieldDescriptor Version;
155 
157  static const FieldDescriptor Type;
158 
160  static constexpr uint16_t MaxStpFieldID = Layer::SerializedFields::MaxID + 3;
161  };
162 
167 
171  {
172  return reinterpret_cast<stp_header*>(m_Data);
173  }
174 
177  uint16_t getProtoId() const
178  {
179  return getStpHeader()->protoId;
180  }
181 
184 
185  void setProtoId(uint16_t value)
186  {
187  getStpHeader()->protoId = value;
188  }
189 
192  uint8_t getVersion() const
193  {
194  return getStpHeader()->version;
195  }
196 
199  void setVersion(uint8_t value)
200  {
201  getStpHeader()->version = value;
202  }
203 
206  uint8_t getType() const
207  {
208  return getStpHeader()->type;
209  }
210 
213  void setType(uint8_t value)
214  {
215  getStpHeader()->type = value;
216  }
217 
218  // overridden methods
219 
221  size_t getHeaderLen() const override
222  {
223  return m_DataLen;
224  }
225 
227  void computeCalculateFields() override
228  {}
229 
232  {
233  return OsiModelDataLinkLayer;
234  }
235 
240  static bool isDataValid(const uint8_t* data, size_t dataLen);
241 
249  static StpLayer* parseStpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet);
250  };
251 
255  {
256  protected:
257  explicit StpTopologyChangeBPDULayer(size_t dataLen) : StpLayer(dataLen)
258  {}
259 
260  public:
266  StpTopologyChangeBPDULayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet)
267  : StpLayer(data, dataLen, prevLayer, packet)
268  {}
269 
273 
277  {
278  return getStpHeader();
279  }
280 
281  // overridden methods
282 
284  size_t getHeaderLen() const override
285  {
286  return sizeof(stp_tcn_bpdu);
287  }
288 
290  void parseNextLayer() override;
291 
293  std::string toString() const override
294  {
295  return "Spanning Tree Topology Change Notification";
296  }
297 
303  static bool isDataValid(const uint8_t* data, size_t dataLen)
304  {
305  return canReinterpretAs<stp_tcn_bpdu>(data, dataLen);
306  }
307  };
308 
312  {
313  protected:
314  explicit StpConfigurationBPDULayer(size_t dataLen) : StpTopologyChangeBPDULayer(dataLen)
315  {}
316 
317  void serializeLayer(ObjectScope& serializer) const override;
318 
319  public:
325  StpConfigurationBPDULayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet)
326  : StpTopologyChangeBPDULayer(data, dataLen, prevLayer, packet)
327  {}
328 
331  {
333  static std::vector<FieldDescriptor> all()
334  {
335  return { Priority, SystemIdExtension, SystemId };
336  }
337 
339  static const FieldDescriptor Priority;
340 
343 
345  static const FieldDescriptor SystemId;
346  };
347 
350  {
352  static std::vector<FieldDescriptor> all()
353  {
354  auto result = StpLayer::SerializedFields::all();
355  std::initializer_list<FieldDescriptor> extra{ Flags, RootId, PathCost, BridgeId,
357  ForwardDelay };
358  std::copy(extra.begin(), extra.end(), std::back_inserter(result));
359  return result;
360  }
361 
363  static const FieldDescriptor Flags;
364 
367 
369  static const FieldDescriptor PathCost;
370 
373 
375  static const FieldDescriptor PortId;
376 
379 
382 
385 
388 
391  };
392 
396 
400  {
401  return reinterpret_cast<stp_conf_bpdu*>(m_Data);
402  }
403 
406  uint8_t getFlag() const
407  {
408  return getStpConfHeader()->flag;
409  }
410 
413  void setFlag(uint8_t value)
414  {
415  getStpConfHeader()->flag = value;
416  }
417 
420  uint64_t getRootId() const;
421 
424  void setRootId(uint64_t value);
425 
428  uint16_t getRootPriority() const;
429 
432  void setRootPriority(uint16_t value);
433 
436  uint16_t getRootSystemIDExtension() const;
437 
440  void setRootSystemIDExtension(uint16_t value);
441 
445  {
446  return IDtoMacAddress(getRootId());
447  }
448 
451  void setRootSystemID(const pcpp::MacAddress& value);
452 
455  uint32_t getPathCost() const;
456 
459  void setPathCost(uint32_t value);
460 
463  uint64_t getBridgeId() const;
464 
467  void setBridgeId(uint64_t value);
468 
471  uint16_t getBridgePriority() const;
472 
475  void setBridgePriority(uint16_t value);
476 
479  uint16_t getBridgeSystemIDExtension() const;
480 
483  void setBridgeSystemIDExtension(uint16_t value);
484 
488  {
489  return IDtoMacAddress(getBridgeId());
490  }
491 
495 
498  uint16_t getPortId() const;
499 
502  void setPortId(uint16_t value);
503 
506  double getMessageAge() const;
507 
510  void setMessageAge(double value);
511 
514  double getMaximumAge() const;
515 
518  void setMaximumAge(double value);
519 
522  double getTransmissionInterval() const;
523 
526  void setTransmissionInterval(double value);
527 
530  double getForwardDelay() const;
531 
534  void setForwardDelay(double value);
535 
536  // overridden methods
537 
539  size_t getHeaderLen() const override
540  {
541  return sizeof(stp_conf_bpdu);
542  }
543 
545  void parseNextLayer() override;
546 
548  std::string toString() const override
549  {
550  return "Spanning Tree Configuration";
551  }
552 
557  static bool isDataValid(const uint8_t* data, size_t dataLen)
558  {
559  return canReinterpretAs<stp_conf_bpdu>(data, dataLen);
560  }
561  };
562 
566  {
567  protected:
568  explicit RapidStpLayer(size_t dataLen) : StpConfigurationBPDULayer(dataLen)
569  {}
570 
571  void serializeLayer(ObjectScope& serializer) const override;
572 
573  public:
579  RapidStpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet)
580  : StpConfigurationBPDULayer(data, dataLen, prevLayer, packet)
581  {}
582 
585  {
587  static std::vector<FieldDescriptor> all()
588  {
590  std::initializer_list<FieldDescriptor> extra{ Version1Length };
591  std::copy(extra.begin(), extra.end(), std::back_inserter(result));
592  return result;
593  }
594 
597 
599  static constexpr uint16_t MaxRapidFieldID =
601  };
602 
606 
610  {
611  return reinterpret_cast<rstp_conf_bpdu*>(m_Data);
612  }
613 
616  uint8_t getVersion1Len() const
617  {
618  return getRstpConfHeader()->version1Len;
619  }
620 
623  void setVersion1Len(uint8_t value)
624  {
625  getRstpConfHeader()->version1Len = value;
626  }
627 
628  // overridden methods
629 
631  size_t getHeaderLen() const override
632  {
633  return sizeof(rstp_conf_bpdu);
634  }
635 
637  void parseNextLayer() override;
638 
640  std::string toString() const override
641  {
642  return "Rapid Spanning Tree";
643  }
644 
649  static bool isDataValid(const uint8_t* data, size_t dataLen)
650  {
651  return canReinterpretAs<rstp_conf_bpdu>(data, dataLen);
652  }
653  };
654 
659  {
660  protected:
661  void serializeLayer(ObjectScope& serializer) const override;
662 
663  public:
669  MultipleStpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet)
670  : RapidStpLayer(data, dataLen, prevLayer, packet)
671  {}
672 
675  {
677  static std::vector<FieldDescriptor> all()
678  {
679  auto result = RapidStpLayer::SerializedFields::all();
680  std::initializer_list<FieldDescriptor> extra{ Version3Length, ConfigFormatSelector,
684  std::copy(extra.begin(), extra.end(), std::back_inserter(result));
685  return result;
686  }
687 
690 
693 
696 
699 
702 
705 
708 
711 
714  };
715 
719 
723  {
724  return reinterpret_cast<mstp_conf_bpdu*>(m_Data);
725  }
726 
728  uint16_t getVersion3Len() const;
729 
732  void setVersion3Len(uint16_t value);
733 
737  {
739  }
740 
744  {
746  }
747 
750  std::string getMstConfigurationName() const;
751 
755  void setMstConfigurationName(const std::string& value);
756 
759  uint16_t getMstConfigRevision() const;
760 
763  void setMstConfigRevision(uint16_t value);
764 
767  uint8_t* getMstConfigDigest() const
768  {
769  return getMstpHeader()->mstConfigDigest;
770  }
771 
775  void setMstConfigDigest(const uint8_t* value, uint8_t len);
776 
779  uint32_t getCISTIrpc() const;
780 
783  void setCISTIrpc(uint32_t value);
784 
787  uint64_t getCISTBridgeId() const;
788 
791  void setCISTBridgeId(uint64_t value);
792 
795  uint16_t getCISTBridgePriority() const;
796 
799  void setCISTBridgePriority(uint16_t value);
800 
804 
807  void setCISTBridgeSystemIDExtension(uint16_t value);
808 
812  {
813  return IDtoMacAddress(getCISTBridgeId());
814  }
815 
819 
822  uint8_t getRemainingHopCount() const
823  {
824  return getMstpHeader()->remainId;
825  }
826 
829  void setRemainingHopCount(uint8_t value)
830  {
831  getMstpHeader()->remainId = value;
832  }
833 
837  {
838  return (getVersion3Len() - (sizeof(mstp_conf_bpdu) - sizeof(rstp_conf_bpdu) - sizeof(uint16_t))) /
839  sizeof(msti_conf_msg);
840  }
841 
846 
847  // overridden methods
848 
850  void parseNextLayer() override
851  {}
852 
854  std::string toString() const override
855  {
856  return "Multiple Spanning Tree";
857  }
858 
863  static bool isDataValid(const uint8_t* data, size_t dataLen)
864  {
865  return canReinterpretAs<mstp_conf_bpdu>(data, dataLen);
866  }
867  };
868 } // namespace pcpp
Definition: Layer.h:117
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:659
void setMstConfigRevision(uint16_t value)
uint8_t getNumberOfMSTIConfMessages() const
Definition: StpLayer.h:836
uint32_t getCISTIrpc() const
void serializeLayer(ObjectScope &serializer) const override
void setRemainingHopCount(uint8_t value)
Definition: StpLayer.h:829
void parseNextLayer() override
Parses next layer.
Definition: StpLayer.h:850
mstp_conf_bpdu * getMstpHeader() const
Definition: StpLayer.h:722
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:736
uint8_t * getMstConfigDigest() const
Definition: StpLayer.h:767
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:811
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:669
uint16_t getVersion3Len() const
std::string toString() const override
Definition: StpLayer.h:854
void setMstConfigurationFormatSelector(uint8_t value)
Definition: StpLayer.h:743
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: StpLayer.h:863
uint8_t getRemainingHopCount() const
Definition: StpLayer.h:822
Definition: Serializers.h:230
Definition: Packet.h:49
Definition: StpLayer.h:566
uint8_t getVersion1Len() const
Definition: StpLayer.h:616
void parseNextLayer() override
Parses next layer.
std::string toString() const override
Definition: StpLayer.h:640
void serializeLayer(ObjectScope &serializer) const override
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: StpLayer.h:649
rstp_conf_bpdu * getRstpConfHeader() const
Definition: StpLayer.h:609
RapidStpLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: StpLayer.h:579
void setVersion1Len(uint8_t value)
Definition: StpLayer.h:623
size_t getHeaderLen() const override
Definition: StpLayer.h:631
Definition: StpLayer.h:312
void setBridgePriority(uint16_t value)
StpConfigurationBPDULayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: StpLayer.h:325
uint8_t getFlag() const
Definition: StpLayer.h:406
void setPathCost(uint32_t value)
size_t getHeaderLen() const override
Definition: StpLayer.h:539
void setRootId(uint64_t value)
void setForwardDelay(double value)
pcpp::MacAddress getRootSystemID() const
Definition: StpLayer.h:444
void setMaximumAge(double value)
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:399
uint16_t getBridgePriority() const
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: StpLayer.h:557
uint16_t getRootSystemIDExtension() const
void setFlag(uint8_t value)
Definition: StpLayer.h:413
void setRootSystemID(const pcpp::MacAddress &value)
void setRootSystemIDExtension(uint16_t value)
pcpp::MacAddress getBridgeSystemID() const
Definition: StpLayer.h:487
void setTransmissionInterval(double value)
void setBridgeId(uint64_t value)
std::string toString() const override
Definition: StpLayer.h:548
void setPortId(uint16_t value)
void serializeLayer(ObjectScope &serializer) const override
uint16_t getRootPriority() const
Definition: StpLayer.h:120
static StpLayer * parseStpLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
void serializeLayer(ObjectScope &serializer) const override
uint8_t getVersion() const
Definition: StpLayer.h:192
uint8_t getType() const
Definition: StpLayer.h:206
static pcpp::MacAddress StpUplinkFastMulticastDstMAC
STP Uplink Fast protocol uses "01:00:0C:CD:CD:CD" as destination MAC.
Definition: StpLayer.h:166
void setProtoId(uint16_t value)
Definition: StpLayer.h:185
void setType(uint8_t value)
Definition: StpLayer.h:213
uint16_t getProtoId() const
Definition: StpLayer.h:177
size_t getHeaderLen() const override
Definition: StpLayer.h:221
stp_header * getStpHeader() const
Definition: StpLayer.h:170
static pcpp::MacAddress StpMulticastDstMAC
STP protocol uses "01:80:C2:00:00:00" multicast address as destination MAC.
Definition: StpLayer.h:164
OsiModelLayer getOsiModelLayer() const override
Definition: StpLayer.h:231
void setVersion(uint8_t value)
Definition: StpLayer.h:199
void computeCalculateFields() override
Does nothing for this layer.
Definition: StpLayer.h:227
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: StpLayer.h:255
StpTopologyChangeBPDULayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: StpLayer.h:266
std::string toString() const override
Definition: StpLayer.h:293
stp_tcn_bpdu * getStpTcnHeader()
Definition: StpLayer.h:276
size_t getHeaderLen() const override
Definition: StpLayer.h:284
void parseNextLayer() override
Parses next layer.
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: StpLayer.h:303
const ProtocolType STP
Spanning Tree Protocol.
Definition: ProtocolType.h:198
The main namespace for the PcapPlusPlus lib.
Definition: AssertionUtils.h:19
OsiModelLayer
An enum representing OSI model layers.
Definition: ProtocolType.h:425
@ OsiModelDataLinkLayer
Data link layer (layer 2)
Definition: ProtocolType.h:429
stp_tcn_bpdu stp_header
Spanning Tree protocol common header.
Definition: StpLayer.h:26
Definition: Serializers.h:18
Definition: Layer.h:212
static std::vector< FieldDescriptor > all()
Definition: Layer.h:214
static constexpr uint16_t MaxID
Maximum field ID used by the layer.
Definition: Layer.h:229
Fields serialized for MultipleStpLayer, including its base layer fields.
Definition: StpLayer.h:675
static const FieldDescriptor CistInternalRootPathCost
CIST internal root path cost, in host byte order.
Definition: StpLayer.h:704
static const ObjectFieldDescriptor< BridgeIdSerializedFields > CistBridgeId
CIST bridge identifier containing priority, system identifier extension and MAC address.
Definition: StpLayer.h:707
static const FieldDescriptor ConfigRevision
MST configuration revision, in host byte order.
Definition: StpLayer.h:698
static const FieldDescriptor RemainingHopCount
CIST remaining hop count.
Definition: StpLayer.h:710
static const FieldDescriptor ConfigDigest
16-byte MST configuration digest as lowercase hexadecimal without separators.
Definition: StpLayer.h:701
static constexpr uint16_t MaxMultipleFieldID
Maximum field ID used by this layer.
Definition: StpLayer.h:713
static const FieldDescriptor Version3Length
Version 3 length, in bytes and host byte order.
Definition: StpLayer.h:689
static const FieldDescriptor ConfigFormatSelector
MST configuration format selector.
Definition: StpLayer.h:692
static const FieldDescriptor ConfigName
MST configuration name, up to 32 characters, terminated at the first null byte.
Definition: StpLayer.h:695
static std::vector< FieldDescriptor > all()
Definition: StpLayer.h:677
Fields serialized for RapidStpLayer, including its base layer fields.
Definition: StpLayer.h:585
static std::vector< FieldDescriptor > all()
Definition: StpLayer.h:587
static const FieldDescriptor Version1Length
Version 1 length, in bytes.
Definition: StpLayer.h:596
static constexpr uint16_t MaxRapidFieldID
Maximum field ID used by this layer.
Definition: StpLayer.h:599
Fields describing an STP bridge identifier.
Definition: StpLayer.h:331
static std::vector< FieldDescriptor > all()
Definition: StpLayer.h:333
static const FieldDescriptor SystemId
System identifier as a MAC address string.
Definition: StpLayer.h:345
static const FieldDescriptor Priority
Bridge priority, in host byte order.
Definition: StpLayer.h:339
static const FieldDescriptor SystemIdExtension
System identifier extension, in host byte order.
Definition: StpLayer.h:342
Fields serialized for StpConfigurationBPDULayer, including its base layer fields.
Definition: StpLayer.h:350
static constexpr uint16_t MaxConfigurationFieldID
Maximum field ID used by this layer.
Definition: StpLayer.h:390
static const FieldDescriptor PathCost
Root path cost, in host byte order.
Definition: StpLayer.h:369
static const ObjectFieldDescriptor< BridgeIdSerializedFields > BridgeId
Bridge identifier containing priority, system identifier extension and MAC address.
Definition: StpLayer.h:372
static const FieldDescriptor MaximumAge
BPDU maximum age, as returned by getMaximumAge().
Definition: StpLayer.h:381
static std::vector< FieldDescriptor > all()
Definition: StpLayer.h:352
static const FieldDescriptor TransmissionInterval
BPDU transmission interval, as returned by getTransmissionInterval().
Definition: StpLayer.h:384
static const FieldDescriptor ForwardDelay
Forward delay, as returned by getForwardDelay().
Definition: StpLayer.h:387
static const ObjectFieldDescriptor< BridgeIdSerializedFields > RootId
Root bridge identifier containing priority, system identifier extension and MAC address.
Definition: StpLayer.h:366
static const FieldDescriptor PortId
Port identifier, in host byte order.
Definition: StpLayer.h:375
static const FieldDescriptor Flags
Raw BPDU flag bits.
Definition: StpLayer.h:363
static const FieldDescriptor MessageAge
BPDU message age, as returned by getMessageAge().
Definition: StpLayer.h:378
Fields serialized for StpLayer, including its base layer fields.
Definition: StpLayer.h:140
static std::vector< FieldDescriptor > all()
Definition: StpLayer.h:142
static const FieldDescriptor ProtoId
BPDU protocol identifier, as an unsigned integer in host byte order.
Definition: StpLayer.h:151
static const FieldDescriptor Type
BPDU type (0 for configuration, 2 for RSTP/MSTP, 128 for TCN).
Definition: StpLayer.h:157
static const FieldDescriptor Version
BPDU protocol version.
Definition: StpLayer.h:154
static constexpr uint16_t MaxStpFieldID
Maximum field ID used by this layer.
Definition: StpLayer.h:160
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