diff options
author | Kovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com> | 2009-09-22 14:41:30 +0000 |
---|---|---|
committer | Kovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com> | 2009-09-22 14:41:30 +0000 |
commit | 627a7c1f47b3e49fb2d55d09acd930c1cadea61f (patch) | |
tree | 956365349792fd2737df632fa3fa7e3b12a7e045 | |
parent | 14d2f617c2da878c5b12d39f16d72b0f34672526 (diff) | |
download | wireshark-627a7c1f47b3e49fb2d55d09acd930c1cadea61f.tar.gz wireshark-627a7c1f47b3e49fb2d55d09acd930c1cadea61f.tar.bz2 wireshark-627a7c1f47b3e49fb2d55d09acd930c1cadea61f.zip |
Switch Wireshark GUI (file.c) over to using frame_data.c
svn path=/trunk/; revision=30067
-rw-r--r-- | epan/frame_data.c | 11 | ||||
-rw-r--r-- | file.c | 87 |
2 files changed, 10 insertions, 88 deletions
diff --git a/epan/frame_data.c b/epan/frame_data.c index 7ccb82a464..768dc4776e 100644 --- a/epan/frame_data.c +++ b/epan/frame_data.c @@ -197,7 +197,7 @@ frame_data_init(frame_data *fdata, guint32 num, fdata->pfd = NULL; fdata->num = num; fdata->pkt_len = phdr->len; - fdata->cum_bytes = cum_bytes + phdr->len; + 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 */ @@ -227,15 +227,13 @@ frame_data_set_before_dissect(frame_data *fdata, /* 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. */ - if (nstime_is_unset(first_ts)) { + if (nstime_is_unset(first_ts)) *first_ts = fdata->abs_ts; - } /* if this frames is marked as a reference time frame, reset firstsec and firstusec to this frame */ - if(fdata->flags.ref_time){ + if(fdata->flags.ref_time) *first_ts = fdata->abs_ts; - } /* If we don't have the time stamp of the previous displayed packet, it's because this is the first packet that's being displayed. Save the time @@ -248,9 +246,8 @@ frame_data_set_before_dissect(frame_data *fdata, it's because this is the first packet. Save the time stamp of this packet as the time stamp of the previous captured packet. */ - if (nstime_is_unset(prev_cap_ts)) { + if (nstime_is_unset(prev_cap_ts)) *prev_cap_ts = fdata->abs_ts; - } /* Get the time elapsed between the first packet and this packet. */ nstime_delta(&fdata->rel_ts, &fdata->abs_ts, first_ts); @@ -1083,54 +1083,8 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf, cinfo = (tap_flags & TL_REQUIRES_COLUMNS) ? &cf->cinfo : NULL; - /* 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. */ - if (nstime_is_unset(&first_ts)) { - first_ts = fdata->abs_ts; - } - - /* if this frames is marked as a reference time frame, reset - firstsec and firstusec to this frame */ - if(fdata->flags.ref_time){ - first_ts = fdata->abs_ts; - } - - /* If we don't have the time stamp of the previous displayed packet, - it's because this is the first displayed packet. Save the time - stamp of this packet as the time stamp of the previous displayed - packet. */ - if (nstime_is_unset(&prev_dis_ts)) { - prev_dis_ts = fdata->abs_ts; - } - - /* If we don't have the time stamp of the previous captured packet, - it's because this is the first packet. Save the time - stamp of this packet as the time stamp of the previous captured - packet. */ - if (nstime_is_unset(&prev_cap_ts)) { - prev_cap_ts = fdata->abs_ts; - } - - /* Get the time elapsed between the first packet and this packet. */ - nstime_delta(&fdata->rel_ts, &fdata->abs_ts, &first_ts); - - /* If it's greater than the current elapsed time, set the elapsed time - to it (we check for "greater than" so as not to be confused by - time moving backwards). */ - if ((gint32)cf->elapsed_time.secs < fdata->rel_ts.secs - || ((gint32)cf->elapsed_time.secs == fdata->rel_ts.secs && (gint32)cf->elapsed_time.nsecs < fdata->rel_ts.nsecs)) { - cf->elapsed_time = fdata->rel_ts; - } - - /* Get the time elapsed between the previous displayed packet and - this packet. */ - nstime_delta(&fdata->del_dis_ts, &fdata->abs_ts, &prev_dis_ts); - - /* Get the time elapsed between the previous captured packet and - this packet. */ - nstime_delta(&fdata->del_cap_ts, &fdata->abs_ts, &prev_cap_ts); - prev_cap_ts = fdata->abs_ts; + frame_data_set_before_dissect(fdata, &cf->elapsed_time, + &first_ts, &prev_dis_ts, &prev_cap_ts); /* If either + we have a display filter and are re-applying it; @@ -1173,22 +1127,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf, 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; + frame_data_set_after_dissect(fdata, &cum_bytes, &prev_dis_ts); /* If we haven't yet seen the first frame, this is it. @@ -1402,23 +1341,9 @@ read_packet(capture_file *cf, dfilter_t *dfcode, #else fdata = g_mem_chunk_alloc(cf->plist_chunk); #endif - fdata->num = cf->count; - fdata->next = NULL; - fdata->prev = NULL; - fdata->pfd = NULL; - fdata->pkt_len = phdr->len; - fdata->cap_len = phdr->caplen; - fdata->file_off = offset; - /* To save some memory, we coarcese it into a gint8 */ - g_assert(phdr->pkt_encap <= G_MAXINT8); - fdata->lnk_t = (gint8) phdr->pkt_encap; - fdata->abs_ts.secs = phdr->ts.secs; - fdata->abs_ts.nsecs = phdr->ts.nsecs; - fdata->flags.encoding = CHAR_ASCII; - fdata->flags.visited = 0; - fdata->flags.marked = 0; - fdata->flags.ref_time = 0; - fdata->color_filter = NULL; + + frame_data_init(fdata, cf->count, phdr, offset, cum_bytes); + #ifdef NEW_PACKET_LIST fdata->col_text_len = se_alloc0(sizeof(fdata->col_text_len) * (cf->cinfo.num_cols)); fdata->col_text = se_alloc0(sizeof(fdata->col_text) * (cf->cinfo.num_cols)); |