X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/90692fcf9745a67fff68350b88acd56e4ddcb23b..refs/pull/1034/head:/print-sunatm.c diff --git a/print-sunatm.c b/print-sunatm.c index fc03d42a..0fe5eee8 100644 --- a/print-sunatm.c +++ b/print-sunatm.c @@ -30,17 +30,16 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#define NETDISSECT_REWORKED +/* \summary: SunATM DLPI capture printer */ + #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif -#include - -struct mbuf; -struct rtentry; +#include "netdissect-stdinc.h" -#include "interface.h" +#define ND_LONGJMP_FROM_TCHECK +#include "netdissect.h" #include "extract.h" #include "atm.h" @@ -61,7 +60,7 @@ struct rtentry; * 'h->len' is the length of the packet off the wire, and 'h->caplen' * is the number of bytes actually captured. */ -u_int +void sunatm_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { @@ -71,16 +70,13 @@ sunatm_if_print(netdissect_options *ndo, u_char vpi; u_int traftype; - if (caplen < PKT_BEGIN_POS) { - ND_PRINT((ndo, "[|atm]")); - return (caplen); - } + ndo->ndo_protocol = "sunatm"; if (ndo->ndo_eflag) { - ND_PRINT((ndo, p[DIR_POS] & 0x80 ? "Tx: " : "Rx: ")); + ND_PRINT(GET_U_1(p + DIR_POS) & 0x80 ? "Tx: " : "Rx: "); } - switch (p[DIR_POS] & 0x0f) { + switch (GET_U_1(p + DIR_POS) & 0x0f) { case PT_LANE: traftype = ATM_LANE; @@ -95,13 +91,12 @@ sunatm_if_print(netdissect_options *ndo, break; } - vci = EXTRACT_16BITS(&p[VCI_POS]); - vpi = p[VPI_POS]; + vpi = GET_U_1(p + VPI_POS); + vci = GET_BE_U_2(p + VCI_POS); p += PKT_BEGIN_POS; caplen -= PKT_BEGIN_POS; length -= PKT_BEGIN_POS; + ndo->ndo_ll_hdr_len += PKT_BEGIN_POS; atm_print(ndo, vpi, vci, traftype, p, length, caplen); - - return (PKT_BEGIN_POS); }