aboutsummaryrefslogtreecommitdiffstats
path: root/epan/funnel.c
AgeCommit message (Collapse)AuthorFilesLines
2023-08-18epan: Fix a memory leakJoão Valverde1-0/+3
2023-08-16Qt: Add Lua console dialogJoão Valverde1-0/+58
This adds a dialog in the Tools menu to open a console and evaluate Lua code using the embedded Lua engine. It replaces the previous console.lua implementation that was more limited to use, because it relies on GUI bits exposed to Lua. It used two separate windows for that reason. The implementation uses the existing "funnel" API amd relies heavily on callbacks to maintain separation between GUI and epan code and make it generic enough to possibly support more use cases than just the Lua 5.2 console. The open and close callbacks are used to install and remove a custom print() lua function with dialog creation and destruction. The eval callback is basically the same as luaL_dostring().
2022-12-07WSLUA: Add new lua function register_packet_menu()Moshe Kaplan1-0/+128
This adds support to Wireshark for custom context menus for packets, so that when a packet's context menu is opened (e.g., by right-clicking), Wireshark can support doing things like "run a program" or "open a URL" with a field from the packet as a parameter. Note that this is similar to ArcSight's integration commands feature. For example, it could be used like the following: ``` ROBTEX_URL = "https://www.robtex.com/dns-lookup/" local function search_robtex(...) local fields = {...}; for i, field in ipairs( fields ) do if (field.name == 'http.host') then browser_open_url(ROBTEX_URL .. field.value) break end end end register_packet_menu("Search host in Robtex", search_robtex, "http.host"); ``` Fixes issue #14998
2021-03-25wsutils: add local implementation of g_memdup2.Dario Lombardo1-1/+2
g_memdup() was deprecated and replaced with g_memdup2() in GLib 2.68, we provide our own copy of g_memdup2() for older GLib versions.
2020-12-22Detect and replace bad allocation patternsMoshe Kaplan1-2/+2
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.
2019-11-05funnel: Free callback dataStig Bjørlykke1-0/+6
Free allocated callback data in FunnelStringDialog, TextWindow and registered menu items. Also free strings used in FunnelStringDialog. Bug: 16177 Change-Id: I9a129b8975a55d1dc89fe851116feebe82763bca Reviewed-on: https://code.wireshark.org/review/34945 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
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-28funnel: Fix memleaks in funnel_remove_menuStig Bjørlykke1-1/+6
The loop to remove all matching callbacks was skipping every second entry which would give some leaks when reloading Lua plugins. Add funnel_cleanup() to be called in epan_cleanup() at shutdown to remove all allocated menu entries. Change-Id: I3a50ba2070c8675fee1385f25e9e109db57c2dc5 Reviewed-on: https://code.wireshark.org/review/31769 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
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>
2016-01-21Fix warning for funnel.c [-Wcast-qual]João Valverde1-3/+3
Change-Id: Ib80b2f56ab76d72e89f6a0fbe2d0903d1029ed19 Reviewed-on: https://code.wireshark.org/review/13448 Reviewed-by: João Valverde <j@v6e.pt>
2015-08-11Added Reload Lua plugins.Stig Bjørlykke1-12/+90
This is initial support for reloading Lua plugins without restarting the application. Still todo: - Deregister FileHandlers - Support deregister ProtoField with existing abbrev (same_name_hfinfo) - Add a progress dialog when reloading many plugins - Search for memory leakages in wslua functions Change-Id: I48870d8741251705ca15ffe1068613fcb0cb18c1 Reviewed-on: https://code.wireshark.org/review/5028 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-07-07Qt: Add initial Lua support.Gerald Combs1-0/+1
Add a FunnelStatistics class, which is the main interface between the Qt UI and the Funnel API. Add FunnelTextDialog, which implements the text_window, ProgDlg, menu, and other routines. Add FunnelStringDialog, which implements dlg_new. We currently only support "Tools" menu items (MENU_TOOLS_UNSORTED, aka REGISTER_TOOLS_GROUP_UNSORTED). Add a disabled placeholder to the "Tools" menu in case we don't load any scripts. Use "struct progdlg" instead of needlessly casting to funnel_progress_window_t. To do: - Add support for MENU_STAT_UNSORTED, MENU_STAT_GENERIC, etc. - Make the firewall config generator a Lua script? - Add FunnelGraphDialog? It seems like it would be useful to make QCustomPlot accessible to Lua scripts. Ping-Bug: 9845 Change-Id: Iefff02e9032ed1853666f7902509ed08b431e7a7 Reviewed-on: https://code.wireshark.org/review/9523 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-10-10Add editor modelines; Adjust whitespace as needed.Bill Meier1-2/+12
Change-Id: I3dc57f4c2ca57585103e3b71503ac4c332903e50 Reviewed-on: https://code.wireshark.org/review/4594 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-02-25Remove trailing whitespaceBill Meier1-2/+2
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>
2013-03-20 From beroset:Bill Meier1-1/+1
remove C++ incompatibilities https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 attachment #10397 svn path=/trunk/; revision=48438
2012-09-20We always HAVE_CONFIG_H so don't bother checking whether we have it or not.Jeff Morriss1-2/+0
svn path=/trunk/; revision=45016
2012-06-28Update Free Software Foundation address.Jakub Zawadzki1-1/+1
(COPYING will be updated in next commit) svn path=/trunk/; revision=43536
2011-05-17More eradication of old-style function definitions.Guy Harris1-1/+1
svn path=/trunk/; revision=37216
2009-09-28Only include config.h in C files, to avoid multiple inclusion.Stig Bjørlykke1-0/+4
svn path=/trunk/; revision=30180
2008-08-05luis.ontanon@gmail.com => luis@ontanon.orgLuis Ontanon1-1/+1
svn path=/trunk/; revision=25937
2006-09-27* rename REGISTER_STAT_GROUP_E -> register_stat_group_tLuis Ontanon1-2/+2
* Add a "Tools" menu * allow wslua's register_menu to register menu items into more menus svn path=/trunk/; revision=19338
2006-05-21name changeRonnie Sahlberg1-2/+2
svn path=/trunk/; revision=18197
2006-02-05* add an option to funnel_register_menu to retap the packets right after ↵Luis Ontanon1-2/+5
been called * add a set_close_cllback function to the textwindow mini-api to set a callback to be called when the window gets closed. * fix few issues regarding the closing of the window svn path=/trunk/; revision=17165
2006-02-05- add a register_menu funnel Luis Ontanon1-15/+7
- remove the field_menu altoghether (It was not what I thought) - move a declaration to the start of a function to allow VC6 to compile svn path=/trunk/; revision=17161
2006-02-04define funnel_register_field_menu even if it is not implemented.Luis Ontanon1-7/+7
svn path=/trunk/; revision=17155
2006-02-04The funneled GUI mini API.Luis Ontanon1-0/+81
A very reduced set of gui ops (by now just a text window) that can be funneled to dissectors (even plugins) via epan. svn path=/trunk/; revision=17149