aboutsummaryrefslogtreecommitdiffstats
path: root/cfile.c
AgeCommit message (Collapse)AuthorFilesLines
2011-04-27Create a new frame_data_sequence data type; it represents a denseGuy Harris1-256/+12
sequence of frame_data structures, indexed by the frame number. Extract the relevant bits of the capture_file data structure and move them to the frame_data_sequence, and move the relevant code from cfile.c and tweak it to handle frame_data_sequence structures. Have a possibly-null pointer to a frame_data_sequence structure in the capture_file structure; if it's null, we aren't keeping a sequence of frame_data structures (we don't keep that sequence when we're doing one-pass processing in TShark). Nothing in libwireshark should care about a capture_file structure; get rid of some unnecessary includes of cfile.h. svn path=/trunk/; revision=36881
2011-04-25Store the frame_data structures in a tree, rather than a linked list. Guy Harris1-62/+222
This lets us get rid of the per-frame_data-structure prev and next pointers, saving memory (at least according to Activity Monitor's report of the virtual address space size on my Snow Leopard machine, it's a noticeable saving), and lets us look up frame_data structures by frame number in O(log2(number of frames)) time rather than O(number of frames) time. It seems to take more CPU time when reading in the file, but seems to go from "finished reading in all the packets" to "displaying the packets" faster and seems to free up the frame_data structures faster when closing the file. It *is* doing more copying, currently, as we now don't allocate the frame_data structure until after the packet has passed the read filter, so that might account for the additional CPU time. (Oh, and, for what it's worth, on an LP64 platform, a frame_data structure is exactly 128 bytes long. However, there's more stuff to remove, so the power-of-2 size is not guaranteed to remain, and it's not a power-of-2 size on an ILP32 platform.) It also means we don't need GLib 2.10 or later for the two-pass mode in TShark. It also means some code in the TCP dissector that was checking pinfo->fd->next to see if it's NULL, in order to see if this is the last packet in the file, no longer works, but that wasn't guaranteed to work anyway: we might be doing a one-pass read through the capture in TShark; we might be dissecting the frame while we're reading in the packets for the first time in Wireshark; we might be doing a live capture in Wireshark; in which case packets might be prematurely considered "the last packet". #if 0 the no-longer-working tests, pending figuring out a better way of doing it. svn path=/trunk/; revision=36849
2011-04-25Make the packet count an unsigned value, as frame numbers are unsigned.Guy Harris1-13/+83
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
2010-04-01Keep a copy of the interface description and capture filter around so thatGerald Combs1-0/+1
we can use it in the main window title during and after capture. Add a "-X" option for providing a description for stdin. svn path=/trunk/; revision=32357
2009-09-22Rename init_cap_file() to cap_file_init()Kovarththanan Rajaratnam1-1/+1
svn path=/trunk/; revision=30073
2009-09-22Introduce cap_file_add_fdata() and start using itKovarththanan Rajaratnam1-0/+12
svn path=/trunk/; revision=30071
2009-09-21Don't include header files that are not requiredKovarththanan Rajaratnam1-6/+0
svn path=/trunk/; revision=30050
2009-09-21Remove unused 'pstats' member in capture_fileKovarththanan Rajaratnam1-1/+1
svn path=/trunk/; revision=30048
2009-09-21Rename capture_file.plist to capture_file.plist_start to make it consistent ↵Kovarththanan Rajaratnam1-14/+14
with capture_file.plist_end svn path=/trunk/; revision=30047
2009-02-15Adjust some spacing ....Bill Meier1-3/+3
svn path=/trunk/; revision=27457
2008-09-30From jmmikkel@mit.edu (Bug 2895):Sake Blok1-0/+1
We might receive new packets while redissecting and don't want to dissect those before the packet-list is fully rebuilt. svn path=/trunk/; revision=26309
2007-01-01break out dfcode from the capture file structure and declare it locally ↵Ronnie Sahlberg1-1/+0
where it is needed. allocate and release the dfcode program as needed instead of having it hang around in the capture file structure. this will ensure that dfcode will not have longer than se scope lifetime in case we need that property of it later svn path=/trunk/; revision=20251
2006-05-21name changeRonnie Sahlberg1-2/+2
svn path=/trunk/; revision=18197
2005-02-06another two steps towards privilege seperation:Ulf Lamping1-4/+0
move another two capture related fields (iface and cfilter) from cfile to capture_opts also move the handling of capture related command line options from main.c to capture.c, that way a future privilege seperated capture program can use the same code to parse it's command line than Ethereal. It might be even possible to share this parser code even with Tethereal, didn't took a closer look at this. svn path=/trunk/; revision=13320
2005-02-04(some) redesign of capture data structures.Ulf Lamping1-1/+0
don't use global cfile at all but only an untpyed handle to call the cf_... functions in file.c move the save_file member from capture_file to capture_opts, as it's only used while capturing and while preparing it svn path=/trunk/; revision=13276
2005-02-03move capture_file_fd field from capture_file to capture_opts type, as this ↵Ulf Lamping1-1/+0
is the place where it should be svn path=/trunk/; revision=13268
2004-07-18Set the svn:eol-style property on all text files to "native", so thatGuy Harris1-1/+1
they have LF at the end of the line on UN*X and CR/LF on Windows; hopefully this means that if a CR/LF version is checked in on Windows, the CRs will be stripped so that they show up only when checked out on Windows, not on UN*X. svn path=/trunk/; revision=11400
2002-09-06Forgot to add two filesRonnie Sahlberg1-0/+65
svn path=/trunk/; revision=6204