summaryrefslogtreecommitdiff
path: root/cfile.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2011-04-25 05:33:07 +0000
committerGuy Harris <guy@alum.mit.edu>2011-04-25 05:33:07 +0000
commit678be392f16cda70c04059717022d9b2d100825a (patch)
tree7de19db35225461d7a3d9418e48e78bb803382fc /cfile.h
parentd687ba04fdac0a694ecc87c440a77537888598f6 (diff)
downloadwireshark-678be392f16cda70c04059717022d9b2d100825a.tar.gz
Make the packet count an unsigned value, as frame numbers are unsigned.
Make the loops that scan through all the packets do so by frame number, to abstract away the "next" and "previous" pointers in the frame_data structure. Add a routine to cfile.c to map frame numbers to frame_data structures, and put in some special case handling so scanning forward or backward through the packets is O(N) rather than O(N^2). svn path=/trunk/; revision=36846
Diffstat (limited to 'cfile.h')
-rw-r--r--cfile.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/cfile.h b/cfile.h
index a54fddc0a0..06bdc4e120 100644
--- a/cfile.h
+++ b/cfile.h
@@ -55,11 +55,11 @@ typedef struct _capture_file {
gint64 f_datalen; /* Size of capture file data (uncompressed) */
guint16 cd_t; /* File type of capture file */
int lnk_t; /* Link-layer type with which to save capture */
- int count; /* Total number of frames */
- int displayed_count; /* Number of displayed frames */
- int marked_count; /* Number of marked frames */
- int ignored_count; /* Number of ignored frames */
- int ref_time_count; /* Number of time referenced frames */
+ guint32 count; /* Total number of frames */
+ guint32 displayed_count; /* Number of displayed frames */
+ guint32 marked_count; /* Number of marked frames */
+ guint32 ignored_count; /* Number of ignored frames */
+ guint32 ref_time_count; /* Number of time referenced frames */
gboolean drops_known; /* TRUE if we know how many packets were dropped */
guint32 drops; /* Dropped packets */
nstime_t elapsed_time; /* Elapsed time */
@@ -96,6 +96,9 @@ typedef struct _capture_file {
frame_data *plist_end; /* Last packet in list */
frame_data *first_displayed; /* First frame displayed */
frame_data *last_displayed; /* Last frame displayed */
+ /* The next two are used to speed up frame number -> frame data searches */
+ guint32 last_found_num; /* Frame number we last found */
+ frame_data *last_found_fd; /* The corresponding frame_data */
column_info cinfo; /* Column formatting information */
frame_data *current_frame; /* Frame data for current frame */
gint current_row; /* Row number for current frame */
@@ -107,4 +110,11 @@ void cap_file_init(capture_file *cf);
void cap_file_add_fdata(capture_file *cf, frame_data *fdata);
+/*
+ * Find the frame_data for the specified frame number.
+ * Do some caching to make this work reasonably fast for
+ * forward and backward sequential passes through the packets.
+ */
+extern frame_data *cap_file_find_fdata(capture_file *cf, guint32 num);
+
#endif /* cfile.h */