X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/7885cfa165458a05ef818c34ee03affc79f03725..HEAD:/print-ppi.c diff --git a/print-ppi.c b/print-ppi.c index 97754265..0795f276 100644 --- a/print-ppi.c +++ b/print-ppi.c @@ -9,9 +9,7 @@ * https://web.archive.org/web/20160328114748/http://www.cacetech.com/documents/PPI%20Header%20format%201.0.7.pdf */ -#ifdef HAVE_CONFIG_H #include -#endif #include "netdissect-stdinc.h" @@ -67,7 +65,7 @@ void ppi_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { - if_printer_t printer; + if_printer printer; const ppi_header_t *hdr; u_int caplen = h->caplen; u_int length = h->len; @@ -79,7 +77,7 @@ ppi_if_print(netdissect_options *ndo, ndo->ndo_protocol = "ppi"; if (caplen < sizeof(ppi_header_t)) { nd_print_trunc(ndo); - ndo->ndo_ll_header_length += caplen; + ndo->ndo_ll_hdr_len += caplen; return; } @@ -90,7 +88,7 @@ ppi_if_print(netdissect_options *ndo, ND_PRINT(" [length %u < %zu or > 65532]", len, sizeof(ppi_header_t)); nd_print_invalid(ndo); - ndo->ndo_ll_header_length += caplen; + ndo->ndo_ll_hdr_len += caplen; return; } if (caplen < len) { @@ -99,7 +97,7 @@ ppi_if_print(netdissect_options *ndo, * bother. */ nd_print_trunc(ndo); - ndo->ndo_ll_header_length += caplen; + ndo->ndo_ll_hdr_len += caplen; return; } dlt = GET_LE_U_4(hdr->ppi_dlt); @@ -111,16 +109,13 @@ ppi_if_print(netdissect_options *ndo, caplen -= len; p += len; - printer = lookup_printer(ndo, dlt); - if (printer.printer != NULL) { + printer = lookup_printer(dlt); + if (printer != NULL) { nhdr = *h; nhdr.caplen = caplen; nhdr.len = length; - if (ndo->ndo_void_printer == TRUE) { - printer.void_printer(ndo, &nhdr, p); - hdrlen = ndo->ndo_ll_header_length; - } else - hdrlen = printer.uint_printer(ndo, &nhdr, p); + printer(ndo, &nhdr, p); + hdrlen = ndo->ndo_ll_hdr_len; } else { if (!ndo->ndo_eflag) ppi_header_print(ndo, (const u_char *)hdr, length + len); @@ -129,7 +124,6 @@ ppi_if_print(netdissect_options *ndo, ND_DEFAULTPRINT(p, caplen); hdrlen = 0; } - ndo->ndo_ll_header_length += len + hdrlen; - return; + ndo->ndo_ll_hdr_len += len + hdrlen; } #endif /* DLT_PPI */