Commit Graph

1216 Commits

Author SHA1 Message Date
João Valverde fa525649be CMake: Try to set a required try_run() definition in a more idiomatic way
This is applicable to every test (if we had more), not just HAVE_C99_VSNPRINTF.

Could also be a #define but let's go with this for now. This takes
advantage of the stack based design of CMakePushCheckState.
2021-09-22 16:34:37 +00:00
João Valverde 9f9afc0e86 CMake: Remove an unnecessary version check
MINGW implies WIN32 which implies CMake >= 3.13.

Follow-up to 1dad8190b1.
2021-09-22 16:43:09 +01:00
João Valverde 6921f01250 MinGW-w64: Need to use ANSI C stdio
Defining _POSIX enables __USE_MINGW_ANSI_STDIO, this switches the
stdio API from Microsoft to MinGW internal (ANSI C).
2021-09-22 14:37:13 +01:00
João Valverde c4265865c2 MinGW-w64: Fix windeployqt errors
--debug and --release flags are unnecessary and trigger errors.

--pdb not supported and triggers a warning.
2021-09-22 14:28:49 +01:00
João Valverde c4d5eea33e CMake: Target platform for WIN32 needs to be lower case
Capitalization matters here. We are now accepting this value from the
environment so we need to lower case that string.

Add an extra sanity check and status message for target CPU architecture
to help detect mismatches.
2021-09-22 14:21:20 +01:00
João Valverde 1dad8190b1 CMake: Fix minimum version requirements for CentOS 8
target_link_options() requires CMake >= 3.13.
2021-09-22 10:46:20 +00:00
João Valverde 0d6f0a4213 MinGW-w64: Add guards for MSVC macro definitions
Add a comment too.
2021-09-21 14:52:32 +00:00
João Valverde a5a9bb0763 CMake: Move UNICODE defines to command line
For consistency's sake, I have not had any build errors that can
be attributed to this.
2021-09-21 14:52:32 +00:00
João Valverde 6bd1bb4d7c MinGW-w64: Define NOMINMAX for Windows API
This seems relevant to MinGW-w64 from a quick look at the source.
2021-09-21 14:52:32 +00:00
João Valverde b12644b629 MinGW-w64: Need to define WIN32_LEAN_AND_MEAN 2021-09-21 05:56:34 +00:00
João Valverde 50fdfda316 MinGW-w64: Need to link using -municode
Some targets are not using unicode/WinMain (not sure why), so this
really needs to be a per target setting (better anyway).
2021-09-21 05:56:34 +00:00
João Valverde a193aff052 Windows: Don't search for a SpeexDSP package 2021-09-20 20:11:49 +00:00
João Valverde 2c7d22dba2 CMake: Fix macro redefinition of Windows API versioning 2021-09-20 20:11:23 +01:00
João Valverde bb12a187df CMake: Add guards for PLATFORM sanity check
The sanity check is specific for Visual Studio so add those
guards. The PLATFORM variable is not standard for other toolchains.

Add a default "windows target platform" of Win64.

Add error output for win-setup.ps1.
2021-09-20 15:11:52 +01:00
João Valverde c513188f52 CMake: wsetargv.obj is specific to Visual Studio 2021-09-20 13:27:11 +01:00
Gerald Combs 55a67fd66a Tools: Migrate compress-pngs.sh to Python.
Migrate compress-pngs from a Bash script that ran Make to a Python
script, which should be usable on more platforms.

Add Efficient Compression Tool (ect) to the list of compressors.

Add the compressors to the various *-setup.sh scripts, but comment them
out for now.
2021-09-13 11:00:04 -07:00
Nardi Ivan 3cb302f05b HTTP2, QUIC: fix "Follow Stream"
"Follow Stream" functionality assumes that all data in a single packet
belongs to the same stream. That is not true for HTTP2 and QUIC, where
we end up having data from unrelated streams.

Filter out the unwanted data directly in the protocol dissector code with
a custom `tap_handler` (as TCP already does).

Close #16093
2021-09-13 15:13:10 +00:00
John Thacker 6fe68991df wiretap: Add zstd and lz4 as WTAP compression types
This has a few effects on the behavior of wtap_get_compression_type()
and wtap_get_all_compression_type_extensions():

Make capinfos correctly report the compression type (instead of
saying gzip compressed for zstd and lz4 compressed files).

Makes files with the .zstd and .lz4 extension show up in the file
chooser when "Files of type" is set to something other than "All Files",
such as "All Capture Files" or "Wireshark/... pcapng"

Makes the UI not default to gzip compression when saving a file
compressed as zstd or lz4 (write support for zstd and lz4 doesn't
exist yet, and the GUI doesn't have hooks for it anyway, though
this can help as a prerequisite for later support for writing.)

Also replace a couple of assert() with ws_assert().

Update the PURPOSE in CMakeLists for zstd and lz4 to note that they
can be used to read compressed capture files.
2021-09-11 22:37:25 +00:00
Gerald Combs 5893d3cd09 CMake: Fix tests.
Pass $<TARGET_FILE_DIR:wmem_test> to test.py, which should be the path
for all of our built executables, instead of ...:tshark, which is the
path for *some* of our built executables on macOS.
2021-09-01 09:31:07 -07:00
Gerald Combs 4d1357eebe CMake: Get rid of WS_PROGRAM_PATH
Use the $<TARGET_FILE_DIR:tshark> generator expression instead.
2021-09-01 07:16:20 +00:00
Gerald Combs f51b018f87 Version: 3.5.0 → 3.5.1. 2021-08-27 21:40:12 +00:00
Guy Harris ea0f14a6fb cmake: add an "uninstall" target.
Based on the uninstall target I added to libpcap and tcpdump's CMake
files.  cmake_uninstall.cmake.in is BSD-licensed, so I can use it here
and in libpcap/tcpdump without adding any GPL stuff to libpcap/tcpdump.
2021-08-26 00:42:51 -07:00
João Valverde 3467b98eb7 CMake: Make LTO default off, restrict to release build
Link Time Optimizations increases build time a lot so restrict
this optimization to release builds. Follow our build bots and
make this option default off.

Also LTO requires CMake >= 3.9 so make the LTO CMake option
universally conditional on that requirement.
2021-07-26 15:13:38 +00:00
João Valverde c0ae696253 CMake: Remove some unused definitions 2021-07-23 21:23:00 +01:00
Gerald Combs 539ad8a91b CMake: Remove unneeded GLIB2_LIBRARIES.
GLib is part of wsutil's link interface, so we don't need to link to it
explictly.
2021-07-21 10:05:21 +00:00
Gerald Combs 34ef2066e5 CMake: Don't bother checking for fcntl.h or floorl.
fcntl.h appears to be available on all of our supported platforms,
including Windows. We've also been including it without HAVE_FCNTL_H
guards in a few places (e.g. sshdump.c) without any issues for some
time.

floorl is part of C99.
2021-07-15 06:41:05 +00:00
Gerald Combs 9b78a42855 CMake: Fixup qtui's includes.
Add ${MINIZIP_INCLUDE_DIRS} to qtui's includes instead of every
target's. Make more includes SYSTEM PRIVATE.
2021-07-14 17:33:18 -07:00
Gerald Combs 8834b470d0 CMake: Fixup SpanDSP's TIFF includes.
Add TIFF_INCLUDE_DIR to SPANDSP_INCLUDE_DIRS, but only if TIFF has been
found.

Ping #17477.
2021-07-14 09:10:09 -07:00
Gerald Combs ff60fcf92d CMake: Adjust wsutil includes and linking.
Mark wsutil's includes SYSTEM PRIVATE. This exposed a lot of targets
that were indirectly picking up include paths via the wsutil target, so
add direct includes where needed. The G.722 and G.726 codecs were
implicilty including tiffio.h; find it explicitly instead.

Mark some of wsutil's libraries PRIVATE, but leave commonly-used ones
PUBLIC.

Ping #17477.
2021-07-14 03:56:05 +00:00
João Valverde 89acb935bc wsutil: Start adding a test suite 2021-07-11 14:39:13 +00:00
João Valverde ffcfc83ecb Rename version.h to be more descriptive
Version.h is too generic. This is specific to VCSVERSION and that
should be made more obvious and discoverable.
2021-07-09 18:27:41 +00:00
Anders Broman 2270056073 Revert "Wirehark Windows: Harden build with Shadow Stack and EHCONT metadata"
This reverts commit ebb8703a50.
2021-07-05 15:48:48 +02:00
João Valverde 100876337a Move version_info.[ch] to ui/
Version info is an aspect of UI implementation so move it to
a more appropriate place, such as ui/. This also helps declutter
the top-level.

A static library is appropriate to encapsulate the dependencies
as private and it is better supported by CMake than object libraries.

Also version_info.h should not be installed as a public header.
2021-07-04 10:37:49 +00:00
Gerald Combs 0bc39aa2eb Win32: Compile ui/win32 as C++.
We always build the .c files in ui/win32 with Visual C++, so rename
them to .cpp and update CMakeLists.txt to match. Leave the C code mostly
intact for now, but this lets us take advantage of C++ features in the
future if desired.
2021-07-02 08:02:38 +00:00
Moshe Kaplan ebb8703a50 Wirehark Windows: Harden build with Shadow Stack and EHCONT metadata
Compile and link with the /CETCOMPAT and /guard:ehcont flags
on supported versions of Visual Studio
2021-06-28 16:37:11 +00:00
Peter Wu a7ef7ff40d CMake: clear stale MaxMindDB cache entries if needed
On macOS with Homebrew, the version is included with the library path.
On updates, the old MAXMINDDB_LIBRARY is invalidated. However
ws_find_package only checks MaxMindDB_LIBRARY. Windows has a similar
problem. Make sure to clear the stale value such that newer versions can
be found, fixing the build.

Fixes #17069
2021-06-24 22:55:50 +00:00
João Valverde ff9acff6f2 Replace usage of GLogLevel flags everywhere
ws_log_domains.h needs to be included before wslog.h to be used
to define WS_LOG_DOMAIN. Also the definition for enum ws_log_level
needs to be exported for other APIs so move that to ws_log_domains.h
and rename the file to ws_log_defs.h to reflect the new scope.
2021-06-17 12:00:10 +01:00
João Valverde 05ed76d4c0 wslog: Use plain format with "message" level
Try out a simpler format with the default log level.

Don't display process and file/function information with "message"
level (experimental).
2021-06-17 12:00:09 +01:00
João Valverde c025e793dd CMake: Remove -Wc++-compat
Happy days are here again.
2021-06-14 11:47:53 +00:00
João Valverde dc7f0b88bb Refactor our logging and extend the wslog API
Experience has shown that:

  1. The current logging methods are not very reliable or practical.
A logging bitmask makes little sense as the user-facing interface (who
would want debug but not crtical messages for example?); it's
computer-friendly and user-unfriendly. More importantly the console
log level preference is initialized too late in the startup process
to be used for the logging subsystem and that fact raises a number
of annoying and hard-to-fix usability issues.

  2. Coding around G_MESSAGES_DEBUG to comply with our log level mask
and not clobber the user's settings or not create unexpected log misses
is unworkable and generally follows the principle of most surprise.
The fact that G_MESSAGES_DEBUG="all" can leak to other programs using
GLib is also annoying.

  3. The non-structured GLib logging API is very opinionated and lacks
configurability beyond replacing the log handler.

  4. Windows GUI has some special code to attach to a console,
but it would be nice to abstract away the rest under a single
interface.

  5. Using this logger seems to be noticeably faster.

Deprecate the console log level preference and extend our API to
implement a log handler in wsutil/wslog.h to provide easy-to-use,
flexible and dependable logging during all execution phases.

Log levels have a hierarchy, from most verbose to least verbose
(debug to error). When a given level is set everything above that
is also enabled.

The log level can be set with an environment variable or a command
line option (parsed as soon as possible but still later than the
environment). The default log level is "message".

Dissector logging is not included because it is not clear what log
domain they should use. An explosion to thousands of domains is
not desirable and putting everything in a single domain is probably
too coarse and noisy. For now I think it makes sense to let them do
their own thing using g_log_default_handler() and continue using the
G_MESSAGES_DEBUG mechanism with specific domains for each individual
dissector.

In the future a mechanism may be added to selectively enable these
domains at runtime while trying to avoid the problems introduced
by G_MESSAGES_DEBUG.
2021-06-11 09:40:28 +00:00
João Valverde af2a88cd18 CMake: Reverse logic to handle debug code
Only enabling debug code by default with Debug build type
seems overly restrictive; debug output is still conditional
on the log level.
2021-06-10 00:57:49 +01:00
João Valverde 9b13c4352d epan: Add SMI version 2021-05-25 20:10:37 +01:00
João Valverde 6a772ab68c CMake: Rewrite preprocessor definitions again 2021-05-24 19:38:14 +00:00
João Valverde f273c62553 CMake: Enable LTO/IPO support for all platforms 2021-05-24 15:58:16 +00:00
João Valverde d34ade4d9a CMake: Refactor DISABLE_ASSERT option 2021-05-24 01:35:30 +00:00
João Valverde 9ba97d12d6 Add ws_debug() and use it
Replace most instances of ws_debug_printf() except in
epan/dissectors and dissector plugins.

Some replacements use printf(), some use ws_debug(), and
some were removed because they were dead or judged to be
temporary.
2021-05-24 01:13:19 +00:00
Anders Broman f5c05eedc5 Adding more than one protobuff file fails. 2021-05-20 18:37:51 +00:00
João Valverde 8eacd615c8 Disable assertions for release builds
Currently our build generates very many warnings if
G_DISABLE_ASSERT is defined.

Add ws_assert() and ws_assert_not_reached() to incrementally
replace existing assertions and then disable them using
WS_DISABLE_ASSERT.

Assertions are disabled with CMake build type Release.
By default the build type is RelWithDebInfo so the current
behaviour of enabling assertions by default is (for now) preserved.

Add some notes to README.Developer.
2021-05-19 03:52:45 +01:00
Gerald Combs 7b2c0edb74 CMake: Remove a no-longer-needed workaround.
It looks like the setting autogen properties for the wireshark target in
2c62e2eb3f means we don't have to work around CMake issue 22085 any
more.
2021-05-14 13:45:47 -07:00
Graham Bloice f6ad4812a2 Add SparkplugB dissector
Add a dissector for SparkplugB as a heuristic subdissector of MQTT
and which calls protobuf to dissect the messages payload.
2021-05-14 12:11:03 +01:00