]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-rrcp.c
Default to first interface from pcap_findalldevs()
[tcpdump] / print-rrcp.c
index 82d0788a3b90d4c6b67ac75e5bcda4ec3ed81339..315514752624fc75635c86aaa7edddce1246f685 100644 (file)
  * and Realtek Echo Protocol (RRCP-REP) packets.
  */
 
  * and Realtek Echo Protocol (RRCP-REP) packets.
  */
 
-#define NETDISSECT_REWORKED
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
 
 
-#include "interface.h"
+#include "netdissect.h"
 #include "addrtoname.h"
 #include "extract.h"
 #include "ether.h"
 #include "addrtoname.h"
 #include "extract.h"
 #include "ether.h"
@@ -75,11 +74,9 @@ rrcp_print(netdissect_options *ndo,
          u_int length _U_)
 {
        const u_char *rrcp;
          u_int length _U_)
 {
        const u_char *rrcp;
-       u_int8_t rrcp_proto;
-       u_int8_t rrcp_opcode;
+       uint8_t rrcp_proto;
+       uint8_t rrcp_opcode;
        register const struct ether_header *ep;
        register const struct ether_header *ep;
-       char proto_str[16];
-       char opcode_str[32];
 
        ep = (const struct ether_header *)cp;
        rrcp = cp + ETHER_HDRLEN;
 
        ep = (const struct ether_header *)cp;
        rrcp = cp + ETHER_HDRLEN;
@@ -89,13 +86,13 @@ rrcp_print(netdissect_options *ndo,
        ND_TCHECK(*(rrcp + RRCP_OPCODE_ISREPLY_OFFSET));
        rrcp_opcode = (*(rrcp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_OPCODE_MASK;
         ND_PRINT((ndo, "%s > %s, %s %s",
        ND_TCHECK(*(rrcp + RRCP_OPCODE_ISREPLY_OFFSET));
        rrcp_opcode = (*(rrcp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_OPCODE_MASK;
         ND_PRINT((ndo, "%s > %s, %s %s",
-               etheraddr_string(ESRC(ep)),
-               etheraddr_string(EDST(ep)),
-               tok2strbuf(proto_values,"RRCP-0x%02x",rrcp_proto,proto_str,sizeof(proto_str)),
+               etheraddr_string(ndo, ESRC(ep)),
+               etheraddr_string(ndo, EDST(ep)),
+               tok2str(proto_values,"RRCP-0x%02x",rrcp_proto),
                ((*(rrcp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_ISREPLY) ? "reply" : "query"));
        if (rrcp_proto==1){
            ND_PRINT((ndo, ": %s",
                ((*(rrcp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_ISREPLY) ? "reply" : "query"));
        if (rrcp_proto==1){
            ND_PRINT((ndo, ": %s",
-                    tok2strbuf(opcode_values,"unknown opcode (0x%02x)",rrcp_opcode,opcode_str,sizeof(opcode_str))));
+                    tok2str(opcode_values,"unknown opcode (0x%02x)",rrcp_opcode)));
        }
        if (rrcp_opcode==1 || rrcp_opcode==2){
            ND_TCHECK2(*(rrcp + RRCP_REG_ADDR_OFFSET), 6);
        }
        if (rrcp_opcode==1 || rrcp_opcode==2){
            ND_TCHECK2(*(rrcp + RRCP_REG_ADDR_OFFSET), 6);
@@ -114,7 +111,7 @@ rrcp_print(netdissect_options *ndo,
            ND_PRINT((ndo, " downlink_port=%d, uplink_port=%d, uplink_mac=%s, vendor_id=%08x ,chip_id=%04x ",
                     *(rrcp + RRCP_DOWNLINK_PORT_OFFSET),
                     *(rrcp + RRCP_UPLINK_PORT_OFFSET),
            ND_PRINT((ndo, " downlink_port=%d, uplink_port=%d, uplink_mac=%s, vendor_id=%08x ,chip_id=%04x ",
                     *(rrcp + RRCP_DOWNLINK_PORT_OFFSET),
                     *(rrcp + RRCP_UPLINK_PORT_OFFSET),
-                    etheraddr_string(rrcp + RRCP_UPLINK_MAC_OFFSET),
+                    etheraddr_string(ndo, rrcp + RRCP_UPLINK_MAC_OFFSET),
                     EXTRACT_32BITS(rrcp + RRCP_VENDOR_ID_OFFSET),
                     EXTRACT_16BITS(rrcp + RRCP_CHIP_ID_OFFSET)));
        }else if (rrcp_opcode==1 || rrcp_opcode==2 || rrcp_proto==2){
                     EXTRACT_32BITS(rrcp + RRCP_VENDOR_ID_OFFSET),
                     EXTRACT_16BITS(rrcp + RRCP_CHIP_ID_OFFSET)));
        }else if (rrcp_opcode==1 || rrcp_opcode==2 || rrcp_proto==2){