]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-sl.c
Backout CHANGES update - wrong branch
[tcpdump] / print-sl.c
index 4419f11cc0f6c8db7229784d4478c2c4d667c0c8..f00d3943d320a6d4613f8ad9265210fa4238eb6a 100644 (file)
  */
 
 #ifndef lint
-static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-sl.c,v 1.55 2000-10-09 01:53:20 guy Exp $ (LBL)";
+static const char rcsid[] _U_ =
+    "@(#) $Header: /tcpdump/master/tcpdump/print-sl.c,v 1.65 2005-04-06 21:32:42 mcr Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include <sys/param.h>
-#include <sys/time.h>
+#include <tcpdump-stdinc.h>
 
-#include <netinet/in.h>
-
-#include <ctype.h>
-#include <netdb.h>
 #include <pcap.h>
 #include <stdio.h>
 
@@ -53,26 +48,17 @@ static u_int lastconn = 255;
 static void sliplink_print(const u_char *, const struct ip *, u_int);
 static void compressed_sl_print(const u_char *, const struct ip *, u_int, int);
 
-void
-sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
+u_int
+sl_if_print(const struct pcap_pkthdr *h, const u_char *p)
 {
        register u_int caplen = h->caplen;
        register u_int length = h->len;
        register const struct ip *ip;
 
-       ts_print(&h->ts);
-
        if (caplen < SLIP_HDRLEN) {
                printf("[|slip]");
-               goto out;
+               return (caplen);
        }
-       /*
-        * 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 -= SLIP_HDRLEN;
 
@@ -83,7 +69,7 @@ sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
 
        switch (IP_V(ip)) {
        case 4:
-               ip_print((u_char *)ip, length);
+               ip_print(gndo, (u_char *)ip, length);
                break;
 #ifdef INET6
        case 6:
@@ -94,33 +80,20 @@ sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
                printf ("ip v%d", IP_V(ip));
        }
 
-       if (xflag)
-               default_print((u_char *)ip, caplen - SLIP_HDRLEN);
- out:
-       putchar('\n');
+       return (SLIP_HDRLEN);
 }
 
-
-void
-sl_bsdos_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
+u_int
+sl_bsdos_if_print(const struct pcap_pkthdr *h, const u_char *p)
 {
        register u_int caplen = h->caplen;
        register u_int length = h->len;
        register const struct ip *ip;
 
-       ts_print(&h->ts);
-
        if (caplen < SLIP_HDRLEN) {
                printf("[|slip]");
-               goto out;
+               return (caplen);
        }
-       /*
-        * 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 -= SLIP_HDRLEN;
 
@@ -131,12 +104,9 @@ sl_bsdos_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
                sliplink_print(p, ip, length);
 #endif
 
-       ip_print((u_char *)ip, length);
+       ip_print(gndo, (u_char *)ip, length);
 
-       if (xflag)
-               default_print((u_char *)ip, caplen - SLIP_HDRLEN);
- out:
-       putchar('\n');
+       return (SLIP_HDRLEN);
 }
 
 static void
@@ -265,5 +235,5 @@ compressed_sl_print(const u_char *chdr, const struct ip *ip,
        hlen = IP_HL(ip);
        hlen += TH_OFF((struct tcphdr *)&((int32_t *)ip)[hlen]);
        lastlen[dir][lastconn] = length - (hlen << 2);
-       printf(" %d (%d)", lastlen[dir][lastconn], cp - chdr);
+       printf(" %d (%ld)", lastlen[dir][lastconn], (long)(cp - chdr));
 }