]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-rrcp.c
Use more the ND_TTEST_1() macro
[tcpdump] / print-rrcp.c
index e57be39b2f7a7be0faa07485b792a2f3246cac74..0885f64657c8ca30be51dbf403a98197d69ee228 100644 (file)
@@ -49,7 +49,6 @@
 #include "netdissect.h"
 #include "addrtoname.h"
 #include "extract.h"
-#include "ether.h"
 
 #define RRCP_OPCODE_MASK       0x7F    /* 0x00 = hello, 0x01 = get, 0x02 = set */
 #define RRCP_ISREPLY           0x80    /* 0 = request to switch, 0x80 = reply from switch */
@@ -89,7 +88,7 @@ static const struct tok opcode_values[] = {
  */
 void
 rrcp_print(netdissect_options *ndo,
-         register const u_char *cp,
+         const u_char *cp,
          u_int length _U_,
          const struct lladdr_info *src,
          const struct lladdr_info *dst)
@@ -97,9 +96,9 @@ rrcp_print(netdissect_options *ndo,
        uint8_t rrcp_proto;
        uint8_t rrcp_opcode;
 
-       ND_TCHECK(*(cp + RRCP_PROTO_OFFSET));
+       ND_TCHECK_1(cp + RRCP_PROTO_OFFSET);
        rrcp_proto = EXTRACT_U_1(cp + RRCP_PROTO_OFFSET);
-       ND_TCHECK(*(cp + RRCP_OPCODE_ISREPLY_OFFSET));
+       ND_TCHECK_1(cp + RRCP_OPCODE_ISREPLY_OFFSET);
        rrcp_opcode = EXTRACT_U_1((cp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_OPCODE_MASK;
        if (src != NULL && dst != NULL) {
                ND_PRINT((ndo, "%s > %s, ",
@@ -125,7 +124,7 @@ rrcp_print(netdissect_options *ndo,
                  EXTRACT_BE_U_2(cp + RRCP_AUTHKEY_OFFSET)));
        }
        if (rrcp_proto==1 && rrcp_opcode==0 &&
-            ((*(cp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_ISREPLY)){
+            ((EXTRACT_U_1(cp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_ISREPLY)){
            ND_TCHECK_4(cp + RRCP_VENDOR_ID_OFFSET);
            ND_PRINT((ndo, " downlink_port=%d, uplink_port=%d, uplink_mac=%s, vendor_id=%08x ,chip_id=%04x ",
                     EXTRACT_U_1(cp + RRCP_DOWNLINK_PORT_OFFSET),