]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-icmp.c
NDOize more small decoders
[tcpdump] / print-icmp.c
index 03b9505b1146da6f0dc91ad38466ece3ae1ef8ab..32357dfab607dfab7428e6a1d9e104b15520b15a 100644 (file)
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.87 2007-09-13 17:42:31 guy Exp $ (LBL)";
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -89,7 +84,7 @@ struct icmp {
 #define        icmp_data       icmp_dun.id_data
 };
 
-#define ICMP_MPLS_EXT_EXTRACT_VERSION(x) (((x)&0xf0)>>4) 
+#define ICMP_MPLS_EXT_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
 #define ICMP_MPLS_EXT_VERSION 2
 
 /*
@@ -194,7 +189,7 @@ struct icmp {
 #endif
 
 /* Most of the icmp types */
-static struct tok icmp2str[] = {
+static const struct tok icmp2str[] = {
        { ICMP_ECHOREPLY,               "echo reply" },
        { ICMP_SOURCEQUENCH,            "source quench" },
        { ICMP_ECHO,                    "echo request" },
@@ -208,7 +203,7 @@ static struct tok icmp2str[] = {
 };
 
 /* Formats for most of the ICMP_UNREACH codes */
-static struct tok unreach2str[] = {
+static const struct tok unreach2str[] = {
        { ICMP_UNREACH_NET,             "net %s unreachable" },
        { ICMP_UNREACH_HOST,            "host %s unreachable" },
        { ICMP_UNREACH_SRCFAIL,
@@ -235,7 +230,7 @@ static struct tok unreach2str[] = {
 };
 
 /* Formats for the ICMP_REDIRECT codes */
-static struct tok type2str[] = {
+static const struct tok type2str[] = {
        { ICMP_REDIRECT_NET,            "redirect %s to net %s" },
        { ICMP_REDIRECT_HOST,           "redirect %s to host %s" },
        { ICMP_REDIRECT_TOSNET,         "redirect-tos %s to net %s" },
@@ -329,7 +324,7 @@ icmp_tstamp_print(u_int tstamp) {
     snprintf(buf, sizeof(buf), "%02u:%02u:%02u.%03u",hrs,min,sec,msec);
     return buf;
 }
+
 void
 icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
 {
@@ -612,7 +607,7 @@ icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
 
             printf("\n\tMPLS extension v%u",
                    ICMP_MPLS_EXT_EXTRACT_VERSION(*(ext_dp->icmp_ext_version_res)));
-            
+
             /*
              * Sanity checking of the header.
              */
@@ -650,7 +645,7 @@ icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
 
                 hlen-=sizeof(struct icmp_mpls_ext_object_header_t); /* length field includes tlv header */
 
-                /* infinite loop protection */                
+                /* infinite loop protection */
                 if ((obj_class_num == 0) ||
                     (obj_tlen < sizeof(struct icmp_mpls_ext_object_header_t))) {
                     return;
@@ -669,7 +664,7 @@ icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
                         printf(", ttl %u", MPLS_TTL(raw_label));
                         break;
                     default:
-                        print_unknown_data(obj_tptr, "\n\t    ", obj_tlen);
+                        print_unknown_data(gndo,obj_tptr, "\n\t    ", obj_tlen);
                     }
                     break;
 
@@ -679,7 +674,7 @@ icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
                 */
                 case 2:
                 default:
-                    print_unknown_data(obj_tptr, "\n\t    ", obj_tlen);
+                    print_unknown_data(gndo,obj_tptr, "\n\t    ", obj_tlen);
                     break;
                 }
                 if (hlen < obj_tlen)
@@ -693,3 +688,9 @@ icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
 trunc:
        fputs("[|icmp]", stdout);
 }
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */