]> The Tcpdump Group git mirrors - tcpdump/commitdiff
add support for DLT_JUNIPER{PPP,ETHER,FRELAY,CHDLC} printers
authorhannes <hannes>
Tue, 23 Aug 2005 10:24:58 +0000 (10:24 +0000)
committerhannes <hannes>
Tue, 23 Aug 2005 10:24:58 +0000 (10:24 +0000)
interface.h
print-chdlc.c
print-juniper.c
tcpdump.c

index 5f36e23c381296eca9bc4254a5e6d2fb82195e1b..148cfd94bf94eeb9a733d981026dea5756ba470a 100644 (file)
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.259 2005-07-20 22:12:39 hannes Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.260 2005-08-23 10:24:58 hannes Exp $ (LBL)
  */
 
 #ifndef tcpdump_interface_h
@@ -253,6 +253,7 @@ extern u_int lane_if_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int cip_if_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int sl_bsdos_if_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int chdlc_if_print(const struct pcap_pkthdr *, const u_char *);
+extern u_int chdlc_print(register const u_char *, u_int);
 extern u_int juniper_atm1_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int juniper_atm2_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int juniper_mfr_print(const struct pcap_pkthdr *, register const u_char *);
@@ -264,6 +265,10 @@ extern u_int juniper_ggsn_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int juniper_es_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int juniper_monitor_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int juniper_services_print(const struct pcap_pkthdr *, const u_char *);
+extern u_int juniper_ether_print(const struct pcap_pkthdr *, const u_char *);
+extern u_int juniper_ppp_print(const struct pcap_pkthdr *, const u_char *);
+extern u_int juniper_frelay_print(const struct pcap_pkthdr *, const u_char *);
+extern u_int juniper_chdlc_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int sll_if_print(const struct pcap_pkthdr *, const u_char *);
 extern void snmp_print(const u_char *, u_int);
 extern void sunrpcrequest_print(const u_char *, u_int, const u_char *);
index 0865888883573aebca57df6db94881f7f4afe380..4743b951e81d0890cc82373ec175726057e53328 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.39 2005-04-27 14:33:24 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.40 2005-08-23 10:24:58 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -48,13 +48,18 @@ chdlc_if_print(const struct pcap_pkthdr *h, register const u_char *p)
 {
        register u_int length = h->len;
        register u_int caplen = h->caplen;
-       const struct ip *ip;
-       u_int proto;
 
        if (caplen < CHDLC_HDRLEN) {
                printf("[|chdlc]");
                return (caplen);
        }
+        return (chdlc_print(p,length));
+}
+
+u_int
+chdlc_print(register const u_char *p, u_int length) {
+       u_int proto;
+       const struct ip *ip;
 
        proto = EXTRACT_16BITS(&p[2]);
        if (eflag) {
index f5afea3cbfe3a85cfd23d26122d2c6b465ef25c9..63e191a7de37828d9ffd3e7852e742bf0573fecc 100644 (file)
@@ -15,7 +15,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.26 2005-08-10 14:18:57 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.27 2005-08-23 10:24:59 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -358,6 +358,74 @@ juniper_pppoe_print(const struct pcap_pkthdr *h, register const u_char *p)
 }
 #endif
 
+#ifdef DLT_JUNIPER_ETHER
+u_int
+juniper_ether_print(const struct pcap_pkthdr *h, register const u_char *p)
+{
+        struct juniper_l2info_t l2info;
+
+        l2info.pictype = DLT_JUNIPER_ETHER;
+        if(juniper_parse_header(p, h, &l2info) == 0)
+            return l2info.header_len;
+
+        p+=l2info.header_len;
+        /* this DLT contains nothing but raw Ethernet frames */
+        ether_print(p, l2info.length, l2info.caplen);
+        return l2info.header_len;
+}
+#endif
+
+#ifdef DLT_JUNIPER_PPP
+u_int
+juniper_ppp_print(const struct pcap_pkthdr *h, register const u_char *p)
+{
+        struct juniper_l2info_t l2info;
+
+        l2info.pictype = DLT_JUNIPER_PPP;
+        if(juniper_parse_header(p, h, &l2info) == 0)
+            return l2info.header_len;
+
+        p+=l2info.header_len;
+        /* this DLT contains nothing but raw ppp frames */
+        ppp_print(p, l2info.length);
+        return l2info.header_len;
+}
+#endif
+
+#ifdef DLT_JUNIPER_FRELAY
+u_int
+juniper_frelay_print(const struct pcap_pkthdr *h, register const u_char *p)
+{
+        struct juniper_l2info_t l2info;
+
+        l2info.pictype = DLT_JUNIPER_FRELAY;
+        if(juniper_parse_header(p, h, &l2info) == 0)
+            return l2info.header_len;
+
+        p+=l2info.header_len;
+        /* this DLT contains nothing but raw frame-relay frames */
+        fr_print(p, l2info.length);
+        return l2info.header_len;
+}
+#endif
+
+#ifdef DLT_JUNIPER_CHDLC
+u_int
+juniper_chdlc_print(const struct pcap_pkthdr *h, register const u_char *p)
+{
+        struct juniper_l2info_t l2info;
+
+        l2info.pictype = DLT_JUNIPER_CHDLC;
+        if(juniper_parse_header(p, h, &l2info) == 0)
+            return l2info.header_len;
+
+        p+=l2info.header_len;
+        /* this DLT contains nothing but raw c-hdlc frames */
+        chdlc_print(p, l2info.length);
+        return l2info.header_len;
+}
+#endif
+
 #ifdef DLT_JUNIPER_PPPOE_ATM
 u_int
 juniper_pppoe_atm_print(const struct pcap_pkthdr *h, register const u_char *p)
index 44a218dae487fcb4c40f70c9af63de3b3555a175..ffa812123d3b5c622e9664f5b4455e9020a967cf 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -30,7 +30,7 @@ static const char copyright[] _U_ =
     "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\
 The Regents of the University of California.  All rights reserved.\n";
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.260 2005-07-07 01:22:21 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.261 2005-08-23 10:24:58 hannes Exp $ (LBL)";
 #endif
 
 /*
@@ -252,6 +252,18 @@ static struct printer printers[] = {
 #endif
 #ifdef DLT_JUNIPER_SERVICES
        { juniper_services_print, DLT_JUNIPER_SERVICES },
+#endif
+#ifdef DLT_JUNIPER_ETHER
+       { juniper_ether_print, DLT_JUNIPER_ETHER },
+#endif
+#ifdef DLT_JUNIPER_PPP
+       { juniper_ppp_print, DLT_JUNIPER_PPP },
+#endif
+#ifdef DLT_JUNIPER_FRELAY
+       { juniper_frelay_print, DLT_JUNIPER_FRELAY },
+#endif
+#ifdef DLT_JUNIPER_CHDLC
+       { juniper_chdlc_print, DLT_JUNIPER_CHDLC },
 #endif
        { NULL,                 0 },
 };