aboutsummaryrefslogtreecommitdiffstats
path: root/cfile.c
AgeCommit message (Collapse)AuthorFilesLines
2011-04-27Create a new frame_data_sequence data type; it represents a denseguy1-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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@36881 f5534014-38df-0310-8fa8-9805f1628bb7
2011-04-25Store the frame_data structures in a tree, rather than a linked list. guy1-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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@36849 f5534014-38df-0310-8fa8-9805f1628bb7
2011-04-25Make the packet count an unsigned value, as frame numbers are unsigned.guy1-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). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@36846 f5534014-38df-0310-8fa8-9805f1628bb7
2010-04-01Keep a copy of the interface description and capture filter around so thatgerald1-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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@32357 f5534014-38df-0310-8fa8-9805f1628bb7
2009-09-22Rename init_cap_file() to cap_file_init()krj1-1/+1
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@30073 f5534014-38df-0310-8fa8-9805f1628bb7
2009-09-22Introduce cap_file_add_fdata() and start using itkrj1-0/+12
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@30071 f5534014-38df-0310-8fa8-9805f1628bb7
2009-09-21Don't include header files that are not requiredkrj1-6/+0
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@30050 f5534014-38df-0310-8fa8-9805f1628bb7
2009-09-21Remove unused 'pstats' member in capture_filekrj1-1/+1
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@30048 f5534014-38df-0310-8fa8-9805f1628bb7
2009-09-21Rename capture_file.plist to capture_file.plist_start to make it consistent ↵krj1-14/+14
with capture_file.plist_end git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@30047 f5534014-38df-0310-8fa8-9805f1628bb7
2009-02-15Adjust some spacing ....wmeier1-3/+3
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27457 f5534014-38df-0310-8fa8-9805f1628bb7
2008-09-30From jmmikkel@mit.edu (Bug 2895):sake1-0/+1
We might receive new packets while redissecting and don't want to dissect those before the packet-list is fully rebuilt. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@26309 f5534014-38df-0310-8fa8-9805f1628bb7
2007-01-01break out dfcode from the capture file structure and declare it locally ↵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 git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20251 f5534014-38df-0310-8fa8-9805f1628bb7
2006-05-21name changesahlberg1-2/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@18197 f5534014-38df-0310-8fa8-9805f1628bb7
2005-02-06another two steps towards privilege seperation:ulfl1-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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@13320 f5534014-38df-0310-8fa8-9805f1628bb7
2005-02-04(some) redesign of capture data structures.ulfl1-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 git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@13276 f5534014-38df-0310-8fa8-9805f1628bb7
2005-02-03move capture_file_fd field from capture_file to capture_opts type, as this ↵ulfl1-1/+0
is the place where it should be git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@13268 f5534014-38df-0310-8fa8-9805f1628bb7
2004-07-18Set the svn:eol-style property on all text files to "native", so thatguy1-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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@11400 f5534014-38df-0310-8fa8-9805f1628bb7
2002-09-06Forgot to add two filessahlberg1-0/+65
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@6204 f5534014-38df-0310-8fa8-9805f1628bb7