Commit Graph

1101 Commits

Author SHA1 Message Date
Hadriel Kaplan e25562badd Pcapng: clean up Section Header Block handling
Change-Id: I8516d0c561ed0b63e49a3594027c9c15bb789258
Reviewed-on: https://code.wireshark.org/review/9726
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-18 05:52:45 +00:00
Hadriel Kaplan 910438b17f Pcapng: support Name Resolution Block options
Make pcapng decode options in an NRB during read, and store the comment
option, and write it back out as well. Also make it handle plugin handlers
for unknown options in received NRB(s).

Change-Id: I81863ef8d85cb1c8b5ba6673ba0e562efe77714f
Reviewed-on: https://code.wireshark.org/review/9723
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-06 03:32:13 +00:00
Guy Harris c6f41124af Do error checking on simple_error_message_box() calls and fix errors.
It's a printf-like routine, so give it the right declaration.  Fix
errors that this finds.

Change-Id: I7e8c100ff9e16ba89743ce744cbf548aae705b77
Reviewed-on: https://code.wireshark.org/review/9487
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-07-04 02:39:18 +00:00
Michael Mann da09a1bfd8 Take all epan_column_info members that always get allocated to "number of columns" to share their own data structure.
Change-Id: Ib982662db6cf68730a7d121eac60d9bc5ae67429
Reviewed-on: https://code.wireshark.org/review/9195
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-06-29 02:11:04 +00:00
Pascal Quantin 5bc38611fd mergecap: check input files time precision before exporting to pcapng format
Bug: 11202
Change-Id: I0891235e9fd41687a12eb8c7e05048e25de3d8b9
Reviewed-on: https://code.wireshark.org/review/9137
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-06-25 20:28:13 +00:00
Martin Kaiser cb84022296 Qt: fix crashes when Wireshark is closed while running a capture
if we haven't captured any packets yet, don't display a warning about
unsaved changes

make sure that we're not running into a scenario where
MainWindow::testCaptureFileClose() tries to close the capture file at
the same time as the pipe handler who sees an eof on the pipe

cf_has_unsaved_data() should return false if we have a temporary file
that contains no packets

Change-Id: I18d75bd658b85d45dd3313d49e2cd654c6300de5
Reviewed-on: https://code.wireshark.org/review/9109
Reviewed-by: Evan Huus <eapache@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-06-25 15:55:36 +00:00
Alexis La Goutte f75e52ba71 file.c: fix Fix Branch condition evaluates to a garbage value found by Clang Analyzer
Change-Id: Ib7c9e114973f78775cf17889b6aeab217cb6d0ef
Reviewed-on: https://code.wireshark.org/review/9101
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-06-24 22:21:00 +00:00
Gerald Combs 1dc608a05e Morph ProgressBar into CaptureProgressFrame.
Switch from a plain QProgressBar to a QFrame with a QProgressBar and a
stop button.

Add a stop_flag boolean to the capture_file struct.

To do:
- Start adding the progress bar to dialogs.
- Don't complain so loudly when the user stops a capture.

Change-Id: Iedd1d7d79f2044f1a53e4fb22186d25930a3ef03
Reviewed-on: https://code.wireshark.org/review/9029
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-06-23 06:06:37 +00:00
Gerald Combs b18309c07f Qt: Update the status bar when saving.
Plumb in more capture file callbacks. Add common functions for setting
the status bar file information. Add and update code to match the GTK+
status bar behavior.

Make sure we update the capture file length when rescanning.

Bug: 10943

Change-Id: Ie84c7a57ee421d57ba3477f8dde3847aaafa1cd1
Reviewed-on: https://code.wireshark.org/review/8594
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-05-23 00:31:08 +00:00
Joerg Mayer 1c455284f0 Fix some files to pass the pre-commit hook script.
Change-Id: I105bf4e03fcf95cf7541f6377215809759fd933e
Reviewed-on: https://code.wireshark.org/review/8502
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2015-05-17 21:01:03 +00:00
Pascal Quantin 4263c131a4 mergecap: fix merge of files with different encapsulation types
Issue reported on https://ask.wireshark.org/questions/42061/merging-captures-on-1995

Change-Id: I0697a03221972f2d1616da52aecc6257f0bc5b88
Reviewed-on: https://code.wireshark.org/review/8293
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-05-10 15:57:23 +00:00
Michael Mann 0a729d8d66 Revert "Don't rescan packets when a display filter is added if we are capturing without "Updating list of packets in real time". There are no displayed packets to filter!"
This reverts commit a11f7a7548.

Change-Id: If3ae617c8e35439d0a77d2a2ded50288e2e6f5d7
Reviewed-on: https://code.wireshark.org/review/7961
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-04-07 03:09:29 +00:00
Michael Mann a11f7a7548 Don't rescan packets when a display filter is added if we are capturing without "Updating list of packets in real time". There are no displayed packets to filter!
Bug: 6217
Change-Id: Ie4a90ff8a738d6c970d51598bf14b4b51ea069ce
Reviewed-on: https://code.wireshark.org/review/7918
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-04-07 01:16:26 +00:00
Guy Harris 1871fb2b0d Keep a captured-packet count in a capture_session and use that.
Have the count in a cfile_t structure always reflect the actual number
of packets that have been read from the file, rather than, when doing a
non-update-list-of-packets-in-real-time capture, falsely increasing the
count in the cfile_t to reflect the number of packets captured but not
yet read.

Have the status bar base its captured-packet count on the count in the
capture_session structure, and base the "sorry, no packets were
captured" message on the count in the capture_session structure, as
we're no longer using the count in the cfile_t structure to count
anything in the process of a non-update-list-of-packets-in-real-time
capture.

That way, we preserve the invariant that the "frames" member of a
cfile_t will be non-null if the "count" member is non-zero, fixing bug
6217.

It also means we can get rid of cf_set_packet_count(), as we only set
the count in the capture-file-reading code.

Bug: 6217
Change-Id: I72c0e2c07c30782bad777995370b7c19e1460cc2
Reviewed-on: https://code.wireshark.org/review/7950
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-04-06 19:15:24 +00:00
Michael Mann e7fd1bfdf7 Reduce epan dependence on dissectors by having print module "cache" the protocol and field ids that it needs.
Change-Id: I4ec48067e9ca2cbe88e1cf2e6c9dc1e382379221
Reviewed-on: https://code.wireshark.org/review/7767
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-03-20 05:30:52 +00:00
Gerald Combs cac102eee3 Change a lot of http:// URLs to https://.
Most of our sites are now HTTPS-only. Update URLs accordingly. Update
other URLs while we're at it. Remove or comment out dead links.

Change-Id: I7c4f323e6585d22760bb90bf28fc0faa6b893a33
Reviewed-on: https://code.wireshark.org/review/7621
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-03-10 19:30:50 +00:00
Michal Labedzki 2d4817966e Qt: Automatically scroll the packet list.
Add an "Auto Scroll in Live Capture" action to the Go menu. It's in the
View menu in the GTK+ UI but it seems to make more sense as a navigation
item.

Use a timeout interval for automatic scrolling. I haven't run any tests
to see if this makes a difference but it would seem that the less
drawing we do during a high speed capture the better, particularly for
remote displays.

Update the x-stay-last icons.

Note that we might want to make prefs.capture_auto_scroll a "recent"
setting.

Mark auto_scroll_live and packet_list_check_end GTK+ only.

Bug: 10601
Co-authored-by: Gerald Combs <gerald@wireshark.org>
Change-Id: I645d27c0814f0e4a0d5b01ae68be366847e2522d
Reviewed-on: https://code.wireshark.org/review/7292
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-02-27 20:27:14 +00:00
Guy Harris cfcbb28671 Clean up ftype-conversion and dfilter error message string handling.
Have dfilter_compile() take an additional gchar ** argument, pointing to
a gchar * item that, on error, gets set to point to a g_malloc()ed error
string.  That removes one bit of global state from the display filter
parser, and doesn't impose a fixed limit on the error message strings.

Have fvalue_from_string() and fvalue_from_unparsed() take a gchar **
argument, pointer to a gchar * item, rather than an error-reporting
function, and set the gchar * item to point to a g_malloc()ed error
string on an error.

Allow either gchar ** argument to be null; if the argument is null, no
error message is allocated or provided.

Change-Id: Ibd36b8aaa9bf4234aa6efa1e7fb95f7037493b4c
Reviewed-on: https://code.wireshark.org/review/6608
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-18 10:22:59 +00:00
Guy Harris 1bc2565bff Don't include signal.h unless we need it.
Change-Id: I3965e0951eee919720f780b5e52732fd18fd9786
Reviewed-on: https://code.wireshark.org/review/6194
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-31 22:54:01 +00:00
Alexis La Goutte 9b3f9b711a Fix The left operand of '!=' is a garbage value issue found by Clang Analyzer
Change-Id: Ia555fc8eca2a7288c159983578cbc88dc0bebbc2
Reviewed-on: https://code.wireshark.org/review/5952
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-12-22 07:38:57 +00:00
Gerald Combs 9ba9cd83a4 Qt: Add a CaptureFile class.
Wrap the capture_file struct in a QObject which translates cf_cb_* and
capture_cb_* events into signals. Move the global cfile to
capture_file.cpp.

Don't use a void pointer for the capture file struct.

Change-Id: Ic5d5efb4bb1db64aa0247245890e5669b1da723a
Reviewed-on: https://code.wireshark.org/review/5885
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-12-20 17:39:29 +00:00
Guy Harris 0885d29451 Make sure err_info is always set, and print it iff it's non-null.
Change-Id: Ib5c600c491a3d8adcfa91c00fa9445283610545b
Reviewed-on: https://code.wireshark.org/review/5830
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-18 04:04:19 +00:00
Guy Harris 6011a047d3 WTAP_ERR_UNWRITABLE_ errors aren't returned by reads or open-for-reading.
Check for them *only* on opening for writing and writes.

Change-Id: I4b537d511ec04bcfc81f69166a2b9a2ee9310067
Reviewed-on: https://code.wireshark.org/review/5827
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-18 00:41:43 +00:00
Guy Harris aa27e665b1 Rename WTAP_ERR_REC_TYPE_UNSUPPORTED to WTAP_ERR_UNWRITABLE_REC_TYPE.
That indicates that it's a problem specific to *writing* capture files;
we've already converted some errors to that style, and added a new one
in that style.

Change-Id: I8268316fd8b1a9e301bf09ae970b4b1fbcb35c9d
Reviewed-on: https://code.wireshark.org/review/5826
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-18 00:32:14 +00:00
Guy Harris 51522b3372 Handle "I can't map this for that file format" better.
For cases where record (meta)data is something that can't be written out
in a particular file format, return WTAP_ERR_UNWRITABLE_REC_DATA along
with an err_info string.

Report (and free) that err_info string in cases where
WTAP_ERR_UNWRITABLE_REC_DATA is returned.

Clean up some other error reporting cases, and flag with an XXX some
cases where we aren't reporting errors at all, while we're at it.

Change-Id: I91d02093af0d42c24ec4634c2c773b30f3d39ab3
Reviewed-on: https://code.wireshark.org/review/5823
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-18 00:03:26 +00:00
Guy Harris e00f585296 Fix another incorrect message for WTAP_ERR_UNSUPPORTED.
WTAP_ERR_FILE_UNKNOWN_FORMAT is reported if the file is in a format that
libwiretap doesn't know about (either because it's not a capture file at
all or because it's a capture file in a format it doesn't support).
WTAP_ERR_UNSUPPORTED is for files in a *known* format that are using
features or file format elements (record type, link-layer header type,
etc.) that libwireshark doesn't support.  Fix another copy-and-pasteo
causing WTAP_ERR_UNSUPPORTED to be reported with a message appropriate
for WTAP_ERR_FILE_UNKNOWN_FORMAT.

Change-Id: Ib35e2a6b6c62517887e0386f0fed1795db335439
Reviewed-on: https://code.wireshark.org/review/5810
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-17 19:54:13 +00:00
Guy Harris ddcc2aee3d Rename WTAP_ERR_UNSUPPORTED_FILE_TYPE to WTAP_ERR_UNWRITABLE_FILE_TYPE.
That makes it clearer what the problem is, and that it should only be
returned by the dump code path, not by the read code path.

Change-Id: I22d407efe3ae9fba7aa25f08f050317549866442
Reviewed-on: https://code.wireshark.org/review/5798
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-17 08:31:49 +00:00
Guy Harris dbdcae80ba Rename WTAP_ERR_UNSUPPORTED_ENCAP to WTAP_ERR_UNWRITABLE_ENCAP.
That makes it clearer what the problem is, and that it should only be
returned by the dump code path, not by the read code path.

Change-Id: Icc5c9cff43be6c073f0467607555fa7138c5d074
Reviewed-on: https://code.wireshark.org/review/5797
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-17 06:41:45 +00:00
Guy Harris 846bb53948 Add a Buffer to wtap_pkthdr to hold file-type-specific packet metadata.
For example, this can be used for pcap-ng options not mapped to
file-type-independent metadata values.

Change-Id: I398b324c62c1cc1cc61eb5e9631de00481b4aadc
Reviewed-on: https://code.wireshark.org/review/5549
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-01 00:31:03 +00:00
Guy Harris 81ab6012fe Clean up routine names, don't pass capture_file into libwireshark.
Give all routines in epan/print.c that write a particular format a name
beginning with write_{formatname}.

If routines write columns, rather than the raw protocol tree, don't give
it a name containing proto_tree.

Get rid of empty preamble/finale routines.

For CSV, the preamble routine writes out column titles, so call it
write_csv_column_titles().

For C arrays, the body routine writes out raw hex data, so call it
write_carrays_hex_data().

capture_file isn't a structure defined by libwireshark, so don't make it
an argument passed into libwireshark.

Change-Id: I5a7e04de9382cf51a59d9d9802f815b8b3558332
Reviewed-on: https://code.wireshark.org/review/5536
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-29 22:44:29 +00:00
Guy Harris 741db4c751 Get rid of another global in the print code.
Pass the "output only these protocols" hash table as an argument,
instead.

Change-Id: Id8540943037e7b9bbfe377120c3f60dbe54fe0f1
Reviewed-on: https://code.wireshark.org/review/5440
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-22 09:07:46 +00:00
Guy Harris b19b12a85d Get rid of write_headers global variable.
Have write_psml_preamble() and write_csv_preamble() take a capture_file *
as an argument, so they can print the column titles themselves, rather
than having to defer it to the routine that prints packet data.

Change-Id: Ifd1b7a13062be8ad46846315976922a752778153
Reviewed-on: https://code.wireshark.org/review/5438
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-22 08:07:24 +00:00
Guy Harris 77f969958c Fix support for writing out edited records.
Add a cf_set_frame_edited() routine to set the record header and data
for a record; have it do all the non-GUI work, and have it set the
file's "unsaved changes" flag.

Have the GUI code just call that routine and then update the title bar
to reflect the unsaved changes.

While we're at it, unmark a no-longer-unused argument to save_record().

Change-Id: Ieb513fdf423b388519527621ecec4cf634b98caf
Reviewed-on: https://code.wireshark.org/review/4885
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-20 21:37:41 +00:00
Guy Harris a566f617d8 No need for WTAP_ERR_CANT_READ.
Unlike the standard I/O routines, the code we introduced that supports
fast random seeking on gzipped files will always supply some specific
error code for read errors, so we don't need WTAP_ERR_CANT_READ.

Add WTAP_ERR_CANT_WRITE for writing, as we're still using the standard
I/O routines for that.  Set errno to WTAP_ERR_CANT_WRITE before calling
fwrite() in wtap_dump_file_write(), so that it's used if fwrite() fails
without setting errno.

Change-Id: I6bf066a6838284a532737aa65fd0c9bb3639ad63
Reviewed-on: https://code.wireshark.org/review/4540
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-07 23:19:56 +00:00
Guy Harris 54b733ce9a Make the time stamp resolution per-packet.
Pcap-ng files don't have a per-file time stamp resolution, they have a
per-interface time stamp resolution.  Add new time stamp resolution
types of "unknown" and "per-packet", add the time stamp resolution to
struct wtap_pkthdr, have the libwiretap core initialize it to the
per-file time stamp resolution, and have pcap-ng do the same thing with
the resolution that it does with the packet encapsulation.

Get rid of the TS_PREC_AUTO_XXX values; just have TS_PREC_AUTO, which
means "use the packet's resolution to determine how many significant
digits to display".  Rename all the WTAP_FILE_TSPREC_XXX values to
WTAP_TSPREC_XXX, as they're also used for per-packet values.

Change-Id: If9fd8f799b19836a5104aaa0870a951498886c69
Reviewed-on: https://code.wireshark.org/review/4349
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-28 18:38:18 +00:00
Gerald Combs ea6fa049c9 Update the simple dialog code.
Rename simple_dialog_qt.{cpp,h} to simple_dialog.{cpp,h}. Make it a
subclass of QMessageBox. Queue messages at startup similar to GTK+.

Move the GTK+-specific simple_dialog declarations to
gtk/simple_dialog.h.

Don't yell at the user so much. Replace exclamation points with periods.

Change-Id: I1cc771106222d5e06f1f52d67ac29d6dc367cce4
Reviewed-on: https://code.wireshark.org/review/4288
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-09-25 22:02:43 +00:00
Evan Huus 02d50a54a8 Ensure pcapng application name is dynamically allocated
I was hasty with my original fix...

Change-Id: I339994c1afc34274a5d73eff98c4ebbf030e0f36
Reviewed-on: https://code.wireshark.org/review/4255
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-09-22 20:56:19 +00:00
Bill Meier a379ac74d2 Fix spelling: cant-->can't, wont-->won't, etc
Change-Id: Ia6c3e7a25615bf8e052c3bacf096d76df775c9c2
Reviewed-on: https://code.wireshark.org/review/4126
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-09-16 15:31:58 +00:00
Graham Bloice 97546165fa Modify includes of config.h so that out-of-tree builds, i.e. CMake
don't pick up the in-tree copy.

Change-Id: I7ec473876cdba1a025c52362d7f6adc62d24ce71
Reviewed-on: https://code.wireshark.org/review/3798
Petri-Dish: Graham Bloice <graham.bloice@trihedral.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2014-08-24 08:04:08 +00:00
Guy Harris 0734ac385f Rename buffer_ routines to ws_buffer_ to avoid name collisions.
In particular, epan/wslua/lrexlib.c has its own buffer_ routines,
causing some linker warnings on some platforms, as reported in bug
10332.

(Not to be backported to 1.12, as that would change the API and ABI of
libwsutil and libwiretap.  We should also make the buffer_ routines in
epan/wslua/lrexlib.c static, which should also address this problem, but
the name change avoids other potential namespace collisions.)

Change-Id: I1d42c7d1778c7e4c019deb2608d476c52001ce28
Reviewed-on: https://code.wireshark.org/review/3351
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-08-02 11:01:29 +00:00
Guy Harris 28971b2851 Squelch a warning.
In at least some versions of GLib, g_array_free() warns if passed a null
pointer, rather than just silently returning.

Change-Id: I1bfc0a81faa1eeebe288f6e0cc58ebfb64784958
Reviewed-on: https://code.wireshark.org/review/3068
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-16 00:14:35 +00:00
Guy Harris f9f6fa74fd Get rid of cf_reset_state() - it's only called from one place.
Change-Id: I48521bbaa898c99286e6bb5e40281aba7701ed4d
Reviewed-on: https://code.wireshark.org/review/3062
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-15 22:48:53 +00:00
Bill Meier 9ed99d5c4e Strip some trailing whitespace; Fix some indentation; Add editor-modelines as needed.
Change-Id: I943153e28f468070d86535abad7be032e1386118
Reviewed-on: https://code.wireshark.org/review/2994
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-07-11 03:20:54 +00:00
Guy Harris c46329c27b Add a routine to return a version string including VCS information.
Add a routine get_ws_vcs_version_info() that, for builds from a tree
checked out from Wireshark's version control system, returns a string
that includes both the Wireshark version number and an indication of
what particular VCS version was checked out, and just returns
Wireshark's version number for other builds.

Use that routine rather than manually gluing VERSION and the Git version
number together.

("vcs", not "git", just in case we do something bizarre or mercurial
some day. :-))

Change-Id: Ie5c6dc83b9d3f56655eaef30fec3ec9916b6320d
Reviewed-on: https://code.wireshark.org/review/2529
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-22 01:06:25 +00:00
Guy Harris 318cf8a678 Add support for dissecting non-packet records.
Add a dissector table indexed by the file type, and, for the
file-type-specific records, have the frame dissector skip the usual
pseudo-header processing, as the pseudo-header has a file-type-specific
record subtype in it, and call the dissector for that file type's
records.

Change-Id: Ibe97cf6340ffb0dabc08f355891bc346391b91f9
Reviewed-on: https://code.wireshark.org/review/1782
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-25 00:05:07 +00:00
Guy Harris 6db77b000f Allow wtap_read() and wtap_seek_read() to return records other than packets.
Add a "record type" field to "struct wtap_pkthdr"; currently, it can be
REC_TYPE_PACKET, for a record containing a packet, or
REC_TYPE_FILE_TYPE_SPECIFIC, for records containing file-type-specific
data.

Modify code that reads packets to be able to handle non-packet records,
even if that just means ignoring them.

Rename some routines to indicate that they handle more than just
packets.

We don't yet have any libwiretap code that supplies records other than
REC_TYPE_PACKET or that supporting writing records other than
REC_TYPE_PACKET, or any code to support plugins for handling
REC_TYPE_FILE_TYPE_SPECIFIC records; this is just the first step for bug
8590.

Change-Id: Idb40b78f17c2c3aea72031bcd252abf9bc11c813
Reviewed-on: https://code.wireshark.org/review/1773
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-24 18:31:25 +00:00
Guy Harris a344c9736e Revert "Allow wtap_read() and wtap_seek_read() to return non-packet records."
This reverts commit c0c480d08c.

A better way to do this is to have the record type be part of struct wtap_pkthdr; that keeps the metadata for the record together and requires fewer API changes.  That is in-progress.

Change-Id: Ic558f163a48e2c6d0df7f55e81a35a5e24b53bc6
Reviewed-on: https://code.wireshark.org/review/1741
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-23 10:50:10 +00:00
Guy Harris c0c480d08c Allow wtap_read() and wtap_seek_read() to return non-packet records.
This is the first step towards implementing the mechanisms requestd in
bug 8590; currently, we don't return any records other than packet
records from libwiretap, and just ignore non-packet records in the rest
of Wireshark, but this at least gets the ball rolling.

Change-Id: I34a45b54dd361f69fdad1a758d8ca4f42d67d574
Reviewed-on: https://code.wireshark.org/review/1736
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-23 03:02:32 +00:00
Peter Wu 3aee917058 wiretap: remove unused code, drop number_of_interfaces
While investigating an ASAN issue (fixed in
commit dcdd076ab0), I got greatly confused
by three different types having the same "interface_data" field name:

 * pcapng_t *pn stores an array of interface_data_t objects.
 * wtap *wth stores an array of wtapng_if_descr_t objects.
 * pcapng_dump_t should store an array of interface_data_t objects.

pcapng_dump_t and friends are unused since
commit c7f1a431d2, so drop it.

To fix the confusion, rename the interface_data_t type to
interface_info_t type and use the local variable "iface_info"
everywhere. Rename interface_data of pcapng_t to "interfaces" and
add a comment what this exactly means (interfaces listed in the capture
file).

Drop the number_of_interfaces field for interfaces as the array
length is already available from GArray. Now interface_data is always
initialized for wth (which also gets copied to idb).

s/int/guint/g and replace cast at some places.

There are no regressions for the in-tree test suite.

Change-Id: I2d5985c9f1e43f8230dbb4a73bd1e243c4858170
Reviewed-on: https://code.wireshark.org/review/1656
Reviewed-by: Evan Huus <eapache@gmail.com>
Tested-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-05-17 12:41:50 +00:00
Guy Harris a1b1c8bed5 Revert "Refactor Wiretap"
This reverts commit 1abeb277f5.

This isn't building, and looks as if it requires significant work to fix.

Change-Id: I622b1bb243e353e874883a302ab419532b7601f2
Reviewed-on: https://code.wireshark.org/review/1568
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-09 05:21:01 +00:00
Michael Mann 1abeb277f5 Refactor Wiretap
Start of refactoring Wiretap and breaking structures down into "generally useful fields for dissection" and "capture specific". Since this in intended as a "base" for Wiretap and Filetap, the "wft" prefix is used for "common" functionality.

The "architectural" changes can be found in cfile.h, wtap.h, wtap-int.h and (new file) wftap-int.h. Most of the other (painstaking) changes were really just the result of compiling those new architecture changes.

bug:9607
Change-Id: Ife858a61760d7a8a03be073546c0e7e582cab2ae
Reviewed-on: https://code.wireshark.org/review/1485
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-05-09 03:04:39 +00:00
Peter Wu dfb92dfd67 Fix crash when switching profiles
rescan_packets() starts a new dissection session by free'ing the
previous state and creating a new one. A reference to the old session
was not updated though.

This is the only place where epan is overwritten. After init, col_init
will at some point initialize cf->cinfo.epan with a cf->epan.

Bug: 9463
Change-Id: I8cf4e0823328f44a0dccfeeec1594f9929829d2d
Reviewed-on: https://code.wireshark.org/review/1430
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-04-29 17:06:02 +00:00
Bill Meier d063b324e4 Fix "might be clobbered by 'longjmp' or 'vfork' [-Werror=clobbered]" warning from gcc 4.9.
Change-Id: I8495d746f47c0e2528f88295771f86197d22d159
Reviewed-on: https://code.wireshark.org/review/1166
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-04-16 03:05:21 +00:00
Gerald Combs a5cb72fe9e Add a Qt I/O Graph dialog.
For each graph you can set:
- Its visibility
- A name
- A display filter
- Color, from a fixed list
- Plot style: Line, Impulse, Bar, Stacked Bar, Dot, Square, Diamond
- Basic Y Axes (packets/s, bytes/s, bits/s)
- Computed Y Axes (SUM, MIN, AVG, MAX)
- Smoothing

You can pan and zoom using the mouse and keyboard. Clicking on a graph
selects the last packet for that interval. If all graphs have the same Y
axis a single label is shown, otherwise a legend is shown.

The time scale (X axis) can be toggled between relative seconds and the
time of day.

Graphs can be saved as PDF, PNG, BMP, and JPEG. Settings are "sticky"
via the io_graphs UAT.

To do:
- Minimize graph drawing delays.
- Figure out why smoothing differs from GTK+
- Everything else at the top of io_graph_dialog.cpp
- Fix empty resets.

A fair amount of code was copied from TCPStreamDialog. We might want to
subclass QCustomPlot and place the shared code there.

Move common syntax checking to SyntaxLineEdit.

Move some common code from ui/gtk/io_stat.c to ui/io_graph_item.[ch] and
use it in both GTK+ and Qt.

Make the io_graph_item_t array allocation in io_stat.c static. The
behavior should be identical and this gives us additional compile-time
checks.

Change-Id: I9a3d544469b7048f0761fdbf7bcf20f44ae76577
Reviewed-on: https://code.wireshark.org/review/435
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Tested-by: Gerald Combs <gerald@wireshark.org>
2014-04-07 20:56:42 +00:00
Hadriel Kaplan ca9c160933 Fix bug9931 'Encapsulated ethernet packets sometimes show invalid FCS'
This fixes part-1 of bug9931: the uninitialized use of a wtap_pkthdr
struct. The second part of the bug deals with dissectors calling
the Ethernet dissector for ecnapsulated Ethernet packets but using
the wrong dissector handle to do so. That's unrelated to the issue this
commit addresses, so I'm splitting them up.

Change-Id: I87be7b736f82dd74d8c261062f88143372b5344c
Reviewed-on: https://code.wireshark.org/review/848
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-27 21:39:57 +00:00
Hadriel Kaplan d1873dbcc8 Fix Bug 9903: 'Clicking reload-file ignores selected file format reader'
There's a relatively new feature in 1.11.3 to select a specific file format
reader, instead of relying on magics or heuristics. If you select a file
reader and open a file, open it, and then click the reload-file button or go
to View->Reload or press the ctrl-R keymap, the file is reloaded but using the
magic/heuristics again instead of the file format reader you previously chose.
Likewise, the Lua relaod() function has the same issue (which is how I found
this problem).

I have tested this change by hand, using a Lua script, but I didn't add it
to the testsuite because I need another change for my test script to work
correctly. (an enhancement rather than a bug fix, which I'll submit separately)

Change-Id: I48c2d9ea443e37fd9d41be43d6b6cd5a866d5b01
Reviewed-on: https://code.wireshark.org/review/764
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-21 17:51:45 +00:00
Anders Broman 0513b29b8b Revert "Allow pcapng interface options to be available to dissectors."
This patch causes Wireshark/tshark to segfault if the file is reread(open a file and press reload).
The test suite also fails on 
2.1.1 Step: Exit status for existing file: "/home/wireshark/builders/trunk/sol10sparc/build/test/captures/dhcp.pcap" must be 0/home/wireshark/builders/trunk/sol10sparc/build/test/suite-clopts.sh: line 149:  6646 Segmentation Fault      (core dumped) $TSHARK -r "${CAPTURE_DIR}dhcp.pcap" > ./testout.txt 2>&1

OSX build bot chokes on
pcapng.c: In function 'pcapng_destroy_option_value':
pcapng.c:377: warning: implicit declaration of function 'g_byte_array_unref'
pcapng.c:379: warning: implicit declaration of function 'g_array_unref'
pcapng.c: In function 'pcapng_collect_block_option':
pcapng.c:419: warning: implicit declaration of function 'g_byte_array_new_take'
pcapng.c:419: warning: initialization makes pointer from integer without a cast

these functions are glib 2.22
This reverts commit 7b13a3b0f6.

Change-Id: Ia82fdb2d08287bc2cd2841e1e941ae68cbc2e009
Reviewed-on: https://code.wireshark.org/review/749
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-20 12:25:21 +00:00
Christopher Kilgour 7b13a3b0f6 Allow pcapng interface options to be available to dissectors.
Interface options[1], and more generally pcapng options[2], are useful
information that can provide improved dissector output.

Prior to this change, only certain pcapng interface options were interpreted
and made available to dissectors, e.g. the interface name or description.
This change augments the situation by providing epan_get_interface_option( ),
which returns an array of byte arrays if the option code exists
(otherwise NULL).  Each element of the array is a byte buffer containing
the raw data of the option.  An array-of-buffers is used because pcapng
allows for multiple instances of the same option to be present in the file.
All interface options found in a pcapng file are thus made available to the
dissector.

The implementation also provides infrastructure to collect options from
other pcapng blocks such as the section header.  Currently these options
are discarded, but could be retained in the future to support more features.

[1] http://www.winpcap.org/ntar/draft/PCAP-DumpFileFormat.html#sectionidb
[2] http://www.winpcap.org/ntar/draft/PCAP-DumpFileFormat.html#sectionopt

Change-Id: I944b6f0f03dde9b8e7d1348b76acde6f9d312f37
Reviewed-on: https://code.wireshark.org/review/331
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-20 09:54:01 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Hadriel Kaplan 907a825986 Fix file.c: Dereference of null pointer (clang analyzer)
Change-Id: Ib96e5ffb284234562c2883c13e93109173e22179
Reviewed-on: https://code.wireshark.org/review/368
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-25 20:52:48 +00:00
Michal Labedzki 579e7e19ce Wireshark: Add option to choose format type of capture file
The best heuristic can fail, so add possibility to manually choose
capture file format type, so not correctly recognize file format can be
loaded in Wireshark.

On the other side now it is possible to open capture file
as file format to be dissected.

Change-Id: I5a9f662b32ff7e042f753a92eaaa86c6e41f400a
Reviewed-on: https://code.wireshark.org/review/16
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
Tested-by: Evan Huus <eapache@gmail.com>
2014-02-25 17:43:13 +00:00
Gerald Combs f966980937 Replace "svn" with "git" all over the place.
Rename "SVNPATH" to "GITBRANCH" since that seems more appropriate.
Rename "svnversion.h" to "version.h" as Evan suggested. Update some
URLs. In make-version.pl, make sure we don't set an improper upstream
branch name. Use the number of commits + short hash from `git describe`
for package names by default.

Change-Id: I922bba8d83eabdf49284a119f55b4076bc469b96
Reviewed-on: https://code.wireshark.org/review/139
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-02-07 23:03:03 +00:00
Guy Harris 90d7c5f59b Don't write out packets that have a "captured length" bigger than we're
willing to read or that's bigger than will fit in the file format;
instead, report an error.

For the "I can't write a packet of that type in that file type" error,
report the file type in question.

svn path=/trunk/; revision=54882
2014-01-22 00:26:36 +00:00
Guy Harris 8f8eeb5dce Check the return of wtap_dump_close() even if we've gotten a read error;
the only reason not to check it is if we've already gotten a write error
and another write error would be superfluous (either "you got two of the
same error" or "you got an I/O error *and* you ran out of disk
space/disk quota" is of limited interest).

Discard the return value of wtap_dump_close() in the case where we've
already gotten a write error, in the hopes of squelching a Coverity
warning.

svn path=/trunk/; revision=54872
2014-01-21 08:50:35 +00:00
Pascal Quantin 386c5ba6c6 Fix crash when exporting to CSV file
svn path=/trunk/; revision=54722
2014-01-13 21:23:36 +00:00
Guy Harris 9d41c658fe No seek-read routines use the length argument, so eliminate it from
wtap_seek_read().

svn path=/trunk/; revision=54570
2014-01-02 20:47:21 +00:00
Martin Kaiser 13fb0f313c int -> gboolean
svn path=/trunk/; revision=53800
2013-12-05 21:35:25 +00:00
Jakub Zawadzki 6aec20c782 Rmove packet_info argument from packet_list_append(), never used.
Part of attachment 12060, from Didier Gautheron (bug #9419).

svn path=/trunk/; revision=53544
2013-11-24 12:49:50 +00:00
Guy Harris db25270df8 Move the epan/filesystem.c routines to wsutil; they're not specific to
packet dissection, they're specific to the entire Wireshark suite of
programs.

svn path=/trunk/; revision=53377
2013-11-17 02:55:14 +00:00
Jakub Zawadzki ae59b09443 Add missing includes in order to remove exceptions.h from proto.h (next commit).
svn path=/trunk/; revision=53230
2013-11-10 15:59:37 +00:00
Guy Harris 853da2eb9b The "file types" we have are actually combinations of types and
subtypes, e.g. Network Monitor version 1 and Network Monitor version 2
are separate "file types", even though they both come from Network
Monitor.

Rename various functions, #defines, and variables appropriately.

svn path=/trunk/; revision=53166
2013-11-08 09:53:01 +00:00
Jakub Zawadzki a9d79ebb94 Try to fix recent test failures (wild guess, can't reproduce).
svn path=/trunk/; revision=52717
2013-10-20 17:53:55 +00:00
Jakub Zawadzki 52e1697533 wireshark: use epan_dissect_reset(), rawshark: fix missing epan_dissect_cleanup()
svn path=/trunk/; revision=52711
2013-10-20 13:22:48 +00:00
Jeff Morriss aae1de7f9e cf_start_tail() is (now) just a wrapper around cf_open(). Get rid of it and just call cf_open().
svn path=/trunk/; revision=52553
2013-10-11 21:29:12 +00:00
Anders Broman ca78b8f9dc g_list_prepend() is faster.
svn path=/trunk/; revision=52475
2013-10-09 20:12:08 +00:00
Anders Broman 20108d7950 Get rid of struct addrinfo, use the hastables for name resolution instead.
svn path=/trunk/; revision=52176
2013-09-22 19:40:02 +00:00
Pascal Quantin 0cf459a6cc Try to fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9106 :
Intialize phdr structure to avoid an invalid access to phdr->opt_comment

svn path=/trunk/; revision=51791
2013-09-05 20:35:03 +00:00
Guy Harris cbda96d79a Global variables considered harmful.
svn path=/trunk/; revision=51352
2013-08-14 04:14:36 +00:00
Evan Huus f528d4ecbc Only rescan packets if we have packets to rescan. Fixes at least the surface
problem in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9033

The underlying scoping issues may not be fully resolved yet.

svn path=/trunk/; revision=51327
2013-08-13 02:18:04 +00:00
Jeff Morriss 56d05bfd4b It's not necessary to call epan_free() in cf_open(): cf_close() (which is
called by cf_open()) already calls epan_free().

svn path=/trunk/; revision=51188
2013-08-07 16:14:44 +00:00
Martin Kaiser bee464590b use explicit cast to squelch compiler warning
svn path=/trunk/; revision=51093
2013-08-01 21:06:34 +00:00
Jakub Zawadzki 08eb36b5af Remove fdata->opt_comment, add pkt_comment to pinfo
Original (read from file) comments can be accessed by pkthdr->opt_comment
Keep user comments in seperated BST, add new method for epan session to get it.

svn path=/trunk/; revision=51090
2013-08-01 20:59:38 +00:00
Jakub Zawadzki 9bb17b7b2b Remove interface_id, pack_flags from frame_data structure.
This patch assumes that wtap_phdr interface_id, pack_flags both from initial read and seek read will contain same values.
Please fix if it's not.

svn path=/trunk/; revision=51041
2013-07-30 23:14:09 +00:00
Guy Harris 905eb4d706 Make a routine not used outside file.c static.
svn path=/trunk/; revision=50857
2013-07-23 23:45:24 +00:00
Jakub Zawadzki 7ec1a78fe8 Abuse epan_t more: add callback to get interface name.
svn path=/trunk/; revision=50794
2013-07-22 19:38:38 +00:00
Evan Huus ad42fced15 Fix file.c:112:1: error: ‘static’ is not at beginning of declaration
[-Werror=old-style-declaration]

svn path=/trunk/; revision=50775
2013-07-21 23:30:10 +00:00
Jakub Zawadzki c702e92121 Replace relative timestamp with reference frame number. Saves 16B per frame.
svn path=/trunk/; revision=50772
2013-07-21 23:07:33 +00:00
Jakub Zawadzki 5d52e16734 Add helper function to epan_session which can be used to get absolute timestamp of given frame.
Remove ->prev_cap, for testing purpose also replace ->prev_dis with number of previously displayed frame number.

This patch reduce size of frame_data by 8B (amd64)
This is what (I think) was suggested by Guy in comment 13 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5821#c13)

svn path=/trunk/; revision=50765
2013-07-21 20:48:30 +00:00
Jakub Zawadzki 28e9dcc4a9 Some work on multi file dissection
- make init_dissection/cleanup_dissection private for libwireshark
- implement epan_new(), epan_free()
- pass epan_t to epan_dissect*

svn path=/trunk/; revision=50761
2013-07-21 18:38:03 +00:00
Jeff Morriss 0a669967fa Move merge.{h,c} into wiretap: these modules use wiretap to merge files.
svn path=/trunk/; revision=50656
2013-07-16 02:35:33 +00:00
Jeff Morriss 4dcc156cf3 Move the print modules into epan.
svn path=/trunk/; revision=50526
2013-07-12 03:50:50 +00:00
Jeff Morriss 45449ce1a8 Move some more modules into epan.
svn path=/trunk/; revision=50517
2013-07-11 23:57:11 +00:00
Jakub Zawadzki ce81449ed9 packet dissection now takes pointer to tvb instead of guint8 data
implement frame_tvbuff, right now almost a copy of 'real' tvb.

svn path=/trunk/; revision=50497
2013-07-11 05:47:02 +00:00
Alexis La Goutte a5e8bb116c Fix some Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=50232
2013-06-29 21:58:57 +00:00
Jeff Morriss bbf6a3766e Move tempfile.{h,c} into wsutil.
svn path=/trunk/; revision=50163
2013-06-26 01:14:35 +00:00
Guy Harris 847fbeefdb Fix build with packet editor enabled. (Fix a typo while we're at it.)
svn path=/trunk/; revision=50153
2013-06-25 21:45:56 +00:00
Martin Kaiser 369658c499 inform expert info layer about the current number of packet comments
when the last comment is removed and we have no other expert info,
the maximum severity is changed from comment to none

svn path=/trunk/; revision=50091
2013-06-20 22:25:33 +00:00
Chris Maynard 909d2eb309 Allow for column headers not to be printed in order to make it possible to export packets as plain text in a format that could then have a chance of being imported again (assuming other factors such as packet bytes were printed, etc.) in order to recover the original pcap file.
Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1636

svn path=/trunk/; revision=50036
2013-06-19 15:22:56 +00:00
Guy Harris 8c9edf1280 Have the seek-read routines take a Buffer rather than a guint8 pointer
as the "where to put the packet data" argument.

This lets more of the libwiretap code be common between the read and
seek-read code paths, and also allows for more flexibility in the "fill
in the data" path - we can expand the buffer as needed in both cases.

svn path=/trunk/; revision=49949
2013-06-16 00:20:00 +00:00
Evan Huus 882a1fe6f0 Don't take the shortcut of moving/copying the existing file if we have a name
resolution block to write (which isn't necessarily in the existing file).

Fixes at least part of https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8317

svn path=/trunk/; revision=48842
2013-04-13 18:24:06 +00:00
Guy Harris 432e914dbd Rename cf_not_saved() to cf_has_unsaved_data() to clarify what it
indicates.  (Note: "unsaved data" is more than just "unsaved changes";
it could also mean "temporary file that hasn't been saved anywhere".)

svn path=/trunk/; revision=48709
2013-04-02 20:35:46 +00:00
Guy Harris d942759401 Add routines to file.c to indicate whether:
a save can be done ("can" in the sense of "there's something to
	save" and in the sense of "we can write that something out");

	a "save as" can be done (in the sense of "we can write what we
	have out");

	there's unsaved data to save (which might be unsaved changes or
	might be a temporary file full of packets);

and use them as appropriate.  This means that the "unsaved data"
indicator in the UI will be turned on for temporary files full of
packets as well as for files with unsaved changes; that's what we want.

svn path=/trunk/; revision=48693
2013-04-01 23:44:29 +00:00
Guy Harris b1ecd8d217 Add a wtap_dump_can_write() routine that indicates whether Wiretap
supports writing files with a given set of encapsulations and comment
types.  Use it, rather than asking for a list of file formats that
support the given set of encapsulation and comment types and checking
whether we got back such a list, or duplicating its logic.

Having file.c use it means that nobody's using
wtap_dump_can_write_encaps() any more; get rid of it.  Instead, have a
private routine that checks whether a given file format supports a given
set of encapsulations *and* comment types, and use that internally.

svn path=/trunk/; revision=48690
2013-04-01 21:17:50 +00:00
Guy Harris 82a602d697 Define a collection of bits for different types of capture file comments.
For each capture file type, have a bitset of comment types supported by
that capture file type.

Add a Wiretap routine that, for a given file type, returns the bitset of
comment types it supports.

Have wtap_get_savable_file_types() take a bitset of comment types that
need to be supported by the file types it returns.

Replace cf_has_comments() with a routine that returns a bitset of
capture file comment types in the capture file.

Use those routines in the capture file dialogs; don't wire in the notion
that pcap-NG supports all comment types and no other file formats
support any comment types.  (That's currently true, but we don't want to
wire that in as being forever true.)

svn path=/trunk/; revision=48689
2013-04-01 20:36:42 +00:00
Evan Huus d935a280e3 From Hadriel Kaplan via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8223
Add a 2-pass display-filter flag to tshark so that reassembly and other forward-
looking dissections can be used with filters.

It's a bit of a hack, but this entire area of 2-pass analysis etc. is a giant
pile of hacks to begin with and needs cleaning up. For now just having this
feature is a big enough win.

svn path=/trunk/; revision=48589
2013-03-27 17:14:42 +00:00
Anders Broman ef07303c20 Make internal functions static.
svn path=/trunk/; revision=48465
2013-03-21 21:58:47 +00:00
Bill Meier 0df5a9390d From beroset:
remove C++ incompatibilities
 https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 attachment #10397

svn path=/trunk/; revision=48438
2013-03-20 01:18:10 +00:00
Evan Huus 32799db42c Fix the leaking of packet comments, i.e. the rest of
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7530

The frame_data_cleanup function was ambiguous; it was being used for two
different purposes, and did neither of them quite properly. Split it instead
into frame_data_reset and frame_data_destroy, and call the correct one depending
on why we were originally calling frame_data_cleanup.

svn path=/trunk/; revision=48324
2013-03-15 18:04:50 +00:00
Anders Broman 7990a0e4d0 Use explicit casts.
svn path=/trunk/; revision=48137
2013-03-06 17:35:11 +00:00
Michael Tüxen 6af6ce5ee0 Add support for writing the packet block flags for pcapng.
While there, do some minor cleanup.

svn path=/trunk/; revision=46699
2012-12-22 20:38:08 +00:00
Gerald Combs 5c2c5aed87 Rename the search type menu items to more accurately reflect what we're
actually doing and what users are likely to want to do.  Rename the
search enum values and functions to reflect what we're actually doing
and add a comment explaining why making searches more correct might make
searching worse.  Add a search bar to the Qt main window, thus
continuing the War On Gratuitous Dialogs.

Clear out any previous temporary label stack items before adding a new one.

svn path=/trunk/; revision=46541
2012-12-15 01:04:39 +00:00
Bill Meier 552323e7fb Fix a number of [-Wshadow] warnings;
Also: Do some minor whitespace changes

svn path=/trunk/; revision=46182
2012-11-25 18:35:41 +00:00
Evan Huus 13f8a0466c Make a few variables volatile to satisfy gcc.
svn path=/trunk/; revision=45886
2012-11-03 23:41:59 +00:00
Jakub Zawadzki bdcdec560c Manually revert r45669
svn path=/trunk/; revision=45884
2012-11-03 20:51:19 +00:00
Jakub Zawadzki d127d974f5 volatile fixes.
svn path=/trunk/; revision=45729
2012-10-22 21:22:35 +00:00
Jakub Zawadzki 9e52b48cc6 Move some variables inside TRY { } block.
svn path=/trunk/; revision=45724
2012-10-22 19:44:51 +00:00
Guy Harris 3c93cdbddc Make progbar_quantum volatile to suppress setjmp/longjmp warnings.
svn path=/trunk/; revision=45723
2012-10-22 19:34:09 +00:00
Jakub Zawadzki d26925c9cf Move TRY CATCH outside reading packet loops.
svn path=/trunk/; revision=45722
2012-10-22 19:14:43 +00:00
Chris Maynard 573dd5b3dc 1) Allow for the possibility for both packet summary and packet details to be
printed when either -T is not specified or "-T text" or "-T ps" is selected.

2) Allow for packet hex/ascii to be printed without necessarily requiring that
either packet summary or packet details also be printed.  This just means that
if you want packet summary information, use "-Px" instead of just "-x".

3) Fix bug with order of evaluation of -V and "-T psml".

4) If a packet separator is specified, always use it regardless of the -PVx
options chosen.

5) Don't print 2 lines of separation between packets when only printing
hex/ascii.  Print 1 line of separation as in all other cases.

Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7782 plus other misc. enhancements.

svn path=/trunk/; revision=45715
2012-10-22 15:56:59 +00:00
Jakub Zawadzki 2fd81fdaf9 Move ep_free_all() *AFTER* packet dissection.
Use glib allocator for data_source.

Thread on wireshark-dev: http://www.wireshark.org/lists/wireshark-dev/201210/msg00116.html

svn path=/trunk/; revision=45673
2012-10-20 20:04:40 +00:00
Jakub Zawadzki 33b064cd81 I don't understand how this variable might be clobbered, but mark it volatile to silent gcc warning.
svn path=/trunk/; revision=45671
2012-10-20 19:52:23 +00:00
Jakub Zawadzki 77368c3668 Introduce epan_dissect_run_with_taps() which run dissection with taps.
unexport tap_queue_init, tap_push_tapped_queue

svn path=/trunk/; revision=45670
2012-10-20 19:27:24 +00:00
Jakub Zawadzki 6dc977b7d2 - Allow reseting edt with new function epan_dissect_reset(),
- initialize edt once in few places, and later reset it after dissecting
  (add_packet_to_packet_list),
- revert r45667, probably no longer needed.

svn path=/trunk/; revision=45669
2012-10-20 16:44:55 +00:00
Evan Huus eb4e26e1b7 Make a few variables volatile to fix longjmp warnings.
svn path=/trunk/; revision=45667
2012-10-20 13:16:10 +00:00
Jakub Zawadzki 88ac0dbea2 Pass create_proto_tree, cinfo directly to add_packet_to_packet_list
svn path=/trunk/; revision=45666
2012-10-20 12:51:34 +00:00
Jakub Zawadzki ea31ff66a0 Remove always TRUE refilter argument from rescan_packets, add_packet_to_packet_list
svn path=/trunk/; revision=45665
2012-10-20 12:51:05 +00:00
Jakub Zawadzki 98e6481be8 Only cap_len (not pkt_len) bytes of buffer are valid.
svn path=/trunk/; revision=45621
2012-10-17 21:14:14 +00:00
Jakub Zawadzki 59e2c7fd96 Fix a copy/paste error
svn path=/trunk/; revision=45620
2012-10-17 21:11:58 +00:00
Jakub Zawadzki 78631020b8 Add wtap_pseudo_header union to wtap_pkthdr structure.
Use pkthdr instead of pseudo_header as argument for dissecting.

svn path=/trunk/; revision=45601
2012-10-16 21:50:57 +00:00
Gerald Combs 4f1eb84444 Log the time we spend waiting for the capture child to exit.
Add breadcrumbs so that we can switch from g_get_current_time to
g_get_real_time when our minimum GLib version is >= 2.28.

svn path=/trunk/; revision=45399
2012-10-08 18:11:30 +00:00
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 91db653dca Revert r45182, add better fix for bug #6208: Status bar count of displayed packets wrong
cf_read() is already checking for cf->redissecting variable and if set it don't add packets to packet_list.
Rename it to cf->rescanning and set it always in rescan_packets() [not only when redissecting].

svn path=/trunk/; revision=45183
2012-09-27 21:17:50 +00:00
Jakub Zawadzki 90c5d4e61b Try to fix bug #6208: Status bar count of displayed packets wrong
When refiltering we process gtk/glib events, so it's possible that cf_continue_tail()
will fire-up, reading new packets and incrementing cf->count.

It's also possible that this packet(s) will pass display filter,
incrementing cf->displayed_count.

But when refiltering we use cf->count as number of packets to process, so
new packets are also processed, incrementing cf->displayed_count second time.

Fix bug by saving cf->count before starting refilter loop.

svn path=/trunk/; revision=45182
2012-09-27 20:59:54 +00:00
Gerald Combs 3994ddc357 Call fileset_file_closed from cf_cb_file_closed.
svn path=/trunk/; revision=45163
2012-09-26 23:40:56 +00:00
Gerald Combs 998da54456 Add a cf_cb_file_opened callback and use it instead of calling
fileset_file_opened directly from file.c. This makes the code a bit more
consistenent and makes it easier to port the File Set dialog to Qt.

svn path=/trunk/; revision=45162
2012-09-26 23:33:11 +00:00
Jakub Zawadzki 72ca9d0e61 Store pointers to previously displayed and captured packet, not nstime_t deltas.
This commit reduces size (from 144B to 128B on AMD64) of frame_data structure.

Part of bug 5821: Reduce per-packet memory requirements.

svn path=/trunk/; revision=45071
2012-09-23 16:25:28 +00:00
Jeff Morriss 93b1a4d511 (Try to) fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5808 :
Use and free err_info in cf_continue_tail() and cf_finish_tail().

(Untested because I'm not sure how to corrupt a file to exercise this code path...)

svn path=/trunk/; revision=45032
2012-09-20 21:16:26 +00:00
Jeff Morriss 3551a86c36 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45015
2012-09-20 01:29:52 +00:00
Evan Huus 471b4d94ef Remove string constants from g_assert() calls, as per thread on wireshark-dev:
http://www.wireshark.org/lists/wireshark-dev/201209/msg00030.html

svn path=/trunk/; revision=44774
2012-09-05 01:44:09 +00:00
Jörg Mayer 12a0aa4849 - Replace packet_list_recreate_visible_rows -> packet_list_recreate_visible_rows_list
- Replace new_packet_list_ -> packet_list_


svn path=/trunk/; revision=44765
2012-09-04 02:35:25 +00:00
Bill Meier e211327f65 Fix indentation to match editor mode-lines (no tabs, correct indentation, etc);
Reformat some whitespace;
Remove unneeded variable initialization.

svn path=/trunk/; revision=44461
2012-08-12 22:21:02 +00:00
Anders Broman ae5a2f3b6d Make it possible to merge libpcap files with different encapsulation types by making the output file a pcapng file and construkting SHB and IDB
svn path=/trunk/; revision=44338
2012-08-08 14:06:29 +00:00
Guy Harris c0506eda4a simple_message_box() does not expect Pango markup, so escaping is
not necessary, and just messes up the display.

Fixes bug 7489.

#BACKPORT

svn path=/trunk/; revision=43875
2012-07-21 00:12:21 +00:00
Guy Harris 633de5c7d1 Add a routine that, given a set of packet encapsulation types, returns
the per-file encapsulation type needed to write out a set of packets
with all those encapsulation types.  If there's only one such
encapsulation type, that's the type, otherwise WTAP_ENCAP_PER_PACKET is
needed.  Use that in wtap_dump_can_write_encaps().

Also use it in cf_save_packets() and cf_export_specified_packets(), so
that we can write out files with WTAP_ENCAP_PER_PACKET as the file
encapsulation type and only one actual per-packet encapsulation type in
some cases where that failed before.  This fixes the case that showed up
in bug 7505, although there are other cases where we *could* write out a
capture in a given file format but won't be able to do so; fixing those
will take more work.

#BACKPORT

(Note: this adds a routine to libwiretap, so, when backported, the
*minor* version of the library should be increased.  Code that worked
with the version of the library prior to this change will continue to
work, so there's no need to change the *major* version of the library.)

svn path=/trunk/; revision=43847
2012-07-20 04:00:29 +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
Chris Maynard 83c83a0c05 From Michael Mann via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7356:
Print only visible columns.

svn path=/trunk/; revision=43722
2012-07-15 14:56:40 +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 f272aaeb80 Only allow "Save" if
the file has unsaved changes, and we can save it in some format
	through Wiretap

or

	the file is a temporary file and has no unsaved changes (so that
	"saving" it just means copying it).

Only allow "Save As" if

	we can save it in some format through Wiretap

or

	the file is a temporary file and has no unsaved changes (so that
	"saving" it just means copying it).

This means that we don't support using "Save As" for just copying the
file unless we can do that with Wiretap; copying the file byte-for-byte
only works as "saving" if there are no unsaved changes *and* we're
saving it in the same format that it's in *and* we're saving it with the
same form of compression (if any) that it has.

Rename cf_can_save_as() to cf_can_write_with_wiretap() to better reflect
what it really does.

svn path=/trunk/; revision=43477
2012-06-25 18:37:52 +00:00
Anders Broman cb801710ba From Evan Huus:
Size wrong in "File Set List" for just-finished captures.

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

svn path=/trunk/; revision=43455
2012-06-24 15:08:41 +00:00
Guy Harris 750d666e73 Handle the case where the user has added comments to a file that's not
in a format that supports comments and they do a "Save" by popping up a
similar question to the one we pop up in the "Save As" case and, if they
say "choose another format", pop up a "Save As" dialog box.

svn path=/trunk/; revision=43395
2012-06-20 04:44:14 +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 29e4e24184 Add "simple dialog" routines to pop up modal message boxes. Use them in
file.c and routines called from it; non-modal dialogs end up, in some
cases, either hidden, devoid of the input focus and not dismissable, or
both.

svn path=/trunk/; revision=43321
2012-06-17 22:32:03 +00:00
Guy Harris 2bd813507a Export a wtap_dump_can_write_encaps() routine from Wiretap; it takes a
file type and a GArray of encapsulation types and returns TRUE if a
capture with all those encapsulation types can be written to a file in
that file type and FALSE otherwise.  Use it where appropriate.

svn path=/trunk/; revision=43315
2012-06-17 16:44:09 +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
Jakub Zawadzki a2bb94c3b3 Clear GtkTreeStore before freeing edt
When building current data for packet details treeview we store two things.
- Generated string with item label
- Pointer to node field_info structure

After epan_dissect_{free, cleanup} pointer to field_info node is no longer
valid so we should clear GtkTreeStore before freeing.

svn path=/trunk/; revision=43188
2012-06-10 22:03:17 +00:00
Guy Harris 9fe3d4b4f3 If we do a Save or Save As with a move, don't reread the capture file,
just tweak the elements in the capture_file structure as necessary and
poke the UI to update stuff such as the windows title.

If we do a Save or Save As with a copy, don't reread the capture file,
just close the old wtap, open a wtap for the copy, and tweak the
elements in the capture_file structure as necessary and poke the UI to
update stuff such as the windows title.

Otherwise, don't do a full read-and-dissect pass on the capture file,
just close the old wtap, open a wtap for the new file, tweak the
elements in the capture_file structure as necessary and poke the UI to
update stuff such as the windows title, and rescan the file to update
the packet offsets (and cause Wiretap to regenerate, for a gzipped file,
the information needed to support fast random access to the gzipped
file).

This should speed up Save and Save As a bit, as well as removing some
glitches in the UI (e.g., you won't see the packet list disappear and
reappear).

svn path=/trunk/; revision=43101
2012-06-05 06:52:18 +00:00
Guy Harris d026ca7ed3 Fix some comments.
svn path=/trunk/; revision=43096
2012-06-05 02:49:56 +00:00
Guy Harris 99536cc8da Distinguish between "failed" and "user stopped it" for "save as" and
"export specified packets".  For "failed", let the user try again with a
different file, in case it failed due to, for example, running out of
space or quota (probably the most likely failure mode for writing, and
trying to a different volume might be the best workaround).  For "user
stopped it", presumably they don't want to try again (the most likely
reason is "it was taking too damn long").
 
Put "Exporting to: ...", not "Saving: ..." in the statusbar if we're
doing "export specified packets".

In process_specified_packets(), allow a null range pointer to be
specified, meaning "save 'em all"; that avoids the possibly-expensive
(with a large capture) operation of initializing the range.

If a "safe save" atop an existing file fails or is stopped, get rid of
the temporary file we created.

svn path=/trunk/; revision=43095
2012-06-05 02:46:54 +00:00
Guy Harris 0b835b8cb6 As we might use cf->lnk_t while a capture is in progress, we need up
update it after each burst of packets.  (This is broken - we should have
cf->lnk_t be WTAP_ENCAP_PER_PACKET in all capture file formats that can
handle more than one packet type, and, in order to support writing out
*some* such files in formats that can only handle one packet type, just
use the type of the first packet when doing a one-pass operation and
gather up all the packet types in a multi-pass operation.)

svn path=/trunk/; revision=43048
2012-06-03 23:38:11 +00:00
Guy Harris dbfb305368 g_filename_display_basename() returns a g_mallocated string, so its
callers either need to free it or their callers need to free it or....

This means that cf_get_display_name() must always return a g_mallocated
string and its callers or... must free it.

For some of those callers, create a new set_window_title() routine to do
the work - they're all using the same pattern.

svn path=/trunk/; revision=43047
2012-06-03 22:03:05 +00:00
Guy Harris 49ac36fd59 Use g_filename_display_basename() rather than get_basename() when we're
getting the basename for display purposes, so it's converted from the
GLib/GTK+ locale filename encoding to UTF-8.  (For Windows, the locale
filename encoding is UTF-8, and the internal encoding is UTF-16, so the
file names should *probably* all be valid UTF-8 - Windows may not
support invalid UTF-16 in file names.  For Qt, I'm not sure whether the
file dialogs ever return file names in some non-UTF-8 encoding.)

svn path=/trunk/; revision=43044
2012-06-03 19:31:59 +00:00
Guy Harris 6230f46670 Update a comment.
svn path=/trunk/; revision=43043
2012-06-03 18:48:51 +00:00
Guy Harris 5f0c275f0f If the rename in a safe "Save As" fails, the current file's name has
*not* changed; what we need to, on Windows, reopen is the *old* file
name, not the name we're saving as.

svn path=/trunk/; revision=43003
2012-06-02 16:59:47 +00:00
Guy Harris e51c05a836 TShark doesn't need wtap_fdreopen(), as it doesn't do saves and thus
doesn't do safe saves, so wtap_fdreopen() always needs to reopen the
random file descriptor.

At the point where a safe save is done, the sequential read is done, so
the sequential stream is closed; there's no need to reopen it.

(The former fourth argument to wtap_fdreopen() wasn't an indication of
whether the file was compressed, it was an indicationof whether the
random stream should be reopened.)

svn path=/trunk/; revision=42977
2012-06-01 16:55:10 +00:00
Anders Broman 61390769a4 make it compile.
I suppose we do random access if compressed.

svn path=/trunk/; revision=42966
2012-06-01 10:26:49 +00:00
Guy Harris 129c881fcf Sigh. There appears to be no way to get Windows to allow us to rename a
file that we ourselves have open.  In the "safe save" code path for
capture files, on Windows temporarily close the file descriptors for the
currently-open capture before doing the rename and then, if the rename
failed, reopen them, leaving the rest of the wtap and capture_file
structures intact.

Rename filed_open() to file_fdopen(), to make its name match what it
does a bit better (it's an fdopen()-style routine, i.e. do the
equivalent of an open with an already-open file descriptor rather than a
pathname, in the file_wrappers.c set of routines).

Remove the file_ routines from the .def file for Wiretap - they should
only be called by code inside Wiretap.

Closing a descriptor open for input has no reason to fail (closing a
descriptor open for *writing* could fail if the file is on a server and
dirty pages are pushed asynchronously to the server and synchronously on
a close), so just have file_close() return void.

svn path=/trunk/; revision=42961
2012-06-01 08:05:12 +00:00
Guy Harris 1660e397b9 Test was backwards - if fname_new is *NON*-null, it was the name of a
temporary file to which we were writing in order to do a "safe save". 
Thanks to Coverity for pointing this out - should fix CIDs 703317 and
703316.

svn path=/trunk/; revision=42891
2012-05-29 01:18:16 +00:00
Guy Harris 73fbd6894d I already got rid of that variable - it just mirrors cf->filename.
svn path=/trunk/; revision=42860
2012-05-26 00:53:50 +00:00
Guy Harris 3d3b154b12 We can't save a live capture file with a ws_rename() on Windows, as we
have the file open.  Go back to doing it with a copy on Windows.

Explain what the problem is, and give a way in which we might be able to
make it work on Windows (without using any NT native API calls...).

svn path=/trunk/; revision=42859
2012-05-26 00:44:49 +00:00
Guy Harris 6014035703 Use GTK+'s GtkMessageDialog for the questions we ask in the process of
saving files, and run it modal (which we're already doing with the
GtkFileChooserDialog); this means less callback-based state machine
stuff, simplifying the code paths a bit.

If we're saving a file before closing it, don't bother reloading it
after saving it.

svn path=/trunk/; revision=42855
2012-05-25 21:25:55 +00:00
Jeff Morriss cef1cc7e14 cf_update_capture_comment(): free the shb_inf when we're done with it.
svn path=/trunk/; revision=42830
2012-05-24 18:54:03 +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 b655197a9d In the "Save As" and "Export Specified Packets" code path, do a "safe
save" if the destination file exists.

Don't forbid overwriting an existing file in either of those cases (we
still forbid overwriting the current capture file) - the GUI asks the
user whether they want to do the overwrite, and allows them to cancel
out of it - and don't remove the file before writing to it (doing so
makes the save *un*safe).

Attempt to do a save of an unedited temporary file by just moving the
file on Windows as well as on UN*X - ws_rename() will remove the target
if necessary on Windows (and won't do it as a separate operation before
attempting the rename), so it behaves like ws_rename() on UN*X (which is
just a wrapper around rename()).

svn path=/trunk/; revision=42816
2012-05-24 02:16:53 +00:00
Guy Harris c2bb7956c2 "Save As" always saves everything and, when the save is done, makes the
new file the current file, as is the case in most if not all other GUI
applications.

A new "Export Specified Packets" menu option allows you to specify which
packets to write out, with the default being the displayed packets (and
those on which the displayed packets depend for, e.g.  reassembly), and
never makes the resulting file the current file.

The two operations are conceptually distinct.  Lumping them into one
menu item, with the default for "Save As" being "displayed packets only"
and thus making it behave like the latter operation, was causing some
confusion; see, for example, bug 6640.

Make the dialog popped up if you try to "Save As" or "Export Specified
Packets" on top of an existing file ask the "do you want to do this?"
question in the main part of the message, and note in the secondary text
that doing that will overwrite what's in the file; that matches what
TextEdit on OS X and the GNOME text editor say.

svn path=/trunk/; revision=42792
2012-05-22 22:17:57 +00:00
Guy Harris ae7d57d5fa We're an editor now, as we let you add, delete, and edit frame comments,
so "Save" should, for non-temporary files, mean "save the current state
of the capture file on top of the existing file" without prompting for a
file name.

That means we have to do a "safe save" - i.e, write the capture out to a
new file and, if that succeeds, rename the new file on top of the old
file - as the actual packet data to write out is in the file we're
overwriting, not in memory.  (We'd want to do that anyway, of
course....)

Update some comments.

Clean up indentation slightly, and get rid of an unnecessary variable
(in all the cases where we use it, we assign it the same value, and that
value isn't modified out from under us before we use it).

Note that after a "Save", or a "Save As" that writes out all captured
packets, we shouldn't have to close the current file and open the new
file and reread it - we should be able to open the new file and update
the frame offsets in the frame_data structures.

Note that we need to do some a better job of reporting rename failures.

svn path=/trunk/; revision=42777
2012-05-22 10:36:40 +00:00
Guy Harris 90c43120ca The GUI's state machine requires that, when reloading a capture after a
save, we post capture file callback events similar to the ones posted
when reading a capture - otherwise, the reload will leave the welcome
screen up.

Rename cf_cb_file_save_reload_finished to cf_cb_file_reload_finished,
add a cf_cb_file_reload_started callback, have them work similarly to
read_finished and read_started except that the reload uses "Reloading"
in the progress bar and status bar.

Clean up some indentation while we're at it.

svn path=/trunk/; revision=42764
2012-05-22 03:52:12 +00:00
Jeff Morriss 7755747797 Finish fixing https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7270#c4 :
Revert r42758 as it only helps in one case; rather, fix it correctly: if
we're redissecting or refiltering, clear any frame dependencies as we go
along.  (Fortunately, frame dependencies are all forward dependencies--
meaning that a given frame can only be depended upon by a later frame--
so we can do this as we rescan the packets/frames.)

svn path=/trunk/; revision=42762
2012-05-22 01:59:34 +00:00
Jeff Morriss 33c9fa1f30 Partial fix for https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7270#c4 :
Clear the dependent_of_displayed flag when there's no dfilter.  This only
helps the case when you clear a display filter before moving on to another
display filter.

svn path=/trunk/; revision=42758
2012-05-21 19:44:24 +00:00
Jeff Morriss 1828c71743 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7270 :
Don't mark frames as dependent upon a displayed frame unless the (supposedly)
displayed frame is actually displayed.  (Fix to r41214 <sigh>.)

svn path=/trunk/; revision=42752
2012-05-21 17:09:15 +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 60637d4b70 When saving packets, fill in hdr.presence_flags from the flags in the
frame_data structure; there's no guarantee that the wtap_pkthdr in the
wtap structure reflects the current packet.

svn path=/trunk/; revision=42705
2012-05-18 03:31:50 +00:00
Balint Reczey 4441dd7d59 Give hints to capture from stdin or pipe instead of opening it as a file
svn path=/trunk/; revision=42484
2012-05-07 19:53:49 +00:00
ruengeler 61e2ac924d Fix bug #7112, where the interface ids were not saved
svn path=/trunk/; revision=42110
2012-04-17 13:13:30 +00:00
Jakub Zawadzki 189b255ddf Fix dependent_frames memleak.
Reviewed-By: Jeff Morriss (http://www.wireshark.org/lists/wireshark-dev/201204/msg00013.html)

svn path=/trunk/; revision=41902
2012-04-03 09:18:16 +00:00
Jeff Morriss 9c1bf7223e Don't mark the file as unsaved unless the capture or packet comments actually changed.
svn path=/trunk/; revision=41744
2012-03-23 01:41:59 +00:00
Jeff Morriss 9e8148eeef Should have been part of r41542: Don't free idb_inf in wtap_dump_open_ng(): free it in the callers.
svn path=/trunk/; revision=41553
2012-03-15 02:35:49 +00:00
Guy Harris cd1debf183 Add an explicit capture_cb_capture_failed indication for the case where
we weren't even able to start a capture, rather than delivering a fake
"capture start" indication and relying on a later "capture file closed"
indication - for a capture that was never opened in the first place - to
handle GUI cleanups.

Don't deliver any GUI indications in cf_close() if we didn't have a
capture file open in the first place.

Clear the status bar and welcome header if that indication is delivered.

If we start a capture from the command line with the -k flag, don't show
the captured packet information unless the capture actually starts.

svn path=/trunk/; revision=41521
2012-03-13 08:36:25 +00:00
Guy Harris b77a0b3827 Fix indentation.
svn path=/trunk/; revision=41320
2012-03-02 11:36:44 +00:00
Anders Broman d24fad6371 - Add a LED in the statusbar to indicate that capture comments exists,
clickable to open an edit window.
- Add checks for NULL pointers.

Help with a different color LED possibly with Jeff's (c) in it apreceated.
Should the LED be placed elsewhere or the whole thing done differently?

svn path=/trunk/; revision=41242
2012-02-29 16:51:32 +00:00
Jeff Morriss 89cfdc3559 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3315 -
make Save-As/Displayed/All-Packets save not only the displayed packets but
also any other packets needed (e.g., for reassembly) to fully dissect the
displayed packets.

This works only for the "All packets" case; choosing only the Selected packet,
the Marked packets, or a range of packets would require actually storing which
packets depend on which (too much memory) or going through the packet list many
times (too slow).  Also, this behavior is always the case: you can't save the
displayed packets without their dependencies (I don't see why this would be
desirable).

So far this is done for SCTP and things using the reassembly routines (TCP has
been tested).

The Win32 dialog was modified but hasn't been tested yet.

One confusing aspect of the UI is that the Displayed count in the Save-As
dialog does not match the number of displayed packets.  (I tried renaming the
button "Displayed + Dependencies" but it looked too big.)  The tooltip tries
to explain this and the fact that this works only in the All-Packets case;
suggestions for improvement are welcome.


Implementation details:

Dissectors (or the reassembly code) can list frames which were needed to
build the current frame's tree.  If the current frame passes the display
filter then each listed frame is marked as "depended upon" (this takes up the
last free frame_data flag).

When performing a Save-As/Displayed/All-Packets then choose packets which
passed the dfilter _or_ are depended upon.

svn path=/trunk/; revision=41216
2012-02-28 03:19:49 +00:00
Michael Tüxen 307a310391 Whitespace changes.
svn path=/trunk/; revision=41116
2012-02-21 16:29:29 +00:00
Anders Broman 89758cdec8 From Jose Pedro Oliveira fix a typo
svn path=/trunk/; revision=41091
2012-02-20 22:40:17 +00:00
Anders Broman c7f1a431d2 Handle reading and writing of multiple IDB:s, write IDB options and use correct lengt for strings, handle more than 100 char comment
svn path=/trunk/; revision=41082
2012-02-20 20:15:51 +00:00
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
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
Bill Meier 4871fd2412 Fix compilation error when compiling for "old packet list".
svn path=/trunk/; revision=33802
2010-08-15 15:17:48 +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 cfa9982492 Make sure we call wtap_cleareof() before each read.
svn path=/trunk/; revision=33555
2010-07-16 18:20:32 +00:00
Anders Broman 5356785ede Reverting
http://anonsvn.wireshark.org/viewvc?view=rev&revision=29861
seems to fix the scrolling in live captures issue.

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

svn path=/trunk/; revision=33384
2010-06-30 19:38:26 +00:00
Stig Bjørlykke b444bd6eb2 Increase the displayed_count before we add the packet to the packet list,
because we update the the packets bar when adding the packet.

This fixes bug 4896.

svn path=/trunk/; revision=33331
2010-06-26 21:03:01 +00:00