2011-05-04 06:58:32 +08:00
|
|
|
/*
|
|
|
|
* Oracle
|
|
|
|
*/
|
2014-03-15 18:19:49 +08:00
|
|
|
#define NETDISSECT_REWORKED
|
2011-05-04 06:58:32 +08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <tcpdump-stdinc.h>
|
|
|
|
|
|
|
|
#include "interface.h"
|
|
|
|
#include "extract.h"
|
2013-12-31 14:52:15 +08:00
|
|
|
|
|
|
|
typedef struct ppi_header {
|
|
|
|
uint8_t ppi_ver;
|
|
|
|
uint8_t ppi_flags;
|
|
|
|
uint16_t ppi_len;
|
|
|
|
uint32_t ppi_dlt;
|
|
|
|
} ppi_header_t;
|
|
|
|
|
|
|
|
#define PPI_HDRLEN 8
|
2011-05-04 06:58:32 +08:00
|
|
|
|
|
|
|
#ifdef DLT_PPI
|
|
|
|
|
|
|
|
static inline void
|
2014-04-04 15:43:46 +08:00
|
|
|
ppi_header_print(netdissect_options *ndo, const u_char *bp, u_int length)
|
2011-05-04 06:58:32 +08:00
|
|
|
{
|
|
|
|
const ppi_header_t *hdr;
|
2014-04-23 15:20:40 +08:00
|
|
|
uint16_t len;
|
2014-09-24 07:08:42 +08:00
|
|
|
uint32_t dlt;
|
2011-05-04 06:58:32 +08:00
|
|
|
|
2011-08-15 06:29:49 +08:00
|
|
|
hdr = (const ppi_header_t *)bp;
|
|
|
|
|
2014-04-27 06:39:06 +08:00
|
|
|
len = EXTRACT_LE_16BITS(&hdr->ppi_len);
|
|
|
|
dlt = EXTRACT_LE_32BITS(&hdr->ppi_dlt);
|
2011-05-04 06:58:32 +08:00
|
|
|
|
|
|
|
if (!ndo->ndo_qflag) {
|
2014-09-24 07:08:42 +08:00
|
|
|
ND_PRINT((ndo, "V.%d DLT %s (%d) len %d", hdr->ppi_ver,
|
2011-05-04 06:58:32 +08:00
|
|
|
pcap_datalink_val_to_name(dlt), dlt,
|
|
|
|
len));
|
|
|
|
} else {
|
2014-09-24 07:08:42 +08:00
|
|
|
ND_PRINT((ndo, "%s", pcap_datalink_val_to_name(dlt)));
|
2011-05-04 06:58:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
ND_PRINT((ndo, ", length %u: ", length));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-04-04 15:43:46 +08:00
|
|
|
ppi_print(netdissect_options *ndo,
|
2011-05-04 06:58:32 +08:00
|
|
|
const struct pcap_pkthdr *h, const u_char *p)
|
|
|
|
{
|
2015-03-11 04:25:52 +08:00
|
|
|
if_printer printer;
|
2011-05-04 06:58:32 +08:00
|
|
|
ppi_header_t *hdr;
|
|
|
|
u_int caplen = h->caplen;
|
|
|
|
u_int length = h->len;
|
2014-09-24 07:08:42 +08:00
|
|
|
uint16_t len;
|
2014-04-23 15:20:40 +08:00
|
|
|
uint32_t dlt;
|
2011-05-04 06:58:32 +08:00
|
|
|
|
|
|
|
if (caplen < sizeof(ppi_header_t)) {
|
|
|
|
ND_PRINT((ndo, "[|ppi]"));
|
|
|
|
return;
|
|
|
|
}
|
2014-09-24 07:08:42 +08:00
|
|
|
|
2011-05-04 06:58:32 +08:00
|
|
|
hdr = (ppi_header_t *)p;
|
2014-09-24 07:08:42 +08:00
|
|
|
len = EXTRACT_LE_16BITS(&hdr->ppi_len);
|
|
|
|
if (len < sizeof(ppi_header_t)) {
|
|
|
|
ND_PRINT((ndo, "[|ppi]"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (caplen < len) {
|
|
|
|
ND_PRINT((ndo, "[|ppi]"));
|
|
|
|
return;
|
|
|
|
}
|
2014-04-27 06:39:06 +08:00
|
|
|
dlt = EXTRACT_LE_32BITS(&hdr->ppi_dlt);
|
2011-05-04 06:58:32 +08:00
|
|
|
|
|
|
|
if (ndo->ndo_eflag)
|
|
|
|
ppi_header_print(ndo, p, length);
|
|
|
|
|
2014-09-24 07:08:42 +08:00
|
|
|
length -= len;
|
|
|
|
caplen -= len;
|
|
|
|
p += len;
|
2011-05-04 06:58:32 +08:00
|
|
|
|
|
|
|
if ((printer = lookup_printer(dlt)) != NULL) {
|
2015-03-11 04:25:52 +08:00
|
|
|
printer(ndo, h, p);
|
2011-05-04 06:58:32 +08:00
|
|
|
} else {
|
|
|
|
if (!ndo->ndo_eflag)
|
2014-09-24 07:08:42 +08:00
|
|
|
ppi_header_print(ndo, (u_char *)hdr, length + len);
|
2011-05-04 06:58:32 +08:00
|
|
|
|
|
|
|
if (!ndo->ndo_suppress_default_print)
|
2014-03-26 22:52:40 +08:00
|
|
|
ND_DEFAULTPRINT(p, caplen);
|
2011-05-04 06:58:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is the top level routine of the printer. 'p' points
|
|
|
|
* to the ether header of the packet, 'h->ts' is the timestamp,
|
|
|
|
* 'h->len' is the length of the packet off the wire, and 'h->caplen'
|
|
|
|
* is the number of bytes actually captured.
|
|
|
|
*/
|
|
|
|
u_int
|
2014-04-04 15:43:46 +08:00
|
|
|
ppi_if_print(netdissect_options *ndo,
|
2011-05-04 06:58:32 +08:00
|
|
|
const struct pcap_pkthdr *h, const u_char *p)
|
|
|
|
{
|
|
|
|
ppi_print(ndo, h, p);
|
|
|
|
|
|
|
|
return (sizeof(ppi_header_t));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local Variables:
|
|
|
|
* c-style: whitesmith
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* End:
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endif /* DLT_PPI */
|