]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-stp.c
Default to first interface from pcap_findalldevs()
[tcpdump] / print-stp.c
index 5cbf5d752e8385794a52484874ff421eb5428441..47089e52247783aac2a456fc687ee1c77399492c 100644 (file)
@@ -9,16 +9,15 @@
  * Contributed by Lennert Buytenhek <[email protected]>
  */
 
-#define NETDISSECT_REWORKED
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
 
 #include <stdio.h>
 
-#include "interface.h"
+#include "netdissect.h"
 #include "extract.h"
 
 #define        RSTP_EXTRACT_PORT_ROLE(x) (((x)&0x0C)>>2)
 #define STP_BPDU_MSTP_MIN_LEN 102
 
 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;
+    uint8_t protocol_id[2];
+    uint8_t protocol_version;
+    uint8_t bpdu_type;
+    uint8_t flags;
+    uint8_t root_id[8];
+    uint8_t root_path_cost[4];
+    uint8_t bridge_id[8];
+    uint8_t port_id[2];
+    uint8_t message_age[2];
+    uint8_t max_age[2];
+    uint8_t hello_time[2];
+    uint8_t forward_delay[2];
+    uint8_t v1_length;
 };
 
 #define STP_PROTO_REGULAR 0x00
@@ -232,9 +231,9 @@ stp_print_mstp_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu,
                     u_int length)
 {
     const u_char *ptr;
-    u_int16_t      v3len;
-    u_int16_t      len;
-    u_int16_t      msti;
+    uint16_t       v3len;
+    uint16_t       len;
+    uint16_t       msti;
     u_int          offset;
 
     ptr = (const u_char *)stp_bpdu;
@@ -369,7 +368,7 @@ stp_print(netdissect_options *ndo, const u_char *p, u_int length)
     u_int                  mstp_len;
     u_int                  spb_len;
 
-    stp_bpdu = (struct stp_bpdu_*)p;
+    stp_bpdu = (const struct stp_bpdu_*)p;
 
     /* Minimum STP Frame size. */
     if (length < 4)