path: root/epan/expert.c
AgeCommit message (Collapse)AuthorFilesLines
2017-10-15Remove superfluous null-checks before strdup/freeAhmad Fatoum1-7/+2
NULL checks were removed for following free functions: - g_free "If mem is NULL it simply returns" https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html#g-free - g_slist_free(_full)? "NULL is considered to be the empty list" https://developer.gnome.org/glib/stable/glib-Singly-Linked-Lists.html - g_strfreev "If str_array is NULL, this function simply returns." https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strfreev - g_slice_free "If mem is NULL, this macro does nothing." https://developer.gnome.org/glib/stable/glib-Memory-Slices.html#g-slice-free - g_match_info_free "not NULL... otherwise does nothing" https://developer.gnome.org/glib/stable/glib-Perl-compatible-regular-expressions.html#g-match-info-free - dfilter_free defined in Wireshark code. Returns early when passed NULL epan/dfilter/dfilter.c They were also removed around calls to g_strdup where applicable: - g_strdup "If str is NULL it returns NULL." https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strdup Change-Id: Ie80c2db89bef531edc3aed7b7c9f654e1d654d04 Reviewed-on: https://code.wireshark.org/review/23406 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-01-12uat: add a reset callback.Dario Lombardo1-0/+1
This function will free the resources allocated by the caller. Change-Id: Ib486c14e4fd3c321662fb71f7fd06733ce9a64a4 Reviewed-on: https://code.wireshark.org/review/19375 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-08-05Add PI_DEPRECATED expert info groupJoão Valverde1-0/+1
Change-Id: Ibc43b1976d5827e8c40252a5200852fbcd00b70c Reviewed-on: https://code.wireshark.org/review/16763 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net> Reviewed-by: João Valverde <j@v6e.pt>
2016-07-21Use Windows CRT string functions in some places.Gerald Combs1-1/+3
Copy wsutil/wsprintf.h from change 16537. Update it to use functions appropriate to Visual C++ >= 2015, < 2015, and everything else. Add notes about specific API issues. Update epan/expert.c to use ws_snprintf, since the VS profiler shows it as a minor hot spot. This reduces load time for a large-ish capture from ~14s to ~12s here. Migrate a previous column-utils change. Change-Id: Id4064b7c06c35fd447b63c73f731afee181df4f9 Reviewed-on: https://code.wireshark.org/review/16483 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2016-07-20Allow BASE_NONE (with strings conversion) for integral values again.Jeff Morriss1-2/+2
This mostly reverts SVN rev 43412 (3fa645481f82e32d5ad01ebce9c482c4edae31ae) with the addition of documenting that FT_*INT*'s with BASE_NONE and a FIELDCONVERT tells the Wireshark core that the field's numeric value is meaningless and should not be shown to the user. Use BASE_NONE again with the expert info group and severity fields. This (finally) resolves the complaint from: https://www.wireshark.org/lists/wireshark-dev/201206/msg00188.html (yes, this mail's been sitting in my "todo" pile since then! <sigh>) Change-Id: I1c6dd2864e7a2e959c97c409f277853af74a8d93 Reviewed-on: https://code.wireshark.org/review/16518 Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-06-10Qt: Expert info grouping.Gerald Combs1-1/+1
Add the ability to group expert info items by summary and enable it by default. This more closely matches the GTK+ UI behavior. Show matching item counts while we're here. Bug: 12218 Change-Id: Ic02267da8435fb70015de8dd15e0ac46faabbee9 Reviewed-on: https://code.wireshark.org/review/15796 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-02-03Adds calculation of preamble length and frame duration.Simon Barber1-0/+1
Change-Id: Ie7077b675a242a60ee859098a504707cc61345db Reviewed-on: https://code.wireshark.org/review/13090 Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-01-24Add the packet number to the packet_info structure, and use it.Guy Harris1-2/+2
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>
2015-12-11Qt: Reload Lua expert infosStig Bjørlykke1-2/+38
Support reloading Lua plugins with expert infos. Use the same delayed deregister logic as for fields. Change-Id: I36efa0820050b3a7afed4de7a8b0fa16805e8dfa Reviewed-on: https://code.wireshark.org/review/12498 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>
2015-09-21Remove proto_tree_add_text API.Michael Mann1-2/+2
Its time has finally come. Technically I just renamed it to proto_tree_add_text_internal and removed the WS_DLL_PUBLIC (so it shouldn't link outside of epan). It's still (legitimately) used by expert.c otherwise I would have made it static within proto.c (and the rename wouldn't have been necessary). Change-Id: I9bdf888d5e92bc7b70a3f5461b9297a66d994b80 Reviewed-on: https://code.wireshark.org/review/10594 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Graham Bloice <graham.bloice@trihedral.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Evan Huus <eapache@gmail.com>
2015-09-08Add API to expose "expert info" summary.Michael Mann1-0/+14
This is intended for use in expert_add_info_format or proto_tree_add_expert_format to get the "base" string to then append additional information, but I'm sure other uses can be found. Similar to some of the proto_get_xxx APIs, but still only "create as needed". Change-Id: Ib76e6ed557c2ae41e0a40957a9efa4bf485909da Reviewed-on: https://code.wireshark.org/review/10420 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>
2015-09-07Add a new expert info type for decryption problems.Guy Harris1-0/+1
This is what should be used if, for some reason, decryption can't be performed. (And if there's a known reason why decryption can't be performed, it should be used, so the user knows why their 802.11/SSL/whatever traffic isn't decrypted, and either doesn't have to ask why or, at least, can give more details when they do ask why.) (Yes, I plan to use this for the 802.11 decryption code. Work in progress.) Change-Id: I812e61c2a4613d2e85f9ced1f5ed6ae91ac5f7ae Reviewed-on: https://code.wireshark.org/review/10421 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-08-21[Expert] Enhance error output to identify the duplicated field.AndersBroman1-2/+2
Change-Id: Ie38f51e2fa0f846dbcfd7a19f29eac1bd07cffbc Reviewed-on: https://code.wireshark.org/review/10179 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-11Added Reload Lua plugins.Stig Bjørlykke1-0/+5
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-05-08Expert Info dialog.Gerald Combs1-0/+1
Show all expert messages in a combined view. Group top-level items by a (severity, group, protocol) tuple. Let the user enable and disable messages via a check menu. Add ProtoTree::goToField and expert_info_t.hf_index. Use them to jump to what we hope is the afflicted item. Enable the context menu only if the user has selected a packet item. Add a free-form search field that matches expert summaries. This differs from the GTK+ version but hopefully provides a smoother workflow. Bug: 10931 Change-Id: Ia12cb7c27cdea1634fa2798fb7e4c1b23bd16ad2 Reviewed-on: https://code.wireshark.org/review/8294 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-18Make UAT record update callbacks return a success/failure indication.Guy Harris1-1/+3
Have them return TRUE on success and FALSE on failure. Check the return value rather than whether the error string pointer is null or not. Change-Id: I800a03bcd70a6bbb7b217cf7c4800e9cdcf2189c Reviewed-on: https://code.wireshark.org/review/7222 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-13UAT error string pointers should not be const pointers.Guy Harris1-1/+1
UAT error strings are usually allocated by g_strdup() or g_strdup_printf(), and must ultimately be freed by the caller. Make the pointer-to-error-string-pointer arguments to various functions be "char **", not "const char **". Fix cases that finds where a raw string was being used, as that won't work if you try to free it; g_strdup() it instead. Add a missing free of an error string. Remove some no-longer-necessary casts. Remove some unnecessary g_strdup()s (the string being handed to it was already g_malloc()ated). Change some variable declarations to match. Put in XXX comments for some cases where the error string is just freed, without being shown to the user. Change-Id: I40297746a2ef729c56763baeddbb0842386fa0d0 Reviewed-on: https://code.wireshark.org/review/6525 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-11Replace some "low hanging fruit" uses of emem.Michael Mann1-2/+2
Most of the remaining ep_ uses are grouped with specific functionality. Change-Id: I8fa64a17acc6bcdcf6891b2d28715ac0c58f1a4a Reviewed-on: https://code.wireshark.org/review/6484 Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-09-15expert.[hc] Minor changes:Bill Meier1-69/+82
- Fix a few parameter descriptions in expert.h; - Do whitespace changes; - Add editor modelines. Change-Id: I1b75fa88021f1f44bd607cd33d0ab7f9ec672ab7 Reviewed-on: https://code.wireshark.org/review/4122 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-07-26Allow severity levels of expert info items to be configured by the user.Michael Mann1-3/+154
UAT was the easiest way to do this and I like the "file format" of the data, but the presentation doesn't seem that great. Bug:10180 Change-Id: I7e6bc9e148bc47585a0a7eb8f96900a5c374e673 Reviewed-on: https://code.wireshark.org/review/3082 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-07-20va_list can't be NULL on ARM.Steev Klimaszewski1-7/+29
Bug: 10209 Change-Id: Ibd63a530450b7d2d4ec244e91c77caa731ba63aa Signed-off-by: Steev Klimaszewski <threeway@gmail.com> Signed-off-by: Balint Reczey <balint@balintreczey.hu> Reviewed-on: https://code.wireshark.org/review/2464 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-03-26Add filterable expert info for LuaHadriel Kaplan1-12/+4
This adds the ability for a Lua script to register expert info fields, similar to C-code dissectors. This change also removes the need for the expert_add_info_format_internal() function. Existing Lua scripts do not have to change, because the existing expert info function uses the internal "_ws.lua" protocol instead of nothing; but using the new functionality provides more benefits since it correctly registers the expert info fields to the dissector's protocol. The test suite was amended to generate both old and new forms. Change-Id: Ib5ae74e927cfa81312baf7b04ff4104b0b4f936e Reviewed-on: https://code.wireshark.org/review/830 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.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-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>
2013-12-22Move expert value_string body to expert.c (from expert.h)Jakub Zawadzki1-1/+25
svn path=/trunk/; revision=54354
2013-11-10Add missing includes in order to remove exceptions.h from proto.h (next commit).Jakub Zawadzki1-0/+1
svn path=/trunk/; revision=53230
2013-10-09Prefix all "Wireshark application specific" display filters with a "_ws." to ↵Michael Mann1-5/+5
distinguish them from dissector filters. This was committed now to get it into the 1.11 release so users can start getting used to the changed filter names. svn path=/trunk/; revision=52462
2013-09-08Couldn't quite figure out how to make the expert items in proto.c and the ↵Michael Mann1-2/+2
LUA API filterable (suggestions welcome!), but I wanted to start forcing dissectors to use the filterable expert API (nothing like compile errors to force change!). I created expert_add_info_format_internal (original expert_add_info_format) and used it as a placeholder for proto.c/LUA API until a solution is created. The "new" expert_add_info_format will be the "old" expert_add_info_format_text, and I'll slowly do the search/replace. For those with dissectors outside the source tree, please see tools/convert_expert_add_info_format.pl for help with the conversion. Please do not use expert_add_info_format_internal, as it's support time will be very short lived. svn path=/trunk/; revision=51844
2013-09-01Remove expert_add_undecoded_item in favor of proto_tree_add_expert.Michael Mann1-13/+0
svn path=/trunk/; revision=51632
2013-08-05Completely remove support for proto_item_set_expert_flags.Michael Mann1-3/+11
svn path=/trunk/; revision=51144
2013-07-06Remove unused data structures from new expert code. Cleans up another ~17KBEvan Huus1-29/+1
of leaks, and I suspect they won't be necessary (we can always add them back using wmem if they do turn out to be needed). svn path=/trunk/; revision=50409
2013-07-06Allocate expert protocol structs with wmem, cleans up a few KB of leaks inEvan Huus1-1/+2
epan_cleanup(). svn path=/trunk/; revision=50406
2013-07-05Fix the use of va_args in the new expert code. Passing a va_list to a ... isEvan Huus1-1/+5
valid, but doesn't do what you actually want most of the time. svn path=/trunk/; revision=50392
2013-07-02Differentiate "Disabled" from "Unknown" and provide macros for the ↵Michael Mann1-4/+4
enumerated values. svn path=/trunk/; revision=50323
2013-07-02Add proto_tree_add_expert and proto_tree_add_expert_format. This was added ↵Michael Mann1-2/+44
to expert.h instead of proto.h because the underlying code to process expert info is static (and should probably remain so). Also, proto_tree_add_expert and proto_tree_add_expert_format follow "expert info" rules in that they should be called regardless of tree status (even though they take a tree as an argument), unlike the functions in proto.h Also added an enumeration for checksum validation status, as verifying checksums is considered "expert" functionality. svn path=/trunk/; revision=50322
2013-07-02Cache the malformed filter instead of looking it up each time a malformed ↵Michael Mann1-1/+4
packet comes in. This drastically speeds up the load time of captures with lots of malformed packets (ie fuzztesting). svn path=/trunk/; revision=50313
2013-06-20inform expert info layer about the current number of packet commentsMartin Kaiser1-0/+7
when the last comment is removed and we have no other expert info, the maximum severity is changed from comment to none svn path=/trunk/; revision=50091
2013-05-24Ensure most severe is displayed in expert column. Bug 7733 ↵Michael Mann1-1/+4
(https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7733) #BACKPORT svn path=/trunk/; revision=49565
2013-05-24expert_add_info(): we can't use va_start()/va_end() so don't try to use a ↵Jeff Morriss1-3/+1
va_list (which isn't used by the called function) either. svn path=/trunk/; revision=49564
2013-05-24expert_add_info() doesn't take a variable number of args; don't use ↵Jeff Morriss1-4/+2
va_start()/va_end(). svn path=/trunk/; revision=49563
2013-05-24Add expert info configuration framework. Bug 2412 ↵Michael Mann1-7/+194
(https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2412). Expert info "fields" can now be registered/addressed by name. Right now, the basic framework allows expert info fields to become "display filters". However more could be done, like user preferences overriding default severity level, speeding up expert info dialog load time by not needing to redissect a file, etc. Long term goal is to have all expert_info filterable and have the functionality of expert_add_info_format() include the "registered index". expert_add_info_format_text() is the workaround until all current calls to expert_add_info_format() have been updated with either expert_add_info() or expert_add_info_format_text(). Then the remaining expert_add_info_format_text() will be renamed to expert_add_info_format(). svn path=/trunk/; revision=49559
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
2013-03-02Move expert_group_vals expert_severity_vals constant definitions to expert.hBalint Reczey1-25/+0
svn path=/trunk/; revision=47995
2012-09-20We always HAVE_CONFIG_H so don't bother checking whether we have it or not.Jeff Morriss1-3/+1
svn path=/trunk/; revision=45016
2012-08-10Add a missing NULL check pointed out by Jakub.Gerald Combs1-1/+1
svn path=/trunk/; revision=44437
2012-08-10Make the corresponding packet_info available to each tree item. ThisGerald Combs1-2/+5
lets us pass a NULL pinfo to expert_add_info_format() and expert_add_undecoded_item(), which makes it possible to use those routines deep in the bowels of many dissectors. As a proof of concept remove the recent pinfo additions to packet-afp.c. This should also make it easier to fix bug 3884. svn path=/trunk/; revision=44435
2012-06-28Update Free Software Foundation address.Jakub Zawadzki1-1/+1
(COPYING will be updated in next commit) svn path=/trunk/; revision=43536
2012-06-27Fix compiler warning: "format not a string literal and no format arguments"Bill Meier1-2/+2
svn path=/trunk/; revision=43509
2012-06-27Don't show (essentially meaningless) numeric values of the expert codes.Bill Meier1-2/+5
svn path=/trunk/; revision=43508
2012-06-26Display expert codes in hexadecimal (less painful for my eyes :))Pascal Quantin1-2/+2
svn path=/trunk/; revision=43497