diff options
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 40 |
1 files changed, 36 insertions, 4 deletions
@@ -46,6 +46,7 @@ #include <wiretap/merge.h> +#include <epan/epan-int.h> #include <epan/epan.h> #include <epan/column.h> #include <epan/packet.h> @@ -302,6 +303,37 @@ static void compute_elapsed(GTimeVal *start_time) computed_elapsed = (gulong) (delta_time / 1000); /* ms */ } +const nstime_t * +ws_get_frame_ts(void *data, guint32 frame_num) +{ + capture_file *cf = (capture_file *) data; + + if (prev_dis && prev_dis->num == frame_num) + return &prev_dis->abs_ts; + + if (prev_cap && prev_cap->num == frame_num) + return &prev_cap->abs_ts; + + if (cf->frames) { + frame_data *fd = frame_data_sequence_find(cf->frames, frame_num); + + return (fd) ? &fd->abs_ts : NULL; + } + + return NULL; +} + +epan_t * +ws_epan_new(capture_file *cf) +{ + epan_t *epan = epan_new(); + + epan->data = cf; + epan->get_frame_ts = ws_get_frame_ts; + + return epan; +} + cf_status_t cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err) { @@ -322,7 +354,7 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err) /* Create new epan session for dissection. */ epan_free(cf->epan); - cf->epan = epan_new(); + cf->epan = ws_epan_new(cf); /* We're about to start reading the file. */ cf->state = FILE_READ_IN_PROGRESS; @@ -1123,7 +1155,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf, gint row = -1; frame_data_set_before_dissect(fdata, &cf->elapsed_time, - &first_ts, prev_dis, prev_cap); + &first_ts, prev_dis); prev_cap = fdata; /* Dissect the frame. */ @@ -1821,7 +1853,7 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item, gb /* 'reset' dissection session */ epan_free(cf->epan); - cf->epan = epan_new(); + cf->epan = ws_epan_new(cf); /* We need to redissect the packets so we have to discard our old * packet list store. */ @@ -2125,7 +2157,7 @@ ref_time_packets(capture_file *cf) /* If this frame is displayed, get the time elapsed between the previous displayed packet and this packet. */ if ( fdata->flags.passed_dfilter ) { - fdata->prev_dis = prev_dis; + fdata->prev_dis_num = prev_dis->num; prev_dis = fdata; } |