]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-cdp.c
Makefile.in: 'distclean' target: add files and directories to remove
[tcpdump] / print-cdp.c
index bef7f5eacadd701be847be9c2c5a6ff08d4289b6..5383fd50f9d57d754a361447e59af57092ae15a9 100644 (file)
  *    http://www.cisco.com/univercd/cc/td/doc/product/lan/trsrb/frames.htm
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-cdp.c,v 1.25 2004-10-07 14:53:11 hannes Exp $";
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -43,9 +38,11 @@ static const char rcsid[] _U_ =
 #include "extract.h"                   /* must come after interface.h */
 #include "nlpid.h"
 
+static const char tstr[] = "[|cdp]";
+
 #define CDP_HEADER_LEN  4
 
-static struct tok cdp_tlv_values[] = {
+static const struct tok cdp_tlv_values[] = {
     { 0x01,             "Device-ID"},
     { 0x02,             "Address"},
     { 0x03,             "Port-ID"},
@@ -70,7 +67,7 @@ static struct tok cdp_tlv_values[] = {
     { 0, NULL}
 };
 
-static struct tok cdp_capability_values[] = {
+static const struct tok cdp_capability_values[] = {
     { 0x01,             "Router" },
     { 0x02,             "Transparent Bridge" },
     { 0x04,             "Source Route Bridge" },
@@ -92,7 +89,7 @@ cdp_print(const u_char *pptr, u_int length, u_int caplen)
         const u_char *tptr;
 
        if (caplen < CDP_HEADER_LEN) {
-               (void)printf("[|cdp]");
+               printf("%s", tstr);
                return;
        }
 
@@ -124,7 +121,7 @@ cdp_print(const u_char *pptr, u_int length, u_int caplen)
                                tok2str(cdp_tlv_values,"unknown field type", type),
                                type,
                                len,
-                               len>1 ? "s" : ""); /* plural */
+                               PLURAL_SUFFIX(len)); /* plural */
 
                     switch (type) {
 
@@ -218,7 +215,7 @@ cdp_print(const u_char *pptr, u_int length, u_int caplen)
                        }
                        break;
                     default:
-                        print_unknown_data(tptr,"\n\t  ",len);
+                        print_unknown_data(gndo,tptr,"\n\t  ",len);
                        break;
                     }
                 }
@@ -232,7 +229,7 @@ cdp_print(const u_char *pptr, u_int length, u_int caplen)
 
        return;
 trunc:
-       printf("[|cdp]");
+       printf("%s", tstr);
 }
 
 /*
@@ -252,7 +249,7 @@ cdp_print_addr(const u_char * p, int l)
        int pt, pl, al, num;
        const u_char *endp = p + l;
 #ifdef INET6
-       static u_char prot_ipv6[] = {
+       static const u_char prot_ipv6[] = {
                0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, 0x86, 0xdd
        };
 #endif