X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/e2982e7f6f0b624a773ec5a58885ee80fab46d34..e65c17147a1a76ae9b0cc4feaa480fa865cb867f:/print-zephyr.c diff --git a/print-zephyr.c b/print-zephyr.c index 2addd388..d2fbf4d0 100644 --- a/print-zephyr.c +++ b/print-zephyr.c @@ -23,10 +23,10 @@ /* \summary: Zephyr printer */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif -#include +#include "netdissect-stdinc.h" #include #include @@ -119,7 +119,7 @@ z_triple(const char *class, const char *inst, const char *recipient) { if (!*recipient) recipient = "*"; - snprintf(z_buf, sizeof(z_buf), "<%s,%s,%s>", class, inst, recipient); + nd_snprintf(z_buf, sizeof(z_buf), "<%s,%s,%s>", class, inst, recipient); z_buf[sizeof(z_buf)-1] = '\0'; return z_buf; } @@ -134,7 +134,7 @@ str_to_lower(const char *string) zb_string = z_buf; while (*zb_string) { - *zb_string = tolower((unsigned char)(*zb_string)); + *zb_string = ND_TOLOWER((unsigned char)(*zb_string)); zb_string++; } @@ -144,22 +144,34 @@ str_to_lower(const char *string) void zephyr_print(netdissect_options *ndo, const u_char *cp, int length) { - struct z_packet z; + struct z_packet z = { + NULL, /* version */ + 0, /* numfields */ + 0, /* kind */ + NULL, /* uid */ + 0, /* port */ + 0, /* auth */ + 0, /* authlen */ + NULL, /* authdata */ + NULL, /* class */ + NULL, /* inst */ + NULL, /* opcode */ + NULL, /* sender */ + NULL, /* recipient */ + NULL, /* format */ + 0, /* cksum */ + 0, /* multi */ + NULL /* multi_uid */ + }; const char *parse = (const char *) cp; int parselen = length; const char *s; int lose = 0; int truncated = 0; + ndo->ndo_protocol = "zephyr"; /* squelch compiler warnings */ - z.kind = 0; - z.class = 0; - z.inst = 0; - z.opcode = 0; - z.sender = 0; - z.recipient = 0; - #define PARSE_STRING \ s = parse_field(ndo, &parse, &parselen, &truncated); \ if (truncated) goto trunc; \ @@ -331,6 +343,6 @@ zephyr_print(netdissect_options *ndo, const u_char *cp, int length) return; trunc: - ND_PRINT(" [|zephyr] (%d)", length); + nd_print_trunc(ndo); return; }