Commit Graph

145 Commits

Author SHA1 Message Date
João Valverde 0047ca961f dfilter: Add support for entering time in UTC
Add the option to enter a filter with an absolute time
value in UTC. Otherwise the value is interpreted in
local time.

The syntax used is an "UTC" suffix, for example:

    frame.time == "Dec 31, 2002 13:55:31.3 UTC"

This also changes the behavior of "Apply Selected as filter".
Fields using a local time display type will use local time
and fields using UTC display type will be applied using UTC.

Fixes #13268.
2021-12-30 17:53:09 +00:00
João Valverde 445dcd3117 epan: Extend abs_time_to_str() with a flags argument 2021-12-28 04:05:20 +00:00
João Valverde a566076839 epan: Move time display types to field_display_e
This makes it easier to understand the code, avoids conflicts
and ugly and unnecessary casts.

The field display enum has evolved over time from integer types
to a type generic parameter.
2021-12-27 22:31:31 +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
Evan Huus 0eda51a646 to_str: scope tvb_ip6_to_str 2021-10-07 13:31:23 -04:00
Evan Huus 07f5472aa7 to_str: scope tvb_ip_to_str 2021-10-07 10:25:12 -04:00
Evan Huus f9ac0f40f7 to_str: scope decode_bits_in_field
Mostly straightforward. The only complication was
proto_tree_add_split_bits_crumb which needed some manipulation to
guarantee a non-null tree so we could use its memory scope.

This is one of the last non-dissector uses of wmem_packet_scope!
2021-10-05 04:42:13 +00:00
Evan Huus 7b8938474b to_str: pull scope arg up into more addr macros
These three all had pretty minimal usage, so do them together.
2021-10-04 18:27:26 +00:00
Evan Huus e578c6caee to_str: pull scope arg up into tvb_ether_to_str
There are a bunch of near-identical macros here, but I'm gonna change
one at a time or else the builder times out at the number of files
changed in one merge.
2021-10-04 17:10:17 +00:00
Tomasz Moń 7b82110092 USB HID: Parse bit fields with correct bit order
Implement little endian support for tvb_get_bits family of functions.
The big/little endian refers to bit numbering within an octet. In big
endian, the most significant bit is considered bit 0, while in little
endian the least significant bit is considered bit 0.

Add encoding parameters to proto tree bits format family functions.
Specify ENC_BIG_ENDIAN in all dissectors using these functions except in
USB HID that requires ENC_LITTLE_ENDIAN to work correctly.

When formatting bits values, always display most significant bit on the
leftmost position regardless of the encoding. This results in no gaps
between octets and makes the displayed value comprehensible.

Close #4478
Fix #17014
2021-09-26 18:16:28 +02:00
João Valverde 8c4a479c52 Move more numerical functions to wsutil/to_str.h 2021-09-16 20:55:03 +01:00
João Valverde cc1e5b8334 Reformat and cleanup epan/to_str.h header 2021-09-16 20:15:28 +01:00
João Valverde 24fd8c6740 Move more numerical epan/*to_str() routines to wsutil 2021-09-16 18:21:14 +01:00
João Valverde 8a584222f1 Move epan/*to_str_back() functions to wsutil 2021-09-16 15:53:14 +00:00
João Valverde c3bd5c9d91 Move bytes_to_str() to wsutil
This utility function is useful outside of epan. Move it to wsutil
and export the interface.

The move isn't completely clean as it requires duplicating two small
inline functions but that was necessary to avoiding moving too much at
once.
2021-07-29 17:23:04 +00:00
João Valverde 133b0c583f Move epan/wmem/wmem_scopes.h to epan/
This header was installed incorrectly to epan/wmem_scopes.h.

Instead of creating additional installation rules for a single
header in a subfolder (kept for backward compatibility) just
rename the standard "epan/wmem/wmem.h" include to
"epan/wmem_scopes.h" and fix the documentation.

Now the header is installed *correctly* to epan/wmem_scopes.h.
2021-07-26 14:56:11 +00:00
João Valverde 72ea33ae20 epan: Change bytes_to_str() length argument to a size_t 2021-06-20 18:58:10 +00:00
Guy Harris a58ed646aa Handle relative times with >2^31 seconds.
Make display_signed_time() take a 64-bit signed number of seconds, and,
in calls to it, cast the argument to gint64, not gint32.

Addresses issue #16909.
2020-10-18 02:06:07 -07: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
João Valverde 7507b11ec4 Improve our ip6_to_str_buf() implementation
Change-Id: I02b5d01797e526299a6dc5a031662cb78e4f8423
Reviewed-on: https://code.wireshark.org/review/24163
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-29 15:15:31 +00:00
Guy Harris e1ef732c11 Get rid of MAX_IP_STR_LEN and MAX_IP6_STR_LEN.
We have WS_INET_ADDRSTRLEN and WS_INET6_ADDRSTRLEN; use them.

Change-Id: Idade0da9fae70d891901acd787b06d21e2ddbc5f
Reviewed-on: https://code.wireshark.org/review/24156
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-29 05:51:25 +00:00
Guy Harris 458c3c026e Add a ws_in6_addr typedef for struct e_in6_addr.
That allows a parallel typedef of ws_in4_addr for guint32.

Change-Id: I03b230247065e0e3840eb87635315a8e523ef562
Reviewed-on: https://code.wireshark.org/review/24073
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-26 08:50:34 +00:00
Michael Mann c2ebb62e7e Don't use uint_to_str_back when you need guint32_to_str_buf.
It will end up eventually crashing column buffers because memory
behind the address is trounced.

Change-Id: Id6b5a42effc503e4b8bf5e1deb2135241e2893f3
Reviewed-on: https://code.wireshark.org/review/22563
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-07-09 19:54:35 +00:00
Guy Harris d7fe514fc0 Improve support for single-character fields and filter expressions.
Add an FT_CHAR type, which is like FT_UINT8 except that the value is
displayed as a C-style character constant.

Allow use of C-style character constants in filter expressions; they can
be used in comparisons with all integral types, and in "contains"
operators.

Use that type for some fields that appear (based on the way they're
displayed, or on the use of C-style character constants in their
value_string tables) to be 1-byte characters rather than 8-bit numbers.

Change-Id: I39a9f0dda0bd7f4fa02a9ca8373216206f4d7135
Reviewed-on: https://code.wireshark.org/review/17787
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-19 02:51:13 +00:00
João Valverde f1ff3208a0 Move ip6_to_str_buf() to to_str.c and make it take the buffer length.
Also make it use ws_inet_ntop6() (rather than implementing the string
conversion ourselves).

Remove ip6_to_str_buf_len().

Change-Id: I1eff3a8941e00987c2ff0c4dcfda13476af86191
Reviewed-on: https://code.wireshark.org/review/15692
Reviewed-by: João Valverde <j@v6e.pt>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-06-06 22:00:41 +00:00
Guy Harris 6febe27586 Give the time_[m]secs_to routines names that begin with "[un]signed_".
Indicate whether they take a signed time delta or an unsigned time
delta.

Export unsigned_time_secs_to_str() while we're at it.

Change-Id: I0fbe87f1825efa886364caa61a3358b79d285947
Reviewed-on: https://code.wireshark.org/review/15324
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-09 22:55:00 +00:00
Guy Harris 1b1614913f Shuffle some routines to put absolute-time and relative-time code together.
Put the routines that handle absolute time ("relative to the Epoch")
together and the routines that handle relative time together.

Change-Id: I15256921091ab67a1d92026385bf1b27aa52b404
Reviewed-on: https://code.wireshark.org/review/15316
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-09 20:26:13 +00:00
Michael Mann c62547b951 Refactor "Follow Stream" functionality on all GUI interfaces.
Create a "registration" system for Follow functionality so most of the work can be abstracted into a dissector and GUI can just be responsible for "display".
This also removes the global variables in follow.c to open up multithreading possibilities.

TCP, UDP and HTTP all have the same "tap interface" for Follow functionality (passing a tvb with byte data to "follow"). SSL still has it's own behavior, so Follow structures have to take that into account.

TShark through the Follow registration now has support for HTTP.

The only thing possibly missing is dynamic menu generation to further reduce explicit knowledge of Follow "type" (and rely on registration)

Bug: 11988
Change-Id: I559d9ee1312406ad0986d4dce9fa67ea2103b339
Reviewed-on: https://code.wireshark.org/review/13161
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-12 15:08:18 +00:00
João Valverde cbc36cbd97 Remove constness from bytestring_to_str() [-Wcast-qual]
Change-Id: I7f942787dfdc4f76dd0ad5111d1eb528b20f0ba9
Reviewed-on: https://code.wireshark.org/review/13011
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: João Valverde <j@v6e.pt>
2016-01-07 22:40:30 +00:00
Guy Harris fa7cf8737c Rename ipv6-utils.h to ipv6.h.
By analogy to ipv4.h.

Change-Id: I147565b332024b1bb88e9cd15889255773d04524
Reviewed-on: https://code.wireshark.org/review/13034
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-03 21:42:32 +00:00
Guy Harris 8363733e30 If you want struct e_in6_addr, include <epan/ipv6-utils.h>.
Don't just define it yourself.

(And especially don't define it yourself if you're already including
epan/ipv6-utils.h.)

Change-Id: I9970d0edecef0c820b2a7fdce34509b54e7b3106
Reviewed-on: https://code.wireshark.org/review/13020
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-03 04:01:39 +00:00
Andreas Urke b7d1eedeb3 Fix for bug 11856:
Correct parameter-name "opt-offset" to "offset" in macro
"tvb_eui64_to_str" in epan/to_str.h such that offset is taken into account
when converting eui64 to str.

Bug: 11856
Change-Id: Id0b17c4b9186b4c41d6fe338ba7c017e88f63acf
Reviewed-on: https://code.wireshark.org/review/12441
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-12-05 16:26:18 +00:00
João Valverde 5e6d45ca98 Make address_to_display() use proper (non-)constness
Don't return allocated memory as a const pointer.

Fixes multiple [-Wcast-qual] warnings.

Change-Id: Ie9ceac27fa2a5eba41a5392ac983ff28c3939239
Reviewed-on: https://code.wireshark.org/review/12267
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-29 00:25:11 +00:00
Guy Harris 90c4cbef19 If it's used by dissectors, it belongs in to_str.h, not to_str-int.h.
Assuming *any* of the routines that generate printable strings should be
thought of as "for internal use by libwireshark routines only, not by
dissectors", the ones that *are* used by dissectors obviously shouldn't
be.  The ability for dissectors to register address types certainly
expands the list of routines they would use.

Move everything used by dissectors from to_str-int.h into to_str.h, and
have dissectors not include to_str-int.h.

(Perhaps we should just get rid of to_str-int.h altogether.)

Change-Id: I3c583351f038233c9bcd8f9216188f82630267fa
Reviewed-on: https://code.wireshark.org/review/11149
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-10-19 16:40:43 +00:00
Michal Labedzki 8bb4fed753 Bluetooth: Fix displaying and handling UUID128
Use a standard way of displaying 128 UUIDs (like GUID).
This also change a way that UUID are handled by dissector tables.

Change-Id: Ie0f880f58480c34b40dd23c426202349e0620b12
Reviewed-on: https://code.wireshark.org/review/11018
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
2015-10-17 10:21:37 +00:00
Michael Mann 648cf995b1 Make other_decode_bitfield_value private to proto.c.
This is further encouragement to not try to manually create a bitstring while formatting a field.

Change-Id: I4efbeb39a210cf1fd26203cd8560859276b333b0
Reviewed-on: https://code.wireshark.org/review/10494
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-09-13 00:15:35 +00:00
Guy Harris df5a315048 Fix address resolution for columns.
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-07-03 02:21:20 +00:00
Alexis La Goutte de563fa656 to_str.h: fix api reference
The following parameters of tvb_address_var_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, address_type type, const gint offset, int length) are not documented: parameter 'length'

Change-Id: I0b93a2b47601bbb5ef424b6d0c2651952241ce32
Reviewed-on: https://code.wireshark.org/review/8229
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-04-29 10:55:40 +00:00
Michael Mann baa83912e3 Eliminate decode_bitfield_value from "public" use.
This "encourages" (forces) dissectors to use the bitmask field of the header_field_info structure to get "bitmask formatting" of a field.

other_decode_bitfield_value should be treated the same (eventually eliminated), but there are still replacements to be made in the dissectors.

Change-Id: I8a0d829c3fef2d5e5a588667a259e231bca559e6
Reviewed-on: https://code.wireshark.org/review/7736
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-03-19 04:33:26 +00:00
Michael Mann 8d5da72ff9 Add tvb_address_with_resolution_to_str.
Convert dissectors to using the API where appropriate.

Change-Id: I059582f73a75635d4a0338d02d4c4b212162480b
Reviewed-on: https://code.wireshark.org/review/7296
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-22 02:53:48 +00:00
JC Wren e2bcee6ac4 Make FT_{U}INT64 behave more like FT_{U}INT32, add support for FT_{U}INT{40,48,56}
Change-Id: I57354c309ecf3a0c8f0c7cff485638027f30bb19
Reviewed-on: https://code.wireshark.org/review/5813
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-21 16:57:52 +00:00
Michael Mann 8d16ac46d5 Add name resolution support to address type.
Add address_with_resolution_to_str API that returns address string + name resolution in the format %s (%s), first string is resolved name (if available) and second string is raw address string.

Convert AT_FCWWN to using proper name resolution format

First use of address_with_resolution_to_str with field types in proto.c

Change-Id: I2ae77c29a4ffc30bb919fbec00f06629830898c2
Reviewed-on: https://code.wireshark.org/review/7196
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-19 13:09:41 +00:00
Michael Mann 8ff944d4ab Add fixed length function for address types.
This allows for even more cleanup with respect to how address types are handled, including removing address_to_str.c.  Most of the functionality was folded into address_types.c, but the remainder was just dispersed because it didn't make sense to keep the file.

Change-Id: Id4e9391f0c3c26eff8c27b362e4f7a1970d718b4
Reviewed-on: https://code.wireshark.org/review/7038
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 03:49:13 +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
Alexis La Goutte 0f6b09d32e to_str (epan): fix parameter 'scope' not found in the function declaration [-Wdocumentation]
Change-Id: Ie414d28415b71a79780d37fae454b90a7a610e1c
Reviewed-on: https://code.wireshark.org/review/6475
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-10 15:52:40 +00:00
Michael Mann 284229c0f8 Convert EUI64 address APIs to use wmem.
Change-Id: I57d2e435ac72ea07ec9a567e0b1ce4410966e3d2
Reviewed-on: https://code.wireshark.org/review/6419
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-09 07:44:54 +00:00
Michael Mann 6a6e2efbf9 Have ipxnet addresses use wmem scoped memory.
Change-Id: I1d8eed2ceacccce2768590f0689cd2c83a5e56e9
Reviewed-on: https://code.wireshark.org/review/6418
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-09 06:02:59 +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 cff098e3eb guid_to_ep_str -> guid_to_str
guid_to_str now uses wmem allocation.

Change-Id: I8e48d1a720942fbefbaa6227ae0929cb9f856359
Reviewed-on: https://code.wireshark.org/review/6391
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-08 07:18:09 +00:00
Michael Mann 5d610b58c5 Remove decode_numeric_bitfield.
It was only used by 1 dissector and that dissector can just use bitmasking in the hf_ field.

Change-Id: I99179356dd7cbfab0c7be1512357a7e4c0eecde6
Reviewed-on: https://code.wireshark.org/review/6390
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-08 05:46:26 +00:00