5 /* \summary: Oracle DLT_PPI printer */
11 #include <netdissect-stdinc.h>
13 #include "netdissect.h"
16 typedef struct ppi_header
{
28 ppi_header_print(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_LE_16BITS(&hdr
->ppi_len
);
37 dlt
= EXTRACT_LE_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(netdissect_options
*ndo
,
52 const struct pcap_pkthdr
*h
, const u_char
*p
)
55 const ppi_header_t
*hdr
;
56 u_int caplen
= h
->caplen
;
57 u_int length
= h
->len
;
61 struct pcap_pkthdr nhdr
;
63 if (caplen
< sizeof(ppi_header_t
)) {
64 ND_PRINT((ndo
, "[|ppi]"));
68 hdr
= (const ppi_header_t
*)p
;
69 len
= EXTRACT_LE_16BITS(&hdr
->ppi_len
);
72 * If we don't have the entire PPI header, don't
75 ND_PRINT((ndo
, "[|ppi]"));
78 if (len
< sizeof(ppi_header_t
)) {
79 ND_PRINT((ndo
, "[|ppi]"));
82 dlt
= EXTRACT_LE_32BITS(&hdr
->ppi_dlt
);
85 ppi_header_print(ndo
, p
, length
);
91 if ((printer
= lookup_printer(dlt
)) != NULL
) {
95 hdrlen
= printer(ndo
, &nhdr
, p
);
98 ppi_header_print(ndo
, (const u_char
*)hdr
, length
+ len
);
100 if (!ndo
->ndo_suppress_default_print
)
101 ND_DEFAULTPRINT(p
, caplen
);
104 return (len
+ hdrlen
);
108 * This is the top level routine of the printer. 'p' points
109 * to the ether header of the packet, 'h->ts' is the timestamp,
110 * 'h->len' is the length of the packet off the wire, and 'h->caplen'
111 * is the number of bytes actually captured.
114 ppi_if_print(netdissect_options
*ndo
,
115 const struct pcap_pkthdr
*h
, const u_char
*p
)
117 return (ppi_print(ndo
, h
, p
));
122 * c-style: whitesmith