Commit Graph

104 Commits

Author SHA1 Message Date
Gerald Combs 71ed773862 Add a capture_file * element to packet_range_t and pass it explicitly in
packet_range_init(). Get rid of global cfile references in
packet-range.c. C++-ize packet-range.h. Shuffle some includes around.

svn path=/trunk/; revision=45333
2012-10-05 18:52:42 +00:00
Jakub Zawadzki 99e665dcd4 Revert r45183:r45184
r45182 was good fix, but updae frames_count when redissecting.

svn path=/trunk/; revision=45189
2012-09-28 10:08:17 +00:00
Jakub Zawadzki bd26485af1 Missing part of r45183
svn path=/trunk/; revision=45184
2012-09-27 21:20:27 +00:00
Jakub Zawadzki 78019edc99 cinfo.columns_changed is only used by ui/gtk, move it to cfile structure.
svn path=/trunk/; revision=44750
2012-09-03 15:12:49 +00:00
Gerald Combs 0da59a0058 Pass {delayed_}create_progress_dlg a pointer the top level window
so that we can properly associate a widget with create, update, and
destroy events. Only used by Qt so far but it should be easy enough to
add to GTK+.

Rename ui/qt/progress_dialog.{h,cpp} to progress_bar.{h,cpp}. Show a
progress bar in the status bar of the main window instead of creating
a separate dialog. Note that we still need to add a "cancel" mechanism
and display the task and item titles somewhere.

Thus began the War Against Gratuitous Dialogs.

svn path=/trunk/; revision=43833
2012-07-19 21:49:52 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Guy Harris 06474b4330 If the file has an SHB comment or any packet comments, and the user
tries to do "Save As" in a format for which we don't support comments
(currently, we only support them for pcap-ng), ask whether they want to
discard the comments and save anyway or, *if* the file can be saved in a
format for which we *do* support comments, they want to save the file in
some other format.

Keep a count of packet comments so that we don't have to scan all the
frame_data structures to determine whether we have any comments.

svn path=/trunk/; revision=43392
2012-06-20 01:11:01 +00:00
Guy Harris d1128f6433 For a capture file, keep an array of all encapsulation types seen.
Show all of them in the summary dialog; we will be using it in the
future to figure out what capture file formats we can write to (just
because a capture file format supports per-packet encapsulations, that
doesn't mean that it supports *all possible* encapsulations).

svn path=/trunk/; revision=43278
2012-06-15 23:54:05 +00:00
Guy Harris cf6d9841e3 Keep track, in Wiretap, of whether the file is compressed, and provide
an API to fetch that.

When doing "Save" on a compressed file, write it out compressed.

In the Statistics -> Summary dialog and in capinfos, report whether the
file is gzip-compressed.

svn path=/trunk/; revision=42818
2012-05-24 05:05:29 +00:00
Guy Harris 4a9b825c49 Change the "user_saved" member of a capture_file structure to
"unsaved_changes", and have it be TRUE iff changes have been made to the
file since it was read - *not* if it's a temporary file from a live
capture.

Check the "is_tempfile" member, and the "unsaved_changes" member, when
appropriate.

Just have a set_toolbar_for_capture_file() routine that updates the
"save", "close", and "reload" toolbar as appropriate, given a
capture_file structure - absorb the function of
set_toolbar_for_unsaved_capture_file() into it.

svn path=/trunk/; revision=42721
2012-05-20 08:56:06 +00:00
Guy Harris 15a88e695f Update comment - now that we support adding comments to files, a capture
that we've saved to a particular path, or that we've read in, could
still be unsaved if we add comments to it.

svn path=/trunk/; revision=41321
2012-03-02 11:41:50 +00:00
Gerald Combs 6b178bd415 Add 'extern "C"' wrappers and #include guards to various header files.
svn path=/trunk/; revision=40321
2011-12-29 00:08:47 +00:00
Jakub Zawadzki 63981c8b35 Packet editor: support for saving changed frames.
svn path=/trunk/; revision=37099
2011-05-12 19:47:49 +00:00
Guy Harris c9b9dd690b Create a new frame_data_sequence data type; it represents a dense
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-27 02:54:44 +00:00
Guy Harris 71b31d92fc Store the frame_data structures in a tree, rather than a linked list.
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-25 19:01:05 +00:00
Guy Harris 678be392f1 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
2011-04-25 05:33:07 +00:00
Anders Broman b7527dd063 From Cal Turney:
Bug 5621 - With String in Packet details searches, highlight row in tree 
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5621

svn path=/trunk/; revision=35718
2011-01-31 12:19:15 +00:00
Stephen Fisher 347d0a77bf From Cal Turney via enhancement bug #5587: In hex or string searches of the
packet data highlight the target rather than the entire field.


svn path=/trunk/; revision=35584
2011-01-19 18:21:21 +00:00
Anders Broman 46cd4a8507 From Cal Turney:
1. Restore the functionality of <Ctrl>A and <Ctrl>X to the filter textbox.  
2. Assign intuitive shortcuts without consuming any new shortcut letters.  
3. Add 'Un-Time Reference All Packets' to the menu.
4. Disallow the marking or ignoring of all packets in the capture.  
5. Make the Mark/Ignore/Time Reference-related menu items context sensitive. 
6. Add 'ref_time_count' to the capture_file structure
7. Utilize marked/ignored/ref_time_count vars to prevent needless looping thru
   the entire packet list by exiting the loop when it becomes zero.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5115

svn path=/trunk/; revision=33817
2010-08-16 18:17:45 +00:00
Guy Harris 2a328da4ef Instead of using a Boolean for the search direction, use an enum, so
that you can tell from examination whether the search is forward or
backward.

Make the cf_find_packet routines take the direction as an explicit
argument, rather than, in the cases where you don't want to permanently
set the direction, saving the direction in the capture_file structure,
changing it, doing the search, and restoring the saved direction.  Give
more information in the Doxygen comments for those routines.

Add a cf_find_packet_dfilter_string() routine, which takes a filter
string rather than a compiled filter as an argument.  Replace
find_previous_next_frame_with_filter() with it.

Have cf_read_frame_r() and cf_read_frame() pop up the error dialog if
the read fails, rather than leaving that up to its caller.  That lets us
eliminate cf_read_error_message(), by swallowing its code into
cf_read_frame_r().  Add Doxygen comments for cf_read_frame_r() and
cf_read_frame().

Don't have find_packet() read the packet before calling the callback
routine; leave that up to the callback routine.

Add cf_find_packet_marked(), to find the next or previous marked packet,
and cf_find_packet_time_reference(), to find the next or previous time
reference packet.  Those routines do *not* need to read the packet data
to see if it matches; that lets them run much faster.

Clean up indentation.

svn path=/trunk/; revision=33791
2010-08-13 07:39:46 +00:00
Gerald Combs cc5d7670bd Keep a copy of the interface description and capture filter around so that
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
2010-04-01 21:55:01 +00:00
Stig Bjørlykke 47be3577a7 Introduce "Ignore Packet" in the packet list.
This will remove the package from the dissection functions without
removing it from the capture file.

svn path=/trunk/; revision=31287
2009-12-17 01:18:14 +00:00
Kovarththanan Rajaratnam 0ee2b7754d Rename init_cap_file() to cap_file_init()
svn path=/trunk/; revision=30073
2009-09-22 16:53:11 +00:00
Kovarththanan Rajaratnam 9398b679e8 Introduce cap_file_add_fdata() and start using it
svn path=/trunk/; revision=30071
2009-09-22 16:39:48 +00:00
Kovarththanan Rajaratnam 702b6ea7d0 Remove unused 'vers' member in capture_file
svn path=/trunk/; revision=30049
2009-09-21 18:30:15 +00:00
Kovarththanan Rajaratnam 8b62ba243b Remove unused 'pstats' member in capture_file
svn path=/trunk/; revision=30048
2009-09-21 18:20:01 +00:00
Kovarththanan Rajaratnam 7ca137e294 Rename capture_file.plist to capture_file.plist_start to make it consistent with capture_file.plist_end
svn path=/trunk/; revision=30047
2009-09-21 18:09:19 +00:00
Anders Broman 2e29868357 Use g_slice if glib >=2.10
svn path=/trunk/; revision=29187
2009-07-24 13:50:57 +00:00
Bill Meier 6c47f763a3 Adjust some spacing ....
svn path=/trunk/; revision=27457
2009-02-15 21:55:03 +00:00
Stig Bjørlykke 5498ec1dce Optimized finding current row from cfile.current_frame.
svn path=/trunk/; revision=26804
2008-11-18 14:50:51 +00:00
Sake Blok 2ce22e6bca From jmmikkel@mit.edu (Bug 2895):
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
2008-09-30 15:45:20 +00:00
Ronnie Sahlberg 1370d2f738 break out dfcode from the capture file structure and declare it locally 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
2007-01-01 10:23:37 +00:00
Stephen Fisher 90303fb17f New feature to automatically highlight the field found when doing a find.
This works for both string and hex searches.  This resolves feature request
bug #776.


svn path=/trunk/; revision=19897
2006-11-14 22:35:22 +00:00
Ulf Lamping 59d6c8ea33 change all file offsets from long to gint64 so we can - theoretically - handle files > 2GB correct.
Please distclean Win32 builds!

svn path=/trunk/; revision=19814
2006-11-05 22:46:44 +00:00
Ronnie Sahlberg 89f022b12b name change
svn path=/trunk/; revision=18197
2006-05-21 05:12:17 +00:00
Ulf Lamping 723c80ea90 timestamp display precision:
- automatic adjustment depending on file format
- manual adjustment through menu items

save the setting in the recent file

svn path=/trunk/; revision=15534
2005-08-25 21:29:54 +00:00
Ulf Lamping 6f43fbb2f0 EVERYTHING IN THE BUILDBOT IS GOING TO BE RED!!! Sorry!
I've done more than a day to change the timestamp resolution from microseconds to nanoseconds. As I really don't want to loose those changes, I'm going to check in the changes I've done so far. Hopefully someone else will give me a helping hand with the things left ...

What's done: I've changed the timestamp resolution from usec to nsec in almost any place in the sources. I've changed parts of the implementation in nstime.s/.h and a lot of places elsewhere.

As I don't understand the editcap source (well, I'm maybe just too tired right now), hopefully someone else might be able to fix this soon.

Doing all those changes, we get native nanosecond timestamp resolution in Ethereal. After fixing all the remaining issues, I'll take a look how to display this in a convenient way...

As I've also changed the wiretap timestamp resolution from usec to nsec we might want to change the wiretap version number...

svn path=/trunk/; revision=15520
2005-08-24 21:31:56 +00:00
Guy Harris 53b54d11ed Get rid of f_len field in capture_file structure - we can just keep
the length locally. within cf_read().

svn path=/trunk/; revision=15454
2005-08-20 02:14:01 +00:00
Guy Harris 38ec1644e6 Add APIs to Wiretap to return the file of the size as supplied by the OS
(so if the file's gzipped, it's *NOT* the size of the file after
uncompressing), and an approximation of the amount of that data read
sequentially so far.

Use those for various progress bars and the like.

Make the fstat() in the Ascend trace reader directly use wth->fd, as
it's inside Wiretap; that gets rid of the last caller of wtap_fd() (as
we're no longer directly using fstat() or lseek() in Ethereal), so get
rid of wtap_fd().

svn path=/trunk/; revision=15437
2005-08-19 19:40:00 +00:00
Guy Harris e67b202e2c Have "f_datalen" keep track of the number of bytes of uncompressed file
data, so that "f_len" still keeps the size of the underlying file (which
is necessary in order to make the progress bar when files are being read
work correctly).

svn path=/trunk/; revision=15415
2005-08-19 01:17:24 +00:00
Ulf Lamping 3a63719e38 another two steps towards privilege seperation:
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-06 21:20:35 +00:00
Ulf Lamping dd71ad695f (some) redesign of capture data structures.
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-04 01:29:29 +00:00
Ulf Lamping 9ff19a4c94 move capture_file_fd field from capture_file to capture_opts type, as this is the place where it should be
svn path=/trunk/; revision=13268
2005-02-03 22:48:20 +00:00
Guy Harris 8a8b883450 Set the svn:eol-style property on all text files to "native", so that
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
2004-07-18 00:24:25 +00:00
Guy Harris e5f2451735 Rename a bunch of variables and routines that pertain to string search
with "string" rather than "ascii", to make it clearer what they're
involved with.

Use "gtk_toggle_button_set_active()", not
"gtk_toggle_button_set_state()" (the latter is a deprecated alias for
the former, probably dating back to GTK+ 1.0[.x] - 1.2[.x] and later
have "gtk_toggle_button_set_active()").

Do *NOT* change the radio buttons for the type of string search to do
based on whether we're doing a string search or not - doing so means we
don't correctly remember the type of string search.

Get rid of code to fetch some values that we don't subsequently use.

svn path=/trunk/; revision=10609
2004-04-15 23:28:11 +00:00
Ulf Lamping 3f2f2929eb added some more info to the statusbar (filesize, packet count, ..),
fixed a minor bug in the cfile handling (file length in summary dialog)

svn path=/trunk/; revision=9961
2004-02-03 00:16:59 +00:00
Guy Harris 7502ac216a There's no need to keep a "FILE *" for the file being printed to in a
"capture_file" structure.  Keep it locally, instead.

Check for errors when printing packets.

Report failure to open a print destination and failure to write to a
print destination differently.

Don't have the "print preamble" and "print final" routines return
success/failure indications - revert to the old scheme where they
didn't, and have the callers use "ferror()" to check for errors.

Report write errors when printing dissections in Tethereal.

Report print errors as errors, not warnings.

svn path=/trunk/; revision=9828
2004-01-25 00:58:13 +00:00
Guy Harris 84dcd53b03 We don't need to keep the progress bar quantum or next step in the
capture_file structure - just make it local to the routine scanning
through the packets.

svn path=/trunk/; revision=9616
2004-01-09 21:38:21 +00:00
Guy Harris dd628e00c7 Make "finfo_selected" a member of a "capture_file" structure rather than
an independent global variable.

svn path=/trunk/; revision=8524
2003-09-24 00:47:37 +00:00
Guy Harris f56d16abab Add a routine to return the display name for a "capture_file" structure,
rather than constructing that name when a capture file is opened and
putting a pointer to it in that structure.

svn path=/trunk/; revision=8476
2003-09-15 22:16:08 +00:00
Guy Harris 673e47d4a9 Keep a "display name" as part of a capture_file structure; for live
capture temporary files, it's "<capture", and for saved capture files,
it's the last component of the pathname of the file.  Use that in
various places when displaying the file name.

svn path=/trunk/; revision=8474
2003-09-15 20:37:37 +00:00
Guy Harris 1cf6565adc Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.

Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.

Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.

Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.

Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code.  Check that it's a valid string.

Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.

Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine.  Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.

Search for the Info column by column type, not by name (the user can
change the name).

When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)

Free the generated display filter code after a find-by-display-filter
finishes.

svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
Guy Harris 487d0def6b From Greg Morris: code to support searches for text or raw binary data
in a frame in Find Frame.

svn path=/trunk/; revision=8067
2003-07-22 23:08:48 +00:00
Ronnie Sahlberg 8e876bf574 Forgot to add two files
svn path=/trunk/; revision=6204
2002-09-06 23:14:04 +00:00