Commit Graph

71 Commits

Author SHA1 Message Date
João Valverde c1cede8d7c epan: Format column string input for display.
Format the input for display, by escaping some non printable characters,
using ws_label_strcpy().

In some cases with vsnprintf() this requires using a temporary buffer.

Add some debug checks for invalid UTF-8 errors.

The intention here is to pass dissection data directly to the column
API, and the column functions are responsible for formatting that
data for display. This avoids having to call format_text() before
adding a string to a column and separates the concerns better.
Display formatting is an UI concern.
2022-10-26 13:28:19 +01:00
John Thacker c7a136a5c0 epan: Rearrange column includes
Move all the declarations of routines that are internal and
not for use by dissectors from column-utils.h column-info.h
Move the column max length defines into column-utils.h because
dissectors might need that

Since packet.h already includes column-utils.h, dissectors don't
need to include column-utils.h anymore.
Remove or downgrade a few other column header includes that are
unnecessary.
2022-08-13 19:37:28 +00:00
Moshe Kaplan 1c3a9af869 Add files with WS_DLL_PUBLIC to Doxygen
Add @file markers for most files that
contain functions exported with
WS_DLL_PUBLIC so that Doxygen will
generate documentation for them.
2021-11-29 21:27:45 +00:00
Dario Lombardo 30f8175303 column-utils: replace TAB with SPACE in prototypes.
In some functions the file showed

<ret_type><TAB><func name>

while in others

<ret_type><SPACE><func name>

All prototypes aligned to use the latter.

Change-Id: I47163824c9ae629c84df6d795192353eed5d5cca
Reviewed-on: https://code.wireshark.org/review/31803
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-29 21:49:02 +00:00
Joerg Mayer 2e977276c4 colum-utils.h: Fix 325 million -Wdocumentation warnings
Change-Id: I5ce6fbf4a536ffe72ef7c83d8d4f4f3c79155a8e
Reviewed-on: https://code.wireshark.org/review/26513
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2018-03-16 20:28:25 +00:00
Gerald Combs bbe5fc1028 Epan+Qt: Invalidate cached column strings.
Add col_data_changed, which checks to see if we have updated column
info. Add col_append_frame_number, which adds a frame number and sets
col_data_changed. Call col_append_frame_number instead of
col_append_fstr from some dissectors.

Add PacketListRecord::invalidateAllRecords, which invalidates any cached
record data. Add PacketListModel::invalidateAllColumnStrings which calls
invalidateAllRecords and signals that our data has changed. Call
invalidateAllColumnStrings when we have new name resolution or column
information.

Bug: 11414
Bug: 11468
Change-Id: I2671594a722f4f9436fe1df84d43489a148e0cee
Reviewed-on: https://code.wireshark.org/review/26373
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2018-03-15 12:19:23 +00:00
Dario Lombardo 55c68ee69c epan: use SPDX indentifiers.
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>
2018-02-08 19:29:45 +00:00
Michael Mann 0ef1d941ea Allow control of individual columns to be (un)writable.
Most protocols just want to limit COL_INFO or COL_PROTOCOL
so give that level of granularity.

Bug: 12144
Bug: 5117
Bug: 11144
Change-Id: I8de9b7d2c69e90d3fbfc0a52c2bd78c3de58e2f8
Reviewed-on: https://code.wireshark.org/review/15894
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
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>
2016-06-15 06:03:57 +00:00
Stig Bjørlykke cc679ca5ce Qt: Add check for field extractors
The proto tree is needed in several cases when using Lua field extractors,
because they fetch values from the tree.  Without a valid field extractor
a Lua plugin may misbehave and display wrong column info.

This fixes column issues when:
- Calling resetColumns() in Qt.  This involves adding a display filter,
  change time display format, change name resolution and other changes
  in UI which requires column updates.
- Print summary lines.
- Export as CSV and PSML.

Change-Id: Ieed6f8578cdf2759f1f836cd8413a4529b7bbd80
Reviewed-on: https://code.wireshark.org/review/13708
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>
2016-02-05 05:35:02 +00:00
Michael Mann 850f5d3be0 Remove the deprecated column types so users don't think they still exist.
Bug: 11559
Change-Id: I51836dc9a4fa399835c7bdabcba577ebd40327ad
Reviewed-on: https://code.wireshark.org/review/13538
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>
2016-01-27 07:54:24 +00:00
João Valverde 24bfb7e35d column-utils: Refactor col_append_port() to col_append_ports()
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-11-07 21:15:11 +00:00
João Valverde 5823e6e50b Remove duplicate transport ports from proto tree summary
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-11 23:54:28 +00:00
João Valverde 5d0b3c2f24 UDP: Make port column info similar to TCP, add length information
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-10-05 02:32:31 +00:00
Pascal Quantin 04913778d8 Declare col_get_text() as WS_DLL_PUBLIC
Bug: 11498
Change-Id: I5204bd27cee044a57913e48c4da00628f3f58bf8
Reviewed-on: https://code.wireshark.org/review/10374
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-09-03 20:08:49 +00:00
Alexis La Goutte 377555e5cb [column utils] fix warning: unknown command tag name [-Wdocumentation-unknown-command]
Change-Id: I5a14875b4b61ae7635095bdf9f2ab18dd9dbfc09
Reviewed-on: https://code.wireshark.org/review/6012
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-23 13:59:52 +00:00
Jakub Zawadzki 6e0be0173b Add col_append_lstr(), speedup column generation for TCP.
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-06-23 03:33:59 +00:00
Jakub Zawadzki ea95c837fe Introduce col_add_lstr(), use it instead of slower col_add_fstr.
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-17 21:33:26 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(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-04 14:27:33 +00:00
Jakub Zawadzki 0f8572cb51 Avoid including definition of column_info structure in dissectors.
Move COL_* enum to <epan/column-utils.h>

XXX Later we can rename epan/column-info.h to column-int.h (or smth like this)

svn path=/trunk/; revision=54352
2013-12-22 10:41:27 +00:00
Stig Bjørlykke 80150e196a Added col_clear_fence().
svn path=/trunk/; revision=54220
2013-12-18 14:18:45 +00:00
Jakub Zawadzki b75354ebe8 Avoid including <epan/epan.h> in dissectors.
svn path=/trunk/; revision=53774
2013-12-03 23:49:51 +00:00
Jörg Mayer 662c7704f8 After looking for something in the column-*.h files and
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-18 13:06:05 +00:00
Michael Mann d6950e2176 FINALLY remove the check_col API so that reviewers won't have to mention that it's deprecated. Now it just won't compile if its included in a dissector.
svn path=/trunk/; revision=52317
2013-10-01 15:30:22 +00:00
Jakub Zawadzki 5d52e16734 Add helper function to epan_session which can be used to get absolute 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-21 20:48:30 +00:00
Balint Reczey 1ebdb2e521 Export libwireshark symbols using WS_DLL_PUBLIC define
Also remove old WS_VAR_IMPORT define and related Makefile magic
everywhere in the project.

svn path=/trunk/; revision=47992
2013-03-01 23:53:11 +00:00
Michael Mann 41bd69d601 LUA API improvements
1. Add col_set_fence() equivalent
2. Update __tostring function to actually return column text

From Hadriel Kaplan, bug 8295 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8295)

svn path=/trunk/; revision=47882
2013-02-25 20:43:06 +00:00
Guy Harris 8ed7a73e22 Fix a bunch of warnings.
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
sizeof.

Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
strtol() and strtoul().

Change some data types to avoid those implicit conversion warnings.

When assigning a constant to a float, make sure the constant isn't a
double, by appending "f" to the constant.

Constify a bunch of variables, parameters, and return values to
eliminate warnings due to strings being given const qualifiers.  Cast
away those warnings in some cases where an API we don't control forces
us to do so.

Enable a bunch of additional warnings by default.  Note why at least
some of the other warnings aren't enabled.

randpkt.c and text2pcap.c are used to build programs, so they don't need
to be in EXTRA_DIST.

If the user specifies --enable-warnings-as-errors, add -Werror *even if
the user specified --enable-extra-gcc-flags; assume they know what
they're doing and are willing to have the compile fail due to the extra
GCC warnings being treated as errors.

svn path=/trunk/; revision=46748
2012-12-26 05:57:06 +00:00
Guy Harris 9d4d1a5794 col_cleanup() is undoing the allocations that col_init() does, so it's
freeing the allocated array of pointers, not what the pointers ported
to, so it should free col_data.  Note that it does that, and put it
after col_init() in the source file and header file.

Put in a comment explaining the MSVC bug that we're working around with
the casts.

svn path=/trunk/; revision=45393
2012-10-08 17:04:37 +00:00
Evan Huus 92c3bc0228 Don't leak all of our column data in packet_list_recreate (I think we still leak
some of it?).

Maybe part of https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7775

svn path=/trunk/; revision=45388
2012-10-08 15:12:45 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Guy Harris 25125ae369 Well, we *did* go to a widget that invokes callback to get the text for
the columns, so we *can* clean up the exporting of col_set_fmt_time() by
not exporting it any more.

svn path=/trunk/; revision=40743
2012-01-28 02:21:03 +00:00
Anders Broman 5d82ea810d Make it possiblwe to creare a trime string from frame data.
svn path=/trunk/; revision=39036
2011-09-19 05:15:58 +00:00
Guy Harris c8d2cd3cb5 In packet_list_dissect_and_cache_record(), set the columns to
*something* if we get an error reading the packet from the capture file,
rather than leaving them as null (which will cause a crash).

svn path=/trunk/; revision=36527
2011-04-09 04:33:26 +00:00
Anders Broman 6d1a0a2e86 Doxygen related changes.
svn path=/trunk/; revision=34009
2010-08-30 05:39:02 +00:00
Jeff Morriss b05ee41bc0 Remove duplicate definition of COL_MAX_LEN and COL_MAX_INFO_LEN: apparently no one needs them in this file (probably because they're marked as "don't use"). Now they are only defined in column_info.h .
svn path=/trunk/; revision=33871
2010-08-21 03:31:30 +00:00
Bill Meier 6812b68eb1 From Yaniv Kaul: constify parameters
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4422

 From me: Fix a number of instances where the function prototype or
  the function definition wasn't changed so there was a mismatch 
  thus causing Windows (but not gcc) compilation errors.

svn path=/trunk/; revision=32365
2010-04-03 18:18:50 +00:00
Bill Meier d32b4c0758 Revert SVN #32360 until Windows compilation errors corrected.
svn path=/trunk/; revision=32361
2010-04-02 15:18:03 +00:00
Bill Meier 049f9eac85 From Yaniv Kaul: constify parameters
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4422

svn path=/trunk/; revision=32360
2010-04-02 14:37:49 +00:00
Stig Bjørlykke 9092486f58 Changed from using own defined GNUC_FORMAT_CHECK to G_GNUC_PRINTF
defined in GLib.  Removed epan/gnuc_format_check.h.

svn path=/trunk/; revision=31657
2010-01-25 13:20:53 +00:00
Kovarththanan Rajaratnam de23d92163 Add an option to col_fill_in() to allow us to disable column expression processing. This is rarely needed. It's only needed when the user right clicks on the packet list view to generate a display filter.
svn path=/trunk/; revision=29806
2009-09-08 19:00:54 +00:00
Kovarththanan Rajaratnam 7d4cf0b966 col_custom_set_fstr() is unused. Remove it
svn path=/trunk/; revision=29722
2009-09-05 18:45:55 +00:00
Bill Meier bd5202c051 Add missing prototype ....
svn path=/trunk/; revision=29555
2009-08-26 02:06:39 +00:00
Kovarththanan Rajaratnam b9cbd15469 Custom columnfication:
* Deprecate COL_REL_CONV_TIME (Relative time (conversation)). Use tcp.time_relative

svn path=/trunk/; revision=29523
2009-08-23 12:24:14 +00:00
Anders Broman cb771536df From Kovarththanan Rajaratnam:
Only fill in frame_data vals when needed.

svn path=/trunk/; revision=29203
2009-07-27 08:33:26 +00:00
Anders Broman 9ca4ac2bed From Kovarththanan Rajaratnam:
Use frame_data values .

svn path=/trunk/; revision=29202
2009-07-27 03:34:57 +00:00
Stig Bjørlykke cfe8977eef Fixed a typo.
svn path=/trunk/; revision=27452
2009-02-15 15:02:55 +00:00
Stig Bjørlykke c64847fe16 Update all time columns when changing the time precision.
Not implemented for conversation relative and delta time yet, because this
will need a reload as they are set by the dissectors and does not exist in
the frame data.

svn path=/trunk/; revision=25452
2008-06-14 16:51:11 +00:00
Stephen Fisher 56226b49b8 Custom column updates:
- Change apply / prepare / ... as filter to use the field's value, which
   is now stored in fdata as well as cinfo.  Now we don't have to reprocess
   the entire packet list when using these features.  This also prevents
   the use of these features from overwriting custom column information.
   (custom columns can now be used in apply / prepare ... as filter)
 - Break col_expr and col_expr_val out into a struct that is included not only
   in cinfo, but now also fdata.
 - Have col_custom_set_fstr() quote FT_STRING & FT_STRINGZ when storing the
   col_expr_val value (for filter creation).


svn path=/trunk/; revision=24511
2008-03-01 05:16:45 +00:00
Stephen Fisher 8f3a1b0d16 Check in changes originally checked in as SVN revision 24308 (new column
type: Custom) that were backed out in SVN revision 24309.

Changes since that revision include a reworking of the handling of the
cfile/cinfo variables in epan/column-utils.c, addition of three new
functions to libwireshark.def and a bug fix to prevent a crash when no
custom columns were not in use.

Compilation verified locally on MacOS X, Linux and Windows.


svn path=/trunk/; revision=24317
2008-02-13 05:05:33 +00:00
Stephen Fisher 5e893a8b1c Revert commit 24308 until I can get it to compile on Windows/Linux/Solaris
(strangely, it compiled fine on my MacOS X machine).


svn path=/trunk/; revision=24309
2008-02-12 08:09:22 +00:00