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
;
27 hdr
= (const ppi_header_t
*)bp
;
29 len
= EXTRACT_16BITS(&hdr
->ppi_len
);
30 dlt
= EXTRACT_32BITS(&hdr
->ppi_dlt
);
32 if (!ndo
->ndo_qflag
) {
33 ND_PRINT((ndo
,", V.%d DLT %s (%d) len %d", hdr
->ppi_ver
,
34 pcap_datalink_val_to_name(dlt
), dlt
,
37 ND_PRINT((ndo
,", %s", pcap_datalink_val_to_name(dlt
)));
40 ND_PRINT((ndo
, ", length %u: ", length
));
44 ppi_print(struct netdissect_options
*ndo
,
45 const struct pcap_pkthdr
*h
, const u_char
*p
)
47 if_ndo_printer ndo_printer
;
50 u_int caplen
= h
->caplen
;
51 u_int length
= h
->len
;
54 if (caplen
< sizeof(ppi_header_t
)) {
55 ND_PRINT((ndo
, "[|ppi]"));
58 hdr
= (ppi_header_t
*)p
;
59 dlt
= EXTRACT_32BITS(&hdr
->ppi_dlt
);
62 ppi_header_print(ndo
, p
, length
);
64 length
-= sizeof(ppi_header_t
);
65 caplen
-= sizeof(ppi_header_t
);
66 p
+= sizeof(ppi_header_t
);
68 if ((printer
= lookup_printer(dlt
)) != NULL
) {
70 } else if ((ndo_printer
= lookup_ndo_printer(dlt
)) != NULL
) {
71 ndo_printer(ndo
, h
, p
);
74 ppi_header_print(ndo
, (u_char
*)hdr
,
75 length
+ sizeof(ppi_header_t
));
77 if (!ndo
->ndo_suppress_default_print
)
78 ndo
->ndo_default_print(ndo
, p
, caplen
);
83 * This is the top level routine of the printer. 'p' points
84 * to the ether header of the packet, 'h->ts' is the timestamp,
85 * 'h->len' is the length of the packet off the wire, and 'h->caplen'
86 * is the number of bytes actually captured.
89 ppi_if_print(struct netdissect_options
*ndo
,
90 const struct pcap_pkthdr
*h
, const u_char
*p
)
94 return (sizeof(ppi_header_t
));