diff options
Diffstat (limited to 'tfshark.c')
-rw-r--r-- | tfshark.c | 57 |
1 files changed, 27 insertions, 30 deletions
@@ -87,12 +87,11 @@ #define INVALID_FILTER 2 #define OPEN_ERROR 2 +capture_file cfile; + static guint32 cum_bytes; -static const frame_data *ref; static frame_data ref_frame; -static frame_data *prev_dis; static frame_data prev_dis_frame; -static frame_data *prev_cap; static frame_data prev_cap_frame; static gboolean prefs_loaded = FALSE; @@ -144,8 +143,6 @@ static void read_failure_message(const char *filename, int err); static void write_failure_message(const char *filename, int err); static void failure_message_cont(const char *msg_format, va_list ap); -capture_file cfile; - static GHashTable *output_only_tables = NULL; #if 0 @@ -1028,14 +1025,14 @@ clean_exit: static const nstime_t * tfshark_get_frame_ts(capture_file *cf, guint32 frame_num) { - if (ref && ref->num == frame_num) - return &ref->abs_ts; + if (cf->ref && cf->ref->num == frame_num) + return &cf->ref->abs_ts; - if (prev_dis && prev_dis->num == frame_num) - return &prev_dis->abs_ts; + if (cf->prev_dis && cf->prev_dis->num == frame_num) + return &cf->prev_dis->abs_ts; - if (prev_cap && prev_cap->num == frame_num) - return &prev_cap->abs_ts; + if (cf->prev_cap && cf->prev_cap->num == frame_num) + return &cf->prev_cap->abs_ts; if (cf->frames) { frame_data *fd = frame_data_sequence_find(cf->frames, frame_num); @@ -1099,10 +1096,10 @@ process_packet_first_pass(capture_file *cf, epan_dissect_t *edt, prime_epan_dissect_with_postdissector_wanted_hfids(edt); frame_data_set_before_dissect(&fdlocal, &cf->elapsed_time, - &ref, prev_dis); - if (ref == &fdlocal) { + &cf->ref, cf->prev_dis); + if (cf->ref == &fdlocal) { ref_frame = fdlocal; - ref = &ref_frame; + cf->ref = &ref_frame; } epan_dissect_file_run(edt, whdr, file_tvbuff_new(&fdlocal, pd), &fdlocal, NULL); @@ -1114,7 +1111,7 @@ process_packet_first_pass(capture_file *cf, epan_dissect_t *edt, if (passed) { frame_data_set_after_dissect(&fdlocal, &cum_bytes); - prev_cap = prev_dis = frame_data_sequence_add(cf->frames, &fdlocal); + cf->prev_cap = cf->prev_dis = frame_data_sequence_add(cf->frames, &fdlocal); /* If we're not doing dissection then there won't be any dependent frames. * More importantly, edt.pi.dependent_frames won't be initialized because @@ -1178,10 +1175,10 @@ process_packet_second_pass(capture_file *cf, epan_dissect_t *edt, cinfo = NULL; frame_data_set_before_dissect(fdata, &cf->elapsed_time, - &ref, prev_dis); - if (ref == fdata) { + &cf->ref, cf->prev_dis); + if (cf->ref == fdata) { ref_frame = *fdata; - ref = &ref_frame; + cf->ref = &ref_frame; } epan_dissect_file_run_with_taps(edt, phdr, file_tvbuff_new_buffer(fdata, buf), fdata, cinfo); @@ -1210,9 +1207,9 @@ process_packet_second_pass(capture_file *cf, epan_dissect_t *edt, return FALSE; } } - prev_dis = fdata; + cf->prev_dis = fdata; } - prev_cap = fdata; + cf->prev_cap = fdata; if (edt) { epan_dissect_reset(edt); @@ -1377,8 +1374,8 @@ process_file(capture_file *cf, int max_packet_count, gint64 max_byte_count) * don't need after the sequential run-through of the packets. */ postseq_cleanup_all_protocols(); - prev_dis = NULL; - prev_cap = NULL; + cf->prev_dis = NULL; + cf->prev_cap = NULL; ws_buffer_init(&buf, 1500); if (do_dissection) { @@ -1621,10 +1618,10 @@ process_packet_single_pass(capture_file *cf, epan_dissect_t *edt, gint64 offset, cinfo = NULL; frame_data_set_before_dissect(&fdata, &cf->elapsed_time, - &ref, prev_dis); - if (ref == &fdata) { + &cf->ref, cf->prev_dis); + if (cf->ref == &fdata) { ref_frame = fdata; - ref = &ref_frame; + cf->ref = &ref_frame; } epan_dissect_file_run_with_taps(edt, whdr, frame_tvbuff_new(&fdata, pd), &fdata, cinfo); @@ -1657,11 +1654,11 @@ process_packet_single_pass(capture_file *cf, epan_dissect_t *edt, gint64 offset, /* this must be set after print_packet() [bug #8160] */ prev_dis_frame = fdata; - prev_dis = &prev_dis_frame; + cf->prev_dis = &prev_dis_frame; } prev_cap_frame = fdata; - prev_cap = &prev_cap_frame; + cf->prev_cap = &prev_cap_frame; if (edt) { epan_dissect_reset(edt); @@ -2090,9 +2087,9 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp cf->drops = 0; cf->snap = 0; /**** XXX - DOESN'T WORK RIGHT NOW!!!! */ nstime_set_zero(&cf->elapsed_time); - ref = NULL; - prev_dis = NULL; - prev_cap = NULL; + cf->ref = NULL; + cf->prev_dis = NULL; + cf->prev_cap = NULL; cf->state = FILE_READ_IN_PROGRESS; |