8 #include <tcpdump-stdinc.h>
13 #include "netdissect.h"
14 #include "interface.h"
21 ppi_header_print(struct netdissect_options
*ndo
, const u_char
*bp
, u_int length
)
23 const ppi_header_t
*hdr
;
24 hdr
= (const ppi_header_t
*)bp
;
28 len
= EXTRACT_16BITS(&hdr
->ppi_len
);
29 dlt
= EXTRACT_32BITS(&hdr
->ppi_dlt
);
31 if (!ndo
->ndo_qflag
) {
32 ND_PRINT((ndo
,", V.%d DLT %s (%d) len %d", hdr
->ppi_ver
,
33 pcap_datalink_val_to_name(dlt
), dlt
,
36 ND_PRINT((ndo
,", %s", pcap_datalink_val_to_name(dlt
)));
39 ND_PRINT((ndo
, ", length %u: ", length
));
43 ppi_print(struct netdissect_options
*ndo
,
44 const struct pcap_pkthdr
*h
, const u_char
*p
)
46 if_ndo_printer ndo_printer
;
49 u_int caplen
= h
->caplen
;
50 u_int length
= h
->len
;
53 if (caplen
< sizeof(ppi_header_t
)) {
54 ND_PRINT((ndo
, "[|ppi]"));
57 hdr
= (ppi_header_t
*)p
;
58 dlt
= EXTRACT_32BITS(&hdr
->ppi_dlt
);
61 ppi_header_print(ndo
, p
, length
);
63 length
-= sizeof(ppi_header_t
);
64 caplen
-= sizeof(ppi_header_t
);
65 p
+= sizeof(ppi_header_t
);
67 if ((printer
= lookup_printer(dlt
)) != NULL
) {
69 } else if ((ndo_printer
= lookup_ndo_printer(dlt
)) != NULL
) {
70 ndo_printer(ndo
, h
, p
);
73 ppi_header_print(ndo
, (u_char
*)hdr
,
74 length
+ sizeof(ppi_header_t
));
76 if (!ndo
->ndo_suppress_default_print
)
77 ndo
->ndo_default_print(ndo
, p
, caplen
);
82 * This is the top level routine of the printer. 'p' points
83 * to the ether header of the packet, 'h->ts' is the timestamp,
84 * 'h->len' is the length of the packet off the wire, and 'h->caplen'
85 * is the number of bytes actually captured.
88 ppi_if_print(struct netdissect_options
*ndo
,
89 const struct pcap_pkthdr
*h
, const u_char
*p
)
93 return (sizeof(ppi_header_t
));