X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/e2982e7f6f0b624a773ec5a58885ee80fab46d34..a30de94b5c4ee52f9af98a1ed31d5c51574d8ba6:/print-zephyr.c diff --git a/print-zephyr.c b/print-zephyr.c index 2addd388..b0f8cd31 100644 --- a/print-zephyr.c +++ b/print-zephyr.c @@ -1,7 +1,7 @@ /* * Decode and print Zephyr packets. * - * http://web.mit.edu/zephyr/doc/protocol + * https://web.mit.edu/zephyr/doc/protocol * * Copyright (c) 2001 Nickolai Zeldovich * All rights reserved. @@ -23,15 +23,17 @@ /* \summary: Zephyr printer */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif -#include +#include "netdissect-stdinc.h" #include #include #include +#include "netdissect-ctype.h" + #include "netdissect.h" struct z_packet { @@ -134,7 +136,7 @@ str_to_lower(const char *string) zb_string = z_buf; while (*zb_string) { - *zb_string = tolower((unsigned char)(*zb_string)); + *zb_string = ND_ASCII_TOLOWER(*zb_string); zb_string++; } @@ -144,22 +146,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 +345,6 @@ zephyr_print(netdissect_options *ndo, const u_char *cp, int length) return; trunc: - ND_PRINT(" [|zephyr] (%d)", length); + nd_print_trunc(ndo); return; }