Commit Graph

23 Commits

Author SHA1 Message Date
Guy Harris 272502790b Add FT_STRINGZTRUNC.
FT_STRINGZPAD is for null-*padded* strings, where the field is in an
area of specified length, and, if the string is shorter than that
length, all bytes past the end of the string are NULs.

FT_STRINGZTRUNC is for null-*truncated* strings, where the field is in
an area of specified length and, if the string is shorter than that
length, there's a null character (which might be more than one byte, for
UCS-2, UTF-16, or UTF-32), and anything after that is not guaranteed to
have any particular value.

Use IS_FT_STRING() in some places rather than enumerating all the string
types, so that those places get automatically changed if the set of
string types changes.
2020-09-12 14:16:12 -07:00
John Thacker 847d3949c9 Apply Decode As induced protocol preference changes
Make sure that pending protocol preference changes caused by Decode
As have been fully applied before redissection. Prevents referencing
already freed memory Closes #16787. Also close #10305
2020-08-25 08:20:58 -04:00
Stig Bjørlykke 9a1a5fd22a Qt: Add copy from another profile for Decode As
Add a new button to the Decode As dialog to copy entries from
another profile.

Change-Id: Ia04edd063bd2eba14b2b14acfd53b03111646f7e
Reviewed-on: https://code.wireshark.org/review/37616
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2020-07-02 06:13:27 +00:00
Gerald Combs 2ca5a14513 Qt: Fix some Qt 5.15 deprecation warnings.
Use Qt::ItemFlags() instead of 0.

Use QFileDialog::Options() instead of 0.

Use QComboBox::textActivated instead of QComboBox::activated.

Switch to just using Qt::WindowFlags() in GeometryStateDialog. This
*should* work for Qt 5.5 and earlier, but if it doesn't we can switch
back.

Change-Id: Iaf4e7efa1a11fc7f3325b449eef1be308cd21b45
Reviewed-on: https://code.wireshark.org/review/37349
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-06-01 08:20:01 +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
Guy Harris cced5fb949 Constification, to remove some compiler warnings.
Change-Id: I24f0bdc72109a6ef3d801dc28cb9b523ff4e5fe7
Reviewed-on: https://code.wireshark.org/review/32458
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-03-17 21:09:34 +00:00
Stig Bjørlykke b3cb942dbc Qt: Add clear all button to Decode As
Add a clear all button to easily remove all existing entries.

Change-Id: I76e7ee2b7b85a9b4e5f9f5a788a89f38f70ee8ce
Reviewed-on: https://code.wireshark.org/review/30052
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-08 07:12:34 +00:00
Peter Wu ea763a9638 Qt: select a better default Decode As table
USB has three possible tables, usb.device, usb.product and usb.protocol
(shown in that order in the Decode As dialog). For single packets with
no prior device descriptors, the last two tables have no valid selector
(integer zero). In such cases it seems more reasonable to use tables for
which a valid selector exists (for example, "usb.device").

Bug: 14717
Change-Id: I2319817fa11318a97519d8cfc912343b16224c12
Reviewed-on: https://code.wireshark.org/review/27820
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-28 08:19:43 +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
Roland Knall 3a928f1f87 Qt: Remove checks for version below 5.2
This stops the main source from being buildable by Qt 4.x

Change-Id: I61edbae04ac2b3bf0ae8ee8e09d335083945c176
Reviewed-on: https://code.wireshark.org/review/26756
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2018-04-05 18:48:57 +00:00
Peter Wu 5cbc09e937 Qt: accept hexadecimal input in Decode As dialog
The usb.product dissector table displays vendor+product values as
hexadecimal, ensure that these are not parsed as zero.

While at it, clarify the meaning of the model contents. Ideally the
model should store numeric selectors as integers rather than strings,
but that requires more work.

Change-Id: I3bb17ad0d0a03c8813ded4ea6890dbc2aedd738d
Reviewed-on: https://code.wireshark.org/review/26087
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-27 09:08:43 +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
Peter Wu 9be01dc616 Qt 4.8 compatibility fixes
Add missing include headers, define Q_NULLPTR for all Qt objects (to
avoid having to include an ugly compat header), use old signal/slot
syntax (Q_SIGNALS are protected in Qt 4.8), disable Qt 5 log message
handler, etc.

Change-Id: I449beb0b74050fdfb0fc5828d8fb74eedb2b45bf
Reviewed-on: https://code.wireshark.org/review/25469
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-01-25 17:17:13 +00:00
Michael Mann eef3c8434d Add ability for preferences to determine what they can change.
Add flags field to preference structure to help determine what
areas of Wireshark are affected by a preference changing.  The
intent is to be able to distinguish dissection from GUI or other
changes that are not dissection.

The default is to have all preferences affect dissection, but their
flags can be changed.  This patch doesn't change any flags from the
default.

Change-Id: Ied5ae961bc3f33f5b730b2892fff3fa0898380b8
Reviewed-on: https://code.wireshark.org/review/25171
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-01-06 17:49:23 +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
Michael Mann 9c6d2af0ae Qt: Add support for DCE/RPC in Decode As
DCE/RPC is a FT_GUID type, but has some special handling.  "Regular"
FT_GUID dissector tables still not supported.

Bug: 13122
Change-Id: I328776ffe5bbe87ecfbe6719f04d18b1b237a583
Reviewed-on: https://code.wireshark.org/review/24602
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-28 16:32:57 +00:00
Michael Mann 087faa2488 Always provide value for Decode As selector column
Previous logic required multiple values from the decode as structure in
order to provide an initial value.  This was incorrect and led to
values from protocol not selected showing in the selector column.

Change-Id: If1ad5085f4a6eb8d79fc5dd72be968188051ec4e
Reviewed-on: https://code.wireshark.org/review/24122
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-10-28 00:24:42 +00:00
Michael Mann 560945336c Bugfix Decode As dissector table selection.
Need to use UI name to select between different tables.

Change-Id: I2f25435e6ac1a2f1a15e651cd3ef1bbc9e860d89
Reviewed-on: https://code.wireshark.org/review/23952
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: Anders Broman <a.broman58@gmail.com>
2017-10-17 03:29:32 +00:00
João Valverde 88b88a0e80 Qt: Fix -Wimplicit-fallthrough with GCC
../../../ui/qt/models/decode_as_model.cpp: In member function ‘virtual QVariant DecodeAsModel::data(const QModelIndex&, int) const’:
    ../../../ui/qt/models/decode_as_model.cpp:155:13: error: this statement may fall through [-Werror=implicit-fallthrough=]

Change-Id: I29654a0f6ce6cce7bc778231bc8d6e602875104f
Reviewed-on: https://code.wireshark.org/review/23589
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-09-18 12:40:41 +00:00
Michael Mann 69250aa51e Add support for dissector tables of type FT_NONE.
This is for dissectors that have "payloads" that don't have
a unique identifier to determine a sub dissector.

For the command line parameter -d, specifying a selector is no longer
required for dissector tables of type FT_NONE.

Change-Id: I3370d9e0dc147deeca4f26b842fe35dc3bda876e
Reviewed-on: https://code.wireshark.org/review/22574
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-09-16 11:12:52 +00:00
Michael Mann d992e85fe8 Refactor Decode As dialog to use a model/delegate
The model provides a lot more flexibility and abstracting the
data from the view (dialog)

Noticeable changes from user perspective:
1. Value column doesn't always have a combobox.  If registered decode as
structure doesn't support multiple values, a simple edit box is used.
2. Existing value will always be a choice (default) in the Value combobox.
3. Duplicate values in Value combobox have been removed (for things like
UDP port where source port and dest. port are same)
4. When adding/copying a decode as item, only first column (table) is
editable, not the whole column.
5. Separator always present in Current protocol column to distinguish
"none" from rest of protocols.
6. "Current" protocol defaults to "default value" when first added to the
list instead of "none".

Noticeable changes from developer perspective:
1. Code is much more spread out, but most new additions (like DCE/RPC support)
should be limited to the model class (maybe delegate).  The dialog class
probably won't change much anymore.
2. decode_as_dialog.ui is much less useful because information is provided through
model and delegate.

Change-Id: I70a667cab2c07d251ab370430bc51e5c1f4a3a02
Reviewed-on: https://code.wireshark.org/review/22625
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-09-16 11:11:50 +00:00