34#include <tins/macros.h>
35#include <tins/endianness.h>
36#include <tins/hw_address.h>
37#include <tins/small_uint.h>
66 : priority(priority), ext_id(ext_id), id(
id) { }
92 return Endian::be_to_host(header_.proto_id);
100 return header_.proto_version;
108 return header_.bpdu_type;
116 return header_.bpdu_flags;
124 return Endian::be_to_host(header_.root_path_cost);
132 return Endian::be_to_host(header_.port_id);
140 return Endian::be_to_host(header_.msg_age) / 256;
148 return Endian::be_to_host(header_.max_age) / 256;
156 return Endian::be_to_host(header_.hello_time) / 256;
164 return Endian::be_to_host(header_.fwd_delay) / 256;
171 bpdu_id_type root_id()
const;
177 bpdu_id_type bridge_id()
const;
191 return new STP(*
this);
267 void root_id(
const bpdu_id_type&
id);
273 void bridge_id(
const bpdu_id_type&
id);
277 #if TINS_IS_LITTLE_ENDIAN
292 uint8_t proto_version;
296 uint32_t root_path_cost;
297 pvt_bpdu_id bridge_id;
305 static bpdu_id_type convert(
const pvt_bpdu_id&
id);
306 static pvt_bpdu_id convert(
const bpdu_id_type&
id);
308 void write_serialization(uint8_t* buffer, uint32_t total_sz);
Represents a range of addresses.
Definition address_range.h:167
Base class for protocol data units.
Definition pdu.h:107
PDUType
Enum which identifies each type of PDU.
Definition pdu.h:127
Represents a Spanning Tree Protocol PDU.
Definition stp.h:44
STP * clone() const
Definition stp.h:190
uint32_t root_path_cost() const
Getter for the Root Path Cost field.
Definition stp.h:123
PDUType pdu_type() const
Getter for the PDU's type.
Definition stp.h:183
uint16_t fwd_delay() const
Getter for the Forward Delay field.
Definition stp.h:163
HWAddress< 6 > address_type
Definition stp.h:54
uint8_t bpdu_type() const
Getter for the BDU Type field.
Definition stp.h:107
uint16_t proto_id() const
Getter for the Protocol ID field.
Definition stp.h:91
uint16_t port_id() const
Getter for the Port ID field.
Definition stp.h:131
uint16_t max_age() const
Getter for the Maximum Age field.
Definition stp.h:147
uint16_t hello_time() const
Getter for the Hello Time field.
Definition stp.h:155
uint8_t proto_version() const
Getter for the Protocol Version field.
Definition stp.h:99
uint16_t msg_age() const
Getter for the Message Age field.
Definition stp.h:139
uint8_t bpdu_flags() const
Getter for the BDU Flags field.
Definition stp.h:115
The Tins namespace.
Definition address_range.h:38