Commit Graph

707 Commits

Author SHA1 Message Date
Guy Harris 55001ef198 With the WTAP_ERR_UNSUPPORTED error, Wiretap supplies a string giving
the details of what in particular is unsupported; report it in TShark
and Wireshark.

Handle WTAP_ERR_RANDOM_OPEN_PIPE in TShark.

Handle WTAP_ERR_COMPRESSION_NOT_SUPPORTED in TShark, and have its error
message in Wireshark not speak of gzip, in case we support compressed
output in other formats in the future.

If we see a second section header block in a pcap-NG file, don't report
it as "the file is corrupted", report it as "the file uses a feature we
don't support", as that's the case - and don't free up the interface
data array, as the file remains open, and Wireshark might still try to
access the packets we were able to read.

svn path=/trunk/; revision=41041
2012-02-16 18:58:40 +00:00
Anders Broman 0b6b3937ab Make it possible to get inforamtion from the read SHB to the one to write out.
svn path=/trunk/; revision=41032
2012-02-15 19:44:16 +00:00
Anders Broman 8aea738cda Add the abillity to read and write option comments unedited.
This is POC we may want to have more efficient use of the frame data
structure etc. But this allows for work to be done on the GUI to actually add comments.

svn path=/trunk/; revision=40969
2012-02-11 12:34:39 +00:00
Anders Broman b8bbfcf379 Write address resolution block.
svn path=/trunk/; revision=40938
2012-02-08 20:15:59 +00:00
Guy Harris d7b2aad043 Move some headers for UI stuff, and the alert_box.c UI-specific file, to
the ui directory.  (Perhaps some other files that would be used by all
flavors of Wireshark, for any GUI toolkit or for someting such as
ncurses, and not for any command-line tool such as TShark, should be
moved there as well.)

Shuffle some #includes to put the "ui/XXX.h" includes together.

svn path=/trunk/; revision=40529
2012-01-16 01:07:52 +00:00
Jörg Mayer be706c6380 Move gtk to ui/gtk.
This looses the last checkin to gtk, will add this manually back.

svn path=/trunk/; revision=40518
2012-01-15 21:59:11 +00:00
Bill Meier 439adbdbcc Remove obsolete comments referring to mem_chunks.
svn path=/trunk/; revision=40507
2012-01-14 20:14:43 +00:00
Guy Harris c7857a522b In all these cases, i is a guint32, so if c_match is <= i, c_match fits
in a guint32; cast it to one to squelch compiler warnings.

svn path=/trunk/; revision=40487
2012-01-13 22:27:59 +00:00
Bill Meier 85c1195fe3 Fix Bug #6276: "Find Packet" Bug:
'The search query e.g. (ASCII or hex) "abac" doesn't find the packet(s)
  containing the string "ababac".'

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

svn path=/trunk/; revision=40483
2012-01-13 21:09:33 +00:00
Chris Maynard 3362e174f6 From Jim Young via bug 5580: Only update the time elapsed between the previous displayed packet and this packet if the packet is actually displayed. Ref: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5580
svn path=/trunk/; revision=40304
2011-12-27 18:16:12 +00:00
Guy Harris d94bd07f99 Rename WTAP_ERR_BAD_RECORD to WTAP_ERR_BAD_FILE; it really reports any
form of corruption/bogosity in a file, including in a file header as
well as in records in the file.  Change the error message
wtap_strerror() returns for it to reflect that.

Use it for some file header problems for which it wasn't already being
used - WTAP_ERR_UNSUPPORTED shouldn't be used for that, it should only
be used for files that we have no reason to believe are invalid but that
have a version number we don't know about or some other
non-link-layer-encapsulation-type value we don't know about.

svn path=/trunk/; revision=40175
2011-12-13 09:53:50 +00:00
Chris Maynard 36074c9828 Export all data sources of a frame to a C array. Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4988
svn path=/trunk/; revision=40136
2011-12-09 19:44:28 +00:00
Guy Harris 272c011d19 On an I/O error, merge_read_packet() and merge_append_read_packet() need
to return a pointer to the merge_in_file_t that got the error.  Set *err
to 0 on success and an error code on an err, treat a null return as an
EOF indication, and if we don't get a null return check for a non-zero
error code and treat that as an I/O error.

svn path=/trunk/; revision=39964
2011-11-21 06:26:03 +00:00
Chris Maynard 1e6a19e48a Fix "'Closing File!' Dialog Hangs" bug 3046: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3046
svn path=/trunk/; revision=39959
2011-11-20 15:11:15 +00:00
Guy Harris 2929c93ea2 When reporting "sorry, *this* packet can't be written to a file of that
type" when writing out a capture file (i.e., writing a
per-packet-encapsulation capture to a file type that supports it but
doesn't support one of the packet's encapsulations), report the packet
number and, when doing this in a merge operation, report the file from
which it came.

When reporting "sorry, that file can't be written to a file of that
type, period", show the file type rather than the input file link-layer
type that causes the problem.  (We could show both.  We could be
*really* ambitious and iterate through all possible file types and show
the ones that will or at least might work....)

file_write_error_message() is documented as handling only UNIX-style
errnos, and libwireshark should be usable without libwiretap, so leave
it up to its callers to handle Wiretap errors such as
WTAP_ERR_SHORT_WRITE.

Clean up indentation.

svn path=/trunk/; revision=39949
2011-11-19 20:18:01 +00:00
Chris Maynard e86ebd872d From Michael Mann: Add cf_callback_invoke to cf_open to tidy up the currently open file before opening a new one. Fixes bugs 5987 and 6457.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5987
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6457


svn path=/trunk/; revision=39445
2011-10-17 14:56:37 +00:00
Bill Meier e6bd9d1a8c Whitespace cleanup:
Use consistent indentation;
 Convert "4 space tabs" to spaces;
 Remove trailing whitespace.

svn path=/trunk/; revision=39082
2011-09-21 18:55:03 +00:00
Bill Meier 781129806f Fix ex "modeline" so it works;
See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5748

svn path=/trunk/; revision=39081
2011-09-21 17:49:11 +00:00
Gerald Combs 99d4de66e5 From Dirk Jagdmann via bug 5875:
My attachment adds a link to a XSLT file to the preamble of the PDML.
The XSLT will transform the PDML to a HTML page, and the HTML page
features a look similar to Wireshark. See
http://cubic.org/~doj/ebay/a.pdml for an example.

The patch also contains a small perl program which converts the
Wireshark colortable into javascript code which is used in the XSLT
file. If you want to use a different color scheme you would execute the
perl program and insert the generated javascript function into your XSLT
file.

To view the HTML you could either place the PDML and XSLT file on your
webserver and verify that your webserver sends the PDML file as
"text/xml".  Then your webbrowser will find the linked XSLT file,
download that as well and convert the PDML to HTML on the fly.

You could also use an XSLT processor like xsltproc to convert the PDML
and XSLT into a static HTML file.


From me:

Minor fixups.

svn path=/trunk/; revision=37298
2011-05-19 18:10:21 +00:00
Guy Harris 1372515b02 More eradication of old-style function definitions.
svn path=/trunk/; revision=37216
2011-05-17 22:18:32 +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
Jakub Zawadzki 73d94fa620 When closing capture file, set number of frames to 0. It fix bug #5903.
svn path=/trunk/; revision=37040
2011-05-10 15:13:46 +00:00
Guy Harris 88a1ed85e3 From Jakub Zawadzki: for file read progress bars, use the raw offset in
the file, rather than the offset in the uncompressed data stream.  That
way we don't get the "hey, we're more than 100% into the file, better
refigure this" surprise.

svn path=/trunk/; revision=37025
2011-05-09 05:30:59 +00:00
Guy Harris b42fab3a61 TShark doesn't need column text attached to each frame; move col_text
and col_text_len from the frame_data structure to the PacketRecord
structure.

svn path=/trunk/; revision=36967
2011-05-03 01:19:55 +00:00
Jakub Zawadzki 192837a1f2 Restore updating packet bar while loading file (removed in r36851)
svn path=/trunk/; revision=36896
2011-04-27 09:20:02 +00:00
Guy Harris 59ef61f6da Don't free the frame_data_sequence unless we have one.
svn path=/trunk/; revision=36882
2011-04-27 03:13:03 +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 280fcc497f Get rid of some code that's no longer relevant with the new tree
structure for frame_data items.

svn path=/trunk/; revision=36862
2011-04-26 02:51:10 +00:00
Anders Broman 96ebc30068 from Jakub Zawadzki:
Don't thaw the packet list during file loading to speed up file loading.

svn path=/trunk/; revision=36851
2011-04-25 19:36:13 +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
Guy Harris a39c3fab30 new_packet_list_find_row_from_data() is always used to select a packet,
so get rid of the select_flag argument, and rename it
new_packet_list_select_row_from_data().

It's also always passed a frame_data *, so make its argument a
frame_data *.

Its return value is used only to detect whether the packet was found in
the display or not, so make it a gboolean.  Check it in *all* cases
where it's called, and change the dialog message a bit (the most likely
cause is that the user cancelled a redissection of the packets, so not
all packets in the capture file are in the display.

Also, in the find case, pass it the new packet we found.

svn path=/trunk/; revision=36839
2011-04-24 21:02:55 +00:00
Guy Harris 6cbf6ce16c Add a new WTAP_ERR_DECOMPRESS error, and use that for errors discovered
by the gunzipping code.  Have it also supply a err_info string, and
report it.  Have file_error() supply an err_info string.

Put "the file" - or, for WTAP_ERR_DECOMPRESS, "the compressed file", to
suggest a decompression error - into the rawshark and tshark errors,
along the lines of what other programs print.

Fix a case in the Netscaler code where we weren't fetching the error
code on a read failure.

svn path=/trunk/; revision=36748
2011-04-21 09:41:52 +00:00
Guy Harris 92c974f2f7 Now that wtap_read() checks for delayed errors on EOF, there's no need
to check for it on close.

svn path=/trunk/; revision=36593
2011-04-12 17:37:05 +00:00
Guy Harris e5fe0128d7 Allow wtap_sequential_close() and wtap_close() to return an error; this
may happen if, when reading a compressed file, we find an error in the
file's contents past the last packet (e.g., the file being cut short so
that we can't get a full buffer worth of compressed data), and that
reporting of that error is delayed (so that you can get all of the
packets that we *can* decompress).  Check for those errors, at least on
the sequential read pass (the only errors we should see when closing the
random stream are errors we've already seen in the sequential stream).

svn path=/trunk/; revision=36576
2011-04-12 01:36:12 +00:00
Gerald Combs fcf51fc73b Add initial pcapng name resolution record support. Wireshark has read
support; TShark has read+write support. Additionally TShark can read a
"hosts" file and write those records to a capture file.

This uses "struct addrinfo" in many places and probably won't compile on
some platforms.

svn path=/trunk/; revision=36318
2011-03-24 22:47:57 +00:00
Gerald Combs 6e7d652034 Clarify a comment.
svn path=/trunk/; revision=36270
2011-03-22 21:07:00 +00:00
Stig Bjørlykke ed3d478fb9 Allocate correct size of fdata col_text and col_text_len.
Coverity 711 & 716.

svn path=/trunk/; revision=36266
2011-03-22 19:24:08 +00:00
Guy Harris 8ca97915c3 We have to initialize the elements of the fdata->col_text array to null
pointers, as there's code that assumes that if they're not set to null
pointers, they're set correctly, and doesn't bother setting them to the
right value.

svn path=/trunk/; revision=36252
2011-03-22 16:33:39 +00:00
Guy Harris 23e5eb42ba When we allocate the col_text array, initialize it to a bunch of
pointers to null strings, rather than a bunch of null pointers, so that
if an exception is thrown before we set any of the columns, or some
other problem occurs, we don't end up with null pointers that could
later cause a crash.

Fix indentation.

svn path=/trunk/; revision=36234
2011-03-22 03:56:39 +00:00
Sake Blok 307c0d70fb Removal of the old packet-list in favor of the new packet list.
It compiles with "./configure without options" on my Mac. Let's see what the buildbots have to say about it :-)


svn path=/trunk/; revision=36161
2011-03-08 01:52:25 +00:00
Gerald Combs a6bbdaa849 Fix some dead code and zero division issues found by Clang scan-build.
In convert_string_case() use g_utf8_strup() instead of converting each
character by hand. Hopefully this won't cause any unexpected changes in
behavior.

svn path=/trunk/; revision=36006
2011-02-18 22:43:48 +00:00
Guy Harris 45ba0a19c4 Clean up indentation.
svn path=/trunk/; revision=35813
2011-02-04 10:23:22 +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
Guy Harris a4cc25f84d Move main_statusbar.h to the top-level directory; none of its routines
use GTK+ data types, so, at least in theory, it could be implemented
atop another toolkit.

Make statusbar_push_temporary_msg() take a format string and format
arguments.  Use it instead of simple_status(), and change one call to
just take a format string and arguments rather than to take the result
of using that format string and arguments with g_strdup_printf() and
passing the result to statusbar_push_temporary_msg().

svn path=/trunk/; revision=35041
2010-11-27 21:50:49 +00:00
Bill Meier dbd143d68a (Trivial) Fix a typo in a comment.
svn path=/trunk/; revision=34626
2010-10-23 15:45:12 +00:00
Jeff Morriss 83caffd358 Fix the win64 build
svn path=/trunk/; revision=34564
2010-10-18 21:36:41 +00:00
Jeff Morriss 94e072c92f Fix progress bar when loading compressed files.
Continue to use the data offset ((uncompressed) bytes read) as our progress
indicator, at least until we get a progress value greater than 1.0.  Then,
in addition to checking if the size of the file changed, check our position in
the file and use that as our progress indicator.

This optimizes uncompressed file accesses (avoiding an lseek()) at the "expense"
of switching progress measures (from data read to position in the file) while
loading a file.  Tests have shown that the progress bar never shows the data
offset number when loading a compressed file, so this should be okay.

svn path=/trunk/; revision=34563
2010-10-18 20:52:54 +00:00
Bill Meier ee7d36f1df (Trivial) Fix a typo
svn path=/trunk/; revision=33951
2010-08-27 15:01:28 +00:00