aboutsummaryrefslogtreecommitdiffstats
path: root/ui/gtk/uat_gui.c
AgeCommit message (Collapse)AuthorFilesLines
2017-12-08Have the frame_tvbuff.c routines not use the global cfile.Guy Harris1-0/+2
Have the routines that create them take a pointer to a struct packet_provider_data, store that in the tvbuff data, and use it to get the wtap from which packets are being read. While we're at it, don't include globals.h in any header files, and include it in source files iff the source file actually uses cfile. Add whatever includes that requires. Change-Id: I9f1ee391f951dc427ff62c80f67aa4877a37c229 Reviewed-on: https://code.wireshark.org/review/24733 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-08-07Use UAT model for I/O graphMichael Mann1-0/+2
Convert from using TreeWidgetItems to UAT model/delegate. More of the GUI is "just handled" within the table. Required to add support for "colors" and "protocol fields" to UAT types. Also needed to add some hacks for "custom" UAT field handlers for backwards compatibility with the existing UAT structure used. Because UAT functionality was switched completely to the model, some information in the table was "lost in translation" because the UATs themselves aren't translated to other languages. TODO: 2. Better "order of operations"? A bunch of NULL/size checks needed to be added to prevent crashing. Now with model/"view" should events/functions be reordered? Bug: 13585 Change-Id: I2bbba78182317c4fada07b927c05d0c6f4cdc0fe Reviewed-on: https://code.wireshark.org/review/22766 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>
2017-06-26Convert filter expressions preference data to a UAT.Michael Mann1-0/+4
The filter expressions data was shoved into the preference file in a very loose, non-arrayed form. It's much easier to manage in code (and for users in a separate file) as a UAT. The GTK GUI was hacked to use the existing UAT dialog rather than rewrite the pref_filter_expressions.c to support a UAT. Should be okay since it's deprecated. Change-Id: I688cebb4b7b6594878c1398365e79a205f1902d9 Ping-Bug: 13814 Reviewed-on: https://code.wireshark.org/review/22354 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>
2017-05-16sharkd: export uat records.Jakub Zawadzki1-42/+4
Move gtk's fld_tostr() to epan API as uat_fld_tostr. Change-Id: I01e3b66ca9ea3cd1e2e06e2122190ee42b9ad44b Reviewed-on: https://code.wireshark.org/review/21664 Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-04-08Clean up handling of enabled/disabled protocols/heuristic dissectors.Guy Harris1-1/+1
Add a "report a warning message" routine to the "report_err" code in libwsutil, and rename files and routines appropriately, as they don't only handle errors any more. Have a routine read_enabled_and_disabled_protos() that reads all the files that enable or disable protocols or heuristic dissectors, enables and disables them based on the contents of those files, and reports errors itself (as warnings) using the new "report a warning message" routine. Fix that error reporting to report separately on the disabled protocols, enabled protocols, and heuristic dissectors files. Have a routine to set up the enabled and disabled protocols and heuristic dissectors from the command-line arguments, so it's done the same way in all programs. If we try to enable or disable an unknown heuristic dissector via a command-line argument, report an error. Update a bunch of comments. Update the name of disabled_protos_cleanup(), as it cleans up information for disabled *and* enabled protocols and for heuristic dissectors. Support the command-line flags to enable and disable protocols and heuristic dissectors in tfshark. Change-Id: I9b8bd29947cccdf6dc34a0540b5509ef941391df Reviewed-on: https://code.wireshark.org/review/20966 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-02-20Yell at the user less.Gerald Combs1-1/+1
Our user-facing messages should have a helpful (or at the very least neutral) tone. In English, exclamation points are neither. Replace a bunch of them with periods. Change-Id: I29c3b2f84c25e06aae5b559860224559053a0378 Reviewed-on: https://code.wireshark.org/review/20189 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-08-28UAT gtk-ui, Qt-ui: Fixed copying records when no cp callback is definedMichał Skalski1-0/+4
According to documentation of uat_copy_cb_t, if uat->copy_cb is NULL, memcpy() should be used. This affected IKEv1 and IKEv2 UAT tables (possibly others). Change-Id: I27ebdc08385d260945699f101e714d3abb288b22 Reviewed-on: https://code.wireshark.org/review/17245 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-12-31uat: Fix warnings [-Wcast-qual]João Valverde1-2/+2
uat_fld_tostr_cb_t callback *out_ptr argument is g_mallocated and is to be freed by the caller so drop constness requirement to fix the corresponding g_free warnings. Change-Id: I1be25fa3e2f54fb32058ac0b5c1631b193b07701 Reviewed-on: https://code.wireshark.org/review/12943 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-07Spelling fixes for errors found by lintianBalint Reczey1-1/+1
Change-Id: I889283902875193f4d3f3fd59788f59f8d9bcc20 Reviewed-on: https://code.wireshark.org/review/11945 Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-18Make UAT record update callbacks return a success/failure indication.Guy Harris1-3/+1
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-02-15Fix handling of invalid UAT itemsPeter Wu1-0/+2
If the UAT file failed a field check, then the user_data pointer may be empty. As a result uat_save() triggers an invalid write. (Discovered while working with a dfilter_macros file having duplicate names for bug 10957, caught by ASAN.) The second issue fixed in this patch is that the validity of an item is only calculated when a new record is added. So even if the user edits the UAT and makes the entry valid, it would not be saved. This is solved by adding a new uat_update_record() function which got wires up into GTK and Qt. Some open-coded g_array_index and UAT[_USER]_INDEX_PTR are also converted. Even after this patch, Qt has some issues with UAT handling. In particular, it saves new, but empty/invalid, items. It also it does not check individual fields when saving all fields (unlike Gtk). This patch focused on getting Gtk fixed first so ignores those existing issues. Change-Id: Ia35cfe9d2b793c65144ae7e29a1ed706b6668d99 Reviewed-on: https://code.wireshark.org/review/7120 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-15ui/gtk/*.c: Add editor modelines; As needed: Fix indentationBill Meier1-0/+13
Change-Id: I8cd9d9fe5f12c284f46b8f725766f681faccd753 Reviewed-on: https://code.wireshark.org/review/7138 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-01-18Remove some apparently-unnecessary includes of emem.h.Guy Harris1-1/+0
Also update a comment to no longer speak of ep_ allocation, and add an include of <glib.h> to ui/profile.c, which was formerly relying on the include of emem.h to drag it in. Change-Id: I08926699ee96cf66672836b6ee3bbb405b507ce8 Reviewed-on: https://code.wireshark.org/review/6633 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-13uat_load() and uat_save() return a success indication; use it.Guy Harris1-11/+6
Instead of always ignoring the return value, always check it, and only report an error if it returns FALSE. (Alternative: have it return NULL on success and a pointer to a g_malloc()ed string on failure.) Fix a comment while we're at it. Change-Id: Icb72c9f47775b6552e3eb4fe5ddcc85482bfb5fb Reviewed-on: https://code.wireshark.org/review/6528 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-13UAT error string pointers should not be const pointers.Guy Harris1-2/+2
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-12Remove emem APIs from UAT functionality.Michael Mann1-34/+57
Change-Id: I009c09f25d170e5c9aaaef713eaacb3252817856 Reviewed-on: https://code.wireshark.org/review/6460 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Evan Huus <eapache@gmail.com> Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-01Remove unneeded includes from ui folderMartin Mathieson1-2/+0
Change-Id: Ifd1eebff9080cd3867e44e4dcb2d2681370ed60a Reviewed-on: https://code.wireshark.org/review/6128 Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-11-10Improved deregistering fields.Stig Bjørlykke1-1/+1
This improvement avoids use of deallocated memory (crash) if using a deregistered field in display filter, color filter, custom column and other cases when the field is used as "interesting field". This functionality is currently used in http, imf and ldap preferences. Also removed unused proto_registrar_n() as this does not work correctly after deregistering fields. Change-Id: I043e3bf7a98bd773c9801e712a012d1eab8a7f94 Reviewed-on: https://code.wireshark.org/review/5161 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-09-03Work around an apparent bug in GtkFileChooserButton.Gerald Combs1-0/+12
It looks like some versions of GTK+ intialize GtkFileChooserButton with a location set to NULL and crash when you select an item from the dropdown menu. Make sure we have a valid location set in that case. Change-Id: If2556ef939b95d8af12581a7116a48fb46586f57 Bug: 10434 Reviewed-on: https://code.wireshark.org/review/3977 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-07-03Rename and move ui/stat_menu.h to epan/stat_groups.h.Guy Harris1-1/+1
The groups are, technically, independent of the notion of a menu, and, if we have mechanisms by which taps that are not only GUI toolkit-independent but independent of the *existence* of a GUI can be registered, they might want to register themselves in a group just in case they're running in a program that has a GUI. Also, this might fix the Debian package build. Change-Id: I29435681e79748fd4f2e0c5ac872cd11f831d172 Reviewed-on: https://code.wireshark.org/review/2830 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-30Move stat_menu.h to libui.Guy Harris1-1/+1
Change-Id: I7bed7f7931845bc41035535cc62e1fe17c71047d Reviewed-on: https://code.wireshark.org/review/2726 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-03-31Continue to remove $Id$ from top of fileAlexis La Goutte1-2/+0
(Using sed : sed -i '/^ \* \$Id\$/,+1 d') (Double space between star and $Id$) Change-Id: If9b8f345e3b6493de0b573600e60005c8b0b33c3 Reviewed-on: https://code.wireshark.org/review/877 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-11Migrate GTK icon handling to GTK 3.10 APIBalint Reczey1-8/+8
GtkStockItem usage is deprecated with all the GTK_STOCK_.* stock ids. We keep a stock id based approach but without relying on GTK's GtkStockItem system. We create our own internal stock ids for {icon, label} tuples and keep the original GTK stock id #define-s and values to preserve backward compatibility. Change-Id: Ia0b35a5903f079e92c8026e3df21bbf0be2d06b0 Reviewed-on: https://code.wireshark.org/review/302 Reviewed-by: Gerald Combs <gerald@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2013-12-14Fix const warnings.Jakub Zawadzki1-2/+2
svn path=/trunk/; revision=54092
2013-12-10Use PT_TXTMOD_NONE for columns that should not be editable.Irene Rüngeler1-1/+7
svn path=/trunk/; revision=53906
2013-11-17Move the epan/filesystem.c routines to wsutil; they're not specific toGuy Harris1-1/+1
packet dissection, they're specific to the entire Wireshark suite of programs. svn path=/trunk/; revision=53377
2013-10-25Add a very small hack to make the UAT update callback error string freeable, andEvan Huus1-1/+7
convert all existing UAT update callbacks to use glib memory instead of ephemeral memory for that string. UAT code paths are entirely distinct from packet dissection, so using ephemeral memory was the wrong choice, because there was no guarantees about when it would be freed. The move away from emem still needs to be propogated deeper into the UAT code itself at some point. Net effect: remove another bunch of emem calls from dissectors, where replacing with wmem would have caused assertions. svn path=/trunk/; revision=52854
2013-10-19Only allow one popup dialog in UAT dialog. Editing/copying/deleting can ↵Michael Mann1-36/+60
modify the uat list and other open dialogs will not be aware of it and lead to unexpected behavior (including crashes). Fixes bug 9129 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9129) #BACKPORT(1.10) svn path=/trunk/; revision=52683
2013-10-04in a uat dialogue, allow only one popup for confirming a deletion of anMartin Kaiser1-25/+36
element this should at least partially fix bug 9129 svn path=/trunk/; revision=52357
2013-07-15Move report_err.{h,c} from epan into wsutil: there's nothing epan-specific ↵Jeff Morriss1-1/+2
there and moving it avoids having to recompile the file for use in editcap and capinfos (which don't link against libwireshark). svn path=/trunk/; revision=50598
2013-04-22Add a "hidden" array of UAT entry data to allow separation between UAT file ↵Michael Mann1-6/+6
syntax errors and "syntactically correct, but invalid field". Now UAT files load all entries into the "hidden" array (raw_data), but only adds valid ones to the user_data, which is used by the dissectors. This is a start to fixing bug 7471 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7471) and is being committed to get the new ABI/API in before the 1.10 release. What remains is the "GUI portion" (GTK+qt) to indicate to users which UAT entries are invalid. svn path=/trunk/; revision=48960
2013-04-17Use also const char to uat_save (identical to uat_load)Alexis La Goutte1-2/+2
svn path=/trunk/; revision=48902
2013-03-24Redissect extra packet windows in all cases (that I know of) where weEvan Huus1-0/+2
redissect normal packet list. Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8482 svn path=/trunk/; revision=48528
2013-03-21From beroset:Bill Meier1-41/+41
remove C++ incompatibilities https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 attachment #10404 Note: The following parts of the patch had been previously done: asn1/snmp/packet-snmp-template.c epan/dissectors/packet-snmp.c epan/dissectors/packet-x11.c Also; hostlist_table.c: code under '#ifdef HAVE_GEOIP' didn't compile and needed a few additional patches. svn path=/trunk/; revision=48447
2013-02-08Constify the second argument to uat_load(), to squelch some warnings.Guy Harris1-2/+2
svn path=/trunk/; revision=47560
2013-01-24Use ws_gtk_grid...() in place of gtk_table...();Bill Meier1-205/+207
Also: minor cleanup: - use gtk_window_set_default_size() iso gtk_window_resize(); - change grid row numbers to start at 0 (not 1); - fix some formatting/whitespace. svn path=/trunk/; revision=47260
2013-01-04replace "unsigned" datatype with "guint". Some mpeg files needed "unsigned ↵Michael Mann1-3/+3
int" instead. bugs 7825-7827 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7825) svn path=/trunk/; revision=46928
2012-11-18Enhance error output.Anders Broman1-1/+1
svn path=/trunk/; revision=46076
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-09-18Move the UI-independent help URL code to ui/help_url.[ch].Gerald Combs1-21/+29
svn path=/trunk/; revision=44987
2012-09-04- Replace packet_list_recreate_visible_rows -> ↵Jörg Mayer1-1/+1
packet_list_recreate_visible_rows_list - Replace new_packet_list_ -> packet_list_ svn path=/trunk/; revision=44765
2012-09-04Rename new_packet_list.[ch] to packet_list.[ch]Jörg Mayer1-1/+1
svn path=/trunk/; revision=44764
2012-07-20Fix bug #7377 for:Jakub Zawadzki1-1/+1
- UAT - Packet in new window - Supported protocols dialog. svn path=/trunk/; revision=43861
2012-07-08UATs could be put into "categories". The categories were defined onlyGuy Harris1-3/+8
implicitly by the #define name and string they were defined to; not all UATs neatly fit into any of the categories, so some of them were put into categories that weren't obviously correct for them, and one - the display filter macro UAT - wasn't put into any category at all (which caused crashes when editing them, as the GUI code that handled UAT changes from a dialog assumed the category field was non-null). The category was, in practice, used only to decide, in the aforementioned GUI code, whether the packet summary pane needed to be updated or not. It also offered no option of "don't update the packet summary pane *and* don't redissect anything", which is what would be appropriate for the display filter macro UAT. Replace the category with a set of fields indicating what the UAT affects; we currently offer "dissection", which applies to most UATs (any UAT in libwireshark presumably affects dissection at a minimum) and "the set of named fields that exist". Changing any UAT that affects dissection requires a redissection; changing any UAT that affects the set of named fields that exist requires a redissection *and* rebuilding the packet summary pane. Perhaps we also need "filtering", so that if you change a display filter macro, we re-filter, in case the display is currently filtered with a display filter that uses a macro that changed. svn path=/trunk/; revision=43603
2012-07-07From Evan Huus:Guy Harris1-1/+1
There is no guarantee that uat->category is non-null, so check whether it's null before checking whether it's UAT_CAT_FIELDS or not. Fixes bug 7444. #BACKPORT svn path=/trunk/; revision=43602
2012-06-28Update Free Software Foundation address.Jakub Zawadzki1-1/+1
(COPYING will be updated in next commit) svn path=/trunk/; revision=43536
2012-04-21More GTK3 adaptationsAnders Broman1-3/+3
svn path=/trunk/; revision=42187
2012-04-21Replace gtk_vbox_new() and gtk_hbox_new() with ws_gtk_box_new().Anders Broman1-6/+6
svn path=/trunk/; revision=42176
2012-03-30Recreate the packet list when changing UAT for header fields.Stig Bjørlykke1-3/+13
This fixes a crash when changing settings for fields used as a custom column. svn path=/trunk/; revision=41840
2012-01-15Move gtk to ui/gtk.Jörg Mayer1-0/+1078
This looses the last checkin to gtk, will add this manually back. svn path=/trunk/; revision=40518