]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-tftp.c
Use nd_ types, add EXTRACT_ calls.
[tcpdump] / print-tftp.c
index a47a78474eadd8d7038ea3a97d8b1971f06c53b2..e0bedc3918b7202b0b07e0a54a37d8b4b5d98078 100644 (file)
@@ -89,10 +89,10 @@ static const struct tok err2str[] = {
  */
 void
 tftp_print(netdissect_options *ndo,
-           register const u_char *bp, u_int length)
+           const u_char *bp, u_int length)
 {
-       register const char *cp;
-       register int opcode;
+       const char *cp;
+       int opcode;
        u_int ui;
 
        /* Print length */
@@ -102,7 +102,7 @@ tftp_print(netdissect_options *ndo,
        if (length < 2)
                goto trunc;
        ND_TCHECK_2(bp);
-       opcode = EXTRACT_BE_16BITS(bp);
+       opcode = EXTRACT_BE_U_2(bp);
        cp = tok2str(op2str, "tftp-#%d", opcode);
        ND_PRINT((ndo, " %s", cp));
        /* Bail if bogus opcode */
@@ -139,8 +139,8 @@ tftp_print(netdissect_options *ndo,
 
                /* Print options, if any */
                while (length != 0) {
-                       ND_TCHECK(*bp);
-                       if (*bp != '\0')
+                       ND_TCHECK_1(bp);
+                       if (EXTRACT_U_1(bp) != '\0')
                                ND_PRINT((ndo, " "));
                        ui = fn_printztn(ndo, bp, length, ndo->ndo_snapend);
                        if (ui == 0)
@@ -153,8 +153,8 @@ tftp_print(netdissect_options *ndo,
        case OACK:
                /* Print options */
                while (length != 0) {
-                       ND_TCHECK(*bp);
-                       if (*bp != '\0')
+                       ND_TCHECK_1(bp);
+                       if (EXTRACT_U_1(bp) != '\0')
                                ND_PRINT((ndo, " "));
                        ui = fn_printztn(ndo, bp, length, ndo->ndo_snapend);
                        if (ui == 0)
@@ -169,7 +169,7 @@ tftp_print(netdissect_options *ndo,
                if (length < 2)
                        goto trunc;     /* no block number */
                ND_TCHECK_2(bp);
-               ND_PRINT((ndo, " block %d", EXTRACT_BE_16BITS(bp)));
+               ND_PRINT((ndo, " block %d", EXTRACT_BE_U_2(bp)));
                break;
 
        case TFTP_ERROR:
@@ -178,7 +178,7 @@ tftp_print(netdissect_options *ndo,
                        goto trunc;     /* no error code */
                ND_TCHECK_2(bp);
                ND_PRINT((ndo, " %s", tok2str(err2str, "tftp-err-#%d \"",
-                                      EXTRACT_BE_16BITS(bp))));
+                                      EXTRACT_BE_U_2(bp))));
                bp += 2;
                length -= 2;
                /* Print error message string */