From 14d2f617c2da878c5b12d39f16d72b0f34672526 Mon Sep 17 00:00:00 2001 From: Kovarththanan Rajaratnam Date: Tue, 22 Sep 2009 14:23:20 +0000 Subject: Refactor frame_data_init() into frame_data_set_before_dissect() and frame_data_set_after_dissect(). svn path=/trunk/; revision=30066 --- epan/frame_data.c | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) (limited to 'epan/frame_data.c') diff --git a/epan/frame_data.c b/epan/frame_data.c index 29480b6d4b..7ccb82a464 100644 --- a/epan/frame_data.c +++ b/epan/frame_data.c @@ -189,20 +189,15 @@ frame_data_compare(const frame_data *fdata1, const frame_data *fdata2, int field void frame_data_init(frame_data *fdata, guint32 num, - nstime_t *elapsed_time, const struct wtap_pkthdr *phdr, gint64 offset, - guint32 *cum_bytes, - nstime_t *first_ts, - nstime_t *prev_dis_ts, - nstime_t *prev_cap_ts) + guint32 cum_bytes) { fdata->next = NULL; fdata->prev = NULL; fdata->pfd = NULL; fdata->num = num; fdata->pkt_len = phdr->len; - *cum_bytes += phdr->len; - fdata->cum_bytes = *cum_bytes; + fdata->cum_bytes = cum_bytes + phdr->len; fdata->cap_len = phdr->caplen; fdata->file_off = offset; /* To save some memory, we coarcese it into a gint8 */ @@ -220,7 +215,15 @@ frame_data_init(frame_data *fdata, guint32 num, fdata->col_text_len = NULL; fdata->col_text = NULL; #endif +} +void +frame_data_set_before_dissect(frame_data *fdata, + nstime_t *elapsed_time, + nstime_t *first_ts, + nstime_t *prev_dis_ts, + nstime_t *prev_cap_ts) +{ /* If we don't have the time stamp of the first packet in the capture, it's because this is the first packet. Save the time stamp of this packet as the time stamp of the first packet. */ @@ -270,6 +273,32 @@ frame_data_init(frame_data *fdata, guint32 num, *prev_cap_ts = fdata->abs_ts; } +void +frame_data_set_after_dissect(frame_data *fdata, + guint32 *cum_bytes, + nstime_t *prev_dis_ts) +{ + if(fdata->flags.passed_dfilter || fdata->flags.ref_time) + { + /* This frame either passed the display filter list or is marked as + a time reference frame. All time reference frames are displayed + even if they dont pass the display filter */ + if(fdata->flags.ref_time){ + /* if this was a TIME REF frame we should reset the cul bytes field */ + *cum_bytes = fdata->pkt_len; + fdata->cum_bytes = *cum_bytes; + } else { + /* increase cum_bytes with this packets length */ + *cum_bytes += fdata->pkt_len; + fdata->cum_bytes = *cum_bytes; + } + + /* Set the time of the previous displayed frame to the time of this + frame. */ + *prev_dis_ts = fdata->abs_ts; + } +} + void frame_data_cleanup(frame_data *fdata) { -- cgit v1.2.3