Commit Graph

815 Commits

Author SHA1 Message Date
João Valverde 6c5d00a746 epan: Remove obsolete function proto_register_fields_manual()
Related with #17774.
2021-12-11 17:02:16 +00:00
João Valverde d2a9cb940a epan: Remove new proto tree API
Remove experimental new API.

Fix Netlink dissector to compile with normal proto tree API.

Closes #17774.
2021-12-10 14:37:01 +00:00
João Valverde 1a65cf0533 Fix Debian symbols 2021-12-06 18:51:42 +00:00
AndersBroman 3e0506dbe9 Make wmem_print_tree public. 2021-12-06 16:06:13 +00:00
João Valverde e921b804d0 Fix logging with extcaps
Extcaps require a log file when invoked in child mode. It also has
a specific flag to enable debugging, other that the wslog options.

Fix the logging to:
  1. Enable debug log level if --debug is used.
  2. Do not emit messages to the stderr if debug is enabled.

This brings extcap logging to the same feature level it had before
wslog replaced GLib logging.
2021-12-03 12:30:53 +00:00
João Valverde a9c36dfb75 epan: Remove unused format_uri() function
Used with the GTK GUI, not used for a long time.
2021-11-30 22:07:09 +00:00
João Valverde 37f2a86207 Move string_or_null() to wsutil 2021-11-29 18:37:03 +00:00
João Valverde dcbd79584d epan/str_util: Remove unused functions
Remove ws_strdup_escape_char(). I don't think it is generic enough to keep,
and it does not seem very efficient either.

Remove string_replace(). This function was used in the GTK GUI.
2021-11-29 18:37:03 +00:00
João Valverde 8e63faff95 Fix Debian symbols 2021-11-29 17:47:53 +00:00
João Valverde ef8125e3ae Move two functions from epan to wsutil/str_util
Move epan_memmem() and epan_strcasestr() to wsutil/str_util.
Rename to ws_memmem() and ws_strcasestr(). Add compile time
check for a system implementation and use that if available.

We invoke those functions using a wrapper to avoid exposing
_GNU_SOURCE outside of the implementation.
2021-11-28 12:32:51 +00:00
João Valverde f5d8d9e306 wmem: Use better names in the API 2021-11-27 19:39:27 +00:00
João Valverde 01a95db9b7 epan: Add binary search to introspection API 2021-11-27 14:31:53 +00:00
João Valverde 6fab4cbeff epan: Add introspection API to export some constants
C is notoriously difficult to bind from other languages
without additional metadata. The C ABI does not include
enums and macros that are an essential component of the
API.

To make Wireshark instrospectable and more binding friendly
include an introspection API to export enums and integer macros.

To avoid the tedious need to manually keep the code up to date
it uses the excellent pyclibrary python package to automatically
parse C headers and extract this data.

This is not a process that should be done automatically during
the build.

This could be used for example to replace most of the wslua
make-init-lua.pl perl script, which tries to do the same thing
using regular expressions.

Besides the downside of using Perl using regular expressions
is inferior to pyclibrary in 2 ways: 1) pyclibrary understands
most of C99 grammar so it is much more powerful; 2) pyclibrary
has a specific API to extract "values" (enums and constants)
automagically. We just need to take care to use only integer
values, for our purposes.
2021-11-26 20:38:42 +00:00
Paul Aurich 5d12847fc7 debian: libwiretap-dev headers require libwsutil-dev headers
The headers in the libwiretap-dev package require headers from the
libwsutil-dev package, so ensure they're installed.
2021-11-25 08:21:54 +00:00
John Thacker b5917d0182 wmem: Add a multimap
A number of protocols have IDs that can be reused that are used as
lookup keys. In most cases the frame number should be used as well
to differentiate repeat appearances of an ID. For response/request
matching, it is frequently useful to find the most recent frame number
(greatest value less than or equal to the current one) that contained
an ID.

We can achieve that by using a multimap that stores values with a given
ID in a tree keyed with the frame number. This works better than using
a map or a tree alone:

1) A map isn't ordered, so doesn't allow for less than or equal comparison.
2) Using a tree requires an ordering on all the ID components, and then
   having to test all the components other than the frame number separately
   for equality after retrieval.

Currently the multimap does not support inserting items without specifying
the tree key (and having the multimap generate a key), because the total
capacity of trees (including deleted nodes) is not tracked. If other use
cases are needed, this could be added later along with more generic
multimap support.

Use a multimap in ANSI MAP, ANSI TCAP, and GSM SMS, all of which need to
match lookup IDs that can be reused. Fix #7653.
2021-11-21 07:16:55 -05:00
João Valverde 3c7894e2a0 dfilter: Add compilation result to log output
Add result output to console log, in addition to intermediate debug
information. This allows tracing the result using the log only.
2021-11-16 13:52:30 +00:00
João Valverde 274531820a Move regex code to wsutil 2021-11-14 21:00:59 +00:00
João Valverde ca06d7e4fe Add an include sub-directory to the tree
Blind attempt to fix Debian package brokenness managing
headers separately from install rules.

Global public headers that don't fit any of the Wireshark
libraries should be placed in include/.

Eventually the C files in the root dir should be placed somewhere
else as well (like src/) but this is not a priority.

Fixes #17726.
2021-11-12 17:33:13 +00:00
João Valverde b49abcb215 epan: Remove fvalue_string_repr_len() from the public API
This function is unnecessary. Clients are receiving a wmem-allocated
buffer and have no need to know the length apriori.
2021-11-10 16:01:21 +00:00
João Valverde 5680d1ae0b wsutil: Improve bytes_to_str_max() API
Have these functions accept a zero max length to mean "display
the whole byte array". Change the max length parameter to receive a
number of bytes to print, not the length of the output character
string.

Adjust the macros bytes_to_str() and bytes_to_string_punct() to
produce the same output. Add more tests. Rename the functions to
bytes_to_str_maxlen() and bytes_to_str_punct_maxlen() because this is
an API break.
2021-11-09 20:57:05 +00:00
Gerald Combs e5eb17d414 UAT: Allow missing fields.
Add uat_set_default_values, which lets us provide default values for
fields that might be missing from the end of a UAT line. Set a default
value for the I/O Graph dialog's Y Axis Factor. Fixes the backward
compatibility issue described in #17623
2021-11-08 22:20:24 +00:00
João Valverde 77da5163a6 Fix Debian symbols 2021-11-08 09:49:08 +00:00
João Valverde 01f234571f epan: Optimize heuristic name validity check
Do the name check in one pass only, instead of two passes, one
for all letters and a second one to exclude upper case letters.
2021-11-04 14:03:37 +00:00
Balint Reczey 2103b4b074 Revert "debian: Report upstream and package version instead of git revision"
Probably it is still better to report the git version as the native package builds used to.

This reverts commit ba4bec7d09.
2021-10-25 13:52:31 +02:00
Balint Reczey a8f1b4f12c debian/rules: Run dh_dwz with debhelper (>= 12.6) only 2021-10-21 10:42:07 +00:00
John Thacker f58ccfc068 TCP, UDP, SCTP: Try user specified ports first
When the user has manually registered to a port a dissector other than
the default subdissector (through Decode As, or the preferences
registered via dissector_add_uint_[range_]with_preference), try
those ports with a custom dissector first.

There's a few dissectors (e.g., GTP) that have port preferences
that haven't been migrated to use the DECODE_AS_ preferences for
various reasons; this won't change anything when their preferences
are changed from the default, though it can still work via Decode As.

Fixes #6223 and #12168.
2021-10-21 06:48:52 +00:00
Nardi Ivan 763247c2b3 QUIC: fix compilation on Raspberry 2021-10-19 20:04:17 +00:00
Brian Sipos c36ce0b01b TCPCLv4: Update TCPCL dissector to include version 4 from dtn-wireshark
Some enhancements and visual fixes to version 3 dissector are also included.
2021-10-17 14:09:07 +00:00
Balint Reczey 9f92da75b8 wsutil: Provide static inline g_memdup2 in glib-compat.h to not export it
Shared libraries should not export symbols exported by other libraries to avoid
collisions.

Fixes #17645.
2021-10-11 21:51:35 +02:00
Balint Reczey ba4bec7d09 debian: Report upstream and package version instead of git revision 2021-10-10 19:26:17 +00:00
Balint Reczey 6617c7fc5d debian/rules: Don't pass --parallel to dh, it is the default now 2021-10-10 19:26:17 +00:00
Balint Reczey a1d964fa1c debian/rules: Turn on BUILD_corbaidl2wrs to ship idl2wrs man page 2021-10-10 19:26:17 +00:00
Balint Reczey a9c1d1ac9e debian: Bump compat level to 12 keeping backports in mind 2021-10-10 19:26:17 +00:00
Balint Reczey d87bc0d74d debian/control: Drop Conflists: and Replaces: referring to very old versions 2021-10-10 19:26:17 +00:00
Balint Reczey d74afba1f1 debian: Make wireshark depend on the same version of wireshark-qt 2021-10-10 19:26:17 +00:00
Balint Reczey aed6c130b9 debian/copyright: Fix typo and remove patterns for removed files 2021-10-10 19:26:17 +00:00
Brian Sipos ce0592514c BPv7: Add Bundle Protocol version 7 and BPSec dissectors from dtn-wireshark 2021-10-10 13:27:17 +00:00
Gerald Combs 0c4d4f6835 Version: 3.5.1 → 3.7.0
[skip ci]
2021-10-07 14:27:38 -07:00
Brian Sipos bc3bced07d COSE: Handle indefinite tstr/bstr encodings 2021-10-05 21:11:36 +00:00
Stig Bjørlykke 96cfaf67a3 Qt: Reload Lua FileHandler when having a capture file
Support reloading a Lua FileHandler when this is in use for a
loaded capture file. Prompt to save the file if having unsaved
changes because the file must be reloaded.

Fixes #17615
2021-09-30 11:07:08 +00:00
Brian Sipos abd0f1183f COSE dissector from dtn-wireshark project 2021-09-29 08:51:13 +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
Stig Bjørlykke 533d859499 Qt: Register import_hexdump.json as a profile file
Profile files which is only used in Qt is not automatically registered
during startup and must be explicit registered.

Add profile_register_persconffile() to handle this registration.
2021-09-21 18:20:34 +00:00
João Valverde a34a234cf2 wslog: Add ws_log_buffer()
Use the new API with dot11decrypt debug.
2021-09-18 10:59:10 +01:00
João Valverde 8df2a73594 Use the musl in-tree getopt_long() everywhere
Besides the obvious limitation of being unavailable on Windows,
the standard is vague about getopt() and getopt_long() has many
non-portable pitfalls and buggy implementations, that increase
the maintainance cost a lot. Also the GNU libc code currently
in the tree is not suited for embedding and is unmaintainable.

Own maintainership for getopt_long() and use the musl implementation
everywhere. This way we don't need to worry if optreset is available,
or if the $OPERATING_SYSTEM version behaves in subtly different ways.

The API is under the Wireshark namespace to avoid conflicts with
system headers.

Side-note, the Mingw-w64 9.0 getopt_long() implementation is buggy
with opterr and known to crash. In my experience it's a headache to
use the embedded getopt implementation if the system provides one.
2021-09-17 00:43:54 +01:00
João Valverde 36a2606064 Debian: Fix symbols 2021-09-17 00:08:41 +01:00
João Valverde 8208c68b49 Debian: Add missing wsutil symbols 2021-09-16 18:23:47 +01:00
João Valverde 0019723b14 Debian: Add missing wsutil symbols 2021-09-16 15:53:15 +00:00
Developer Alexander 03480fd6e1 epan: export epan_set_always_visible()
Exports (DLL) epan_set_always_visible() to make it accessible for plugins.

This enables post dissection taps to access all fields.
2021-09-08 14:40:24 +00:00
Evan Huus 6caf24e966 tvblist: explicitly scope memory
Allocate the root node in the same pool as the list itself, and make
that pool explicit so we can pass the pinfo scope instead of using the
global packet pool.
2021-09-08 01:37:07 +00:00