]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-null.c
Hoist a bunch of stuff that should be done by all if_print routines into
[tcpdump] / print-null.c
index 821a447d280ad8a161e58b4693987905db853078..6b7ffe7b2e8f5bc5102aa9702654c1c91f0d6c53 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.43 2002-08-01 08:53:22 risso Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.47 2002-12-19 09:39:13 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -96,17 +96,13 @@ null_print(u_int family, u_int length)
 #define        SWAPLONG(y) \
 ((((y)&0xff)<<24) | (((y)&0xff00)<<8) | (((y)&0xff0000)>>8) | (((y)>>24)&0xff))
 
-void
-null_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
+u_int
+null_if_print(const struct pcap_pkthdr *h, const u_char *p)
 {
        u_int length = h->len;
-       u_int caplen = h->caplen;
        const struct ip *ip;
        u_int family;
 
-       ++infodelay;
-       ts_print(&h->ts);
-
        memcpy((char *)&family, (char *)p, sizeof(family));
 
        /*
@@ -120,14 +116,6 @@ null_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
        if ((family & 0xFFFF0000) != 0)
                family = SWAPLONG(family);
 
-       /*
-        * 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.
-        */
-       packetp = p;
-       snapend = p + caplen;
-
        length -= NULL_HDRLEN;
 
        ip = (struct ip *)(p + NULL_HDRLEN);
@@ -149,11 +137,6 @@ null_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
                break;
        }
 
-       if (xflag)
-               default_print((const u_char *)ip, caplen - NULL_HDRLEN);
-       putchar('\n');
-       --infodelay;
-       if (infoprint)
-               info(0);
+       return (NULL_HDRLEN);
 }