]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-tipc.c
Compile with '-Wsign-compare' in devel mode if supported
[tcpdump] / print-tipc.c
index 88d4862bbaf956627ba7e8450cb09ac43c465f82..45de7387638fdf66b243ebcd856ef2945fa2f954 100644 (file)
  */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
-#include <netdissect-stdinc.h>
+#include "netdissect-stdinc.h"
 
 #include "netdissect.h"
 #include "ethertype.h"
 #include "extract.h"
 
-static const char tstr[] = "[|TIPC]";
 
 #define TIPC_USER_LOW_IMPORTANCE       0
 #define TIPC_USER_MEDIUM_IMPORTANCE    1
@@ -171,7 +170,7 @@ print_payload(netdissect_options *ndo, const struct payload_tipc_pkthdr *ap)
        u_int orig_node;
        u_int dest_node;
 
-       ND_TCHECK(ap->dest_port);
+       ND_TCHECK_4(ap->dest_port);
        w0 = EXTRACT_BE_U_4(ap->w0);
        user = TIPC_USER(w0);
        hsize = TIPC_HSIZE(w0);
@@ -190,7 +189,7 @@ print_payload(netdissect_options *ndo, const struct payload_tipc_pkthdr *ap)
                    tok2str(tipcuser_values, "unknown", user),
                    tok2str(tipcmtype_values, "Unknown", mtype));
        } else {
-               ND_TCHECK(ap->dest_node);
+               ND_TCHECK_4(ap->dest_node);
                orig_node = EXTRACT_BE_U_4(ap->orig_node);
                dest_node = EXTRACT_BE_U_4(ap->dest_node);
                ND_PRINT("TIPC v%u.0 %u.%u.%u:%u > %u.%u.%u:%u, headerlength %u bytes, MessageSize %u bytes, %s, messageType %s",
@@ -216,7 +215,7 @@ print_payload(netdissect_options *ndo, const struct payload_tipc_pkthdr *ap)
        return;
 
 trunc:
-       ND_PRINT("%s", tstr);
+       nd_print_trunc(ndo);
 }
 
 static void
@@ -241,7 +240,7 @@ print_internal(netdissect_options *ndo, const struct internal_tipc_pkthdr *ap)
        u_int msg_cnt;
        u_int link_tol;
 
-       ND_TCHECK(ap->dest_node);
+       ND_TCHECK_4(ap->dest_node);
        w0 = EXTRACT_BE_U_4(ap->w0);
        user = TIPC_USER(w0);
        hsize = TIPC_HSIZE(w0);
@@ -284,7 +283,7 @@ print_internal(netdissect_options *ndo, const struct internal_tipc_pkthdr *ap)
        return;
 
 trunc:
-       ND_PRINT("%s", tstr);
+       nd_print_trunc(ndo);
 }
 
 static void
@@ -301,7 +300,7 @@ print_link_conf(netdissect_options *ndo, const struct link_conf_tipc_pkthdr *ap)
        u_int ntwrk_id;
        u_int media_id;
 
-       ND_TCHECK(ap->prev_node);
+       ND_TCHECK_4(ap->prev_node);
        w0 = EXTRACT_BE_U_4(ap->w0);
        user = TIPC_USER(w0);
        hsize = TIPC_HSIZE(w0);
@@ -319,7 +318,7 @@ print_link_conf(netdissect_options *ndo, const struct link_conf_tipc_pkthdr *ap)
            tok2str(tipcuser_values, "unknown", user),
            tok2str(tipc_linkconf_mtype_values, "Unknown", mtype));
        if (ndo->ndo_vflag) {
-               ND_TCHECK(ap->w5);
+               ND_TCHECK_4(ap->w5);
                node_sig = TIPC_NODE_SIG(w1);
                ntwrk_id = EXTRACT_BE_U_4(ap->ntwrk_id);
                w5 = EXTRACT_BE_U_4(ap->w5);
@@ -330,7 +329,7 @@ print_link_conf(netdissect_options *ndo, const struct link_conf_tipc_pkthdr *ap)
        return;
 
 trunc:
-       ND_PRINT("%s", tstr);
+       nd_print_trunc(ndo);
 }
 
 void
@@ -341,8 +340,9 @@ tipc_print(netdissect_options *ndo, const u_char *bp, u_int length _U_,
        uint32_t w0;
        u_int user;
 
+       ndo->ndo_protocol = "tipc";
        ap = (const struct tipc_pkthdr *)bp;
-       ND_TCHECK(ap->w0);
+       ND_TCHECK_4(ap->w0);
        w0 = EXTRACT_BE_U_4(ap->w0);
        user = TIPC_USER(w0);
 
@@ -373,12 +373,5 @@ tipc_print(netdissect_options *ndo, const u_char *bp, u_int length _U_,
        return;
 
 trunc:
-       ND_PRINT("%s", tstr);
+       nd_print_trunc(ndo);
 }
-
-/*
- * Local Variables:
- * c-style: bsd
- * End:
- */
-