Commit Graph

8 Commits

Author SHA1 Message Date
Gerald Combs 9e0ce57c4d Convert capture/*.[ch] to C99 types
Convert capture/*.[ch] to C99 types. Update other files where needed.

Ping #19116
2023-06-14 19:50:03 +00:00
John Thacker 801554fb79 Add a capture file state for a pending read
When not updating the packet list during a capture, the capture
file structure isn't set up, but there is a pending capture.

We currently treat that as "finished reading", but that means
that other code assumes that all the structures are set up and
can crash, and also don't prompt regarding unsaved packets when
trying to close Wireshark.

Add a state for FILE_READ_PENDING that sometimes should be treated
similar to FILE_CLOSED and sometimes should be treated similar to
FILE_READ_IN_PROGRESS.

This fixes a crash when enabling "update packet list during a capture"
while a capture is in progress, as well a crash when applying a filter
while a capture is in progress but real time packet list updates are
off.

Keep track of the number of packets that the capture child has reported
that haven't been read yet, so that the capture statistics stay accurate
even if the pref is toggled. Also run the main status bar statistics at
the end, so that if any packets are processed in cf_finish_tail() they
are reported.

This also restores status bar statistics for when update packet list
during a capture is off, which 461fb517d1
accidentally disabled.

Fix #4035
2023-06-13 17:09:50 +00:00
Gilbert Ramirez 68526daf24 Add packet dedup support for live captures too 2023-06-09 07:21:08 +00:00
Tomasz Moń 0e7c240897
capture: Convert sync pipe to GIOChannel
Reduce the amount of platform specific Wireshark code by using
GIOChannel watch, i.e. do not use UNIX specific GLib functionality and
do not peek into pipe every 100 ms on Windows.
2022-10-23 13:17:10 +02:00
Tomasz Moń c1861ad1cc
extcap: Close capture session after extcap finishes
Wait up to 30 seconds for extcap process to finish after closing pipes.
The wait is achieved in non-blocking fashion, i.e. the UI is completely
responsive during the wait. Only actions related to capture process like
capture control, file open, save, export are inactive during the wait.

On Windows extcap child watch callback gets called immediately as the
process is forcefully terminated. Prior to this change the extcap was
forcefully terminated on Windows anyway.

The wait is possible on UNIX systems if extcap does handle SIGPIPE and
SIGTERM signals. The defaults handlers for SIGPIPE and SIGTERM simply
terminate the process so for large number of extcaps there is no change.
If extcap does not finish within 30 seconds, it is forcefully terminated
using SIGKILL signal.
2022-08-10 06:18:15 +02:00
Tomasz Moń 2d1380ae5b
capture: Move capture pipe polling out of UI
Both CLI and Qt interfaces spin GLib mainloop. Move the capture pipe
polling into common code to reduce code duplication.
2022-07-30 16:42:12 +02:00
Moshe Kaplan 65a651d5b9 capture: Add header files to Doxygen
Add @file markers for capture
headers so that Doxygen will
generate documentation for them.

Additionally, update the doxygen
config file per
7fee50274f
merging the caputils and capchild
directories.
2021-11-30 06:27:26 +00:00
João Valverde 7fee50274f Merge the caputils/ and capchild/ directories
The distinction between the different kinds of capture utility
may not warrant a special subfolfer for each, and sometimes the
distinction is not be clear or some functions could stradle
multiple "categories" (like capture_ifinfo.[ch]).

Simplify by having only a generic 'capture' subfolder. The
separate CMake libraries are kept as a way to reuse object code
efficiently.
2021-03-29 06:08:02 +01:00