]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ntp.c
Fix the pointer tests in the non-ndoified TTEST2() macro as well.
[tcpdump] / print-ntp.c
index 367d9fe5148957ecb3bd86ca4826e3c3e83ee846..e83d47a7dd58db4b0d478a47398f1d8f22865d27 100644 (file)
  *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 */
 struct l_fixedpt {
-       u_int32_t int_part;
-       u_int32_t fraction;
+       uint32_t int_part;
+       uint32_t fraction;
 };
 
 struct s_fixedpt {
-       u_int16_t int_part;
-       u_int16_t fraction;
+       uint16_t int_part;
+       uint16_t fraction;
 };
 
 /* rfc2030
@@ -120,13 +120,13 @@ struct ntpdata {
        int precision:8;
        struct s_fixedpt root_delay;
        struct s_fixedpt root_dispersion;
-       u_int32_t refid;
+       uint32_t refid;
        struct l_fixedpt ref_timestamp;
        struct l_fixedpt org_timestamp;
        struct l_fixedpt rec_timestamp;
        struct l_fixedpt xmt_timestamp;
-        u_int32_t key_id;
-        u_int8_t  message_digest[16];
+        uint32_t key_id;
+        uint8_t  message_digest[16];
 };
 /*
  *     Leap Second Codes (high order two bits)
@@ -215,21 +215,21 @@ ntp_print(netdissect_options *ndo,
        ND_PRINT((ndo, "NTPv%d", version));
 
        mode = bp->status & MODEMASK;
-        if (!ndo->ndo_vflag) {
-            printf (", %s, length %u",
-                    tok2str(ntp_mode_values, "Unknown mode", mode),
-                    length);
-            return;
-        }
+       if (!ndo->ndo_vflag) {
+               ND_PRINT((ndo, ", %s, length %u",
+                         tok2str(ntp_mode_values, "Unknown mode", mode),
+                         length));
+               return;
+       }
 
-        printf (", length %u\n\t%s",
-                length,
-                tok2str(ntp_mode_values, "Unknown mode", mode));
+       ND_PRINT((ndo, ", length %u\n\t%s",
+                 length,
+                 tok2str(ntp_mode_values, "Unknown mode", mode)));
 
        leapind = bp->status & LEAPMASK;
-        printf (", Leap indicator: %s (%u)",
-                tok2str(ntp_leapind_values, "Unknown", leapind),
-                leapind);
+       ND_PRINT((ndo, ", Leap indicator: %s (%u)",
+                 tok2str(ntp_leapind_values, "Unknown", leapind),
+                 leapind));
 
        ND_TCHECK(bp->stratum);
        ND_PRINT((ndo, ", Stratum %u (%s)",
@@ -261,22 +261,22 @@ ntp_print(netdissect_options *ndo,
                break;
 
        case PRIM_REF:
-               if (fn_printn((u_char *)&(bp->refid), 4, ndo->ndo_snapend))
+               if (fn_printn(ndo, (u_char *)&(bp->refid), 4, ndo->ndo_snapend))
                        goto trunc;
                break;
 
        case INFO_QUERY:
-               ND_PRINT((ndo, "%s INFO_QUERY", ipaddr_string(&(bp->refid))));
+               ND_PRINT((ndo, "%s INFO_QUERY", ipaddr_string(ndo, &(bp->refid))));
                /* this doesn't have more content */
                return;
 
        case INFO_REPLY:
-               ND_PRINT((ndo, "%s INFO_REPLY", ipaddr_string(&(bp->refid))));
+               ND_PRINT((ndo, "%s INFO_REPLY", ipaddr_string(ndo, &(bp->refid))));
                /* this is too complex to be worth printing */
                return;
 
        default:
-               ND_PRINT((ndo, "%s", ipaddr_string(&(bp->refid))));
+               ND_PRINT((ndo, "%s", ipaddr_string(ndo, &(bp->refid))));
                break;
        }
 
@@ -343,8 +343,8 @@ p_ntp_time(netdissect_options *ndo,
            register const struct l_fixedpt *lfp)
 {
        register int32_t i;
-       register u_int32_t uf;
-       register u_int32_t f;
+       register uint32_t uf;
+       register uint32_t f;
        register float ff;
 
        i = EXTRACT_32BITS(&lfp->int_part);
@@ -367,7 +367,7 @@ p_ntp_time(netdissect_options *ndo,
 
            tm = localtime(&seconds);
            strftime(time_buf, sizeof (time_buf), "%Y/%m/%d %H:%M:%S", tm);
-           printf (" (%s)", time_buf);
+           ND_PRINT((ndo, " (%s)", time_buf));
        }
 #endif
 }
@@ -379,9 +379,9 @@ p_ntp_delta(netdissect_options *ndo,
             register const struct l_fixedpt *lfp)
 {
        register int32_t i;
-       register u_int32_t u, uf;
-       register u_int32_t ou, ouf;
-       register u_int32_t f;
+       register uint32_t u, uf;
+       register uint32_t ou, ouf;
+       register uint32_t f;
        register float ff;
        int signbit;