/* specification: http://docs.freebsd.org/44doc/smm/12.timed/paper.pdf */
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
#include "netdissect-stdinc.h"
struct tsp_timeval tspu_time;
nd_int8_t tspu_hopcnt;
} tsp_u;
- nd_byte tsp_name[256];
+ nd_byte tsp_name[256]; /* null-terminated string up to 256 */
};
#define tsp_time tsp_u.tspu_time
#define TSPTYPENUMBER 25
-static const char tstr[] = "[|timed]";
static const char *tsptype[TSPTYPENUMBER] =
{ "ANY", "ADJTIME", "ACK", "MASTERREQ", "MASTERACK", "SETTIME", "MASTERUP",
uint8_t tsp_type;
int sec, usec;
+ ndo->ndo_protocol = "timed";
ND_TCHECK_1(tsp->tsp_type);
tsp_type = EXTRACT_U_1(tsp->tsp_type);
if (tsp_type < TSPTYPENUMBER)
case TSP_ADJTIME:
case TSP_SETDATE:
case TSP_SETDATEREQ:
- ND_TCHECK(tsp->tsp_time);
+ ND_TCHECK_8(&tsp->tsp_time);
sec = EXTRACT_BE_S_4(tsp->tsp_time.tv_sec);
usec = EXTRACT_BE_S_4(tsp->tsp_time.tv_usec);
/* XXX The comparison below is always false? */
break;
}
ND_PRINT(" name ");
- if (fn_print(ndo, (const u_char *)tsp->tsp_name, (const u_char *)tsp->tsp_name + sizeof(tsp->tsp_name)))
+ if (nd_printzp(ndo, tsp->tsp_name, sizeof(tsp->tsp_name),
+ ndo->ndo_snapend))
goto trunc;
return;
trunc:
- ND_PRINT(" %s", tstr);
+ nd_print_trunc(ndo);
}