Commit Graph

246 Commits

Author SHA1 Message Date
Michael Mann da09a1bfd8 Take all epan_column_info members that always get allocated to "number of 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-06-29 02:11:04 +00:00
Michael Mann 2875cd382f Eliminate the hf member out of the address structure.
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-09 03:48:53 +00:00
Michael Mann 2042385ac9 Add "column filter string" support to address types.
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-09 01:13:28 +00:00
Michael Mann 4497bb48fd Add address type registration.
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-02-09 01:12:01 +00:00
Guy Harris 233dc643a6 Remove some apparently-unnecessary includes of emem.h.
Change-Id: Id50ce3e707056cca8f30052f05c451ce431b39b5
Reviewed-on: https://code.wireshark.org/review/6632
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-18 19:36:36 +00:00
Michael Mann f5c4d06dba Replace some "low hanging fruit" uses of emem.
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-11 00:27:57 +00:00
Michael Mann 456095c89d disperse atalk-utils.[ch]
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-09 05:58:59 +00:00
Michael Mann 2209678149 ep_<protocol>_port_to_display -> <protocol>_port_to_display
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>
2015-01-08 05:32:32 +00:00
Alexis La Goutte 7c93e81551 Column utils: Missing varargs init or cleanup (CID 1212122)
Change-Id: I013c737c2cd62e3f1f49b113a7ce0c0616e1ecc4
Reviewed-on: https://code.wireshark.org/review/6119
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-31 14:59:38 +00:00
Michael Mann cdaa669829 Replace ax25_to_str and get_ax25_name with address_to_str.
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-21 15:12:58 +00:00
Stig Bjørlykke b4e90bdc8e Fix filter test for multifield custom column
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-20 20:46:21 +00:00
Michal Labedzki 7b2ae71235 Fix filter valid/invalid test for multifield custom type
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-20 17:59:25 +00:00
Guy Harris df1f919b94 Don't use g_slist_free_full().
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-20 00:21:27 +00:00
Michal Labedzki 361ea8215d Add support for multifields in custom column
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-18 11:03:42 +00:00
Guy Harris 45103068ff Get rid of a trailing blank.
Change-Id: I0cf6d04f5075ba1f064c40f4b39b32b6976b54c7
Reviewed-on: https://code.wireshark.org/review/5633
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-05 21:14:53 +00:00
Guy Harris b98c570969 Fix varargs handling in col_{add,append}_lstr().
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-12-05 21:05:51 +00:00
Stig Bjørlykke d58567bd78 Fixed memory leakage in col_cleanup.
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-11-10 08:00:56 +00:00
Guy Harris 54b733ce9a Make the time stamp resolution per-packet.
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-09-28 18:38:18 +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
Guy Harris 2d0507e33a Use gsize rather than int, to avoid some complaints about shortening.
Change-Id: Ic673525a05cd106677226a4063af825d0f22c97c
Reviewed-on: https://code.wireshark.org/review/1677
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-17 22:29:27 +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
AndersBroman da00889226 Add a cast to make MSVC happy.
Change-Id: Iee901ae56c796007821c1754056c61954e8a342f
Reviewed-on: https://code.wireshark.org/review/1526
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-06 07:57:21 +00:00
Jakub Zawadzki ecc6b8d620 Move common part of col_append_fstr, col_append_sep_fstr to seperate fnction.
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-06 06:49:18 +00:00
Jakub Zawadzki 984e52244f Fix possible buffer overflow in col_append_sep_fstr()
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-05-05 03:58:42 +00:00
Guy Harris 97869f2dec More name changes.
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-19 19:30:17 +00:00
Guy Harris c8f7e16b57 Some routine name changes.
"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-19 19:07:06 +00:00
Guy Harris 80011ec03c Don't se_ allocate strings when mapping addresses to column strings.
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-04-19 14:20:06 +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
Guy Harris 11220f625c Don't cast away constness.
svn path=/trunk/; revision=54797
2014-01-14 18:16:12 +00:00
Guy Harris fd4faf6619 Expand a comment.
svn path=/trunk/; revision=54622
2014-01-06 23:07:48 +00:00
Guy Harris 81b21459c3 In col_fill_in() and col_fill_in_error(), use col_based_on_frame_data()
to determine whether to fill in the column from frame data or not.

svn path=/trunk/; revision=54621
2014-01-06 23:02:32 +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 cedb73c7f7 Dissectors should not use dfilter.h, don't include it.
XXX ncp2222 dissector is using dfilter_compile(), why?

svn path=/trunk/; revision=53766
2013-12-03 21:31:04 +00:00
Jakub Zawadzki 8be10b5662 Remove #if 0 code (introduced in r29489).
svn path=/trunk/; revision=53181
2013-11-09 10:00:54 +00:00
Guy Harris 2a088c1d53 Add support for displaying dates as year and day-of-year (1-origin).
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-11-06 20:39:09 +00:00
Michael Mann 3ead3a994a Remove "Cisco MDS-specific" fields from packet_info. 2 of the 3 fields were 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-27 23:18:19 +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
Jörg Mayer 029e258225 Explicitly include emem.h where it is needed
svn path=/trunk/; revision=51997
2013-09-13 08:16:50 +00:00
Jeff Morriss 2df54da6e2 Move a bunch of the crypt modules and pint.h into wsutil.
This means wsutil now links against libcrypt.

Protect a bunch of the crypt header files from multiple inclusion.

svn path=/trunk/; revision=51100
2013-08-01 23:34:47 +00:00
Jakub Zawadzki c702e92121 Replace relative timestamp with reference frame number. Saves 16B per frame.
svn path=/trunk/; revision=50772
2013-07-21 23:07:33 +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
Chris Maynard d331c33b4f This should fix warning: to be safe all intermediate pointers in cast from 'gchar **' to 'const char **' must be 'const' qualified.
svn path=/trunk/; revision=50655
2013-07-16 02:34:44 +00:00
Bill Meier 8b9135e9b5 Indentation/Whitespace cleanup;
Add editor modelines.

svn path=/trunk/; revision=50146
2013-06-25 19:38:15 +00:00
Sake Blok 56cb987ef2 Fix for https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7546
Make sure unresolved columns are indeed unresolved


svn path=/trunk/; revision=49776
2013-06-04 21:36:47 +00:00
Bill Meier 0df5a9390d From beroset:
remove C++ incompatibilities
 https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 attachment #10397

svn path=/trunk/; revision=48438
2013-03-20 01:18:10 +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
Evan Huus 43fadb88cb Add comment explaining the addr->hf field to column-utils for future
reference. Those lines were already starting to look like magic and
it's only been 24 hours.

svn path=/trunk/; revision=45806
2012-10-27 02:48:45 +00:00
Evan Huus 361aedec1f Create SET_ADDRESS_HF that takes an additional hf_ value that can be
used to override the filter generated from the address column.

Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7728 (again).

svn path=/trunk/; revision=45792
2012-10-26 01:59:17 +00:00