openbsd-ports/net/tcpslice/patches/patch-tcpslice_c
nigel 9b8ade53c3 Update project moved to github
Ok sthen, ajacoutot
2014-10-13 22:06:25 +00:00

114 lines
4.2 KiB
Plaintext

$OpenBSD: patch-tcpslice_c,v 1.4 2014/10/13 22:06:25 nigel Exp $
--- tcpslice.c.orig Mon Apr 7 14:09:35 2014
+++ tcpslice.c Fri Oct 10 13:15:24 2014
@@ -99,7 +99,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 */
@@ -123,18 +123,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));
@@ -159,7 +159,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;
@@ -304,12 +304,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] == '+');
@@ -483,10 +483,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)) {
@@ -498,10 +498,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)) {
@@ -597,12 +597,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 */
@@ -772,7 +772,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