summaryrefslogtreecommitdiff
path: root/ui/capture.c
AgeCommit message (Collapse)AuthorFilesLines
2017-06-17Do not process UI events while reading from live capturePeter Wu1-6/+0
For at least Qt, the main_window_update callback is not necessary to make the stop button work. When restarting a live capture during a flood (via Ctrl-R), this callback actually results in an infinite loop in MainWindow::captureStop since the capture state never changes from FILE_READ_IN_PROGRESS. Remove this callback to ensure that the problematic pipeActivated / sync_pipe_input_cb / capture_input_new_packets / main_window_update / ... / on_actionCaptureRestart_triggered / testCaptureFileClose / captureStop sequence is avoided. Even though captureStop invokes capture_stop, I guess that this does not change the state because the pipeActivated callback is already active. Bug: 10917 Change-Id: I6ca4fa946963928b7bc8a53ca14f9a9a3a35eaa7 Reviewed-on: https://code.wireshark.org/review/22097 Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-03-16g_assert on device.if_info.name to prevent undefined behaviour.Joerg Mayer1-0/+1
Change-Id: Id730eb0e846e557c2f5a47139b480362a0b2a777 Reviewed-on: https://code.wireshark.org/review/20561 Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2015-12-19Allow "capture info data" to not be a singleton.Michael Mann1-7/+7
It was buried as a static variable in capture_info.c, and functions were refactored to allow a pointer to the info_data_t structure to be passed in. TShark and GTK will have their own single (global) copy of the structure, while it opens up Qt to have multiple instances. Change-Id: Ic2d7a2ad574de43f457cb18b194d6bc3fffb6120 Reviewed-on: https://code.wireshark.org/review/12691 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-07Clean up includes of unistd.h, fcntl.h, and sys/stat.h.Guy Harris1-4/+0
Have wsutil/file_util.h include them on UN*X, just as it includes io.h on Windows, so we can have a rule of "if you do file operations, include <wsutil/file_util.h> and use the routines in it". Remove includes of unistd.h, fcntl.h, and sys/stat.h that aren't necessary (whether because of the addition of them to wsutil/file_util.h or because they weren't needed in the first place). Change-Id: Ie241dd74deff284e39a5f690a297dbb6e1dc485f Reviewed-on: https://code.wireshark.org/review/11619 Petri-Dish: Guy Harris <guy@alum.mit.edu> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-04Don't include "file.h" if you don't need it.Guy Harris1-0/+1
It ends up dragging in libwireshark headers, which programs not linking with libwireshark shouldn't do. In particular, including <epan/address.h> causes some functions that refer to libwireshark functions to be defined if the compiler doesn't handle "static inline" the way GCC does, and you end up requiring libwireshark even though you shouldn't require it. Move plurality() to wsutil/str_util.h, so that non-libwireshark code can get it without include epan/packet.h. Fix includes as necessary. Change-Id: Ie4819719da4c2b349f61445112aa419e99b977d3 Reviewed-on: https://code.wireshark.org/review/11545 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-10-04Fix various memleaksPeter Wu1-0/+1
Found by starting Wireshark within an empty profile, opening Preferences, search for Protocol "IEEE 802.11" (because it has radio buttons), then close everything again. Many fixes are trivial, but the various recent_read_* functions in recent.c were changed to return a boolean such that the result can always be checked even if errno==0. QButtonGroup leak was hinted by Clang Static Analyzer, all other memleaks were found using ASAN/LSan. Change-Id: Ia73f5d4c09d92f22e72377be59e23342f8ad7211 Reviewed-on: https://code.wireshark.org/review/10776 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: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-06-27Free a malloc'ed error message to not leak memoryEvan Huus1-0/+2
Change-Id: I59b43e8d4efe8320cf17c6dd086440d3522ef247 Reviewed-on: https://code.wireshark.org/review/9183 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2015-06-10Use pid_t on UN*X, and HANDLE on Windows, for the process ID.Guy Harris1-2/+2
This avoids type punning; at least with Xcode 7 beta on El Capitan beta, that produces warnings that get turned into errors. Change-Id: I57f47455b9630f359828c07c92a190b5cb33816f Reviewed-on: https://code.wireshark.org/review/8862 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-06-09[MSVC 2015] Use intptr_t for "pointer stored as int" to make MSVC happy.Anders1-2/+3
Change-Id: I5dbbea8527a8bb73b17e5a8a5611c3923d82459c Reviewed-on: https://code.wireshark.org/review/8852 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>
2015-04-06Reset the captured-packet count when we start or restart a capture.Guy Harris1-0/+1
Bug: 6217 Change-Id: I916e9a6fdb0e114d5f8f123153c213af9273bbc3 Reviewed-on: https://code.wireshark.org/review/7954 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-04-06Keep a captured-packet count in a capture_session and use that.Guy Harris1-8/+2
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-05Have a common routine for constructing strings listing interfaces.Guy Harris1-29/+2
We have a bunch of duplicated code to make those lists; make a common routine for that. (dumpcap currently doesn't use it, as the routine in question uses a routine in libui, which dumpcap doesn't use. We should probably fix that.) Change-Id: I9058bf3320d420b8713e90743618972da1d1c6ed Reviewed-on: https://code.wireshark.org/review/7934 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-03-10Change a lot of http:// URLs to https://.Gerald Combs1-3/+3
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-01-18Clean up ftype-conversion and dfilter error message string handling.Guy Harris1-1/+1
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>
2014-12-20Qt: Add a CaptureFile class.Gerald Combs1-2/+2
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-10-12Add editor modelines; Adjust whitespace as needed.Bill Meier1-0/+13
Change-Id: I4da7b335d905dbca10bbce03aa88e1cdeeb1f8ad Reviewed-on: https://code.wireshark.org/review/4626 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-09-25Update the simple dialog code.Gerald Combs1-13/+13
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-07-04Move utility routines for capturing into a libcaputils static library.Guy Harris1-3/+3
Some of those routines are used only in dumpcap; others are used in TShark and Wireshark as well. Change-Id: I9d92483f2fcff57a7d8b6bf6bdf2870505d19fb7 Reviewed-on: https://code.wireshark.org/review/2841 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-30Move capture.[ch] to libui.Guy Harris1-0/+799
Change-Id: I86e7e781cc9e14abab0374a18b95438529b046f0 Reviewed-on: https://code.wireshark.org/review/2711 Reviewed-by: Guy Harris <guy@alum.mit.edu>