]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-sunatm.c
Add '-Wunreachable-code-return' warning option in devel mode for cmake
[tcpdump] / print-sunatm.c
index 8c0b26a85b5a5b6c9841d38031c9790f1c9540ac..e1686d83d468e77e32f054678f6aea91346e1cb3 100644 (file)
 /* \summary: SunATM DLPI capture printer */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
-#include <netdissect-stdinc.h>
-
-struct mbuf;
-struct rtentry;
+#include "netdissect-stdinc.h"
 
 #include "netdissect.h"
 #include "extract.h"
@@ -72,16 +69,17 @@ sunatm_if_print(netdissect_options *ndo,
        u_char vpi;
        u_int traftype;
 
+       ndo->ndo_protocol = "sunatm_if";
        if (caplen < PKT_BEGIN_POS) {
-               ND_PRINT((ndo, "[|atm]"));
+               nd_print_trunc(ndo);
                return (caplen);
        }
 
        if (ndo->ndo_eflag) {
-               ND_PRINT((ndo, p[DIR_POS] & 0x80 ? "Tx: " : "Rx: "));
+               ND_PRINT(EXTRACT_U_1(p + DIR_POS) & 0x80 ? "Tx: " : "Rx: ");
        }
 
-       switch (p[DIR_POS] & 0x0f) {
+       switch (EXTRACT_U_1(p + DIR_POS) & 0x0f) {
 
        case PT_LANE:
                traftype = ATM_LANE;
@@ -96,8 +94,8 @@ sunatm_if_print(netdissect_options *ndo,
                break;
        }
 
-       vci = EXTRACT_BE_16BITS(p + VCI_POS);
-       vpi = p[VPI_POS];
+       vci = EXTRACT_BE_U_2(p + VCI_POS);
+       vpi = EXTRACT_U_1(p + VPI_POS);
 
        p += PKT_BEGIN_POS;
        caplen -= PKT_BEGIN_POS;