openbsd-ports/net/tcpslice/patches/patch-search_c
naddy ba77515b9f deal with the timeval -> bpf_timeval change
testing by pvalchev@, wilfried@
2001-10-18 15:12:40 +00:00

81 lines
2.7 KiB
Plaintext

$OpenBSD: patch-search_c,v 1.1 2001/10/18 15:12:40 naddy Exp $
--- search.c.orig Fri Oct 12 18:21:37 2001
+++ search.c Fri Oct 12 18:22:45 2001
@@ -279,8 +279,8 @@ find_header( pcap_t *p, u_char *buf, int
* present in the dump file.
*/
int
-sf_find_end( pcap_t *p, struct timeval *first_timestamp,
- struct timeval *last_timestamp )
+sf_find_end( pcap_t *p, struct bpf_timeval *first_timestamp,
+ struct bpf_timeval *last_timestamp )
{
u_int32_t first_time = first_timestamp->tv_sec;
int num_bytes;
@@ -373,7 +373,7 @@ sf_find_end( pcap_t *p, struct timeval *
/* Takes two timeval's and returns the difference, tv2 - tv1, as a double. */
static double
-timeval_diff( struct timeval *tv1, struct timeval *tv2 )
+timeval_diff( struct bpf_timeval *tv1, struct bpf_timeval *tv2 )
{
double result = (tv2->tv_sec - tv1->tv_sec);
result += (tv2->tv_usec - tv1->tv_usec) / 1000000.0;
@@ -385,7 +385,7 @@ timeval_diff( struct timeval *tv1, struc
/* Returns true if timestamp t1 is chronologically less than timestamp t2. */
int
-sf_timestamp_less_than( struct timeval *t1, struct timeval *t2 )
+sf_timestamp_less_than( struct bpf_timeval *t1, struct bpf_timeval *t2 )
{
return t1->tv_sec < t2->tv_sec ||
(t1->tv_sec == t2->tv_sec &&
@@ -399,9 +399,9 @@ sf_timestamp_less_than( struct timeval *
*/
static off_t
-interpolated_position( struct timeval *min_time, off_t min_pos,
- struct timeval *max_time, off_t max_pos,
- struct timeval *desired_time )
+interpolated_position( struct bpf_timeval *min_time, off_t min_pos,
+ struct bpf_timeval *max_time, off_t max_pos,
+ struct bpf_timeval *desired_time )
{
double full_span = timeval_diff( max_time, min_time );
double desired_span = timeval_diff( desired_time, min_time );
@@ -422,7 +422,7 @@ interpolated_position( struct timeval *m
*/
static int
-read_up_to( pcap_t *p, struct timeval *desired_time )
+read_up_to( pcap_t *p, struct bpf_timeval *desired_time )
{
struct pcap_pkthdr hdr;
const u_char *buf;
@@ -431,7 +431,7 @@ read_up_to( pcap_t *p, struct timeval *d
for ( ; ; )
{
- struct timeval *timestamp;
+ struct bpf_timeval *timestamp;
pos = ftell( pcap_file( p ) );
buf = pcap_next( p, &hdr );
@@ -480,12 +480,12 @@ read_up_to( pcap_t *p, struct timeval *d
int
sf_find_packet( pcap_t *p,
- struct timeval *min_time, off_t min_pos,
- struct timeval *max_time, off_t max_pos,
- struct timeval *desired_time )
+ struct bpf_timeval *min_time, off_t min_pos,
+ struct bpf_timeval *max_time, off_t max_pos,
+ struct bpf_timeval *desired_time )
{
int status = 1;
- struct timeval min_time_copy, max_time_copy;
+ struct bpf_timeval min_time_copy, max_time_copy;
u_int num_bytes = MAX_BYTES_FOR_DEFINITE_HEADER;
int num_bytes_read;
off_t desired_pos, present_pos;