]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ppi.c
CI: Add warning exemptions for Sun C (suncc-5.14) on Solaris 10
[tcpdump] / print-ppi.c
index 977542650c83e9b26ad1a9a5f87138d89e9376e6..0795f276ac0a2f4df03b769620ee7d85fafa1d0a 100644 (file)
@@ -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 <config.h>
-#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 */