]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ppi.c
the failed/passed count was not kept in the right place
[tcpdump] / print-ppi.c
index c4505c47d730f1d01a7bb8aef68fb4c8bfd01d47..8f47fcfcd7848cc337e1f3fc44749a326f6c165f 100644 (file)
@@ -13,7 +13,6 @@
 #include "netdissect.h"
 #include "extract.h"
 
-static const char tstr[] = "[|ppi]";
 
 typedef struct ppi_header {
        nd_uint8_t      ppi_ver;
@@ -26,7 +25,7 @@ typedef struct ppi_header {
 
 #ifdef DLT_PPI
 
-static inline void
+static void
 ppi_header_print(netdissect_options *ndo, const u_char *bp, u_int length)
 {
        const ppi_header_t *hdr;
@@ -36,12 +35,12 @@ ppi_header_print(netdissect_options *ndo, const u_char *bp, u_int length)
 
        hdr = (const ppi_header_t *)bp;
 
-       len = EXTRACT_LE_U_2(hdr->ppi_len);
-       dlt = EXTRACT_LE_U_4(hdr->ppi_dlt);
+       len = GET_LE_U_2(hdr->ppi_len);
+       dlt = GET_LE_U_4(hdr->ppi_dlt);
        dltname = pcap_datalink_val_to_name(dlt);
 
        if (!ndo->ndo_qflag) {
-               ND_PRINT("V.%u DLT %s (%u) len %u", EXTRACT_U_1(hdr->ppi_ver),
+               ND_PRINT("V.%u DLT %s (%u) len %u", GET_U_1(hdr->ppi_ver),
                          (dltname != NULL ? dltname : "UNKNOWN"), dlt,
                           len);
         } else {
@@ -64,28 +63,29 @@ ppi_print(netdissect_options *ndo,
        uint32_t hdrlen;
        struct pcap_pkthdr nhdr;
 
+       ndo->ndo_protocol = "ppi";
        if (caplen < sizeof(ppi_header_t)) {
-               ND_PRINT(" %s", tstr);
+               nd_print_trunc(ndo);
                return (caplen);
        }
 
        hdr = (const ppi_header_t *)p;
        ND_TCHECK_2(hdr->ppi_len);
-       len = EXTRACT_LE_U_2(hdr->ppi_len);
+       len = GET_LE_U_2(hdr->ppi_len);
        if (caplen < len) {
                /*
                 * If we don't have the entire PPI header, don't
                 * bother.
                 */
-               ND_PRINT(" %s", tstr);
+               nd_print_trunc(ndo);
                return (caplen);
        }
        if (len < sizeof(ppi_header_t)) {
-               ND_PRINT(" %s", tstr);
+               nd_print_trunc(ndo);
                return (len);
        }
        ND_TCHECK_4(hdr->ppi_dlt);
-       dlt = EXTRACT_LE_U_4(hdr->ppi_dlt);
+       dlt = GET_LE_U_4(hdr->ppi_dlt);
 
        if (ndo->ndo_eflag)
                ppi_header_print(ndo, p, length);
@@ -122,14 +122,7 @@ u_int
 ppi_if_print(netdissect_options *ndo,
             const struct pcap_pkthdr *h, const u_char *p)
 {
+       ndo->ndo_protocol = "ppi_if";
        return (ppi_print(ndo, h, p));
 }
-
-/*
- * Local Variables:
- * c-style: whitesmith
- * c-basic-offset: 8
- * End:
- */
-
 #endif /* DLT_PPI */