34 #include <tins/macros.h> 35 #include <tins/endianness.h> 36 #include <tins/hw_address.h> 37 #include <tins/small_uint.h> 65 const address_type&
id=address_type())
66 : priority(priority), ext_id(ext_id), id(
id) { }
83 STP(
const uint8_t* buffer, uint32_t total_sz);
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;
191 return new STP(*
this);
199 uint32_t header_size()
const;
207 void proto_id(uint16_t new_proto_id);
213 void proto_version(uint8_t new_proto_version);
219 void bpdu_type(uint8_t new_bpdu_type);
225 void bpdu_flags(uint8_t new_bpdu_flags);
231 void root_path_cost(uint32_t new_root_path_cost);
237 void port_id(uint16_t new_port_id);
243 void msg_age(uint16_t new_msg_age);
249 void max_age(uint16_t new_max_age);
255 void hello_time(uint16_t new_hello_time);
261 void fwd_delay(uint16_t new_fwd_delay);
277 #if TINS_IS_LITTLE_ENDIAN 292 uint8_t proto_version;
296 uint32_t root_path_cost;
297 pvt_bpdu_id bridge_id;
308 void write_serialization(uint8_t* buffer, uint32_t total_sz);
PDUType
Enum which identifies each type of PDU.
Definition: pdu.h:127
uint8_t bpdu_type() const
Getter for the BDU Type field.
Definition: stp.h:107
uint16_t fwd_delay() const
Getter for the Forward Delay field.
Definition: stp.h:163
uint16_t hello_time() const
Getter for the Hello Time field.
Definition: stp.h:155
uint16_t port_id() const
Getter for the Port ID field.
Definition: stp.h:131
uint16_t proto_id() const
Getter for the Protocol ID field.
Definition: stp.h:91
Represents a Spanning Tree Protocol PDU.
Definition: stp.h:44
The Tins namespace.
Definition: address_range.h:38
uint32_t root_path_cost() const
Getter for the Root Path Cost field.
Definition: stp.h:123
uint16_t msg_age() const
Getter for the Message Age field.
Definition: stp.h:139
PDUType pdu_type() const
Getter for the PDU's type.
Definition: stp.h:183
uint8_t bpdu_flags() const
Getter for the BDU Flags field.
Definition: stp.h:115
uint16_t max_age() const
Getter for the Maximum Age field.
Definition: stp.h:147
uint8_t proto_version() const
Getter for the Protocol Version field.
Definition: stp.h:99
STP * clone() const
Definition: stp.h:190
Base class for protocol data units.
Definition: pdu.h:107
HWAddress< 6 > address_type
Definition: stp.h:54