Commit Graph

7682 Commits

Author SHA1 Message Date
John Thacker ef0e96e447 Qt: Revert to our function for displaying bit speed with units
The Qt formattedDataSize() locale aware function only handles
sizes in bytes, not other units. Revert to using our format_size()
function from wsutil for the bits per second display string in
the Conversation window.

Fix #18211
2023-02-25 01:45:35 +00:00
John Thacker 5948274adb Qt: Show date for abs time for long captures in Conversations
Display the date with the absolute time if a conversation in the
conversation table is over 24 hours long. Parse user entered filter
strings for date times as both date times and dates.

Fix #16092
2023-02-23 12:59:50 +00:00
John Thacker 0bd4d9b132 Qt: Mapping between filter proxy column and displayed column
We need to convert between the column selected for filtering
by the user (which is based on what is currently displayed in the
tab) and the column in the model.

The default mapToSource requires a QModelIndex and needs a row,
and thus doesn't work when all rows are filtered out by the current
filter (that is being replaced.) However, since our filterAcceptsColumn
does not depend on the row, we can determine the mapping just based
on the column number.

We want to convert the filter column to the column used in the model
when it is first selected, so that hiding columns later doesn't
accidentally change what column is used for filtering.

Improved fix #18738
2023-02-23 11:23:41 +00:00
John Thacker 33493cb602 Qt: Fix conversation dialog timeline graph columns
Remove the separate copy of the conversation column type
enum in ConversationDialog. It doesn't correspond to the
enum in ATapDataModel, because it doesn't include the
Conversation ID and Total columns.

Delegates set to the Traffic Tree (a QTreeView) apply to
the displayed column number, not the what is displayed
in the column. That is, when columns are hidden (filtered),
the delegates stay with the old column number and end up
being displayed on new content. That's not what we want;
we want to always have the timeline graph on the Start and
Duration columns. Moving around the Delegate depending on
which columns are filtered is complicated; just set the
TimeLine delegate to the entire TrafficTree, and use the
default paint if we're on any column other than Start or
Duration. This does mean that we don't need to store a
map of Delegates.

Use a slightly different way to get TimelineDelegate to
paint the rect with no text using the current style, so
we can use the default paint with text for other columns.

The timeline graph needs to get the value of the Start and
Duration columns as filtered by the proxy column, so have
the model pass in indices so that they can be mapped to
the current displayed column.

Have the timeline graph apply to just the Start or just the
Duration column if only one is visible.

Together these compute the proper pixel values to apply
the timeline graph to the Start and Duration columns regardless
of which columns are displayed and which are filtered, in any
tab, regardless of what optional columns appear in that tab.

Fix #18860
2023-02-22 02:38:12 +00:00
Dr. Lars Völker e73ad66d70 UI: Fix typo in tooltip of Time Display Format
Fixes typo in tooltip for "Seconds Since First Captured Packet in
"Time Display Format".
2023-02-21 21:24:25 +00:00
Nicolás Alvarez 180e6cd48e Fix build of PacketListModel with Qt5
a9a7dcec21 broke the build by using std::as_const (new in C++17, we require
C++11). 189d93b4b8 switched to using a for loop with indices, but that
still fails on Qt5, because Qt5 uses int instead of qsizetype.

Switch back to the foreach-style loop, but using C++11 range-for instead of
Qt's foreach (which is semi-deprecated). Also, use qAsConst, which works in
C++11, instead of std::as_const.
2023-02-20 21:34:56 -03:00
John Thacker 189d93b4b8 Qt: Substitute for C++17 ism
Replace C++17 ism from !9822 with code with the same effect
that is valid earlier

(cherry picked from commit 50f71efbe0955b32dfb99bb4933f6ff310b39283)
2023-02-19 14:57:04 -05:00
John Thacker f6e6853dc4 Qt: Plug leaks in Conversations/Endpoints windows
Set some models to have the Traffic Tab or Traffic Type List
that creates them as parent, so that they will be deleted
properly. Setting a model does not cause it to be deleted
unless it is parented, because models can be shared among
multiple views. Since these models are only used by the
one view, parenting them is fine.
2023-02-19 12:10:44 +00:00
John Thacker a9a7dcec21 Qt: Ensure that add frame comments trigger recoloring, count updates
Add functions to PacketListRecord to invalidate a single record's
colorization and column strings, used for a record is modified in a
way that needs to trigger redrawing, but we don't need to redraw
all packets.

Move the functionality for adding, deleting, and setting frame comments
into PacketListModel, operating on QModelIndexes (or on all physical
rows in the case of deleting all comments from a file.) Trigger
recolorization of any record with an updated comment.

Only set a block as modified when deleting comments if we actually
deleted comments. This avoids marking a file as modified if we
delete all comments from all frames, or all comments from selected
frames, when those comments do not actually have frames.

If cf_set_modified_block is used to modify a block that is already
modified, it can't update the comment count. In that case, return
false and have the callers update the comment count. (It already
has a return value, which is always true.) This avoids having the
GUI warning about saving into a format that doesn't support comments
when comments have been added and then removed.

Note that, unlike with time references and time shifts, there
are no fields (and hence no columns nor color filters) that depend
on whether other fields have comments. If for some reason some
were added, then the model data for all frames would have to be
updated instead. Since there aren't, we don't need to
redrawVisiblePackets, but we do need to drawCurrentPacket to ensure
the packet details are redissected.

Fix #12519
2023-02-17 20:49:11 -05:00
John Thacker a49c022773 Qt: Fix scrollbar vanishing when adding columns
Don't call resize in applyRecentColumnWidths(). It doesn't seem
to be necessary in Qt5 or Qt6 to stretch the packet list last column
when the main window is wider than the total columns, and it doesn't
seem to be necessary to get the horizontal scroll bar to appear if
the columns are wider than the window frame either.
(When adding and removing columns, resizing the main window, etc.,
the columns all behave as expected, including if the wide Info
column is removed).

Resizing the packet list makes the scrollbar (and minimap) disappear.
It reappears when selecting another packet, but since it's not
necessary to resize, don't.

Fix #13597
2023-02-15 13:22:42 +00:00
Gerald Combs 877498ad0b [Automatic update for 2023-02-12]
Update manuf, services enterprise numbers, translations, and other items.
2023-02-12 16:46:06 +00:00
John Thacker 994669e5b3 UAT: Have a combobox for Dissectors
Add a drop-down combobox for UATs, including User DLTs, that
have a choice of dissectors. Make the combobox editable, which
will provide suggestions, and pass things through to the existing
UAT validation for dissectors. (It's a very long list, especially
with 1717 entries, including 530 just from various BT GATT UUIDs,
so being able to still type it in seems useful.)

Dissectors are not protocols. Rename the UAT field from PROTO to
DISSECTOR where used. Update the column names and long descriptions
to use dissector instead of protocol in dissectors that used this.
There may at some point be UATs that want protocols instead of
dissectors, but that's not what the current behavior does and
none of the current dissectors that use the existing types want.

Update the documentation to use "dissector" instead of "protocol."
Put the names of the actual current three Ethernet dissectors.
Clarify that the "ip" dissector actually tries IPv4 and IPv6,
instead of just IPv4.

UAT entries are backwards and forwards compatible with versions
without this change.

Fix #18836.
2023-02-11 16:40:13 +00:00
João Valverde 7fd4e2e542 Move ui/filter_files.[ch] to wsutil 2023-02-10 20:59:22 +00:00
João Valverde cf8107eb2a Move ui/clopts_common.[ch] to wsutil 2023-02-10 20:59:22 +00:00
João Valverde 0cea64a632 Move ui/cmdarg_err.[ch] to wsutil 2023-02-10 20:59:22 +00:00
John Thacker 4221021ab6 Qt: Fix click to packet on OverlayScrollBar
Fix the calculation of the ratio for converting a packet number
to the scrollbar value by accounting for the length of the slider.
maximum() does not correpond to the last packet; it corresponds to
the first packet shown when the scrollbar is at maximum. The last
packet is maximum() + pageStep().
(See https://doc.qt.io/qt-6/qscrollbar.html#details)

The quarter of a page padding should be subtracted, not added,
from the calculated position.
(Fix up 422c0f45d4)

This correctly makes clicking on the a line in the minimap scroll
the packet list so that the corresponding packet is 25% of the
way down the visible window. (Excepting the cases of packets at
the very beginning or end of the entire packet list.)

Fix #13989
2023-02-10 01:56:20 +00:00
Moshe Kaplan 9e1905f88d Preferences: Support configuring debounce timers 2023-02-09 20:54:14 +00:00
John Thacker 66fc2d4ee3 Qt: Actually ensure that rows are colorized
PacketListRecords should only report themselves as colorized when
colorized with the latest version of the coloring rules. Otherwise,
ensureRowColorized will not recolorize rows when the rules have changed.

This makes the minimap/intelligent scrollbar correctly update
colors in the background when the rules have changed. (Rows that
were being displayed were being updated, because the columnStrings
were invalidated at the same time, and when fetching the columnStrings
the colors would be updated if the rules had changed.)

Fix #17621
2023-02-09 15:27:58 +00:00
John Thacker 4f14745fce Qt: Fencepost error in minimap/intelligent scrollbar
The location of the next line should be based off one row larger
than the current row.

This fixes an issue where all the lines drawn in the intelligent
scrollbar are off by one - the color intended to be drawn for
the first packet never appears, the first packet corresponds to
the line for the second packet, etc., and there is a line at
the bottom that can never be colored in.

Fix #18850
2023-02-08 14:47:32 +00:00
João Valverde 84f963dfa2 Move ui/version_info.[ch] to wsutil 2023-02-07 23:17:37 +00:00
João Valverde c62aa67d2c Move ui/exit_codes.h to include/ 2023-02-07 10:12:08 +00:00
John Thacker fd183cb40b Qt: Add ability to cancel sorting
Add the ability to cancel sorting. Since we now parse user inputs
during the sort, test and set the capture file read lock. Try to
sort in PacketList::captureFileReadFinished, since now sorting during
thawing won't happen if it's in the middle of a rescan.

Fix #17640
2023-02-07 00:03:24 +00:00
João Valverde 7c156d9ac4 Add a #define HAVE_MSYSTEM and use it
In certain situations using __MINGW64__ is not correct.
We want to have the condition apply using MinGW-w64 but also
using MSYS2, which the __MINGW64__ condition alone does not
capture.

Add a HAVE_MSYSTEM C define and use it where appropriate.
2023-02-06 19:39:33 +00:00
João Valverde d9353d1684 Fix MSYS2 build
Fix:

```
FAILED: run/extcap/randpktdump.exe
cmd.exe /C "cd . && D:\a\_temp\msys64\ucrt64\bin\gcc.exe -fvisibility=hidden  -Wall -Wextra -Wpointer-arith -Wformat-security -fno-strict-overflow -fexcess-precision=fast -Wvla -Wattributes -Wpragmas -Wredundant-decls -Wunreachable-code -Wlogical-op -Wno-error=stringop-overflow= -Wno-error=deprecated-declarations -Wframe-larger-than=32768 -Wno-format-truncation -fdiagnostics-color=always -Wshadow -Wold-style-definition -Wstrict-prototypes -Wno-pointer-sign -march=nocona -msahf -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -fmacro-prefix-map=D:/a/wireshark/wireshark/build/src/wireshark/= -fmacro-prefix-map=D:/a/wireshark/wireshark/build/src/build-UCRT64/= -O3 -DNDEBUG -pipe     -Wl,--as-needed  -municode CMakeFiles/cli_main.dir/cli_main.c.obj extcap/CMakeFiles/extcap-base.dir/extcap-base.c.obj extcap/CMakeFiles/randpktdump.dir/randpktdump.c.obj extcap/CMakeFiles/randpktdump.dir/__/resources/randpktdump.rc.obj -o run\extcap\randpktdump.exe -Wl,--out-implib,run\librandpktdump.dll.a -Wl,--major-image-version,0,--minor-image-version,0  run/librandpkt_core.a  run/libwiretap.dll.a  -lws2_32  run/libui.a  run/libwsutil.dll.a  D:/a/_temp/msys64/ucrt64/lib/libglib-2.0.dll.a  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
D:/a/_temp/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: run/libui.a(failure_message.c.obj):failure_messag:(.text+0x129): undefined reference to `__imp_wtap_strerror'
```

After this change:

```
[2177/2600] Linking C executable run/dumpcap
Warning: Unused direct dependencies:
	/usr/lib/libnl-route-3.so.200
	/home/jpv/code/wireshark/devel/build/run/libwiretap.so.0
```
2023-02-06 19:35:43 +00:00
j.novak@netsystem.cz 0c0f731c92 extcap: Fix of handling default values 2023-02-06 18:29:25 +00:00
João Valverde 02238edf92 Do not require using wsgcrypt.h
The reason to use wsgcrypt.h was to wrap it around DIAG_OFF()
macros and that should no longer be necessary.
2023-02-06 15:52:10 +00:00
João Valverde 71cfbd81b3 Remove wspcap.h and use config.h instead
Forcing the use of a dedicated header to replace pcap.h is
unnecessary code and mental overhead in this case. We can
use config.h instead for the same purpose of defining a
macro symbol before including pcap.h.
2023-02-06 15:05:36 +00:00
João Valverde b07ab25a1c CMake: Cleanup unnecessary linking with shared libraries 2023-02-06 15:04:46 +00:00
Gerald Combs 754ec536e5 [Automatic update for 2023-02-05]
Update manuf, services enterprise numbers, translations, and other items.
2023-02-05 16:47:29 +00:00
John Thacker 4bb43d5986 RTP Stream Dialog: Actually sort on packet loss
The packet loss column has been sorting on a private variable
that is never set(?!) and also is unsigned whereas the actual
lost number is signed. Get the calculated packet loss number
and sort by that. (Should this be sorting by the total number or
the percentage, since the column displays both? Total number is
first so let's use that.)

This should probably be some kind of Model/View instead.

Fix #16785.
2023-02-04 22:15:25 -05:00
John Thacker 15dfa3aa20 Qt: Fix order of ShowAs enums
The ShowAs enum should stay in the same order as the Items
are added to the ShowAs combobox, because setCurrentIndex()
is used with the enum values, e.g. when setting the value to
"Show As Image" when the bytes are an image.
Fixup c9e08b7be3
2023-02-01 21:18:58 -05:00
Gerald Combs 9d9d72f47b Qt: Fix Logray compilation with Qt 6.4
Copy+paste afa2579124 to fix

wireshark/ui/logray/logray_main_window_slots.cpp:1564:40: error: attempt to use a deleted function
            stats_tree_action->setData(cfg->abbr);
                                       ^
Qt/6.4.2/macos/lib/QtCore.framework/Headers/qvariant.h:199:5: note: 'QVariant<char *, false>' has been explicitly marked deleted here
    QVariant(T) = delete;
    ^
2023-01-31 14:03:04 -08:00
Gerald Combs 620dc806db [Automatic update for 2023-01-29]
Update manuf, services enterprise numbers, translations, and other items.

services failed.
2023-01-29 18:53:10 +00:00
Tomasz Moń 516c69b921
Qt: Allow caching columns while dissecting color
It is fine to dissect and cache columns data during color dissection if
it won't evict already cached data. There is rather high probability of
using the column data because color information is dissected in order.
2023-01-29 10:39:06 +01:00
Gerald Combs 6787835373 [Automatic update for 2023-01-22]
Update manuf, services enterprise numbers, translations, and other items.
2023-01-23 00:27:45 +00:00
Gerald Combs cd9f7b64c7 Logray: Remove the "Follow Stream" dialog
We don't reassemble log data into streams, so remove the "Follow" dialog
(for now, at least).
2023-01-22 23:36:23 +00:00
João Valverde 133bebb18b Qt: Fix build with Qt version < 5.14 2023-01-21 12:14:07 +00:00
João Valverde 39124f2f8f Fix Personal Extcap folder path
The personal extcap folder $XDG_CONFIG_DIR/wireshark on Linux is
inconsistent with the global extcap folder (lib/wireshark/extcap)
and personal plugins folder (.local/lib/wireshark/plugins) and also
the configuration folder should not contain architecture-specific files.

The extcap personal folder is changed from:

    .config/wireshark/extcap

to:

    .local/lib/wireshark/extcap
2023-01-20 22:30:26 +00:00
João Valverde d7427e73af Qt: Fix capitalization of About->Folder characterization
Capitalize Lua as a proper name.

Uncapitalize "Extcap Paths" for consistency.
2023-01-20 14:55:23 +00:00
João Valverde c66fc43e5b GUI: Ship authors as a Qt resource file 2023-01-20 13:35:03 +00:00
John Thacker 199ecf2983 Qt: Clear selection, not current, in drawCurrentPacket
QItemSelectionModel tracks both the selected index and the
current index.

PacketList redraws when the *selected* index changes, not
the current index. Clearing the current index, and then marking
the same packet as selected and current fires currentChanged but
not selectionChanged. So drawCurrentPacket needs to call
clearSelection(), not clearCurrentIndex(), in order to trigger
a redissection of the currently selected packet and update
the packet details.

For example, if you mark or unmark the currently selected frame,
this causes the packet details to update. Cf 52955b9c43,
which fixed the same issue but for Find Packet.

Fix #14330.
2023-01-19 19:51:37 -05:00
John Thacker 38fbccd33e Follow: Remove use of follow type from FollowStreamDialog
We can check if we have a follower. follow_type_t is still
used in the constructor, for now, since other parts call it.
2023-01-19 14:49:37 -05:00
João Valverde 2ab291b3b2 GUI: Ship license + acknowledgements as Qt resource 2023-01-19 19:14:32 +00:00
John Thacker 0a840b5dd8 Follow: Remove check for FOLLOW_TCP for fragments in Qt
Only TCP uses fragments, but we don't need to check FOLLOW_TCP
because the fragments pointers exist but are null if not being
used. See the similar code in epan/follow.c

Part of making it simpler for dissectors to register with Follow.
2023-01-19 18:34:45 +00:00
Mikael Kanstrup c4db402db5 Add follow websocket stream support
The websocket protocol masking feature makes follow TCP stream
on websocket traffic show masked payload. To easily view unmasked
and reassembled websocket payload add follow websocket stream
support.
2023-01-19 03:14:18 +00:00
João Valverde 06519be205 Install documentation (HTML manuals) to DOCDIR
Install documentation to DOCDIR instead of DATADIR.
The code must be fixed to open the Help URLs from
this new path.

This only affects Unix-like FHS platforms. Windows
installation does its own thing.

Needs testing with macOS packaging.
2023-01-19 01:40:59 +00:00
John Thacker a05104df66 Qt: Fix build on OpenSUSE 15.3
OpenSUSE requires explicitly including the QTime header.
Fixup 4d3d856d8f
2023-01-17 20:38:48 -05:00
John Thacker 4d3d856d8f Qt: Conversation/Endpoint table Filter by different QVariant types
Return the percentage in the UNFORMATTED_DISPLAYDATA converted
from our string so it it compares properly with an equality filter.

Use QVariant comparisons where appropriate so that Filter by
works as expected with types that are not integers, such as doubles
the City/Country strings from GeoIP, or when absolute start time
is used for conversation starts.

Fix #18738.
2023-01-17 16:47:19 +00:00
John Thacker 9afd2f23ef Qt: Plug credentials model memory leak 2023-01-17 13:25:02 +00:00
Stig Bjørlykke d851134d89 ui: Check occurrence when check for existing custom column
Add a check for occurrence in column_prefs_has_custom() to allow
"Apply as Column" if column already exists with occurrence set.
2023-01-17 08:34:09 +00:00