]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-dtp.c
remove redundant ND_TCHECK, let GET_ routines handle checks
[tcpdump] / print-dtp.c
index 5e76e2a2a417f26efb48aa58614507ff68be1b97..4c3d6c780eac1d1fa9a2e5de730ff1825425b2c3 100644 (file)
@@ -27,7 +27,6 @@
 #include "addrtoname.h"
 #include "extract.h"
 
-static const char tstr[] = " [|dtp]";
 
 #define DTP_HEADER_LEN                 1
 #define DTP_DOMAIN_TLV                 0x0001
@@ -44,7 +43,7 @@ static const struct tok dtp_tlv_values[] = {
 };
 
 void
-dtp_print (netdissect_options *ndo, const u_char *pptr, u_int length)
+dtp_print(netdissect_options *ndo, const u_char *pptr, u_int length)
 {
     int type, len;
     const u_char *tptr;
@@ -58,7 +57,7 @@ dtp_print (netdissect_options *ndo, const u_char *pptr, u_int length)
     ND_TCHECK_LEN(tptr, DTP_HEADER_LEN);
 
     ND_PRINT("DTPv%u, length %u",
-           EXTRACT_U_1(tptr),
+           GET_U_1(tptr),
            length);
 
     /*
@@ -73,8 +72,8 @@ dtp_print (netdissect_options *ndo, const u_char *pptr, u_int length)
     while (tptr < (pptr+length)) {
 
         ND_TCHECK_4(tptr);
-       type = EXTRACT_BE_U_2(tptr);
-        len  = EXTRACT_BE_U_2(tptr + 2);
+       type = GET_BE_U_2(tptr);
+        len  = GET_BE_U_2(tptr + 2);
        /* XXX: should not be but sometimes it is, see the test captures */
         if (type == 0)
             return;
@@ -90,20 +89,20 @@ dtp_print (netdissect_options *ndo, const u_char *pptr, u_int length)
         switch (type) {
        case DTP_DOMAIN_TLV:
                ND_PRINT(", ");
-               fn_printzp(ndo, tptr+4, len-4, pptr+length);
+               nd_printzp(ndo, tptr+4, len-4, pptr+length);
                break;
 
        case DTP_STATUS_TLV:
        case DTP_DTP_TYPE_TLV:
                 if (len < 5)
                     goto invalid;
-                ND_PRINT(", 0x%x", EXTRACT_U_1(tptr + 4));
+                ND_PRINT(", 0x%x", GET_U_1(tptr + 4));
                 break;
 
        case DTP_NEIGHBOR_TLV:
                 if (len < 10)
                     goto invalid;
-                ND_PRINT(", %s", etheraddr_string(ndo, tptr+4));
+                ND_PRINT(", %s", GET_ETHERADDR_STRING(tptr+4));
                 break;
 
         default:
@@ -115,15 +114,8 @@ dtp_print (netdissect_options *ndo, const u_char *pptr, u_int length)
     return;
 
  invalid:
-    ND_PRINT("%s", istr);
+    nd_print_invalid(ndo);
     return;
  trunc:
-    ND_PRINT("%s", tstr);
+    nd_print_trunc(ndo);
 }
-
-/*
- * Local Variables:
- * c-style: whitesmith
- * c-basic-offset: 4
- * End:
- */