]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-raw.c
Handle very large -f files by rejecting them.
[tcpdump] / print-raw.c
index c8cba8f74394ba35c2381e1671d7e169ab9403d4..463aa41f64907d328da60c2c262787cfea336ce3 100644 (file)
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#ifndef lint
-static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-raw.c,v 1.37 2002-09-05 21:25:46 guy Exp $ (LBL)";
-#endif
+/* \summary: Raw IP printer */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include <tcpdump-stdinc.h>
-
-#include <pcap.h>
-#include <stdio.h>
-#include <string.h>
+#include <netdissect-stdinc.h>
 
-#include "addrtoname.h"
-#include "interface.h"
+#include "netdissect.h"
 
 /*
  * The DLT_RAW packet has no header. It contains a raw IP packet.
  */
 
-void
-raw_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
+u_int
+raw_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
 {
-       u_int length = h->len;
-       u_int caplen = h->caplen;
-
-       ++infodelay;
-       ts_print(&h->ts);
-
-       /*
-        * 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;
-
-       if (eflag)
-               printf("ip: ");
+       if (ndo->ndo_eflag)
+               ND_PRINT((ndo, "ip: "));
 
-       ipN_print(p, length);
+       ipN_print(ndo, p, h->len);
 
-       if (xflag)
-               default_print(p, caplen);
-       putchar('\n');
-       --infodelay;
-       if (infoprint)
-               info(0);
+       return (0);
 }