updated on Thu Jan 19 00:16:31 UTC 2012
[aur-mirror.git] / tcpslice / tcpslice-1.2a3-time.patch
blobc59448d2362755e04da5737c97271ac8f2401ee7
1 --- tcpslice-1.2a3.orig/search.c 2000-09-10 10:52:40.000000000 +0200
2 +++ tcpslice-1.2a3/search.c 2006-07-28 14:56:55.000000000 +0200
3 @@ -53,7 +53,7 @@
4 /* Size of a packet header in bytes; easier than typing the sizeof() all
5 * the time ...
6 */
7 -#define PACKET_HDR_LEN (sizeof( struct pcap_pkthdr ))
8 +#define PACKET_HDR_LEN (sizeof( struct pcap_sf_pkthdr ))
10 extern int snaplen;
12 @@ -111,16 +111,24 @@
13 static void
14 extract_header( pcap_t *p, u_char *buf, struct pcap_pkthdr *hdr )
16 - memcpy((char *) hdr, (char *) buf, sizeof(struct pcap_pkthdr));
17 + struct pcap_sf_pkthdr hdri;
19 + memcpy((char *) &hdri, (char *) buf, sizeof(struct pcap_sf_pkthdr));
21 if ( pcap_is_swapped( p ) )
23 - hdr->ts.tv_sec = SWAPLONG(hdr->ts.tv_sec);
24 - hdr->ts.tv_usec = SWAPLONG(hdr->ts.tv_usec);
25 - hdr->len = SWAPLONG(hdr->len);
26 - hdr->caplen = SWAPLONG(hdr->caplen);
27 + hdr->ts.tv_sec = SWAPLONG(hdri.ts.tv_sec);
28 + hdr->ts.tv_usec = SWAPLONG(hdri.ts.tv_usec);
29 + hdr->len = SWAPLONG(hdri.len);
30 + hdr->caplen = SWAPLONG(hdri.caplen);
31 + }
32 + else
33 + {
34 + hdr->ts.tv_sec = hdri.ts.tv_sec;
35 + hdr->ts.tv_usec = hdri.ts.tv_usec;
36 + hdr->len = hdri.len;
37 + hdr->caplen = hdri.caplen;
41 * From bpf/libpcap/savefile.c:
43 --- tcpslice-1.2a3.orig/tcpslice.h 1995-11-02 00:40:53.000000000 +0100
44 +++ tcpslice-1.2a3/tcpslice.h 2006-07-28 14:56:55.000000000 +0200
45 @@ -20,6 +20,26 @@
49 +#include <time.h>
50 +/* #include <net/bpf.h> */
52 +/*
53 + * This is a timeval as stored in disk in a dumpfile.
54 + * It has to use the same types everywhere, independent of the actual
55 + * `struct timeval'
56 + */
58 +struct pcap_timeval {
59 + bpf_int32 tv_sec; /* seconds */
60 + bpf_int32 tv_usec; /* microseconds */
61 +};
63 +struct pcap_sf_pkthdr {
64 + struct pcap_timeval ts; /* time stamp */
65 + bpf_u_int32 caplen; /* length of portion present */
66 + bpf_u_int32 len; /* length this packet (off wire) */
67 +};
69 time_t gwtm2secs( struct tm *tm );
71 int sf_find_end( struct pcap *p, struct timeval *first_timestamp,