openbsd-ports/net/tcpslice/patches/patch-tcpslice_c
rui fae310b187 update tcpslice to 20070709
help and ok aanriot@
2007-07-13 08:16:16 +00:00

114 lines
4.2 KiB
Plaintext

$OpenBSD: patch-tcpslice_c,v 1.3 2007/07/13 08:16:16 rui Exp $
--- tcpslice.c.orig Thu May 31 19:18:59 2007
+++ tcpslice.c Thu May 31 19:20:16 2007
@@ -101,7 +101,7 @@ extern size_t strlcpy(char *, const char *, size_t);
struct state {
off_t start_pos, /* seek position corresponding to start time */
stop_pos; /* seek position corresponding to stop time */
- struct timeval
+ struct bpf_timeval
file_start_time, /* time of first pkt in file */
file_stop_time, /* time of last pkt in file */
last_pkt_time; /* time of most recently read pkt */
@@ -125,18 +125,18 @@ enum stamp_styles timestamp_style = TIMESTAMP_RAW;
int is_timestamp( char *str );
-struct timeval parse_time(char *time_string, struct timeval base_time);
+struct bpf_timeval parse_time(char *time_string, struct bpf_timeval base_time);
void fill_tm(char *time_string, int is_delta, struct tm *t, time_t *usecs_addr);
-struct timeval lowest_start_time(struct state *states, int numfiles);
-struct timeval latest_end_time(struct state *states, int numfiles);
+struct bpf_timeval lowest_start_time(struct state *states, int numfiles);
+struct bpf_timeval latest_end_time(struct state *states, int numfiles);
void get_next_packet(struct state *s);
struct state *open_files(char *filenames[], int numfiles);
static void extract_slice(struct state *states, int numfiles,
const char *write_file_name,
- struct timeval *start_time, struct timeval *stop_time,
+ struct bpf_timeval *start_time, struct bpf_timeval *stop_time,
int keep_dups, int relative_time_merge,
- struct timeval *base_time);
-char *timestamp_to_string(struct timeval *timestamp);
+ struct bpf_timeval *base_time);
+char *timestamp_to_string(struct bpf_timeval *timestamp);
void dump_times(struct state *states, int numfiles);
__dead void usage(void)__attribute__((volatile));
@@ -161,7 +161,7 @@ main(int argc, char **argv)
char *start_time_string = 0;
char *stop_time_string = 0;
const char *write_file_name = "-"; /* default is stdout */
- struct timeval first_time, start_time, stop_time;
+ struct bpf_timeval first_time, start_time, stop_time;
char ebuf[PCAP_ERRBUF_SIZE];
struct state *states;
@@ -306,12 +306,12 @@ int is_timestamp( char *str )
* containing the specified time.
*/
-struct timeval
-parse_time(char *time_string, struct timeval base_time)
+struct bpf_timeval
+parse_time(char *time_string, struct bpf_timeval base_time)
{
struct tm *bt = localtime((time_t *) &base_time.tv_sec);
struct tm t;
- struct timeval result;
+ struct bpf_timeval result;
time_t usecs = 0;
int is_delta = (time_string[0] == '+');
@@ -485,10 +485,10 @@ fill_tm(char *time_string, int is_delta, struct tm *t,
/* Of all the files, what is the lowest start time. */
-struct timeval
+struct bpf_timeval
lowest_start_time(struct state *states, int numfiles)
{
- struct timeval min_time = states->file_start_time;
+ struct bpf_timeval min_time = states->file_start_time;
while (numfiles--) {
if (sf_timestamp_less_than(&states->file_start_time, &min_time)) {
@@ -500,10 +500,10 @@ lowest_start_time(struct state *states, int numfiles)
}
/* Of all the files, what is the latest end time. */
-struct timeval
+struct bpf_timeval
latest_end_time(struct state *states, int numfiles)
{
- struct timeval max_time = states->file_start_time;
+ struct bpf_timeval max_time = states->file_start_time;
while (numfiles--) {
if (sf_timestamp_less_than(&max_time, &states->file_stop_time)) {
@@ -599,12 +599,12 @@ open_files(char *filenames[], int numfiles)
void
extract_slice(struct state *states, int numfiles, const char *write_file_name,
- struct timeval *start_time, struct timeval *stop_time,
+ struct bpf_timeval *start_time, struct bpf_timeval *stop_time,
int keep_dups, int relative_time_merge,
- struct timeval *base_time)
+ struct bpf_timeval *base_time)
{
struct state *s, *min_state;
- struct timeval temp1, temp2, relative_start, relative_stop;
+ struct bpf_timeval temp1, temp2, relative_start, relative_stop;
int i;
struct state *last_state; /* remember the last packet */
@@ -774,7 +774,7 @@ extract_slice(struct state *states, int numfiles, cons
*/
char *
-timestamp_to_string(struct timeval *timestamp)
+timestamp_to_string(struct bpf_timeval *timestamp)
{
struct tm *t;
#define NUM_BUFFERS 2