Commit Graph

37 Commits

Author SHA1 Message Date
Evan Huus d6d7dd1e56 First pass pinfo->pool conversion
Automated find/replace of wmem_packet_scope() with pinfo->pool in all
files where it didn't cause a build failure.

I also tweaked a few of the docs which got caught up.
2021-07-21 05:38:29 +00: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
Jirka Novak 8dd8491713 Qt framework: Dialogs are correctly notified when capture file was closed
The patch reintroduces WiresharkDialog::captureFileClosed() method and
calls captureFileClosing() and captureFileClosed() in right order.
Both methods call updateWidgets() at its end.

All dialogs were reviewed and captureFileClosing/Closed methods updated
when appropriate.
captureEvent() method in multiple dialogs changed to captureFileClosing/Closed
as it does same actions - looks like old style of detecting of capture
file closing.
2021-01-11 13:30:18 +00:00
Orgad Shaneh 0442f7a2c3 UI: Fix compilation with Qt 5.14
Change-Id: I8adae4609ff2857cb12bc803839ebb2c6afbd264
Reviewed-on: https://code.wireshark.org/review/35517
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2019-12-21 20:25: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
Michał Łabędzki 9a4393851b Qt: Fix Crash in empty Bluetooth windows
Avoid crashed in context menu in Bluetooth windows when there is no any items.
Also add missing last column in "Copy All" in HCI Summary (fix console warning).

Change-Id: I28af0208c3b1c813d43305f3c0a4bf19f66d3e31
Reviewed-on: https://code.wireshark.org/review/31977
Petri-Dish: Michal Labedzki <michal.labedzki@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2019-02-11 20:16:43 +00:00
Guy Harris 2d41b15495 Add a "failed" return for tap packet routines.
This allows taps that can fail to report an error and fail; a failed
tap's packet routine won't be called again, so they don't have to keep
track of whether they've failed themselves.

We make the return value from the packet routine an enum.

Don't have a separate type for the per-packet routine for "follow" taps;
they're expected to act like tap packet routines, so just use the type
for tap packet routines.

One tap packet routine returned -1; that's not a valid return value, and
wasn't one before this change (the return value was a boolean), so
presume the intent was "don't redraw".

Another tap routine's early return, without doing any work, returned
TRUE; this is presumably an error (no work done, no need to redraw), so
presumably it should be "don't redraw".

Clean up some white space while we're at it.

Change-Id: Ia7d2b717b2cace4b13c2b886e699aa4d79cc82c8
Reviewed-on: https://code.wireshark.org/review/31283
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-01-01 05:03:42 +00:00
Guy Harris 9b731e2b32 Add a tap "finish" callback, called when a listener is removed.
Change-Id: Ic6c23dbd39d1adf8f730f1c866e409f731947475
Reviewed-on: https://code.wireshark.org/review/28786
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-07-21 00:51:13 +00:00
Gerald Combs 62999cc677 Windows: Make sure more native dialogs handle HiDPI.
Add a WiresharkFileDialog class, which is a thin wrapper around a few
QFileDialog functions that sets per-monitor v2 DPI awareness before
showing native dialogs and resets the awareness context afterward.
Use it where we call QFileDialog::getXXX.

Change-Id: Ib711a70aa94b693a2515804a729f666ea7fbd673
Reviewed-on: https://code.wireshark.org/review/27568
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-16 04:22:20 +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
Guy Harris 1f5f63f8ef Generalize wtap_pkthdr into a structure for packet and non-packet records.
Separate the stuff that any record could have from the stuff that only
particular record types have; put the latter into a union, and put all
that into a wtap_rec structure.

Add some record-type checks as necessary.

Change-Id: Id6b3486858f826fce4b096c59231f463e44bfaa2
Reviewed-on: https://code.wireshark.org/review/25696
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-09 00:29:51 +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
Roland Knall ddfc1d37cc Qt: Move utils to separate utils directory
Following the move for widgets directory, moving utils
to the utils directory. Guidelines for this directory are:

 - Generic use but not a widget
 - Utility functionality used by many classes
 
 Note: additionally all includes affected by this move have been changed
 to absolute path includes, instead of relative ones.

Change-Id: I019ae4b6e6f6d06a5745a63ed195edbd36fb936b
Reviewed-on: https://code.wireshark.org/review/22602
Petri-Dish: Roland Knall <rknall@gmail.com>
Reviewed-by: Roland Knall <rknall@gmail.com>
2017-07-26 10:11:55 +00:00
Patryk Nowak 03f372fd8b Qt/Bluetooth: add results filter in HCI Summary window
Add ability to display only these HCI commands whose names match specified
filter. Currently only simple filtering is implemented (substring search,
no regex-matching).

Change-Id: I418d3d2d3e7a3b196d5ba05496d31c508e842dec
Reviewed-on: https://code.wireshark.org/review/20880
Reviewed-by: Michal Labedzki <michal.labedzki@wireshark.org>
Petri-Dish: Michal Labedzki <michal.labedzki@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-04-04 01:59:32 +00:00
Michael Mann b56bbb493a Fix "warning C6246: Local declaration hides declaration of the same name in outer scope" warnings
Change-Id: I98edc076fdab40ef1fd05313168011f58e13a4d6
Reviewed-on: https://code.wireshark.org/review/20773
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-03-29 02:38:29 +00:00
Roland Knall 3df81a0550 Qt: Remove unneccessary Q_DECLARE_METATYPE
Remove unnecessary Q_DECLARE_METATYPE macros and replace calls
to QVariant conversions with VariantPointer where necessary

Change-Id: Ia4690590095f930bf94644197de7fa30b00ee7ec
Reviewed-on: https://code.wireshark.org/review/19611
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
2017-01-12 16:04:00 +00:00
Michal Labedzki c799699040 Qt/Bluetooth: Split LE Meta Events
Add 3rd level subtree in Event->LE Meta, because of
existance of "Subevent" which is in similar thing to
Event or Opcode in CommandComplete.

Change-Id: Ib732ab417c5141251736b608de2e4e64b702c20a
Reviewed-on: https://code.wireshark.org/review/18667
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
2016-11-04 09:23:05 +00:00
Michal Labedzki d32fee2d62 Qt/Bluetooth: Add Display Filter Edit field to HCI Summary dialogue
Display Filter can be useful for this summary dialogue,
for example to reduce number of frame that were analyzed, like:
"frame.number >= 100 && frame.number <= 4674"

Change-Id: I19587b9d41f3b253d1ca2683d198f7d7af2ad50f
Reviewed-on: https://code.wireshark.org/review/18265
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Michal Labedzki <michal.labedzki@tieto.com>
2016-10-22 09:22:02 +00:00
Michal Labedzki afcbcdf272 Qt/Bluetooth: Add Mark/Unmark functionality
Add Mark/Unmark functionality for tree/table widget items, user can now
mark row or cell.

Change-Id: I31b9ca128d97da4fb959ae2d92f5c1646ebea478
Reviewed-on: https://code.wireshark.org/review/18266
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>
2016-10-20 07:34:37 +00:00
Guy Harris 41c6b944b4 Rename a function to have a name different from a data object's name.
Change-Id: Iefef8b2161b43900fd81fb1b163a4feee69fd069
Reviewed-on: https://code.wireshark.org/review/18285
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-10-18 20:08:40 +00:00
Michal Labedzki 2898c2a244 Fix wrong local function names
Copy->Paste issue.

Change-Id: I77bc755c772df0fb95a9e4ce91b8b3bc8a8e019d
Reviewed-on: https://code.wireshark.org/review/18282
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-10-18 19:33:17 +00:00
Michal Labedzki ad980c70bf Qt/Bluetooth: Implement hover for rows
This improves readability, especially while presenting results
to the other people.

Change-Id: I1a6fc93c1b858078e171729971561321a4ddd956
Reviewed-on: https://code.wireshark.org/review/16469
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
2016-09-13 06:17:15 +00:00
Pascal Quantin a383e692c8 Revert "tap: change glib functions to wmem."
This reverts commit 2e9f3c5d36.

It breaks the registration of codec, dissector and libwiretap plugins.

Change-Id: I4ef91dd192f765adf87ea9fe9f3693e25dbd24de
Reviewed-on: https://code.wireshark.org/review/16012
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-06-19 10:47:10 +00:00
Dario Lombardo 2e9f3c5d36 tap: change glib functions to wmem.
Change-Id: I878ae6b121a669f9b7f4e1e57bc079f0cb44c0bf
Reviewed-on: https://code.wireshark.org/review/15270
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-17 15:38:03 +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
Alexis La Goutte 2df337d538 Bluetooth HCI (Qt): Remove Q_UNUSED
See g21754f43e for detail

There is always some other Q_UNUSED but include on #if/#endif...

Change-Id: Ib2283660c91787acbf6392841faa3db6aed39438
Reviewed-on: https://code.wireshark.org/review/15803
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
2016-06-10 12:58:56 +00:00
Jaap Keuter 74484c6ebf Apply the prefix operator to iterators.
Prefix operators are supposed to be more efficient with iterators,
so lets use them instead of postfix operators.

Change-Id: I3090e4954c5cb67db47c88e2874b1a8ac52aa2cd
Reviewed-on: https://code.wireshark.org/review/15546
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-08 03:44:36 +00:00
Michal Labedzki 9cbad0207e Qt/Bluetooth: Allow to use Enter button for jump to frames
Implement keyPressEvent and do nothing... However it "takes focus"
from button box and jump to frame that some items in tree widget point.

Change-Id: Ib08f1588f20bce66fa945bf952770600c625233c
Reviewed-on: https://code.wireshark.org/review/15455
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Michal Labedzki <michal.labedzki@tieto.com>
2016-05-20 14:53:13 +00:00
Michal Labedzki d25bdd7c46 Qt/Bluetooth: HCI Summary: Miscellaneous fixes
1. Count vendor commands once
2. Fill Event column in case of Command Status/Command Complete
   types while displaying command
3. Add missing Status from Connect Complete event
4. Add missing Command Complete events opcodes

Change-Id: Ie5a0e373f92f62fcb890cef7ab54762df3bb8a35
Reviewed-on: https://code.wireshark.org/review/14315
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
2016-03-03 10:47:35 +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
Guy Harris bc5a0374bf Add the packet number to the packet_info structure, and use it.
That removes most of the uses of the frame number field in the
frame_data structure.

Change-Id: Ie22e4533e87f8360d7c0a61ca6ffb796cc233f22
Reviewed-on: https://code.wireshark.org/review/13509
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-24 03:41:28 +00:00
Stig Bjørlykke 720f57d000 ui: Code cleanup
Fixed code layout to use common style in the file.
Mostly whitespace changes.

Change-Id: Id37b57717a9e26248fad07322dff09b1d1f45ac2
Reviewed-on: https://code.wireshark.org/review/13504
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-01-23 23:15:54 +00:00
moshekaplan cd7026951b Fix a lot of typos and misspellings
Change-Id: I8512cfa1d424f82a873a0e0e1d22c7b075fdd7f3
Reviewed-on: https://code.wireshark.org/review/13069
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: Michael Mann <mmann78@netscape.net>
2016-01-08 20:04:56 +00:00
Michal Labedzki 2da59158a0 Try to fix some PVS Studio warnings
V814 Decreased performance. The 'strlen' function was called multiple times inside the body of a loop. androiddump.c 626
V814 Decreased performance. The 'strlen' function was called multiple times inside the body of a loop. androiddump.c 661
V814 Decreased performance. The 'strlen' function was called multiple times inside the body of a loop. androiddump.c 678
V814 Decreased performance. The 'strlen' function was called multiple times inside the body of a loop. androiddump.c 689
V814 Decreased performance. The 'strlen' function was called multiple times inside the body of a loop. androiddump.c 700
V814 Decreased performance. The 'strlen' function was called multiple times inside the body of a loop. androiddump.c 711
V814 Decreased performance. The 'strlen' function was called multiple times inside the body of a loop. androiddump.c 728
V814 Decreased performance. The 'strlen' function was called multiple times inside the body of a loop. androiddump.c 739
V814 Decreased performance. The 'strlen' function was called multiple times inside the body of a loop. androiddump.c 750
V814 Decreased performance. The 'strlen' function was called multiple times inside the body of a loop. androiddump.c 761
V814 Decreased performance. The 'strlen' function was called multiple times inside the body of a loop. androiddump.c 810
V814 Decreased performance. The 'strlen' function was called multiple times inside the body of a loop. androiddump.c 867
V814 Decreased performance. The 'strlen' function was called multiple times inside the body of a loop. androiddump.c 889
V814 Decreased performance. The 'strlen' function was called multiple times inside the body of a loop. androiddump.c 949
V814 Decreased performance. The 'strlen' function was called multiple times inside the body of a loop. androiddump.c 971
V804 Decreased performance. The 'strlen' function is called twice in the specified expression to calculate length of the same string. androiddump.c 1876
V512 A call of the 'memcpy' function will lead to underflow of the buffer 'packet + exported_pdu_headers_size'. androiddump.c 1950
V804 Decreased performance. The 'strlen' function is called twice in the specified expression to calculate length of the same string. androiddump.c 2053
V804 Decreased performance. The 'strlen' function is called twice in the specified expression to calculate length of the same string. androiddump.c 2056
V512 A call of the 'memcpy' function will lead to underflow of the buffer 'packet + exported_pdu_headers_size'. androiddump.c 2122
V590 Consider inspecting this expression. The expression is excessive or contains a misprint. androiddump.c 2207
V590 Consider inspecting this expression. The expression is excessive or contains a misprint. androiddump.c 2227
V530 The return value of function 'freopen' is required to be utilized. androiddump.c 2275
V530 The return value of function 'freopen' is required to be utilized. androiddump.c 2279
V808 'name' object of 'QString' type was created but was not utilized. bluetooth_devices_dialog.cpp 201
V807 Decreased performance. Consider creating a pointer to avoid using the 'ui->tableTreeWidget->headerItem()' expression repeatedly. bluetooth_devices_dialog.cpp 337
V807 Decreased performance. Consider creating a pointer to avoid using the 'item->child(i_item)' expression repeatedly. bluetooth_hci_summary_dialog.cpp 648
V807 Decreased performance. Consider creating a pointer to avoid using the 'ui->tableTreeWidget->headerItem()' expression repeatedly. bluetooth_hci_summary_dialog.cpp 669

Change-Id: Ia81b5f867b2b1e0ee58eed0bd297800774bc37f9
Reviewed-on: https://code.wireshark.org/review/12683
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
2015-12-17 14:17:27 +00:00
Michal Labedzki cd5706cb56 Qt/Bluetooth: Disable go to packet for closed files
Go to packet on close files is not valid (for currently open one).
Disable it.

Change-Id: Ib7b65c9ea7e94857692c8ac5ddd3971c52ac717f
Reviewed-on: https://code.wireshark.org/review/11023
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-10-15 03:45:45 +00:00
Michal Labedzki 3faec795e9 Qt/Bluetooth: Add HCI Summary dialogue
HCI Summary dialogue collect HCI Opcodes, HCI Events, Hardware Errors,
Statuses and Reasons. Also show occurrence of them. The top level item
is group of items (by OGF or types), the second level item is in real
command, event, hardware error, status or reason. The third level items
are direct link to packet that contains second level item type.

Change-Id: I6b6bd02533c4605a2dd2c1f5dfee46f72a0f3fdc
Reviewed-on: https://code.wireshark.org/review/9676
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
2015-07-17 13:54:43 +00:00