+#define RSTP_EXTRACT_PORT_ROLE(x) (((x)&0x0C)>>2)
+/* STP timers are expressed in multiples of 1/256th second */
+#define STP_TIME_BASE 256
+
+struct stp_bpdu_ {
+ u_int8_t protocol_id[2];
+ u_int8_t protocol_version;
+ u_int8_t bpdu_type;
+ u_int8_t flags;
+ u_int8_t root_id[8];
+ u_int8_t root_path_cost[4];
+ u_int8_t bridge_id[8];
+ u_int8_t port_id[2];
+ u_int8_t message_age[2];
+ u_int8_t max_age[2];
+ u_int8_t hello_time[2];
+ u_int8_t forward_delay[2];
+ u_int8_t v1_length;
+};
+
+#define STP_PROTO_REGULAR 0x00
+#define STP_PROTO_RAPID 0x02
+
+struct tok stp_proto_values[] = {
+ { STP_PROTO_REGULAR, "802.1d" },
+ { STP_PROTO_RAPID, "802.1w" },
+ { 0, NULL}
+};
+
+#define STP_BPDU_TYPE_CONFIG 0x00
+#define STP_BPDU_TYPE_RSTP 0x02
+#define STP_BPDU_TYPE_TOPO_CHANGE 0x80
+
+struct tok stp_bpdu_flag_values[] = {
+ { 0x01, "Topology change" },
+ { 0x02, "Proposal" },
+ { 0x10, "Learn" },
+ { 0x20, "Forward" },
+ { 0x40, "Agreement" },
+ { 0x80, "Topology change ACK" },
+ { 0, NULL}
+};
+
+struct tok stp_bpdu_type_values[] = {
+ { STP_BPDU_TYPE_CONFIG, "Config" },
+ { STP_BPDU_TYPE_RSTP, "Rapid SPT" },
+ { STP_BPDU_TYPE_TOPO_CHANGE, "Topology Change" },
+ { 0, NULL}
+};
+
+struct tok rstp_obj_port_role_values[] = {
+ { 0x00, "Unknown" },
+ { 0x01, "Alternate" },
+ { 0x02, "Root" },
+ { 0x03, "Designated" },
+ { 0, NULL}
+};
+
+static char *