summaryrefslogtreecommitdiff
path: root/print-cip.c
diff options
context:
space:
mode:
authorguy <guy>2002-12-19 09:39:10 +0000
committerguy <guy>2002-12-19 09:39:10 +0000
commit4bec97f457e593be925e92fa28d73af6a57d81cf (patch)
treefcb53f0e4e3a5749d84858f128e7f6c7e352c23e /print-cip.c
parent60761585472a90c34d7de7bdf50475f0d7261b2d (diff)
downloadtcpdump-4bec97f457e593be925e92fa28d73af6a57d81cf.tar.gz
Hoist a bunch of stuff that should be done by all if_print routines into
tcpdump.c. Have if_print routines return the length of the link-layer header, so that the common code knows how to skip the link-layer header when printing the packet in hex/ASCII.
Diffstat (limited to 'print-cip.c')
-rw-r--r--print-cip.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/print-cip.c b/print-cip.c
index 27986986..9e656a10 100644
--- a/print-cip.c
+++ b/print-cip.c
@@ -22,7 +22,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.20 2002-12-18 08:53:20 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.21 2002-12-19 09:39:12 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -66,31 +66,21 @@ cip_print(int length)
* 'h->length' is the length of the packet off the wire, and 'h->caplen'
* is the number of bytes actually captured.
*/
-void
-cip_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
+u_int
+cip_if_print(const struct pcap_pkthdr *h, const u_char *p)
{
u_int caplen = h->caplen;
u_int length = h->len;
u_short extracted_ethertype;
- ++infodelay;
- ts_print(&h->ts);
-
if (memcmp(rfcllc, p, sizeof(rfcllc))==0 && caplen < RFC1483LLC_LEN) {
printf("[|cip]");
- goto out;
+ return (0);
}
if (eflag)
cip_print(length);
- /*
- * Some printers want to check that they're not walking off the
- * end of the packet.
- * Rather than pass it all the way down, we set this global.
- */
- snapend = p + caplen;
-
if (memcmp(rfcllc, p, sizeof(rfcllc)) == 0) {
/*
* LLC header is present. Try to print it & higher layers.
@@ -114,11 +104,5 @@ cip_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
ip_print(p, length);
}
- if (xflag)
- default_print(p, caplen);
- out:
- putchar('\n');
- --infodelay;
- if (infoprint)
- info(0);
+ return (0);
}