|
|
75b7d9 |
--- tcpslice-1.2a3.orig/search.c 2000-09-10 10:52:40.000000000 +0200
|
|
|
75b7d9 |
+++ tcpslice-1.2a3/search.c 2006-07-28 14:56:55.000000000 +0200
|
|
|
75b7d9 |
@@ -53,7 +53,7 @@
|
|
|
75b7d9 |
/* Size of a packet header in bytes; easier than typing the sizeof() all
|
|
|
75b7d9 |
* the time ...
|
|
|
75b7d9 |
*/
|
|
|
75b7d9 |
-#define PACKET_HDR_LEN (sizeof( struct pcap_pkthdr ))
|
|
|
75b7d9 |
+#define PACKET_HDR_LEN (sizeof( struct pcap_sf_pkthdr ))
|
|
|
75b7d9 |
|
|
|
75b7d9 |
extern int snaplen;
|
|
|
75b7d9 |
|
|
|
75b7d9 |
@@ -111,16 +111,24 @@
|
|
|
75b7d9 |
static void
|
|
|
75b7d9 |
extract_header( pcap_t *p, u_char *buf, struct pcap_pkthdr *hdr )
|
|
|
75b7d9 |
{
|
|
|
75b7d9 |
- memcpy((char *) hdr, (char *) buf, sizeof(struct pcap_pkthdr));
|
|
|
75b7d9 |
+ struct pcap_sf_pkthdr hdri;
|
|
|
75b7d9 |
+
|
|
|
75b7d9 |
+ memcpy((char *) &hdri, (char *) buf, sizeof(struct pcap_sf_pkthdr));
|
|
|
75b7d9 |
|
|
|
75b7d9 |
if ( pcap_is_swapped( p ) )
|
|
|
75b7d9 |
{
|
|
|
75b7d9 |
- hdr->ts.tv_sec = SWAPLONG(hdr->ts.tv_sec);
|
|
|
75b7d9 |
- hdr->ts.tv_usec = SWAPLONG(hdr->ts.tv_usec);
|
|
|
75b7d9 |
- hdr->len = SWAPLONG(hdr->len);
|
|
|
75b7d9 |
- hdr->caplen = SWAPLONG(hdr->caplen);
|
|
|
75b7d9 |
+ hdr->ts.tv_sec = SWAPLONG(hdri.ts.tv_sec);
|
|
|
75b7d9 |
+ hdr->ts.tv_usec = SWAPLONG(hdri.ts.tv_usec);
|
|
|
75b7d9 |
+ hdr->len = SWAPLONG(hdri.len);
|
|
|
75b7d9 |
+ hdr->caplen = SWAPLONG(hdri.caplen);
|
|
|
75b7d9 |
+ }
|
|
|
75b7d9 |
+ else
|
|
|
75b7d9 |
+ {
|
|
|
75b7d9 |
+ hdr->ts.tv_sec = hdri.ts.tv_sec;
|
|
|
75b7d9 |
+ hdr->ts.tv_usec = hdri.ts.tv_usec;
|
|
|
75b7d9 |
+ hdr->len = hdri.len;
|
|
|
75b7d9 |
+ hdr->caplen = hdri.caplen;
|
|
|
75b7d9 |
}
|
|
|
75b7d9 |
-
|
|
|
75b7d9 |
/*
|
|
|
75b7d9 |
* From bpf/libpcap/savefile.c:
|
|
|
75b7d9 |
*
|
|
|
75b7d9 |
--- tcpslice-1.2a3.orig/tcpslice.h 1995-11-02 00:40:53.000000000 +0100
|
|
|
75b7d9 |
+++ tcpslice-1.2a3/tcpslice.h 2006-07-28 14:56:55.000000000 +0200
|
|
|
75b7d9 |
@@ -20,6 +20,26 @@
|
|
|
75b7d9 |
*/
|
|
|
75b7d9 |
|
|
|
75b7d9 |
|
|
|
75b7d9 |
+#include <time.h>
|
|
|
75b7d9 |
+/* #include <net/bpf.h> */
|
|
|
75b7d9 |
+
|
|
|
75b7d9 |
+/*
|
|
|
75b7d9 |
+ * This is a timeval as stored in disk in a dumpfile.
|
|
|
75b7d9 |
+ * It has to use the same types everywhere, independent of the actual
|
|
|
75b7d9 |
+ * `struct timeval'
|
|
|
75b7d9 |
+ */
|
|
|
75b7d9 |
+
|
|
|
75b7d9 |
+struct pcap_timeval {
|
|
|
75b7d9 |
+ bpf_int32 tv_sec; /* seconds */
|
|
|
75b7d9 |
+ bpf_int32 tv_usec; /* microseconds */
|
|
|
75b7d9 |
+};
|
|
|
75b7d9 |
+
|
|
|
75b7d9 |
+struct pcap_sf_pkthdr {
|
|
|
75b7d9 |
+ struct pcap_timeval ts; /* time stamp */
|
|
|
75b7d9 |
+ bpf_u_int32 caplen; /* length of portion present */
|
|
|
75b7d9 |
+ bpf_u_int32 len; /* length this packet (off wire) */
|
|
|
75b7d9 |
+};
|
|
|
75b7d9 |
+
|
|
|
75b7d9 |
time_t gwtm2secs( struct tm *tm );
|
|
|
75b7d9 |
|
|
|
75b7d9 |
int sf_find_end( struct pcap *p, struct timeval *first_timestamp,
|