aboutsummaryrefslogtreecommitdiffstats
path: root/epan/stats_tree.c
AgeCommit message (Collapse)AuthorFilesLines
2024-02-18Some spellingsMartin Mathieson1-1/+1
2024-02-14stats_tree: Free the split string arrayJohn Thacker1-0/+1
Fixup 53638f9ccfc9ce7e685532062c3b4068a759f7dd
2024-02-14Stats tree: Change our path separatorGerald Combs1-10/+20
Change our menu path separator to "//" similar to our filter buttons. Change the "name" configuration element to "path", since it's a menu path. Add a separate "title" element. This lets us use names like "Foo I/O".
2024-02-12stats_tree API updatesGerald Combs1-32/+36
Add an opaque public type for stats_tree configurations. Get rid of stats_tree_register_with_group and add stats_tree_set_group. Add stats_tree_set_first_column_name. Convert some documentation to doxygen.
2023-06-18Get rid of unnecessary casts.Guy Harris1-5/+5
snprintf(), sensibly, takes a size_t argument specifying the size of the buffer. g_snprintf(), bogusly, takes a gulong argument specifying the size of the buffer, so we had to do casts to avoid narrowing complaints, but we're just using snprintf() now (as we require C11 or later), and don't need the casts any more.
2022-06-10tap: Adding flags for tap_packetRoland Knall1-2/+2
This allows flags to be passed by the registering listener to the collection of information
2022-04-12Qt: Update our dynamic menu groups.Gerald Combs1-3/+3
Add log-specific statistics groups, and use them to limit the dynamic menu items in Wireshark and Logwolf.
2021-12-19epan: Convert to use stdio.h from GLibJoão Valverde1-20/+20
Replace: g_snprintf() -> snprintf() g_vsnprintf() -> vsnprintf() g_strdup_printf() -> ws_strdup_printf() g_strdup_vprintf() -> ws_strdup_vprintf() This is more portable, user-friendly and faster on platforms where GLib does not like the native I/O. Adjust the format string to use macros from intypes.h.
2021-06-19Replace g_assert() with ws_assert()João Valverde1-9/+10
2020-12-23Detect and replace bad allocation patterns (more)Moshe Kaplan1-1/+1
Extension of !1413, to improve regex, detect additional opportunities to replace `g_malloc` with `g_new`, and fix them.
2020-12-22Detect and replace bad allocation patternsMoshe Kaplan1-10/+10
Adds a pre-commit hook for detecting and replacing occurrences of `g_malloc()` and `wmem_alloc()` with `g_new()` and `wmem_new()`, to improve the readability of Wireshark's code, and occurrences of `g_malloc(sizeof(struct myobj) * foo)` with `g_new(struct myobj, foo)` to prevent integer overflows Also fixes all existing occurrences across the codebase.
2020-01-03WSUG: Add a Packet Lengths dialog section.Gerald Combs1-4/+4
Add a section for the Packet Lengths window. Use title case for the column headers. Fix a button name and other issues elsewhere. Change-Id: I339d56aa169158e0788acd02a897729205e9f50e Reviewed-on: https://code.wireshark.org/review/35615 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2019-08-28Use g_hash_table_replace() when key depends on dataTomasz Moń1-1/+1
Using g_hash_table_insert() in cases where the key is contained within value is error prone. Use g_hash_table_replace() to eliminate the risk of ending up with incoherent hash table state. Change-Id: I595457476a2682e927d2c56b2692404aef4dc43a Reviewed-on: https://code.wireshark.org/review/34385 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-07-26HTTPS (almost) everywhere.Guy Harris1-1/+1
Change all wireshark.org URLs to use https. Fix some broken links while we're at it. Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c Reviewed-on: https://code.wireshark.org/review/34089 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-01-23stats_tree: use the right modifier for int values.Dario Lombardo1-2/+2
Ping-Bug: 15416 Change-Id: I24593bdc9f2399085926724176b1a0a8197d7e1a Reviewed-on: https://code.wireshark.org/review/31662 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-03epan: remove redundant casts.Dario Lombardo1-2/+2
Found by clang-tidy. Change-Id: Iaf6cf84c33b03ddfcd39a333b49f4987002afa56 Reviewed-on: https://code.wireshark.org/review/31338 Petri-Dish: Dario Lombardo <lomato@gmail.com> Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-01-01Add a "failed" return for tap packet routines.Guy Harris1-2/+2
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>
2018-12-28Allow floating point values for stats_treeMichael Mann1-58/+226
Bug: 4234 Change-Id: Ibd59809b2dd9890a7851eb57ef7af384e280a74b Reviewed-on: https://code.wireshark.org/review/31222 Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-05-14Free g_array_free-related memory leaksPeter Wu1-1/+1
g_array_free(a, FALSE) returns "a->data". Callers that do not handle this will leak memory. Convert other users to use the return value instead of direct access to "a->data". Change-Id: I0a29864e8106c0bf09e9573ef29e4474179c4171 Reviewed-on: https://code.wireshark.org/review/27438 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-04-17Remove some GTK+-only code.Gerald Combs1-1/+0
Change-Id: Ic2498c7acd6a1a522be45094148402ee34a6b4d1 Reviewed-on: https://code.wireshark.org/review/26958 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-02-08epan: use SPDX indentifiers.Dario Lombardo1-13/+1
Skipping dissectors dir for now. Change-Id: I717b66bfbc7cc81b83f8c2cbc011fcad643796aa Reviewed-on: https://code.wireshark.org/review/25694 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-10-01stats tree: (trivial) reformat assignmentsMartin Kaiser1-24/+24
a= b; looks a bit strange. Replace such assignments with a = b; Change-Id: I09534e0201906490daeb5cd35c55df00e139cf30 Reviewed-on: https://code.wireshark.org/review/23800 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-10-01stats_tree: fix the comparison routine for COL_AVERAGEMartin Kaiser1-11/+3
Generally, the average is calculated as node->total / node->count. The curent code does not handle the case where we compare two nodes and both have count == 0. It defines one of the nodes to be bigger. This triggers (at least on Windows) an assertion about invalid operator<. To fix this, we define average = 0 for a node with count == 0. We can then simply compare the two averages. Change-Id: Ie7d9cd590deddcdb9214c4a2693c2eb47c66b287 Reviewed-on: https://code.wireshark.org/review/23799 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-06-26Fix Packet Lengths statistics countSilvio Gissi1-1/+6
Packet statistics were not showing the packets above 5120 due to the last entry being reformatted and not parsed correctly. Since the last entry is "reformatted" for better user string, also "reformat" the last entry as it goes through "range processing". Bug: 13844 Change-Id: Id49b41c08111dcad1590e034159b81ead8636c4e Reviewed-on: https://code.wireshark.org/review/22382 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-03-11stats_tree: fix this statement may fall through ↵Alexis La Goutte1-1/+1
[-Werror=implicit-fallthrough] found by gcc7 Change-Id: Idd5ab938b95d515cdf8b2a8568456f44b3dd85ac Reviewed-on: https://code.wireshark.org/review/20496 Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-20stats_tree: fix no previous prototype for ‘stats_tree_cfg_free’ ↵Alexis La Goutte1-1/+1
[-Wmissing-prototypes] Change-Id: Iddf63fabec9a2abb5b3d75fb5289f769e0175b55 Reviewed-on: https://code.wireshark.org/review/20197 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-02-07stats_tree: add cleanup function.Dario Lombardo1-1/+16
Change-Id: Iefd264bdd79af172c245c3a30119999cca9d56c0 Reviewed-on: https://code.wireshark.org/review/19976 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Dario Lombardo <lomato@gmail.com>
2016-02-08Cleanup indentationJoão Valverde1-163/+183
Change-Id: I59e9a4806d047e8cc26e9927e76243ce58a57e6d Reviewed-on: https://code.wireshark.org/review/13811 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-01-20Fix constnessJoão Valverde1-1/+1
Change-Id: I23a01f86d6934f3d6c048015c47ae690742173c8 Reviewed-on: https://code.wireshark.org/review/13437 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2015-12-28Don't cast away constness unnecessarily.Guy Harris1-2/+2
Compare functions for various collection data types don't need to modify what they're comparing, so keep everything const. Change-Id: I1c2cff6954b1a8c5ade74943934324d0bd8f523c Reviewed-on: https://code.wireshark.org/review/12884 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-01stats_tree: re-indent else for avoid warning found by PVS Studio (V705)Alexis La Goutte1-7/+9
It is possible that 'else' block was forgotten or commented out, thus altering the program's operation logics Change-Id: Ie246592282bd0791021159f90b4b8aeb92cff86f Reviewed-on: https://code.wireshark.org/review/12333 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-22Add support for IPv6 stats tree statisticsJoão Valverde1-1/+14
Also add support for alphabetizing stat tree items as the addition of IPv6 stats tree makes it more obvious its needed. Change-Id: I8b319ceac805ce7e3a1fd59f92c1c6fe2a54d3de Reviewed-on: https://code.wireshark.org/review/10062 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: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-08-20Tap parameter and stats dialog fixups.Gerald Combs1-0/+2
If we run into an error when trying to register a tap listener, return instead of tapping packets. This should fix some (but likely not all) double frees found by Stig. For now close each statistics dialog if we find an error. Note that we might want to keep them open instead. Add checks and cleanups to some of the stats table free routines. Call fillTree once in TapParameterDialog's constructor instead of each time it's shown. Make fillTree a slot which lets us use a delay timer so that the dialog is visible when we retap packets. Change-Id: Id49f2f2a99bc8e5b1d32990024986b3c8b1abe24 Reviewed-on: https://code.wireshark.org/review/10153 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-07-03Add ServiceResponseTimeDialog.Gerald Combs1-1/+2
Add ServiceResponseTimeDialog as a subclass of TapParameterDialog, similar to StatsTreeDialog. Add initial plumbing for statistics menu items and command line invocation. Don't append "..." to menu item names. Don't add menu icons. In each case this avoids repetitive UI clutter. Change-Id: I463b95c93090160bb81d2e80b16aad389dc0bd6c Reviewed-on: https://code.wireshark.org/review/8864 Reviewed-by: Gerald Combs <gerald@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-06-05Clean up stats_tree_presentation.Gerald Combs1-35/+0
Remove some unused struct members and accompanying callbacks. Change-Id: I64d32ddf886038e8f19bc3f88e86c8d7578db648 Reviewed-on: https://code.wireshark.org/review/8779 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-12-30stats_tree: Make sure some structs are fully initialized.Gerald Combs1-36/+4
Get rid of a strcpy. Change-Id: I49460969fdf627fdb89030115ad5a658e300a5d4 Reviewed-on: https://code.wireshark.org/review/6130 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-22stats_tree: g_sprintf()-->g_snprintf(); cleanup #includes.Bill Meier1-6/+5
Change-Id: I862fed818cd1f14584b082f87b1d4d305cf78687 Reviewed-on: https://code.wireshark.org/review/5970 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-06Convert "4 space tabs" to spaces; Adjust editor modelines.Bill Meier1-1002/+1002
Change-Id: I8d61d959c79e6aa9875c58680c54a331d18079cc Reviewed-on: https://code.wireshark.org/review/4504 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(Using sed : sed -i '/^ \* \$Id\$/,+1 d') Fix manually some typo (in export_object_dicom.c and crc16-plain.c) Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8 Reviewed-on: https://code.wireshark.org/review/497 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-01Fix some scan-build warnings.Gerald Combs1-1/+1
Fix a modeline while we're at it. Change-Id: Ief6d5edbe33456170059cfab4f436f0844de32a1 Reviewed-on: https://code.wireshark.org/review/440 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-02-25Remove trailing whitespaceBill Meier1-1/+1
Change-Id: I8116f63ff88687c8db3fd6e8e23b22ab2f759af0 Reviewed-on: https://code.wireshark.org/review/385 Reviewed-by: Bill Meier <wmeier@newsguy.com> Tested-by: Bill Meier <wmeier@newsguy.com>
2014-01-05Fix indent (Use tabs) and add modelinesAlexis La Goutte1-45/+55
svn path=/trunk/; revision=54610
2013-12-09Fix warningsJakub Zawadzki1-1/+1
svn path=/trunk/; revision=53885
2013-12-08From Deon van der Westhuysen via ↵Alexis La Goutte1-91/+7
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9452 Patch: Stats_tree enhancements for sorting, averages and burst rate Add sort, save-as and new columns to Qt ui, remove old functions stats_tree.c / stats_tree_priv.h: Make all columns sortable. Remove unneeded functions stats_tree_get_strs_from_node, stats_tree_branch_to_str and stats_tree_is_sortable_column. stats_tree_stat.c: Set all columns sortable. stats_tree_dialog.cpp / stats_tree_dialog.h: Add new stats_tree columns. Make columns sortable. Remove copy to csv and copy to yaml buttons. Add copy to clipboard as plain text and save as buttons. stats_tree_dialog.ui: Remove copy to csv and copy to yaml buttons. Add copy to clipboard as plain text and save as buttons. Only define one column in ui, rest are added dynmically. From me : fix trailing whitespace svn path=/trunk/; revision=53848
2013-12-07Use strutil xml_escape() functionJakub Zawadzki1-27/+4
svn path=/trunk/; revision=53832
2013-12-02Get rid of a stray semicolon, as it upsets Sun^WOracle Studio's CGuy Harris1-3/+2
compiler. Clean up escape_xml_chars() a bit, so that there's no extra unreached "return s;", and so that it's clearer that it runs until it hits a NUL. (XXX - are there GLib routines that will do this?) svn path=/trunk/; revision=53716
2013-12-01Patch to include YAML export. Bug 9452 ↵Michael Mann1-16/+47
(https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9452) From Deon van der Westhuysen From me: use switch statements instead of if-else svn path=/trunk/; revision=53698
2013-11-30Better fix for uninitialized variable warning. Part of bug 9452 ↵Michael Mann1-2/+7
(https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9452) From Peter Wu. From me: Leave the "result" variable initialized because I'm not sure code analyzers will consider g_assert_not_reached() enough prevention from using uninitialized "result" svn path=/trunk/; revision=53679
2013-11-30Try to please GCC 4.3.2Pascal Quantin1-2/+2
svn path=/trunk/; revision=53675
2013-11-30Casts required from void * in C++.Guy Harris1-1/+1
svn path=/trunk/; revision=53664