]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-lcp.c
Add SunATM support, based on code from Yen Yen Lim at North Dakota State
[tcpdump] / print-lcp.c
index 542bd89310bb8d9b8f6b441a30024e37e05c0eb9..a40b7b54fbe8101db146ea836cb02ede2d301798 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-"@(#) $Header: /tcpdump/master/tcpdump/Attic/print-lcp.c,v 1.2 1999-11-21 09:36:56 fenner Exp $ (LBL)";
+"@(#) $Header: /tcpdump/master/tcpdump/Attic/print-lcp.c,v 1.10 2002-06-11 17:08:52 itojun Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -32,18 +32,8 @@ static const char rcsid[] =
 #include <sys/time.h>
 #include <sys/socket.h>
 
-#if __STDC__
-struct mbuf;
-struct rtentry;
-#endif
-#include <net/if.h>
-
 #include <netinet/in.h>
-#include <netinet/if_ether.h>
 
-#ifdef HAVE_MEMORY_H
-#include <memory.h>
-#endif
 #include <stdio.h>
 #include <string.h>
 
@@ -53,7 +43,7 @@ struct rtentry;
 #include "ppp.h"
 
 /* Codes */
-enum { 
+enum {
   LCP_CONFREQ = 1,
   LCP_CONFACK = 2,
   LCP_CONFNAK = 3,
@@ -126,25 +116,25 @@ static struct tok lcpchap2str[] = {
 };
 
 void
-lcp_print(register const u_char *bp, u_int length, u_int caplen)
+lcp_print(register const u_char *bp, u_int length)
 {
   u_short lcp_code, lcp_id, lcp_length;
   const u_char *lcp_data;
 
   lcp_data = bp+4;
-       
+
   if (snapend < lcp_data) {
     printf(" [LCP|]");
     return;
   }
-  
+
   lcp_code  = bp[0];
   lcp_id    = bp[1];
   lcp_length = EXTRACT_16BITS(bp+2);
 
   printf("LCP %s id=0x%x", tok2str(lcpcode2str, "LCP-#%d", lcp_code), lcp_id);
-  
-  switch(lcp_code) {
+
+  switch (lcp_code) {
   case LCP_CONFREQ:
   case LCP_CONFACK:
   case LCP_CONFNAK:
@@ -157,7 +147,7 @@ lcp_print(register const u_char *bp, u_int length, u_int caplen)
        lcpopt_type = p[0];
        lcpopt_length = p[1];
        p+=2;
-       printf(" <%s ",tok2str(lcpoption2str, "option-#%d", lcpopt_type), lcpopt_length);
+       printf(" <%s ",tok2str(lcpoption2str, "option-#%d", lcpopt_type));
        if (lcpopt_length)
          switch (lcpopt_type) {
          case LCP_MRU:
@@ -169,7 +159,7 @@ lcp_print(register const u_char *bp, u_int length, u_int caplen)
            if (snapend < p+2) return;
            printf("%s",tok2str(lcpauth2str, "AUTH-%#x", ntohs(*(u_short*)p)));
            if (lcpopt_length < 4) printf(" len=%d!",lcpopt_length);
-           if (lcpopt_length >= 5 && p < snapend) 
+           if (lcpopt_length >= 5 && p < snapend)
              printf(" %s",tok2str(lcpchap2str, "%#x", p[0]));
            break;
          case LCP_QUALPROTO:
@@ -181,7 +171,7 @@ lcp_print(register const u_char *bp, u_int length, u_int caplen)
          case LCP_ASYNCMAP:
          case LCP_MAGICNUM:
            if (snapend < p+4) return;
-           printf("%#x",ntohl(*(u_long*)p));
+           printf("%#x", (unsigned)ntohl(*(u_long*)p));
            if (lcpopt_length != 6) printf(" len=%d!",lcpopt_length);
            break;
          case LCP_PCOMP:
@@ -202,7 +192,7 @@ lcp_print(register const u_char *bp, u_int length, u_int caplen)
   case LCP_ECHOREP:
   case LCP_DISCARD:
     if (snapend < lcp_data+4) return;
-    printf(" magic=%#x", ntohl(*(u_long *) lcp_data));
+    printf(" magic=%#x", (unsigned)ntohl(*(u_long *) lcp_data));
     lcp_data +=4;
     break;
   case LCP_PROTREJ:
@@ -213,8 +203,7 @@ lcp_print(register const u_char *bp, u_int length, u_int caplen)
   case LCP_CODEREJ:
     if (snapend < lcp_data+4) return;
     printf(" ");
-    /* XXX What's caplen? (lcp_print doesn't use it so it doesn't matter here) */
-    lcp_print(lcp_data, (lcp_length+lcp_data > snapend ? snapend-lcp_data : lcp_length), 0);
+    lcp_print(lcp_data, (lcp_length+lcp_data > snapend ? snapend-lcp_data : lcp_length));
     break;
   case LCP_TERMREQ:
   case LCP_TERMACK:
@@ -222,6 +211,6 @@ lcp_print(register const u_char *bp, u_int length, u_int caplen)
   default:
     break;
   }
-  
+
   return;
 }