Commit Graph

270 Commits

Author SHA1 Message Date
John Thacker a9a7dcec21 Qt: Ensure that add frame comments trigger recoloring, count updates
Add functions to PacketListRecord to invalidate a single record's
colorization and column strings, used for a record is modified in a
way that needs to trigger redrawing, but we don't need to redraw
all packets.

Move the functionality for adding, deleting, and setting frame comments
into PacketListModel, operating on QModelIndexes (or on all physical
rows in the case of deleting all comments from a file.) Trigger
recolorization of any record with an updated comment.

Only set a block as modified when deleting comments if we actually
deleted comments. This avoids marking a file as modified if we
delete all comments from all frames, or all comments from selected
frames, when those comments do not actually have frames.

If cf_set_modified_block is used to modify a block that is already
modified, it can't update the comment count. In that case, return
false and have the callers update the comment count. (It already
has a return value, which is always true.) This avoids having the
GUI warning about saving into a format that doesn't support comments
when comments have been added and then removed.

Note that, unlike with time references and time shifts, there
are no fields (and hence no columns nor color filters) that depend
on whether other fields have comments. If for some reason some
were added, then the model data for all frames would have to be
updated instead. Since there aren't, we don't need to
redrawVisiblePackets, but we do need to drawCurrentPacket to ensure
the packet details are redissected.

Fix #12519
2023-02-17 20:49:11 -05:00
Roland Knall cfbb6973d4 file: Fix documentation 2022-06-28 20:53:24 +00:00
Roland Knall c3b2cec3f2 Ui: Cleanup row number and select packet
Remove unneeded row number in capture file. The packet list is
the only object that should know the correct number, propagating
it further only complicates things. At the same time, rework
cf_select_packet to select the packet based on frame_data not on
the row (which can be unreliable).
2022-06-28 14:56:06 +02:00
Roland Knall ef8ed9dff9 Ui: Remove time column reformat callback
The code can be placed directly to packet list model
and does not need to be a generic callback
2022-06-28 14:23:05 +02:00
David Perry 70d432c357 Remove editor modelines and .editorconfig exceptions from root files 2022-02-20 19:39:37 +00:00
John Thacker 0011bb6a4c Qt: Allow omitting secondary data sources when printing
Add a checkbox to the packet format group box to allow the
hexdump to only have the main frame instead of secondary data
sources as well, so that Print and Export Packet Dissections can
be used for input to text2pcap.
2022-02-10 23:28:53 -05:00
David Perry 1e0d117eb7 Specify directory for temporary captures 2022-02-09 14:32:28 +00:00
Moshe Kaplan 7567432ec4 Add remaining header files to Doxygen
Add @file markers for remaining
header files so that Doxygen will
generate documentation for them.
2021-12-12 03:56:35 +00:00
Stig Bjørlykke e866034c55 Qt: Handle errors when reloading Lua FileHandler
Reloading the capture file after reloading a Lua FileHandler
may fail because of Lua errors. Handle this by closing the file.

Related to #17615
2021-10-04 07:15:11 +00:00
Developer Alexander 68893e415c capture file: remove redundant API ref_time_packets()
Redundant API ref_time_packets() gets removed.

cf_reftime_packets() gets a better dokumentation.
2021-08-28 07:53:51 +02:00
Dario Lombardo bf5843b646 file: fix constness in declaration.
Ref: ee0dc72084
2021-08-22 21:17:18 +00:00
Guy Harris dd5907d2a3 Consistently refer to blocks that have been modified as "modified".
"User" sounds as if the blocks belong to the user; at most, the current
user might have modified them directly, but they might also have, for
example, run a Lua script that, unknown to them, modified comments.
Also, a file might have "user comments" added by a previous user, who
them wrote the file and and provided it to the current user.

"Modified" seems a bit clearer than "changed".
2021-07-08 00:05:35 -07:00
David Perry 73087d6fb4 Use wtap_blocks for packet comments
Mostly functioning proof of concept for #14329. This work is intended to
allow Wireshark to support multiple packet comments per packet.

Uses and expands upon the `wtap_block` API in `wiretap/wtap_opttypes.h`.
It attaches a `wtap_block` structure to `wtap_rec` in place of its
current `opt_comment` and `packet_verdict` members to hold OPT_COMMENT
and OPT_PKT_VERDICT option values.
2021-07-07 18:40:24 +00:00
Guy Harris 639891651f Impose limits on the number of records we read.
Start the limit at 2^32-1, as we use a guint32 to store the frame
number.

With Qt prior to Qt 6, lower the limit to 53 million packets; this
should fix issue #16908.
2020-10-26 16:52:58 -07:00
Guy Harris 582ad24c38 Remove some single-SHB assumptions.
Make wtap_file_get_shb() take a section number argument, and update code
that called it.  In most cases, we convert the code to iterate over
sections; in cases where a big code change would be required, we
temporarily pass it 0 and mark the code as "needs to be updated for
multiple sections".

Eliminate cf_read_section_comment(); in calls outside file.c, other code
directly calls the libwiretap routines it calls and, inside file.c, we
just transplant the code and then fix it not to assume a single SHB.

Change-Id: I85e94d0a4fc878e9d937088759be04cb004e019b
Reviewed-on: https://code.wireshark.org/review/37000
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-01 19:46:42 +00:00
Tomasz Moń eabc9356c2 Qt: Do not display alerts on repeated failed reads
If read from capture file fails, set a flag that result in subsequent
read attempts to not display alert box on read failure.

This solves endless "An error occurred while reading the capture file"
error when the underlying trace file becomes unavailable. Now it is
possible for the user to close the capture file.

Bug: 4811
Change-Id: I411bbb3fb717bc994ab1f5e3805e2c8b4ee09c5e
Reviewed-on: https://code.wireshark.org/review/36114
Petri-Dish: Tomasz Moń <desowin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-02-28 04:54:15 +00:00
Tomasz Moń c4b68b4935 Wiretap: Fix temporary filename memory corruption
The pointer returned by create_tempfile() must not be freed. As the
wtap_dump_open_tempfile() callers are freeing the returned filename,
duplicate the string so it can be freed.

Bug: 15377
Change-Id: Ib0b23aaee748ef67600ef3f7d40610ebbbec721c
Reviewed-on: https://code.wireshark.org/review/34272
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-08-14 20:33:21 +00:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
Change all wireshark.org URLs to use https.

Fix some broken links while we're at it.

Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c
Reviewed-on: https://code.wireshark.org/review/34089
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26 18:44:40 +00:00
Guy Harris 89f339afa2 Hava a routine to read the currently-selected frome.
Have cf_read_current_record() take a capture_file as an argument and
read, into its wtap_rec and Buffer for the currently-selected frame,
information for the currently-selected frame.

Rename cf_read_record_r() to cf_read_record().

That gives us 1) a routine that reads the currently-selected frame into
the wtap_rec and Buffer for the currently-selected frame and 2) a
routine that reads an arbitrary frame into the wtap_rec and Buffer
supplied to it.  If you *want* the currently-selected record, use the
former, otherwise use the latter.

Change-Id: If6bd5915dd5bc18334d7b89859822a19234153a4
Reviewed-on: https://code.wireshark.org/review/32858
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-15 05:54:41 +00:00
Guy Harris 0771cf73cd Use a single wtap_rec and Buffer for an entire capture session.
That way we aren't allocating memory, reading packets from a batch, and
freeing the memory for each batch of packets delivered by dumpcap; we do
the allocation when the capture starts and the freeing when it finishes.

Change-Id: If012ab865f3a99d869535ad10827ad8680c1b10c
Reviewed-on: https://code.wireshark.org/review/32766
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-04-08 07:58:16 +00:00
Peter Wu f0a2b8303a Revert "Get rid of the per-capture_file wtap_rec and Buffer."
This reverts commit 9445403f95.

cf_select_packet frees the buffer backing the dissection result
(cf->edt) which results in use-after-frees when callers try to access
the contents. See for example this call trace:

* PacketList::selectionChanged
  * cf_select_packet(cap_file_, row)
  * frameSelected(row) -> ByteViewTab::selectedFrameChanged
    * addTab(source_name, get_data_source_tvb(source))

get_data_source_tvb returns the buffer that backs the dissection and
must remain valid even after dissection has completed. If this is not
done, then a possibly expensive redissection must be done in order to
populate the byte view. The temporary memory savings are not worth it.

Bug: 15683
Change-Id: Ia5ec2c7736cdebbac3c5bf46a4e2470c9236262d
Reviewed-on: https://code.wireshark.org/review/32758
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-06 20:00:57 +00:00
Guy Harris 9445403f95 Get rid of the per-capture_file wtap_rec and Buffer.
Most code that reads from a capture_file already has its own wtap_rec
and Buffer; change the remaining ones to do so as well.

Change-Id: I9b7c136642bbb375848c37ebe23c9cdeffe830c3
Reviewed-on: https://code.wireshark.org/review/32732
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-05 08:15:40 +00:00
Peter Wu 66345f008f Fix memory ownership when using cf_get_packet_comment
cf_get_packet_comment already has one code path that returns duplicated
memory. Be sure to document the requirement to free this memory and
adjust Qt to avoid memory leaks.

Be firm and assume that wth.opt_comment is owned by wth, so duplicate it
before returning it from cf_get_packet_comment.

Change-Id: I91f406296c9db5ea21b90fc2e108c37de4528527
Ping-Bug: 7515
Reviewed-on: https://code.wireshark.org/review/31712
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Vasil Velichkov <vvvelichkov@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-25 04:53:01 +00:00
Guy Harris a1372f6d01 Use an enum for compression types in various interfaces.
This:

1) means that we don't have to flag the compression argument with a
comment to indicate what it means (FALSE doesn't obviously say "not
compressed", WTAP_UNCOMPRESSED does);

2) leaves space in the interfaces in question for additional compression
types.

(No, this is not part 1 of an implementation of additional compression
types, it's just an API cleanup.  Implementing additional compression
types involves significant work in libwiretap, as well as UI changes to
replace "compress the file" checkboxes with something to indicate *how*
to compress the file, or to always use some other form of compression).

Change-Id: I1d23dc720be10158e6b34f97baa247ba8a537abf
Reviewed-on: https://code.wireshark.org/review/30660
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-16 09:20:36 +00:00
Guy Harris aab5ad074e Fix the calculation of a file's "basename".
Strip off only extensions that correspond to file types we know about;
QFileInfo::baseName() strips off *all* extensions, where "extension" is
"anything preceded by a .", so it turns foo.bar.pcap.gz into foo, not
foo.bar.  We don't want that; instead, we strip off only those
extensions that correspond to file types we know how to read, so we'd
strip off .pcap.gz in foo.bar.pcap.gz, and strip off .pcap in
foo.bar.pcap, leaving foo.bar in both cases.

Change-Id: I5385921ad2f0fef815d52e9902fef15735fd9dae
Reviewed-on: https://code.wireshark.org/review/28636
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-07-06 09:07:52 +00:00
Guy Harris 3c9249433f Remove trailing comma from enum list.
Change-Id: I3972458e6ede037a8080f34a154ca750a275f723
Reviewed-on: https://code.wireshark.org/review/27012
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-04-18 19:59:29 +00:00
Gerald Combs 1d030928ef Remove some GTK+-only code.
Change-Id: Ic2498c7acd6a1a522be45094148402ee34a6b4d1
Reviewed-on: https://code.wireshark.org/review/26958
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-17 03:44:47 +00:00
Guy Harris 1f5f63f8ef Generalize wtap_pkthdr into a structure for packet and non-packet records.
Separate the stuff that any record could have from the stuff that only
particular record types have; put the latter into a union, and put all
that into a wtap_rec structure.

Add some record-type checks as necessary.

Change-Id: Id6b3486858f826fce4b096c59231f463e44bfaa2
Reviewed-on: https://code.wireshark.org/review/25696
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-09 00:29:51 +00:00
Dario Lombardo 8cd389e161 replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later.
The first is deprecated, as per https://spdx.org/licenses/.

Change-Id: I8e21e1d32d09b8b94b93a2dc9fbdde5ffeba6bed
Reviewed-on: https://code.wireshark.org/review/25661
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 14:57:36 +00:00
Guy Harris ccc55bc80c Put the structure of a capture_file back in cfile.h.
The split isn't necessary now that epan no longer uses the capture_file
structure.

Change-Id: Ia232712a2fb5db511865805518e8d03509b2167f
Reviewed-on: https://code.wireshark.org/review/24693
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-12-04 05:35:36 +00:00
Guy Harris eb8ffb74e2 Use cfile.h to define the capture_file type.
Have cfile-int.h declare the structure, and use it in files that
directly access the structure.

Have cfile.h just incompletely declare the structure and include it
rather than explicitly declaring it in source files or other header
files.

Never directly refer to struct _capture_file except when typedeffing
capture_file.

Add #includes as necessary, now that cfile.h doesn't drag in a ton of

Change-Id: I7931c8039d75ff7c980b0f2a6e221f20e602a556
Reviewed-on: https://code.wireshark.org/review/24686
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-12-03 18:54:37 +00:00
João Valverde 8fa4a440a8 GTK: Remove packet editor
Removes limited experimental feature for deprecated UI.

Change-Id: Ib3ccfae89dd2a674ebbde346a442fa1cf6587f26
Reviewed-on: https://code.wireshark.org/review/24563
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-24 05:13:42 +00:00
Gerald Combs 775bbbcded Start using SPDX license identifiers.
A while back Graham pointed out the SPDX project (spdx.org), which is
working on standardizing license specifications:

https://www.wireshark.org/lists/wireshark-dev/201509/msg00119.html

Appendix V of the specification describes a short identifier
(SPDX-License-Identifier) that you can use in place of boilerplate in
your source files:

https://spdx.org/spdx-specification-21-web-version#h.twlc0ztnng3b

Start the conversion process with our top-level C and C++ files.

Change-Id: Iba1d835776714deb6285e2181e8ca17f95221878
Reviewed-on: https://code.wireshark.org/review/24302
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Balint Reczey <balint@balintreczey.hu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-11-09 20:03:51 +00:00
Guy Harris 4dd48721ee Rename cf_get_comment() to reflect what comment it gets.
Change-Id: Id3b0430a1d462b29833259462536ed4cb0424f77
Reviewed-on: https://code.wireshark.org/review/22662
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-07-17 03:49:33 +00:00
Guy Harris cdc01b89bf Rename section comment get/set routines.
Rename cf_read_shb_comment() to cf_read_section_comment(); an SHB is a
record type in a particular capture file format (pcapng), and not all
files that have per-file or per-file-section comments have something
called a Section Header Block.

Rename cf_update_capture_comment() to cf_update_section_comment();
pcapng, at least, supports multiple sections, although we don't curently
support that.

This also gives them matching names.

Change-Id: Idd8cb0f0fd9125b9626411274aebfb1ec0097665
Reviewed-on: https://code.wireshark.org/review/22659
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-07-17 03:38:45 +00:00
Jeff Morriss bef90e1493 Update the capture file load time each time we update the progress bar.
The Qt UI doesn't have a popup that tells you how long your file has been
loading.  So let's set the load time each time we update the packets bar.

(Obviously this is only useful when you're waiting a long time for a file to
load...)

Change-Id: I9da372800a12454888439e2baf3d2a848c611501
Reviewed-on: https://code.wireshark.org/review/22234
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-06-19 23:49:24 +00:00
Guy Harris e52c95c6c8 Move UI-only stuff out of libwireshark.
Packet ranges are used only in the UI; move the packet range stuff into
libui.

Don't pass a print_args_t structure to libwireshark packet-printing
routines, just pass the few parameters they need.  Move the declaration
of print_args_t into file.h.

Change-Id: Icff5991eea7d7d56f33b4716105895263d275bcf
Reviewed-on: https://code.wireshark.org/review/21308
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-24 03:38:21 +00:00
Gerald Combs 05fbb4826b Qt: Show merge progress.
Add "file merge" callback plumbing. Use it to display "Merging files" in
the main statusbar.

Make sure we have a usable window pointer when we merge files.

Change-Id: I236b6edb30685f0b06703ab8304bc88ae592f83c
Reviewed-on: https://code.wireshark.org/review/19716
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-01-21 06:50:30 +00:00
Michael Mann 1a57d81042 Rename packet-range.[ch] to packet_range.[ch]
The check*.pl scripts presume that files with the prefix "packet-"
are dissector files and therefore have different rules than other
files.  Rather than trying to clarify that more with additional
directory information, just make any non-dissector file with
"packet-" filename prefix conform if it fails a "dissector specific"
check from the scripts.

Change-Id: I7cb52e1fad4ea62320492bb690904260f958aeb4
Reviewed-on: https://code.wireshark.org/review/19304
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-12-16 17:28:50 +00:00
Guy Harris 334485f65b Get rid of some GTK+-only routines in file.c.
Just directly call the packet_list_select_ routine from the GTK+ code.

Change-Id: I9146fb968c407d6186b146a86aa34678765f7352
Reviewed-on: https://code.wireshark.org/review/19225
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-12-12 20:58:09 +00:00
Gerald Combs eb1307a099 Mark routines GTK+ only.
Mark packet_list_select_last_row and cf_goto_bottom_frame GTK+ only.

Change-Id: I158814c2fa8c5fa8021b7156dded0945535c978a
Reviewed-on: https://code.wireshark.org/review/19223
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-12-12 20:37:10 +00:00
Guy Harris dd98856afc Have separate merge APIs for regular file/temporary file/standard output.
This is similar to what we have for opening a dump file - one API that
uses the file name as specified, one that creates a temporary file and
provides the file name, and one that uses the standard output.

All of those APIs handle closing the output file.

Change-Id: I56beea7be347402773460b9148ab31a8f8bc51e1
Reviewed-on: https://code.wireshark.org/review/19059
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-12-04 03:12:23 +00:00
Guy Harris e5fa40ab31 Mark the file as having unsaved data if you change address resolution.
That information can, and will, get saved in some file formats, so mark
the file as changed so it can and will get saved by "Save".

XXX - we need to treat it as a type of data that can be discarded when
saving in some file formats, just like comments.

Bug: 12629
Change-Id: I1fd69b95f4f7345c339961b4c53c28b98b364e4e
Reviewed-on: https://code.wireshark.org/review/16538
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-07-18 23:04:59 +00:00
Gerald Combs b0b2540fba Qt: Clean up capture file callbacks.
Mark some callbacks GTK+ only as appropriate. Change a debug message to
an assert since we handle all callbacks.

Change-Id: I4266f0d7134d19a9c0432354ea36de67501275b4
Reviewed-on: https://code.wireshark.org/review/16171
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-06-27 20:09:33 +00:00
Pascal Quantin 92f4c7c8d2 Add JSON export to Qt/GTK UI
Change-Id: I5ff46a40cdb1f8f41565d2aa54c6f9e61d397e3a
Reviewed-on: https://code.wireshark.org/review/16013
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-20 01:22:57 +00:00
Guy Harris c73cf3cd00 Don't show a progress bar when previewing for the Qt print dialog.
We don't do much work to do that - we don't print anything before the
first selected page, and once we're finished generating that page, we
terminate the printing process - so it shouldn't need a progress bar.
(If it needs a progress bar, We Have A Problem, as that slows down the
drawing of the dialog box.)

This should prevent the problem seen in bug 12040.

Bug: 12040
Change-Id: I129191e06fff3e1eb59a9631c7395b9e7f650809
Reviewed-on: https://code.wireshark.org/review/14255
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-03-01 02:53:44 +00:00
Gerald Combs e234ce8804 Rework tapping in Qt dialogs.
Add cf_cb_file_retap_started and cf_cb_file_retap_finished to file.[ch].
Add their associated signals to CaptureFile.

Add registerTapListener and removeTapListeners to WiresharkDialog, which
collect and automatically remove tap listeners. Add beginRetapPackets
and endRetapPackets, which can be used to wrap critical sections so that
we don't delete ourselves while tapping. Don't cancel tapping on close
in WiresharkDialog.

Use beginRetapPackets and endRetapPackets in WiresharkDialog and
FollowStreamDialog. We will likely need to add them elsewhere.

Update comments.

Change-Id: I1788a6ade0817c31aa3419216df96be5e36b2178
Reviewed-on: https://code.wireshark.org/review/10261
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-08-26 15:04:28 +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
Guy Harris 5981dab95b Declare read_keytab_file() in epan/dissectors/packet-kerberos.h.
Don't throw its declaration in file.h, as it's not defined in file.c.
Instead, include it in epan/dissectors/packet-kerberos.h and include
that wherever read_keytab_file() is called.

Yes, that means you also have to include <epan/asn1.h> and, therefore,
you have to include <epan/packet.h>.  Yes, that should be cleaned up,
perhaps by splitting the Kerberos support code into "stuff that handles
encryption keys without any reference to dissection" and "stuff that
does dissection-related work".

Change-Id: Ide5c31e6d85e6011d57202f728dbc656e36138ef
Reviewed-on: https://code.wireshark.org/review/6210
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-01 23:05: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