aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/filter_dialog.cpp
AgeCommit message (Collapse)AuthorFilesLines
2024-01-24file: Don't recompile the dfilter during a live captureJohn Thacker1-0/+8
Saving only the dfilter text and recompiling the code when [re]dissecting or scanning groups of packets operates on the explicit assumption that previously validated filter text will always compile to valid filter code That assumption is not true; while we invalidate the filter and replace the text with NULL if display filter macros change or other aspects of the packet matching expressions change so that the previous text is no longer valid, display filters that match FT_IPv4 or FT_IPv6 fields to resolved hostnames require a host name lookup each time they are compiled, which can timeout, especially if there are too many requests in flight at once. This is particularly likely if a recompilation is performed each time additional frames arrive during a live capture. It is important to stress that the stronger, implicit assumption that the display filter will compile to the same code is also false. 1) Display filters that require host name lookup can change even if it doesn't timeout. 2) Display filter macros can change. 3) Display filters with field references will change if the selected frame has changed. In the case of a rescan, redissection, reload, retap, or opening a new file, we want the new dfcode. For cf_continue_tail and cf_finish_tail, when a new batch of frames have arrived, we might be able to cache the host lookup for 1), and a user might want the new macro definitions in 2) (but in that case, why not a rescan of all packets?), but almost surely for 3) wants the field references of the frame selected in the GUI when the filter was applied, not whatever frame is currently selected when new packets arrive. So we keep the old dfcode, and also reduce recompilation (which becomes more important as the default update interval can be reduced, cf. f0712606a3d014a915e585997f624640b326b9c0 ). Currently filters with field references don't work at all with newly arrived frames in live captures, because the references aren't loaded to the code. This fixes that by using the field references from the original frame. Cf. 1370d2f738f4ec4b7a00f63e5f04fe916da79533 Fix #19612. Fix #12517.
2023-11-13Qt: Fix display filter macros when switching profilesJoão Valverde1-1/+1
We need to reload the display filter macros when switching profiles. This was done automatically before by the UAT sub-system.
2023-11-08Qt: Add macro name validatorJoão Valverde1-2/+24
2023-11-08Qt: Remove an errant tr()João Valverde1-1/+1
2023-11-08dfilter: Replace macro UAT config file and update GUIJoão Valverde1-33/+71
Remove the UAT macro usage. The UAT API is nifty for dissectors but clunky for everything else. This allows using a hash table to store macros, that is the natural data structure for the use case (and faster). It also allows using the existing filter GUI dialog, adapted for display filter macros. The difference isn't huge but it's better and less limited than the more generic UAT dialog, with room for improvement. Changing the UAT dialog for filter specific use cases is difficult. The config file is renamed to "dmacros" and uses the same format as "dfilter", that is more amenable and forgiving for hand-editing than the UAT storage format. There is some logic to convert the "dfilter_macros" UAT config file to a "dmacros" filter config file, for backward-compatibility. The conversion is only done if there is no existing "dmacros" file in the profile folder.
2023-06-26Don't include errno.h if we don't use errno or errno value definitions.Guy Harris1-2/+0
2023-02-10Move ui/filter_files.[ch] to wsutilJoão Valverde1-2/+1
2022-04-04Qt: Split MainApplication out from WiresharkApplication.Gerald Combs1-8/+8
Move WiresharkApplication.{cpp,h} to MainApplication.{cpp,h}. Add back WiresharkApplication as a thin superclass of MainApplication, similar to LogsharkApplication. Change all of our wsApp references to mainApp. We will likely have to change many or most of them back, but that's a commit for another time.
2022-03-25Qt: Handle qsizetype.Gerald Combs1-1/+1
Qt 5.10 added qsizetype, aka an ssize_t and Qt 6 makes extensive use of it. Add a compatibility typedef and use it where we can. Cast it away where we can't.
2021-06-07Qt: add display filter - invalid new filter syntaxChuck Craft1-1/+1
2021-03-08Remove modelines in ui/qt.Gerald Combs1-13/+0
Remove the editor modeline blocks from most of the source files in ui/qt by running perl -i -p0e 's{ \n+ /[ *\n]+ editor \s+ modelines .* shiftwidth= .* \*/ \s+ } {\n}gsix' $( ag -g '\.(cpp|h)' ) then cleaning up the remaining files by hand. This *shouldn't* affect anyone since - All of the source files in ui/qt use 4 space indentation, which matches the default in our top-level .editorconfig - The one notable editor that's likely to be used on these files and *doesn't* support EditorConfig (Qt Creator) defaults to 4 space indentation.
2019-11-17Qt: Cleanup space inside parenthesesStig Bjørlykke1-15/+15
Remove randomly used space inside parentheses to make the coding style uniform. Add space after if, for and while. Change-Id: I519f5994b6f73d8a57a5004d51ca460276c618fe Reviewed-on: https://code.wireshark.org/review/35112 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
2019-11-06Qt: Ensure only valid input for DisplayFilterRoland Knall1-13/+19
Allow only valid inputs to be given for the name of a DisplayFilter. Specifically adding a quotation mark is not allowed Change-Id: I10454a2d23db1e0ef08148571d2762a3285e5ab8 Reviewed-on: https://code.wireshark.org/review/35006 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
2019-10-29Qt: Allow drag/drop of filter buttons in dialogRoland Knall1-8/+8
Allow the drag/drop of filter buttons in the dialog Change-Id: Ie2d5987ecdb626a8f12e8f17e6967f937bdf4648 Reviewed-on: https://code.wireshark.org/review/34885 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
2019-10-28Qt: Implement FilterListModelRoland Knall1-91/+78
Change-Id: I365281a709ded644fc8d6ccfce5870a000221a3b Reviewed-on: https://code.wireshark.org/review/34856 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
2019-08-30Qt: Add macro for g_list_next for C++Roland Knall1-2/+2
Using a simple (type *) cast on g_list_next results in a warning with modern compilers "old-style cast" Adding a warning for g_list_next and data access to avoid the warning A good overview why reinterpret_cast has been used can be found here: https://stackoverflow.com/questions/332030/when-should-static-cast-dynamic-cast-const-cast-and-reinterpret-cast-be-used It is a 1:1 replacement in this case, but does not use any of the new cast styles and therefore should be used with caution. Change-Id: I989f237afc39aaf40133a788b1c0bbd7a51bf974 Reviewed-on: https://code.wireshark.org/review/34284 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
2019-06-21Qt: Convert the rest of the preference dialog list buttons.Gerald Combs1-0/+4
We no longer use the old icon names, so remove their aliases from stock_icons.qrc. Ping-Bug: 15511 Change-Id: If3c5e2b95825207a401e12607fcb94cdcc8a51c8 Reviewed-on: https://code.wireshark.org/review/33689 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-10-10Qt: Add back pathLabel in some dialogsStig Bjørlykke1-0/+20
Add the pathLabel for Coloring Rules, Decode As, Display Filters and Capture Filter. Put the absolute file path into the pathLabel if the file exists. This aligns with UAT dialogs and frames. Change-Id: I72bd06e31bab220de0a0ef8df99df9a4daed667c Reviewed-on: https://code.wireshark.org/review/30089 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-01Fix comment end after SPDX identifierStig Bjørlykke1-1/+2
Move */ to a separate line below the SPDX identifier. Change-Id: Id1032215449cfccae0933147b45e04b65e0b727f Reviewed-on: https://code.wireshark.org/review/27211 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later.Dario Lombardo1-1/+1
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-02Qt: use SPDX identifiers.Dario Lombardo1-14/+1
Change-Id: I111945c08f99818c249a868c12d9a7b3a3df64b3 Reviewed-on: https://code.wireshark.org/review/25563 Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-07-11Qt: Move all utility widgets to widgets subdirectoryRoland Knall1-2/+2
Move all utility widgets to the widgets subdirectory and add separate source_group for their files Correct some alphabetization in ui/qt/CMakeLists.txt noticed during compare. Change-Id: I2d664edc2b32f126438fb673ea53a5ae94cd43d1 Reviewed-on: https://code.wireshark.org/review/22531 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Roland Knall <rknall@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-04-09Pull the error reporting into {read,save}_filter_list.Guy Harris1-33/+1
Change-Id: I4d9582661f2f1728d400eeb2a1b1dea98f32ce7f Reviewed-on: https://code.wireshark.org/review/20982 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-09Move the filter file reading code to libui.Guy Harris1-1/+1
It doesn't belong in libwireshark, as it doesn't affect dissection, but it *does* belong in libui, as it's helper code for the UIs. Change-Id: I8a5e0640a299a08e9ec1917dd253197438ebfdbc Reviewed-on: https://code.wireshark.org/review/20974 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-28Qt: Add dialog geometry restoreStig Bjørlykke1-4/+2
Add GeometryStateDialog class to handle load and save dialog geometry. The QDialog class name will be used as window name. For shared classes the UAT name or the statistics title or abbr will be used. Change-Id: I5a019598307fb3861518f41e733de834788184d8 Reviewed-on: https://code.wireshark.org/review/14139 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-01-28Qt: Enable capture filter bookmarksStig Bjørlykke1-1/+3
Update the code handling capture filter bookmarks and enable the bookmark button and clear button in CaptureFilterEdit(). Disable the apply button (which starts a capture) for now. Bug: 11836 Change-Id: Ia33cbb8c9bb839be037112eef26daf744c4ea8f8 Reviewed-on: https://code.wireshark.org/review/13568 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-01-28Qt: Update display filter bookmarks when list changedStig Bjørlykke1-0/+4
Recreate the display filter bookmarks menu only when the list has changed, not every time the display filter changes. The list changes when removing an entry from the menu and when changing the list in the "Manage Display Filters" dialog. Save the list when removing an entry from the menu. Change-Id: Icd08e0a80085cca55c0e63177d45abe4902c7c3e Reviewed-on: https://code.wireshark.org/review/13567 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-01-27Allow/Create an option to use "capture filter" labels defined in wireshark ↵Mike781-1/+1
GUI from CLI Move ui/filters.[ch] to filter_files.[ch] because dumpcap is using functionality. Bug: 8091 Change-Id: I195c82fc023f97d6f331b8718c45a2d83d30faea Reviewed-on: https://code.wireshark.org/review/5925 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-16Label the filter in the file open dialog as a "read filter".Guy Harris1-1/+1
This matches what the Windows file open dialog says, and also should help prevent people thinking that it's a display filter, so that you can clear it and see all the packets in the file. I leave translations to native speakers. Bug: 11708 Change-Id: I060816357bf7958d516429d09708a7ce16d609c5 Reviewed-on: https://code.wireshark.org/review/11877 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-09-06Display filter edit updates.Gerald Combs1-3/+8
Have the bookmark button operate on saved display filters, similar to the "Filter:" button in the GTK+ UI. Expose the saved display filter list via a popup menu. Update the display filter icons. Make the "Apply" button wider. Remove the old icon assets. Add a StockIconToolButton class along with note explaining why it's necessary. Rename the "Filter Bookmarks" preference to "Filter Shortcuts". Suggestion for a better name are welcome. Change-Id: I0082d3f01b017253fa75e51cbff9beb17c41a209 Reviewed-on: https://code.wireshark.org/review/10390 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
2015-06-25Qt: use <> for including the generated ui_*.h filesMartin Kaiser1-1/+1
this should make Visual Studio pick up the generated include files from the build directory instead of the source directory (which may contain lefovers from an in-tree build) Change-Id: Ie3de4cdd85a2865e203118a42ab10f443372f03b Reviewed-on: https://code.wireshark.org/review/9129 Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-06-05Qt: Add the capture and display filter dialog.Gerald Combs1-0/+280
Use a single overloaded dialog, similar to the GTK+ UI. Change-Id: If85db14a7101770f115bef725f5145e0010c518d Reviewed-on: https://code.wireshark.org/review/8776 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>