aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorJakub Zawadzki <darkjames-ws@darkjames.pl>2013-07-21 20:48:30 +0000
committerJakub Zawadzki <darkjames-ws@darkjames.pl>2013-07-21 20:48:30 +0000
commit5d52e1673483c6ed146ced3c7c086594c0a484ac (patch)
tree88ca0347d8bbadce7fd02036e5b5a2c34887ac31 /file.c
parenta66a717d46af19111dbde3dc9e72a2bd32734692 (diff)
Add helper function to epan_session which can be used to get absolute timestamp of given frame.
Remove ->prev_cap, for testing purpose also replace ->prev_dis with number of previously displayed frame number. This patch reduce size of frame_data by 8B (amd64) This is what (I think) was suggested by Guy in comment 13 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5821#c13) svn path=/trunk/; revision=50765
Diffstat (limited to 'file.c')
-rw-r--r--file.c40
1 files changed, 36 insertions, 4 deletions
diff --git a/file.c b/file.c
index c230326d33..b2de0194ad 100644
--- a/file.c
+++ b/file.c
@@ -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;
}