#include "netdissect-ctype.h"
#include "netdissect.h"
+#include "extract.h"
struct z_packet {
const char *version;
static char z_buf[256];
static const char *
-parse_field(netdissect_options *ndo, const char **pptr, int *len, int *truncated)
+parse_field(netdissect_options *ndo, const char **pptr, int *len)
{
const char *s;
/* Ran out of packet data without finding it */
return NULL;
}
- if (!ND_TTEST_SIZE(*pptr)) {
- /* Ran out of captured data without finding it */
- *truncated = 1;
- return NULL;
- }
- if (**pptr == '\0') {
+ if (GET_U_1(*pptr) == '\0') {
/* Found it */
break;
}
int parselen = length;
const char *s;
int lose = 0;
- int truncated = 0;
ndo->ndo_protocol = "zephyr";
/* squelch compiler warnings */
#define PARSE_STRING \
- s = parse_field(ndo, &parse, &parselen, &truncated); \
- if (truncated) goto trunc; \
+ s = parse_field(ndo, &parse, &parselen); \
if (!s) lose = 1;
#define PARSE_FIELD_INT(field) \
if (!lose) field = s;
PARSE_FIELD_STR(z.version);
- if (lose) return;
+ if (lose)
+ goto invalid;
+
if (strncmp(z.version, "ZEPH", 4))
return;
PARSE_FIELD_STR(z.multi_uid);
if (lose)
- goto trunc;
+ goto invalid;
ND_PRINT(" zephyr");
if (strncmp(z.version+4, "0.2", 3)) {
ND_PRINT(" op %s", z.opcode);
return;
-trunc:
- nd_print_trunc(ndo);
+invalid:
+ nd_print_invalid(ndo);
}
1 00:00:00.000000 00:16:ca:92:12:01 > 00:15:e8:97:b2:01, ethertype IPv4 (0x0800), length 65535: (tos 0x0, ttl 124, id 16059, offset 0, flags [none], proto UDP (17), length 65521)
- 167.155.6.190.2104 > 167.155.9.153.514: [udp sum ok]
+ 167.155.6.190.2104 > 167.155.9.153.514: [udp sum ok] (invalid)