]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ntp.c
Use nd_ types, add EXTRACT_ calls.
[tcpdump] / print-ntp.c
index f2fbd1aa0d17a3651096701f57694591eb676b6e..c9d0a200bee2820326ee2ef368db5bf14725f366 100644 (file)
@@ -189,7 +189,7 @@ struct ntp_time_data {
 static void p_sfix(netdissect_options *ndo, const struct s_fixedpt *);
 static void p_ntp_time(netdissect_options *, const struct l_fixedpt *);
 static void p_ntp_delta(netdissect_options *, const struct l_fixedpt *, const struct l_fixedpt *);
-static void p_poll(netdissect_options *, register const int);
+static void p_poll(netdissect_options *, const int);
 
 static const struct tok ntp_mode_values[] = {
     { MODE_UNSPEC,    "unspecified" },
@@ -262,7 +262,7 @@ struct ntp_control_data {
  */
 static void
 ntp_time_print(netdissect_options *ndo,
-              register const struct ntp_time_data *bp, u_int length)
+              const struct ntp_time_data *bp, u_int length)
 {
        uint8_t stratum;
 
@@ -350,7 +350,7 @@ ntp_time_print(netdissect_options *ndo,
        } else if (length == NTP_TIMEMSG_MINLEN + 4 + 16) {     /* Optional: key-id + 128-bit digest */
                ND_TCHECK_4(bp->key_id);
                ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_BE_U_4(bp->key_id)));
-               ND_TCHECK2(bp->message_digest, 16);
+               ND_TCHECK_LEN(bp->message_digest, 16);
                 ND_PRINT((ndo, "\n\tAuthentication: %08x%08x%08x%08x",
                               EXTRACT_BE_U_4(bp->message_digest),
                               EXTRACT_BE_U_4(bp->message_digest + 4),
@@ -359,7 +359,7 @@ ntp_time_print(netdissect_options *ndo,
        } else if (length == NTP_TIMEMSG_MINLEN + 4 + 20) {     /* Optional: key-id + 160-bit digest */
                ND_TCHECK_4(bp->key_id);
                ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_BE_U_4(bp->key_id)));
-               ND_TCHECK2(bp->message_digest, 20);
+               ND_TCHECK_LEN(bp->message_digest, 20);
                ND_PRINT((ndo, "\n\tAuthentication: %08x%08x%08x%08x%08x",
                               EXTRACT_BE_U_4(bp->message_digest),
                               EXTRACT_BE_U_4(bp->message_digest + 4),
@@ -373,7 +373,7 @@ ntp_time_print(netdissect_options *ndo,
 
 invalid:
        ND_PRINT((ndo, " %s", istr));
-       ND_TCHECK2(*bp, length);
+       ND_TCHECK_LEN(bp, length);
        return;
 
 trunc:
@@ -385,9 +385,9 @@ trunc:
  */
 static void
 ntp_control_print(netdissect_options *ndo,
-                 register const struct ntp_control_data *cd, u_int length)
+                 const struct ntp_control_data *cd, u_int length)
 {
-       u_int8_t control, R, E, M, opcode;
+       uint8_t control, R, E, M, opcode;
        uint16_t sequence, status, assoc, offset, count;
 
        if (length < NTP_CTRLMSG_MINLEN)
@@ -426,14 +426,14 @@ ntp_control_print(netdissect_options *ndo,
        if (NTP_CTRLMSG_MINLEN + count > length)
                goto invalid;
        if (count != 0) {
-               ND_TCHECK2(cd->data, count);
+               ND_TCHECK_LEN(cd->data, count);
                ND_PRINT((ndo, "\n\tTO-BE-DONE: data not interpreted"));
        }
        return;
 
 invalid:
        ND_PRINT((ndo, " %s", istr));
-       ND_TCHECK2(*cd, length);
+       ND_TCHECK_LEN(cd, length);
        return;
 
 trunc:
@@ -450,9 +450,9 @@ union ntpdata {
  */
 void
 ntp_print(netdissect_options *ndo,
-          register const u_char *cp, u_int length)
+          const u_char *cp, u_int length)
 {
-       register const union ntpdata *bp = (const union ntpdata *)cp;
+       const union ntpdata *bp = (const union ntpdata *)cp;
        int mode, version, leapind;
        uint8_t status;
 
@@ -493,11 +493,11 @@ trunc:
 
 static void
 p_sfix(netdissect_options *ndo,
-       register const struct s_fixedpt *sfp)
+       const struct s_fixedpt *sfp)
 {
-       register int i;
-       register int f;
-       register double ff;
+       int i;
+       int f;
+       double ff;
 
        i = EXTRACT_BE_U_2(&sfp->int_part);
        f = EXTRACT_BE_U_2(&sfp->fraction);
@@ -510,12 +510,12 @@ p_sfix(netdissect_options *ndo,
 
 static void
 p_ntp_time(netdissect_options *ndo,
-           register const struct l_fixedpt *lfp)
+           const struct l_fixedpt *lfp)
 {
-       register uint32_t i;
-       register uint32_t uf;
-       register uint32_t f;
-       register double ff;
+       uint32_t i;
+       uint32_t uf;
+       uint32_t f;
+       double ff;
 
        i = EXTRACT_BE_U_4(&lfp->int_part);
        uf = EXTRACT_BE_U_4(&lfp->fraction);
@@ -565,14 +565,14 @@ p_ntp_time(netdissect_options *ndo,
 /* Prints time difference between *lfp and *olfp */
 static void
 p_ntp_delta(netdissect_options *ndo,
-            register const struct l_fixedpt *olfp,
-            register const struct l_fixedpt *lfp)
+            const struct l_fixedpt *olfp,
+            const struct l_fixedpt *lfp)
 {
-       register int32_t i;
-       register uint32_t u, uf;
-       register uint32_t ou, ouf;
-       register uint32_t f;
-       register double ff;
+       int32_t i;
+       uint32_t u, uf;
+       uint32_t ou, ouf;
+       uint32_t f;
+       double ff;
        int signbit;
 
        u = EXTRACT_BE_U_4(&lfp->int_part);
@@ -618,7 +618,7 @@ p_ntp_delta(netdissect_options *ndo,
 /* Prints polling interval in log2 as seconds or fraction of second */
 static void
 p_poll(netdissect_options *ndo,
-       register const int poll_interval)
+       const int poll_interval)
 {
        if (poll_interval <= -32 || poll_interval >= 32)
                return;