aboutsummaryrefslogtreecommitdiffstats
path: root/epan/column-utils.c
AgeCommit message (Collapse)AuthorFilesLines
2015-11-07column-utils: Refactor col_append_port() to col_append_ports()João Valverde1-6/+17
Having a single function call to format source-destination port column info serves the current (and presently only) use case better by having a single place to manage the display format. This commit does not introduce any actual formatting changes. Change-Id: I1d479d0fd5690d12afb47e538057fdc2dd369ca2 Reviewed-on: https://code.wireshark.org/review/11539 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-10-11Remove duplicate transport ports from proto tree summaryJoão Valverde1-1/+16
Don't display duplicate ports if transport name resolution is not enabled (for UDP/TCP/DCCP). Also introduce col_append_port() to handle info column port display with name resolution in a uniform format. Change-Id: Icb8ac45f726b7c539b4534c62061473e9b582753 Reviewed-on: https://code.wireshark.org/review/10804 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-10-05UDP: Make port column info similar to TCP, add length informationJoão Valverde1-0/+9
Change-Id: I3f7a35db53a1ecc9d543b80f143eb6082616e458 Reviewed-on: https://code.wireshark.org/review/10702 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Evan Huus <eapache@gmail.com>
2015-08-28Speed up column sorting.Gerald Combs1-2/+6
The GTK+ UI sequentially dissects and caches column strings for all rows before sorting a column. Do the same in the Qt UI, which can improve performance considerably. Don't colorize packets when sorting in the Qt UI unless it's necessary. When sorting in the Qt UI, let the user cancel the initial packet dissection. Note that we'll need to replace std::sort in order to cancel out of sorting. Use a pre-allocated and pre-compiled GRexex when we prime columns. Note that we probably shouldn't parse a regular expression there. Cache the last result of proto_registrar_get_byname. Note performance hot spots elsewhere in the code. To do: GeoIP in packet-ip.c is pretty slow. Bug: 11467 Change-Id: Ib34038fee08ef0319261faeffc4eca01e52f4bd3 Reviewed-on: https://code.wireshark.org/review/10275 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-07-03Fix address resolution for columns.Guy Harris1-1/+1
Have address_to_name() be a routine that takes an address and returns a string with a "sufficiently long" lifetime for use in columns, using the address type's addr_name_res_str routine for most address types, rather than having a too-small set of address types wired into it. It replaces both the internal solve_address_to_name() routine and get_addr_name(), and can, for example, handle the special WLAN address types rather than leaving them unresolved even with an ethers file. Change-Id: Id09bc412adf5d2752155650a14a77c5378af2e42 Reviewed-on: https://code.wireshark.org/review/9475 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-06-29Don't free col_item->col_data.Gerald Combs1-1/+1
It either points to col_item->col_buf (which we explicitly free) or to a static string. Change-Id: I4d6db3fa16e69a4321be9d01076026c024df9a00 Reviewed-on: https://code.wireshark.org/review/9219 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-06-29Take all epan_column_info members that always get allocated to "number of ↵Michael Mann1-216/+235
columns" to share their own data structure. Change-Id: Ib982662db6cf68730a7d121eac60d9bc5ae67429 Reviewed-on: https://code.wireshark.org/review/9195 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Anders Broman <a.broman58@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-09Eliminate the hf member out of the address structure.Michael Mann1-12/+0
Using the new address type registration, dissectors can create their own address types with their own (column) filters attached to them, eliminating the need for an address to keep track of a hf_ field. Change-Id: I2bbec256a056f403a7ac9880d5d76a0b2a21b221 Ping-Bug: 7728 Reviewed-on: https://code.wireshark.org/review/7037 Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-09Add "column filter string" support to address types.Michael Mann1-59/+5
Information about dissector (filter) fields should be kept in a dissector as much as possible. Supporting "column filter string" also allows other dissectors to create their own "address types" with different column filters (because AT_ETHER isn't always an "Ethernet" address). This feature also allowed a few "dissector specific" address types to be moved to their own dissector. Change-Id: Ie9024af4db62bc2ee4f8c9d28a1d807f706f45bf Ping-Bug:7728 Reviewed-on: https://code.wireshark.org/review/7029 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-09Add address type registration.Michael Mann1-1/+0
Now address types are setup just like field types and must be registered with a structure that provides its string representation (and more things in the future). Address types that are limited to a single dissector are registered by the dissector. More "common" ones are globally registered. There are still a few that really belong in a dissector, but have other dependencies currently not accounted for in the address type support. Many of the "address to string" conversions that involved g_sprintf have be changed to use more "performance friendly" methods (some at the cost of needing to_str-int.h) Leaving all comments regarding this "solution" in address_to_str.c in until all have been implemented Change-Id: I494f413e016b22859c44675def11135f228796e0 Reviewed-on: https://code.wireshark.org/review/7019 Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-18Remove some apparently-unnecessary includes of emem.h.Guy Harris1-1/+0
Change-Id: Id50ce3e707056cca8f30052f05c451ce431b39b5 Reviewed-on: https://code.wireshark.org/review/6632 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-11Replace some "low hanging fruit" uses of emem.Michael Mann1-4/+0
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>
2015-01-09disperse atalk-utils.[ch]Michael Mann1-1/+0
The functionality was suiting for address_to_str.c and the #defines belong in packet-atalk.h. Kept the address structure with the "address string conversion", but that can probably be better cleaned up when the address to str as a whole is cleaned up. Would also consider making AT_ATALK an FT_ type as well. Change-Id: Ia534096c707e6fb94acdfee0d332beda6571c371 Reviewed-on: https://code.wireshark.org/review/6417 Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-08ep_<protocol>_port_to_display -> <protocol>_port_to_displayMichael Mann1-3/+3
Adjust any other ep_ related APIs related to the transition. Change-Id: I961b371c2c4bda557e0f1817705c27eef0dae66c Reviewed-on: https://code.wireshark.org/review/6388 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-12-31Column utils: Missing varargs init or cleanup (CID 1212122)Alexis La Goutte1-0/+1
Change-Id: I013c737c2cd62e3f1f49b113a7ce0c0616e1ecc4 Reviewed-on: https://code.wireshark.org/review/6119 Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-21Replace ax25_to_str and get_ax25_name with address_to_str.Michael Mann1-1/+1
Change-Id: I74ddb6fc629ef32b217dede7a3ba652cbbf5ab12 Reviewed-on: https://code.wireshark.org/review/5932 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-20Fix filter test for multifield custom columnStig Bjørlykke1-1/+1
This adds support for "field||field" without spaces. Change-Id: Ia738d6642d12a188d1629bbdd9701cc8f8bb7a68 Reviewed-on: https://code.wireshark.org/review/5922 Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com> Tested-by: Michal Labedzki <michal.labedzki@tieto.com>
2014-12-20Fix filter valid/invalid test for multifield custom typeMichal Labedzki1-17/+20
Check for "or" or "||" (also ignore whitespaces) and check both arguments of this operator to be fieldname (character check), then check whole filter is valid for dfilter compiler. Change-Id: I412b5dc1fca16fcd2b640aa74af81167300fd11e Reviewed-on: https://code.wireshark.org/review/5848 Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Tested-by: Michal Labedzki <michal.labedzki@tieto.com> Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
2014-12-20Don't use g_slist_free_full().Guy Harris1-8/+14
It's only in GLib 2.28 or later, but we don't require 2.28. Instead, have col_custom_field_ids_free() do what g_slist_free_full() does - and more. Change-Id: I15768cfd2d26c847470b02ea6c51830dabcaa7ee Reviewed-on: https://code.wireshark.org/review/5894 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-18Add support for multifields in custom columnMichal Labedzki1-8/+43
You can now add column with Custom type with more than one field by using OR "||" splitter. Bug: 9695 Change-Id: Ia82a91e7a35b867647d36cb9626e3870f46c0d85 Reviewed-on: https://code.wireshark.org/review/5804 Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
2014-12-05Get rid of a trailing blank.Guy Harris1-1/+1
Change-Id: I0cf6d04f5075ba1f064c40f4b39b32b6976b54c7 Reviewed-on: https://code.wireshark.org/review/5633 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-05Fix varargs handling in col_{add,append}_lstr().Guy Harris1-4/+8
We do multiple va_start() calls using the first string in the list of strings; do *not* use the first-string argument to iterate over all the argument strings, as that means that only the first va_start() call will do the right thing, use a separate variable. Bug: 10755 Change-Id: Ic4a6c24f911e335d147883a25d30289628836875 Reviewed-on: https://code.wireshark.org/review/5630 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-10Fixed memory leakage in col_cleanup.Stig Bjørlykke1-0/+12
Several fields in cinfo is allocated memory and must be freed here to avoid memory leakage when recreating the packet list. Do not allocate memory for col_expr[] as this points to static strings or other allocated strings. Change-Id: I840377e3c590b1a3e2a38e0537465a028041d1e9 Reviewed-on: https://code.wireshark.org/review/5137 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-09-28Make the time stamp resolution per-packet.Guy Harris1-89/+206
Pcap-ng files don't have a per-file time stamp resolution, they have a per-interface time stamp resolution. Add new time stamp resolution types of "unknown" and "per-packet", add the time stamp resolution to struct wtap_pkthdr, have the libwiretap core initialize it to the per-file time stamp resolution, and have pcap-ng do the same thing with the resolution that it does with the packet encapsulation. Get rid of the TS_PREC_AUTO_XXX values; just have TS_PREC_AUTO, which means "use the packet's resolution to determine how many significant digits to display". Rename all the WTAP_FILE_TSPREC_XXX values to WTAP_TSPREC_XXX, as they're also used for per-packet values. Change-Id: If9fd8f799b19836a5104aaa0870a951498886c69 Reviewed-on: https://code.wireshark.org/review/4349 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-23Add col_append_lstr(), speedup column generation for TCP.Jakub Zawadzki1-0/+39
When dissecting with columns TCP dissector spends around 1/4 time in col_append_fstr(), add col_append_lstr() and do formatting by ourselves. Change-Id: If90bc26242761884b4991e8db0db62c8f9e32690 Reviewed-on: https://code.wireshark.org/review/2527 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-17Use gsize rather than int, to avoid some complaints about shortening.Guy Harris1-2/+2
Change-Id: Ic673525a05cd106677226a4063af825d0f22c97c Reviewed-on: https://code.wireshark.org/review/1677 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-17Introduce col_add_lstr(), use it instead of slower col_add_fstr.Jakub Zawadzki1-1/+47
We have callgrind benchmarks which shows that col_add_fstr() takes 5% of Ir count cause of formatting done in g_vsnprintf(). New col_add_lstr() can be used in few dissectors without much ugliness, and it should be a little faster. Change-Id: Ifddd951063dfd3a27c2a7da4dafce9b242c0472c Reviewed-on: https://code.wireshark.org/review/1629 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-06Add a cast to make MSVC happy.AndersBroman1-1/+1
Change-Id: Iee901ae56c796007821c1754056c61954e8a342f Reviewed-on: https://code.wireshark.org/review/1526 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-06Move common part of col_append_fstr, col_append_sep_fstr to seperate fnction.Jakub Zawadzki1-51/+36
From the comments I think it was intended - but there were no G_VA_COPY macro in glib (?). Change-Id: Ic1e1d4a5ac9e5b8f27f25487416c0ededeed2093 Reviewed-on: https://code.wireshark.org/review/1518 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-05Fix possible buffer overflow in col_append_sep_fstr()Jakub Zawadzki1-3/+5
After appending separator it might happen that len > max_len, in such case g_vsnprintf() will overflow the col_buf buffer. Change-Id: Ic5ff49d30e30509e835165c4cc7e72e31f92fd5f Reviewed-on: https://code.wireshark.org/review/1493 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-19More name changes.Guy Harris1-3/+3
Add ep_ to routines that may return ephemeral strings. Change "get_XXX" to "XXX_to_display" if the routine returns a formatted string if it can't get a name. Change-Id: Ia0e82784349752cf4285bf82788316c9588fdd88 Reviewed-on: https://code.wireshark.org/review/1217 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-04-19Some routine name changes.Guy Harris1-1/+1
"get_addr_name()" -> "ep_address_to_display()", to 1) indicate that it returns a string with ephemeral scope and 2) indicate that it maps an address to a "displayable" form - a name if possible, an address string if not. "se_get_addr_name()" -> "get_addr_name()", to indicate that its strings have the same scope as "get_ether_name()", "get_hostname()", and "get_hostname6()". Change-Id: If2ab776395c7a4a163fef031d92b7757b5d23838 Reviewed-on: https://code.wireshark.org/review/1216 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-04-19Don't se_ allocate strings when mapping addresses to column strings.Guy Harris1-4/+8
This should significantly reduce memory usage, without increasing the CPU time required to process a capture file in TShark or Wireshark. As a result, se_address_to_str() is no longer used; eliminate it. Fixes bug #9949. Change-Id: I65a112a426c82cc73a957b81384c765c3d14f2c3 Reviewed-on: https://code.wireshark.org/review/1213 Reviewed-by: Evan Huus <eapache@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-01-14Don't cast away constness.Guy Harris1-2/+2
svn path=/trunk/; revision=54797
2014-01-06Expand a comment.Guy Harris1-2/+2
svn path=/trunk/; revision=54622
2014-01-06In col_fill_in() and col_fill_in_error(), use col_based_on_frame_data()Guy Harris1-105/+73
to determine whether to fill in the column from frame data or not. svn path=/trunk/; revision=54621
2013-12-18Added col_clear_fence().Stig Bjørlykke1-0/+16
svn path=/trunk/; revision=54220
2013-12-03Dissectors should not use dfilter.h, don't include it.Jakub Zawadzki1-1/+1
XXX ncp2222 dissector is using dfilter_compile(), why? svn path=/trunk/; revision=53766
2013-11-09Remove #if 0 code (introduced in r29489).Jakub Zawadzki1-285/+0
svn path=/trunk/; revision=53181
2013-11-06Add support for displaying dates as year and day-of-year (1-origin).Guy Harris1-36/+183
In the process, fix various man page descriptions of the -t flag, and add support for UTC absolute times in the iousers and iostat TShark taps. svn path=/trunk/; revision=53114
2013-10-27Remove "Cisco MDS-specific" fields from packet_info. 2 of the 3 fields were ↵Michael Mann1-8/+3
used strictly for columns that are considered "deprecated" and I think the third could be put in that category as well. I assume the column enumerations haven't already been removed because of legacy "indexing issues", but if I'm wrong, we should definitely remove the columns altogether. Could also see renaming columns to DEPRECATED_[X]. svn path=/trunk/; revision=52910
2013-10-18After looking for something in the column-*.h files andJörg Mayer1-1/+1
not finding it, I finally found it in column_info.h Renamed column_info.h to column-info.h to have consistency with the column*h files. svn path=/trunk/; revision=52667
2013-10-01FINALLY remove the check_col API so that reviewers won't have to mention ↵Michael Mann1-6/+0
that it's deprecated. Now it just won't compile if its included in a dissector. svn path=/trunk/; revision=52317
2013-09-13Explicitly include emem.h where it is neededJörg Mayer1-0/+1
svn path=/trunk/; revision=51997
2013-08-01Move a bunch of the crypt modules and pint.h into wsutil.Jeff Morriss1-1/+1
This means wsutil now links against libcrypt. Protect a bunch of the crypt header files from multiple inclusion. svn path=/trunk/; revision=51100
2013-07-21Replace relative timestamp with reference frame number. Saves 16B per frame.Jakub Zawadzki1-5/+14
svn path=/trunk/; revision=50772
2013-07-21Add helper function to epan_session which can be used to get absolute ↵Jakub Zawadzki1-6/+7
timestamp of given frame. Remove ->prev_cap, for testing purpose also replace ->prev_dis with number of previously displayed frame number. This patch reduce size of frame_data by 8B (amd64) This is what (I think) was suggested by Guy in comment 13 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5821#c13) svn path=/trunk/; revision=50765
2013-07-16This should fix warning: to be safe all intermediate pointers in cast from ↵Chris Maynard1-2/+2
'gchar **' to 'const char **' must be 'const' qualified. svn path=/trunk/; revision=50655
2013-06-25Indentation/Whitespace cleanup;Bill Meier1-635/+642
Add editor modelines. svn path=/trunk/; revision=50146