/* * This is the top level routine of the printer. 'p' points * to the SunATM pseudo-header for 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 sunatm_if_print(const struct pcap_pkthdr *h, const u_char *p) { u_int caplen = h->caplen; u_int length = h->len; u_short vci; u_char vpi; u_int traftype; if (caplen < PKT_BEGIN_POS) { printf("[|atm]"); return (caplen); } if (eflag) { if (p[DIR_POS] & 0x80) printf("Tx: "); else printf("Rx: "); } switch (p[DIR_POS] & 0x0f) { case PT_LANE: traftype = ATM_LANE; break; case PT_LLC: traftype = ATM_LLC; break; default: traftype = ATM_UNKNOWN; break; } vci = EXTRACT_16BITS(&p[VCI_POS]); vpi = p[VPI_POS]; p += PKT_BEGIN_POS; caplen -= PKT_BEGIN_POS; length -= PKT_BEGIN_POS; atm_print(vpi, vci, traftype, p, length, caplen); return (PKT_BEGIN_POS); }
/* * This is the top level routine of the printer. 'p' points * to the SunATM pseudo-header for 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 sunatm_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { u_int caplen = h->caplen; u_int length = h->len; u_short vci; u_char vpi; u_int traftype; if (caplen < PKT_BEGIN_POS) { ND_PRINT((ndo, "[|atm]")); return (caplen); } if (ndo->ndo_eflag) { ND_PRINT((ndo, p[DIR_POS] & 0x80 ? "Tx: " : "Rx: ")); } switch (p[DIR_POS] & 0x0f) { case PT_LANE: traftype = ATM_LANE; break; case PT_LLC: traftype = ATM_LLC; break; default: traftype = ATM_UNKNOWN; break; } vci = EXTRACT_16BITS(&p[VCI_POS]); vpi = p[VPI_POS]; p += PKT_BEGIN_POS; caplen -= PKT_BEGIN_POS; length -= PKT_BEGIN_POS; atm_print(ndo, vpi, vci, traftype, p, length, caplen); return (PKT_BEGIN_POS); }