]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Put the infodelay wrapping into the remaining "XXX_if_print()" routines.
authorguy <guy>
Thu, 5 Jul 2001 18:54:13 +0000 (18:54 +0000)
committerguy <guy>
Thu, 5 Jul 2001 18:54:13 +0000 (18:54 +0000)
Split the Cisco HDLC printer into "chdlc_if_print()", which does the
stuff expected of a low-level print routine (printing the time stamp,
printing the final newline, doing the infodelay stuff) and
"chdlc_print()", which doesn't do that stuff.  This lets us clean up
"ppp_hdlc_if_print()" a bit - it can just print the time stamp at the
beginning, and do the infodelay stuff at the end, without having to
treat Cisco HDLC specially by skipping the time stamp printing.  (This
also ensures that the time stamp is always printed, which wasn't the
case before.)

Print the missing final newline in "pppoe_if_print()".

14 files changed:
interface.h
print-802_11.c
print-arcnet.c
print-atalk.c
print-atm.c
print-chdlc.c
print-cip.c
print-lane.c
print-null.c
print-ppp.c
print-pppoe.c
print-raw.c
print-sl.c
print-sll.c

index 888dd81ecab12f1e548adbcd21227bcb71599aec..1113d482f61882a6b62b45c97f1062db15d1430d 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.165 2001-07-04 22:03:13 fenner Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.166 2001-07-05 18:54:13 guy Exp $ (LBL)
  */
 
 #ifndef tcpdump_interface_h
@@ -249,6 +249,7 @@ extern void sl_bsdos_if_print(u_char *, const struct pcap_pkthdr *,
     const u_char *);
 extern void chdlc_if_print(u_char *, const struct pcap_pkthdr *,
     const u_char *);
+extern void chdlc_print(register const u_char *, u_int, u_int);
 extern void sll_if_print(u_char *, 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 3c98cf4d0abf16ea74033694872f37de58c21bfe..3a6914f7990c358aef82609884fb02d1e8834d69 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.4 2001-06-15 07:39:43 itojun Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.5 2001-07-05 18:54:13 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -771,6 +771,7 @@ ieee802_11_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
        u_int HEADER_LENGTH;
        u_short extracted_ethertype;
 
+       ++infodelay;
        ts_print(&h->ts);
 
        if (caplen < IEEE802_11_FC_LEN) {
@@ -851,4 +852,7 @@ ieee802_11_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
                default_print(p, caplen);
  out:
        putchar('\n');
+       --infodelay;
+       if (infoprint)
+               info(0);
 }
index b553750902702a24771c7d03a28e6ad7f7063af1..bdfe46c7f661787abc88b09fbbdcd7deaee9ff47 100644 (file)
@@ -22,7 +22,7 @@
  */
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-arcnet.c,v 1.3 2001-05-22 06:23:29 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-arcnet.c,v 1.4 2001-07-05 18:54:14 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -141,6 +141,7 @@ arcnet_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
        u_int seqid = 0;
        u_char arc_type;
 
+       ++infodelay;
        ts_print(&h->ts);
 
        if (caplen < ARC_HDRLEN) {
@@ -216,6 +217,9 @@ arcnet_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
 
  out:
        putchar('\n');
+       --infodelay;
+       if (infoprint)
+               info(0);
 }
 
 /*
index 19e430971ae2a5bff79f2bca79e6708a4bc1c59b..30ae8b4edd72876d097bb2848ed66c263d57356d 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.66 2001-06-18 08:52:53 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.67 2001-07-05 18:54:14 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -90,11 +90,15 @@ void
 ltalk_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
 {
        snapend = p + h->caplen;
+       ++infodelay;
        ts_print(&h->ts);
        llap_print(p, h->caplen);
        if(xflag)
                default_print(p, h->caplen);
        putchar('\n');
+       --infodelay;
+       if (infoprint)
+               info(0);
 }
 
 /*
index 7458116ffa2ee272ebef85d98058f911806c492e..e2a2a46e7598a66d993a183e7d439c35a842ec1c 100644 (file)
@@ -20,7 +20,7 @@
  */
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.20 2000-12-22 22:45:09 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.21 2001-07-05 18:54:14 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -53,6 +53,7 @@ atm_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
        u_int length = h->len;
        u_short ethertype;
 
+       ++infodelay;
        ts_print(&h->ts);
 
        if (caplen < 8) {
@@ -141,4 +142,7 @@ atm_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
                default_print(p, caplen);
  out:
        putchar('\n');
+       --infodelay;
+       if (infoprint)
+               info(0);
 }
index aa1b330d24a1db2b672a5ed7c0bb3d49e1a90484..b415d4e72b59f8f64c1a172cc87e1a491d2f4f2a 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.11 2000-10-09 01:53:19 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.12 2001-07-05 18:54:14 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -54,25 +54,38 @@ chdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
 {
        register u_int length = h->len;
        register u_int caplen = h->caplen;
-       const struct ip *ip;
-       u_int proto;
 
+       ++infodelay;
        ts_print(&h->ts);
 
-       if (caplen < CHDLC_HDRLEN) {
-               printf("[|chdlc]");
-               goto out;
-       }
-
        /*
         * Some printers want to get back at the link level addresses,
         * and/or check that they're not walking off the end of the packet.
         * Rather than pass them all the way down, we set these globals.
         */
-       proto = ntohs(*(u_short *)&p[2]);
        packetp = p;
        snapend = p + caplen;
 
+       chdlc_print(p, length, caplen);
+
+       putchar('\n');
+       --infodelay;
+       if (infoprint)
+               info(0);
+}
+
+void
+chdlc_print(register const u_char *p, u_int length, u_int caplen)
+{
+       const struct ip *ip;
+       u_int proto;
+
+       if (caplen < CHDLC_HDRLEN) {
+               printf("[|chdlc]");
+               return;
+       }
+
+       proto = ntohs(*(u_short *)&p[2]);
        if (eflag) {
                switch (p[0]) {
                case CHDLC_UNICAST:
@@ -110,8 +123,6 @@ chdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
        }
        if (xflag)
                default_print((const u_char *)ip, caplen - CHDLC_HDRLEN);
-out:
-       putchar('\n');
 }
 
 struct cisco_slarp {
index f3afd3080de18ff27fcc5a77c1d6aa3a627a785c..45ece55f84878df4d27493640af0284559dd8bc3 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.13 2001-06-08 04:48:23 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.14 2001-07-05 18:54:15 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -96,6 +96,7 @@ cip_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
        u_short extracted_ethertype;
        u_short *bp;
 
+       ++infodelay;
        ts_print(&h->ts);
 
        if (memcmp(rfcllc, p, sizeof(rfcllc))==0 && caplen < RFC1483LLC_LEN) {
@@ -155,4 +156,7 @@ cip_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
                default_print(p, caplen);
  out:
        putchar('\n');
+       --infodelay;
+       if (infoprint)
+               info(0);
 }
index 6aadad46bc1b054af42d11d11e0a6c2dbccf996b..2836f788f56b184c4160b39ff1a5b63e9d8e0f83 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-lane.c,v 1.11 2000-12-22 22:45:11 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-lane.c,v 1.12 2001-07-05 18:54:15 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -81,6 +81,7 @@ lane_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
        u_short ether_type;
        u_short extracted_ethertype;
 
+       ++infodelay;
        ts_print(&h->ts);
 
        if (caplen < sizeof(struct lecdatahdr_8023)) {
@@ -136,4 +137,7 @@ lane_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
                default_print(p, caplen);
  out:
        putchar('\n');
+       --infodelay;
+       if (infoprint)
+               info(0);
 }
index a602bc3a511cfde4886733ed1ccc050100bb7447..30724ec68305b7b9fbb7cdc49ad7cd83fb538c72 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.40 2000-12-16 22:00:50 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.41 2001-07-05 18:54:15 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -113,6 +113,7 @@ null_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
        const struct ip *ip;
        u_int family;
 
+       ++infodelay;
        ts_print(&h->ts);
 
        memcpy((char *)&family, (char *)p, sizeof(family));
@@ -160,5 +161,8 @@ null_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
        if (xflag)
                default_print((const u_char *)ip, caplen - NULL_HDRLEN);
        putchar('\n');
+       --infodelay;
+       if (infoprint)
+               info(0);
 }
 
index 1dd2a98f78397305d41d3ee4a65be0afef986da0..9b1f362b39a13c3b6ee2eb247ff192aa1f527f3f 100644 (file)
@@ -31,7 +31,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.61 2001-06-11 10:33:03 itojun Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.62 2001-07-05 18:54:16 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -1032,6 +1032,7 @@ ppp_if_print(u_char *user, const struct pcap_pkthdr *h,
        register u_int length = h->len;
        register u_int caplen = h->caplen;
 
+       ++infodelay;
        ts_print(&h->ts);
 
        if (caplen < PPP_HDRLEN) {
@@ -1094,6 +1095,9 @@ ppp_if_print(u_char *user, const struct pcap_pkthdr *h,
                default_print(p, caplen);
 out:
        putchar('\n');
+       --infodelay;
+       if (infoprint)
+               info(0);
 }
 
 /*
@@ -1113,6 +1117,9 @@ ppp_hdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
        register u_int caplen = h->caplen;
        u_int proto;
 
+       ++infodelay;
+       ts_print(&h->ts);
+
        if (caplen < 2) {
                printf("[|ppp]");
                goto out;
@@ -1134,7 +1141,6 @@ ppp_hdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
                        goto out;
                }
 
-               ts_print(&h->ts);
                if (eflag)
                        printf("%02x %02x %d ", p[0], p[1], length);
                p += 2;
@@ -1151,14 +1157,10 @@ ppp_hdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
 
        case CHDLC_UNICAST:
        case CHDLC_BCAST:
-               /*
-                * Have the Cisco HDLC print routine do all the work.
-                */
-               chdlc_if_print(user, h, p);
-               return;
+               chdlc_print(p, length, caplen);
+               goto out;
 
        default:
-               ts_print(&h->ts);
                if (eflag)
                        printf("%02x %02x %d ", p[0], p[1], length);
                p += 2;
@@ -1177,6 +1179,9 @@ ppp_hdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
                default_print(p, caplen);
 out:
        putchar('\n');
+       --infodelay;
+       if (infoprint)
+               info(0);
 }
 
 
@@ -1231,6 +1236,7 @@ ppp_bsdos_if_print(u_char *user, const struct pcap_pkthdr *h,
        const u_char *q;
        int i;
 
+       ++infodelay;
        ts_print(&h->ts);
 
        if (caplen < PPP_BSDI_HDRLEN) {
@@ -1372,5 +1378,8 @@ printx:
                default_print((const u_char *)p, caplen - hdrlength);
 out:
        putchar('\n');
+       --infodelay;
+       if (infoprint)
+               info(0);
 #endif /* __bsdi__ */
 }
index 5369a9834859dda18d4e029f64ccb23d465b27c7..c6a2cb447a52badebf3a4f61faed5cf72a7cb588 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.14 2001-06-20 07:40:44 guy Exp $ (LBL)";
+"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.15 2001-07-05 18:54:17 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -100,6 +100,7 @@ pppoe_if_print(u_char *user, const struct pcap_pkthdr *h,
        register u_int length = h->len;
        register u_int caplen = h->caplen;
 
+       ++infodelay;
        ts_print(&h->ts);
 
        /*
@@ -111,6 +112,10 @@ pppoe_if_print(u_char *user, const struct pcap_pkthdr *h,
        snapend = p + caplen;
 
        pppoe_print(p, length);
+       putchar('\n');
+       --infodelay;
+       if (infoprint)
+               info(0);
 }
 
 void
index 7502394ab9ba8ada5bc8d28abe004cc19b2978d6..979b5f8f01f038a04fdd65647288c1a8266e3e99 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-raw.c,v 1.33 2000-10-06 04:23:13 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-raw.c,v 1.34 2001-07-05 18:54:17 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -53,6 +53,7 @@ raw_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
        u_int length = h->len;
        u_int caplen = h->caplen;
 
+       ++infodelay;
        ts_print(&h->ts);
 
        /*
@@ -71,4 +72,7 @@ raw_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
        if (xflag)
                default_print(p, caplen);
        putchar('\n');
+       --infodelay;
+       if (infoprint)
+               info(0);
 }
index d4f7edd742e5b605e1fe7573e35ea6dde2cdf8db..2ddad0508f51048bdac8d377b9d9ebb82dd94128 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-sl.c,v 1.56 2000-10-10 05:06:10 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-sl.c,v 1.57 2001-07-05 18:54:17 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -60,6 +60,7 @@ sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
        register u_int length = h->len;
        register const struct ip *ip;
 
+       ++infodelay;
        ts_print(&h->ts);
 
        if (caplen < SLIP_HDRLEN) {
@@ -98,6 +99,9 @@ sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
                default_print((u_char *)ip, caplen - SLIP_HDRLEN);
  out:
        putchar('\n');
+       --infodelay;
+       if (infoprint)
+               info(0);
 }
 
 
@@ -108,6 +112,7 @@ sl_bsdos_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
        register u_int length = h->len;
        register const struct ip *ip;
 
+       ++infodelay;
        ts_print(&h->ts);
 
        if (caplen < SLIP_HDRLEN) {
@@ -137,6 +142,9 @@ sl_bsdos_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
                default_print((u_char *)ip, caplen - SLIP_HDRLEN);
  out:
        putchar('\n');
+       --infodelay;
+       if (infoprint)
+               info(0);
 }
 
 static void
index d8661a9e0f89c05429141aa356e1b42f74069874..836140fdd3698f1b1ec53ec667764e13d6e27c00 100644 (file)
@@ -20,7 +20,7 @@
  */
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-sll.c,v 1.5 2001-06-08 04:48:23 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-sll.c,v 1.6 2001-07-05 18:54:18 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -110,6 +110,7 @@ sll_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
        u_short ether_type;
        u_short extracted_ethertype;
 
+       ++infodelay;
        ts_print(&h->ts);
 
        if (caplen < SLL_HDR_LEN) {
@@ -239,4 +240,7 @@ sll_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
                default_print(p, caplen);
  out:
        putchar('\n');
+       --infodelay;
+       if (infoprint)
+               info(0);
 }