]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-llc.c
The third argument to linkaddr_string is one of the LINKADDR_ enums.
[tcpdump] / print-llc.c
index a1a507bb1bbd98225bbd4de797dded3865bd3fda..750a8ccdae5499a4f2f5127922ae9b813dad90f4 100644 (file)
 /* \summary: IEEE 802.2 LLC printer */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
-#include <netdissect-stdinc.h>
+#include "netdissect-stdinc.h"
 
 #include "netdissect.h"
 #include "addrtoname.h"
@@ -155,19 +155,20 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen,
        int hdrlen;
        int is_u;
 
+       ndo->ndo_protocol = "llc";
        if (caplen < 3) {
-               ND_PRINT("[|llc]");
+               nd_print_trunc(ndo);
                ND_DEFAULTPRINT((const u_char *)p, caplen);
                return (caplen);
        }
        if (length < 3) {
-               ND_PRINT("[|llc]");
+               nd_print_trunc(ndo);
                ND_DEFAULTPRINT((const u_char *)p, caplen);
                return (length);
        }
 
-       dsap_field = EXTRACT_U_1(p);
-       ssap_field = EXTRACT_U_1(p + 1);
+       dsap_field = GET_U_1(p);
+       ssap_field = GET_U_1(p + 1);
 
        /*
         * OK, what type of LLC frame is this?  The length
@@ -175,7 +176,7 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen,
         * have a two-byte control field, and U frames have
         * a one-byte control field.
         */
-       control = EXTRACT_U_1(p + 2);
+       control = GET_U_1(p + 2);
        if ((control & LLC_U_FMT) == LLC_U_FMT) {
                /*
                 * U frame.
@@ -188,12 +189,12 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen,
                 * 2 bytes...
                 */
                if (caplen < 4) {
-                       ND_PRINT("[|llc]");
+                       nd_print_trunc(ndo);
                        ND_DEFAULTPRINT((const u_char *)p, caplen);
                        return (caplen);
                }
                if (length < 4) {
-                       ND_PRINT("[|llc]");
+                       nd_print_trunc(ndo);
                        ND_DEFAULTPRINT((const u_char *)p, caplen);
                        return (length);
                }
@@ -201,7 +202,7 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen,
                /*
                 * ...and is little-endian.
                 */
-               control = EXTRACT_LE_U_2(p + 2);
+               control = GET_LE_U_2(p + 2);
                is_u = 0;
                hdrlen = 4;     /* DSAP, SSAP, 2-byte control field */
        }
@@ -367,20 +368,20 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen,
                                return (hdrlen);
                        }
                        if (caplen < 1) {
-                               ND_PRINT("[|llc]");
+                               nd_print_trunc(ndo);
                                if (caplen > 0)
                                        ND_DEFAULTPRINT((const u_char *)p, caplen);
                                return (hdrlen);
                        }
-                       if (EXTRACT_U_1(p) == LLC_XID_FI) {
+                       if (GET_U_1(p) == LLC_XID_FI) {
                                if (caplen < 3 || length < 3) {
-                                       ND_PRINT("[|llc]");
+                                       nd_print_trunc(ndo);
                                        if (caplen > 0)
                                                ND_DEFAULTPRINT((const u_char *)p, caplen);
                                } else
                                        ND_PRINT(": %02x %02x",
-                                                 EXTRACT_U_1(p + 1),
-                                                 EXTRACT_U_1(p + 2));
+                                                 GET_U_1(p + 1),
+                                                 GET_U_1(p + 2));
                                return (hdrlen);
                        }
                }
@@ -427,11 +428,12 @@ snap_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen,
        u_short et;
        int ret;
 
+       ndo->ndo_protocol = "snap";
        ND_TCHECK_5(p);
        if (caplen < 5 || length < 5)
                goto trunc;
-       orgcode = EXTRACT_BE_U_3(p);
-       et = EXTRACT_BE_U_2(p + 3);
+       orgcode = GET_BE_U_3(p);
+       et = GET_BE_U_2(p + 3);
 
        if (ndo->ndo_eflag) {
                /*
@@ -603,14 +605,6 @@ snap_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen,
        return (0);
 
 trunc:
-       ND_PRINT("[|snap]");
+       nd_print_trunc(ndo);
        return (1);
 }
-
-
-/*
- * Local Variables:
- * c-style: whitesmith
- * c-basic-offset: 8
- * End:
- */