Commit Graph

31 Commits

Author SHA1 Message Date
Chuck Craft c6e228bb17 Qt: Resolved Addresses - display filename if present 2022-10-24 00:07:09 +00:00
John Thacker 2c37027762 Qt: Fix resolved addresses dialog sorting, filtering, Ethernet groups
Qt6 removed QComboBox:currentIndexChanged(QString), which had
previously been deprecated in favor of the version with an int.
Switch to using the supported function, so that the comboboxes
work.

The models used for the resolved addresses require that the
source models be set first before setting other properties,
so do that so that filtering works.

For some reason the portTypeModel has to indicate that the
port number column is numeric in order for the ports to
numerically sort instead of lexicographically, so do that too.

Add the Ethernet addresses in their specific groups (Addresses,
Manufacturers, Well-Known Hosts) instead of adding them all
to the Well-Known hosts groups, so that that filtering works.

Fix #18087
2022-09-09 01:03:36 +00:00
Roland Knall eca007e617 Qt: Speedup for Resolved Addresses Dlg
This is a small speedup for the ResolvedAddressesDialog. QString::arg
is a copy-by-call method as QString::append just extends the space
occupied by the string, leading to a major speed improvement.

Same goes for configuring the proxymodels first and then assigning the
data model as this will lead not to reorganization everytime
invalideFilter is being called
2022-05-16 15:07:47 +00:00
Gerald Combs 80de95ca71 Qt: Split MainApplication out from WiresharkApplication.
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-04-04 09:39:27 -07:00
Gerald Combs d3f17ee08a Remove modelines in ui/qt.
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.
2021-03-08 18:11:32 +00:00
Peter Wu 995672e8b6 Qt: allow Resolved Addresses search filter to be cleared
Allow the filter in the Resolved Address dialog to be cleared to disable
filtering without requiring the dialog to be reopened.

Change-Id: I8164d42ac763f8b7faf23821633e129feba69790
Fixes: v3.1.1rc0-244-g743f8598cd0b ("Qt: Rework Resolved Addresses dialog")
Reviewed-on: https://code.wireshark.org/review/36027
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2020-02-04 14:22:25 +00:00
Stig Bjørlykke a51c58fa1b Qt: Cleanup space inside parentheses
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-17 20:43:10 +00:00
Roland Knall cb352105b8 Qt: Reduce use of CaptureFile
In preparation of having just a single instance of CaptureFile
dialogs are redesigned to not use CaptureFile

Change-Id: I2bff036d6f9e946954873c90b935b6653fbeb474
Reviewed-on: https://code.wireshark.org/review/34723
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-10-07 21:00:31 +00:00
Roland Knall 743f8598cd Qt: Rework Resolved Addresses dialog
This is a refactoring/redesign of the "Resolved Addresses" dialog,
allowing for sorting/filtering and searching within the addresses
and ports.

Change-Id: I5071e92ff699323b6c93fc533eeaf92e0db334de
Reviewed-on: https://code.wireshark.org/review/34398
Reviewed-by: Roland Knall <rknall@gmail.com>
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-09-01 09:02:51 +00:00
Roland Knall 8e80415aaf Qt: Fix 5.13 deprecated warnings
With Qt 5.13 some methods are deprecated. Fixing those warnings

Change-Id: Ia290f06f2b681de1d5b437624de77d8a5c2f5266
Reviewed-on: https://code.wireshark.org/review/33761
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-06-28 17:16:09 +00:00
Peter Wu ad0aecbf8b addr_resolv: avoid unnecessary memory allocation for hash tables
The key for the manuf table is 24 bits of the ether addr while the key
for services table needs is a 16 bit port. Store this value directly,
saving some memory and improving startup time by a tiny bit.

Likewise for ipxnet_hash_table and vlan_hash_table. These tables seem
unused though, perhaps it should be removed.

Change-Id: Ide9ffad8e2c9af24afa82adb2e009f32a5f43d38
Reviewed-on: https://code.wireshark.org/review/30756
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-11-22 01:18:21 +00:00
Stig Bjørlykke 14720ace06 Fix comment end after SPDX identifier
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-05-01 06:56:37 +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
Dario Lombardo e52172c775 Qt: use SPDX identifiers.
Change-Id: I111945c08f99818c249a868c12d9a7b3a3df64b3
Reviewed-on: https://code.wireshark.org/review/25563
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-02-02 13:39:36 +00:00
Guy Harris 797d2f6a87 Move the frame_set stuff back into the capture_file structure.
libwireshark now expects an epan_t to be created with a pointer to a
"packet provider" structure; that structure is opaque within
libwireshark, and a pointer to it is passed to the callbacks that
provide interface names, interface, descriptions, user comments, and
packet time stamps, and that set user comments.  The code that calls
epan_new() is expected to provide those callbacks, and to define the
structure, which can be used by the providers.  If none of the callbacks
need that extra information, the "packet provider" structure can be
null.

Have a "file" packet provider for all the programs that provide packets
from a file.

Change-Id: I4b5709a3dd7b098ebd7d2a7d95bcdd7b5903c1a0
Reviewed-on: https://code.wireshark.org/review/24731
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-12-08 03:32:25 +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 1834dca365 Move the parts of a capture_file used by libwireshark to a new structure.
Embed one of those structures in a capture_file, and have a struct
epan_session point to that structure rather than to a capture_file.
Pass that structure to the routines that fetch data that libwireshark
uses when dissecting.

That separates the stuff that libwireshark expects from the stuff that
it doesn't look at.

Change-Id: Ia3cd28efb9622476437a2ce32204597fae720877
Reviewed-on: https://code.wireshark.org/review/24692
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-12-04 05:02:18 +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
Mikael Kanstrup a17bbc1841 qt: Fix some leaked menu objects
Calling QPushButton.setMenu and QMenu.addMenu does not transfer ownership
of the menu. Fix some leaks by letting "receiving" object act parent
for the menu object.

Bug: 14071
Change-Id: Id4edaf895503ef5dd4597eac99c2cdd6ad09b2ff
Reviewed-on: https://code.wireshark.org/review/23600
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-09-20 05:48:06 +00:00
Anthony Coddington 193cef0bcb Attempt to clean up addr_resolv flags by removing DUMMY_ADDRESS_ENTRY
Replace with easier to understand and already present NAME_RESOLVED given dummy address is always filled.

Change-Id: If8464f89e88722aac70689749fe0d4a31c119db2
Bug: 13798
Reviewed-on: https://code.wireshark.org/review/22110
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-06-19 14:33:09 +00:00
sfd 9dc4d271cd Fix the display of the IPv4 Hash Table in Resolved Addresses Dialog QT UI
Was sign extending the key to 64-bit in Linux.

GPOINTER_TO_UINT should not be stored in 'int', use guint.

Change-Id: Ib4a994fdda5d69a589d3cffce644584103f2cd1d
Reviewed-on: https://code.wireshark.org/review/22107
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-06-13 03:52:58 +00:00
Guy Harris 1f8999bb96 Redo the block options APIs.
A block can have zero or more instances of a given option.  We
distinguish between "one instance only" options, where a block can have
zero or one instance, and "multiple instances allowed" options, where a
block can have zero or more instances.

For "one instance only" options:

	"add" routines add an instance if there isn't one already
	and fail if there is;

	"set" routines add an instance if there isn't one already
	and change the value of the existing instance if there is one;

	"set nth" routines fail;

	"get" routines return the value of the instance if there is one
	and fail if there isn't;

	"get nth" routines fail.

For "multiple instances allowed" options:

	"add" routines add an instance;

	"set" routines fail;

	"set nth" routines set the value of the nth instance if there is
	one and fail otherwise;

	"get" routines fail;

	"get nth" routines get the value if the nth instance if there is
	one and fail otherwise.

Rename "optionblock" to just "block"; it describes the contents of a
block, including both mandatory items and options.

Add some support for NRB options, including IPv4 and IPv6 option types.

Change-Id: Iad184f668626c3d1498b2ed00c7f1672e4abf52e
Reviewed-on: https://code.wireshark.org/review/16444
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-07-14 23:02:39 +00:00
Dario Lombardo a7ab65df89 addr_resolv: change g_hash to wmem_map.
Change-Id: Ice7533fbeac700dae0a46766838818a32b0d5736
Reviewed-on: https://code.wireshark.org/review/15051
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-06-14 19:33:04 +00:00
Martin Kaiser dda2acc06f qt: use #include <file.h> for generated include files
make sure that generated include files are picked up only from the
directories set by -I (or /I), not from the current directory

if we use #include "file.h", Visual Studio searches for file.h in the
same diretory as the source file that includes file.h

if we do an out-of-tree build with cmake and the source directory
contains files from an in-tree build (done with autotools), we might end
up including the wrong file

Change-Id: Iaaed2626258b6ff0c12485fe3f436bd03bbb5adf
Reviewed-on: https://code.wireshark.org/review/15873
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-13 21:17:06 +00:00
Stig Bjørlykke 1a716800e3 Qt: Add dialog geometry restore
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-02-28 18:25:50 +00:00
Pascal Quantin 4b35048af3 Qt: ensure to call destructor when closing a few QDialog windows
Change-Id: I10d2a610e852fdc2f38b84e561f04783af0d612e
Reviewed-on: https://code.wireshark.org/review/13453
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-01-20 23:38:26 +00:00
Peter Wu 33570f81b5 Fix misaligned read and buffer overrun
Ethernet addresses are only 6 bytes in size, reading it as a 64-bit
integer is invalid. Use unsigned 8-bit integers instead.

Caught by UBSAN and Address Sanitizer. Trigger via the Statistics menu
Resolved Addresses (Qt) or Show address resolution (GTK).

Change-Id: I628ff7cce0ea4f4e378c7968cd79a0ae34cdd20b
Reviewed-on: https://code.wireshark.org/review/10443
Reviewed-by: ronnie sahlberg <ronniesahlberg@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-09-13 02:38:19 +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
Joerg Mayer 0d4f412015 Get rid of _U_, which was (mis)used in some places:
- It was used even though the variable actually *was* in use for
  some compile settings.
- It's not the c++ way.

2do: In case the definition of _U_ in Wireshark.pro is only used for
  the ui/qt directory, it should be removed to avoid further (ab)use.

Change-Id: I22d6269a66d6ed558035aad3e6702c4a9c8af1fa
Reviewed-on: https://code.wireshark.org/review/9665
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2015-07-16 21:02:53 +00:00
Pascal Quantin d23ff4f5f8 Qt: remove unused parameters
Change-Id: I45fcf87f99dc15eb49343119fa134fb5698b15cf
Reviewed-on: https://code.wireshark.org/review/9664
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-07-16 20:04:38 +00:00
Gerald Combs 0aaf0f04cf Add the "Resolved Addresses" dialog.
The GTK+ equivalent is named "Address Resolution" but "Resolved
Addresses" seemed (to me at least) to be more clear.

Change-Id: I1806354d91bb5ce8af11d20568b92a04c78d4d73
Reviewed-on: https://code.wireshark.org/review/9580
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-07-10 03:20:33 +00:00