]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-mpls.c
Rename the fn_printX() functions to nd_printX()
[tcpdump] / print-mpls.c
index b156ef7fc5d6ffe2185bb04b0f4ffaf7b5f2a9fa..3d2a2645cfddff9a94139ce5992ef7247db8ce5d 100644 (file)
 /* \summary: Multi-Protocol Label Switching (MPLS) printer */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
-#include <netdissect-stdinc.h>
+#include "netdissect-stdinc.h"
 
 #include "netdissect.h"
 #include "extract.h"
@@ -64,26 +64,27 @@ mpls_print(netdissect_options *ndo, const u_char *bp, u_int length)
        uint16_t label_stack_depth = 0;
        enum mpls_packet_type pt = PT_UNKNOWN;
 
+       ndo->ndo_protocol = "mpls";
        p = bp;
-       ND_PRINT((ndo, "MPLS"));
+       ND_PRINT("MPLS");
        do {
-               ND_TCHECK2(*p, sizeof(label_entry));
+               ND_TCHECK_LEN(p, sizeof(label_entry));
                if (length < sizeof(label_entry)) {
-                       ND_PRINT((ndo, "[|MPLS], length %u", length));
+                       ND_PRINT("[|MPLS], length %u", length);
                        return;
                }
                label_entry = EXTRACT_BE_U_4(p);
-               ND_PRINT((ndo, "%s(label %u",
+               ND_PRINT("%s(label %u",
                       (label_stack_depth && ndo->ndo_vflag) ? "\n\t" : " ",
-                              MPLS_LABEL(label_entry)));
+                              MPLS_LABEL(label_entry));
                label_stack_depth++;
                if (ndo->ndo_vflag &&
                    MPLS_LABEL(label_entry) < sizeof(mpls_labelname) / sizeof(mpls_labelname[0]))
-                       ND_PRINT((ndo, " (%s)", mpls_labelname[MPLS_LABEL(label_entry)]));
-               ND_PRINT((ndo, ", exp %u", MPLS_EXP(label_entry)));
+                       ND_PRINT(" (%s)", mpls_labelname[MPLS_LABEL(label_entry)]);
+               ND_PRINT(", exp %u", MPLS_EXP(label_entry));
                if (MPLS_STACK(label_entry))
-                       ND_PRINT((ndo, ", [S]"));
-               ND_PRINT((ndo, ", ttl %u)", MPLS_TTL(label_entry)));
+                       ND_PRINT(", [S]");
+               ND_PRINT(", ttl %u)", MPLS_TTL(label_entry));
 
                p += sizeof(label_entry);
                length -= sizeof(label_entry);
@@ -189,7 +190,7 @@ mpls_print(netdissect_options *ndo, const u_char *bp, u_int length)
                        ND_DEFAULTPRINT(p, length);
                return;
        }
-       ND_PRINT((ndo, ndo->ndo_vflag ? "\n\t" : " "));
+       ND_PRINT(ndo->ndo_vflag ? "\n\t" : " ");
        switch (pt) {
 
        case PT_IPV4:
@@ -210,13 +211,5 @@ mpls_print(netdissect_options *ndo, const u_char *bp, u_int length)
        return;
 
 trunc:
-       ND_PRINT((ndo, "[|MPLS]"));
+       ND_PRINT("[|MPLS]");
 }
-
-
-/*
- * Local Variables:
- * c-style: whitesmith
- * c-basic-offset: 8
- * End:
- */