8 #include <tcpdump-stdinc.h>
12 #include "netdissect.h"
13 #include "interface.h"
16 typedef struct ppi_header
{
28 ppi_header_print(struct netdissect_options
*ndo
, const u_char
*bp
, u_int length
)
30 const ppi_header_t
*hdr
;
34 hdr
= (const ppi_header_t
*)bp
;
36 len
= EXTRACT_16BITS(&hdr
->ppi_len
);
37 dlt
= EXTRACT_32BITS(&hdr
->ppi_dlt
);
39 if (!ndo
->ndo_qflag
) {
40 ND_PRINT((ndo
,", V.%d DLT %s (%d) len %d", hdr
->ppi_ver
,
41 pcap_datalink_val_to_name(dlt
), dlt
,
44 ND_PRINT((ndo
,", %s", pcap_datalink_val_to_name(dlt
)));
47 ND_PRINT((ndo
, ", length %u: ", length
));
51 ppi_print(struct netdissect_options
*ndo
,
52 const struct pcap_pkthdr
*h
, const u_char
*p
)
54 if_ndo_printer ndo_printer
;
57 u_int caplen
= h
->caplen
;
58 u_int length
= h
->len
;
61 if (caplen
< sizeof(ppi_header_t
)) {
62 ND_PRINT((ndo
, "[|ppi]"));
65 hdr
= (ppi_header_t
*)p
;
66 dlt
= EXTRACT_32BITS(&hdr
->ppi_dlt
);
69 ppi_header_print(ndo
, p
, length
);
71 length
-= sizeof(ppi_header_t
);
72 caplen
-= sizeof(ppi_header_t
);
73 p
+= sizeof(ppi_header_t
);
75 if ((printer
= lookup_printer(dlt
)) != NULL
) {
77 } else if ((ndo_printer
= lookup_ndo_printer(dlt
)) != NULL
) {
78 ndo_printer(ndo
, h
, p
);
81 ppi_header_print(ndo
, (u_char
*)hdr
,
82 length
+ sizeof(ppi_header_t
));
84 if (!ndo
->ndo_suppress_default_print
)
85 ndo
->ndo_default_print(ndo
, p
, caplen
);
90 * This is the top level routine of the printer. 'p' points
91 * to the ether header of the packet, 'h->ts' is the timestamp,
92 * 'h->len' is the length of the packet off the wire, and 'h->caplen'
93 * is the number of bytes actually captured.
96 ppi_if_print(struct netdissect_options
*ndo
,
97 const struct pcap_pkthdr
*h
, const u_char
*p
)
101 return (sizeof(ppi_header_t
));
106 * c-style: whitesmith