aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil/CMakeLists.txt
AgeCommit message (Collapse)AuthorFilesLines
2023-12-08plugins: Improve build with !HAVE_PLUGINSJoão Valverde1-6/+1
Instead of not compiling plugins.c without HAVE_PLUGINS, we should disable plugin support in a way that is functionally the same as if the platform does not support it at runtime. This reduces the number of ifdefs and allows sharing more utility code for plugins.
2023-10-31wsutil: Rename inet_netw.[ch]João Valverde1-2/+2
inet_netw.c -> inet_cidr.c inet_netw.h -> inet_cidr.h
2023-10-31wsutil: Move and consolidate CIDR codeJoão Valverde1-0/+2
Consolidate code to handle CIDR network addresses in inet_netw.[ch].
2023-10-31wsutil: Consolidate IP address codeJoão Valverde1-2/+0
Consolidate code to handle IP addresses in inet_addr.[ch].
2023-10-27dfilter: Install plugin headersJoão Valverde1-0/+1
Install headers required to build display filter plugins. Refactoring and optimizing system headers is an ongoing effort.
2023-10-19Fixup vcpkg-export-20231017-1Gerald Combs1-2/+2
GLib's debug libraries link against pcre2-8d.lib, which means we have to as well. Revert some debugging in GitLab CI.
2023-09-16Move ws_return macros to ws_assert.hJoão Valverde1-1/+0
2023-09-03Build with NetBSD's strptime()João Valverde1-4/+2
Replace our strptime code, which is from gnulib, with the simpler and better NetBSD implementation. This changes the ws_strptime() stub to unconditionally use the internal implementation. Previously it would use the system implementation of available. This is still possible but is opt-in, i.e., code should add the necessary #ifdefs and assume responsability for handling non-portable formats or providing limited functionality on some platforms. Text import allows the user to specify the strptime() format freely, so in that case it makes sense to use the system's implementation, and pass the responsability for understanding the implementation and the supported specifiers to the user. Only fall back to our implementation if the system libc lacks a strptime().
2023-02-13Enable rpathification and working relocation on Linux (take 3)João Valverde1-0/+39
Dumpcap depends on wsutil.so. The path to the shared library is encoded in the RPATH (or RUNPATH) property of ELF binaries. This is currently an absolute path on most Unixy systems. Dumpcap could not be made to work with a relative RPATH because it uses elevated privileges and some loaders will ignore relative RPATHs and non-standard paths under those circumstances, because of (justified) security concerns. To enable relocation of the program we link dumpcap statically with wsutil instead. This provides a fully working relocatable installation on Linux and other platforms that support relative RPATHs.
2023-02-12CMake: Check sse4.2 compiler option for x86 onlyBiswapriyo Nath1-6/+10
This prevents checking sse4.2 compiler flag in non-x86 architectures. Also set COMPILE_CAN_HANDLE_SSE4_2 and SSE4_2_FLAG variables to false and empty values respectively to skip subsequent checks.
2023-02-12Revert "Enable rpathification and working relocation on Linux (take 2)"João Valverde1-39/+0
This reverts commit 8dfe8737c554b4e4b2b48b994290a75c261e0f11
2023-02-12Enable rpathification and working relocation on Linux (take 2)João Valverde1-0/+39
Dumpcap depends on wsutil.so. The path to the shared library is encoded in the RPATH (or RUNPATH) property of ELF binaries. This is currently an absolute path on most Unixy systems. Dumpcap could not be made to work with a relative RPATH because it uses elevated privileges and some loaders will ignore relative RPATHs and non-standard paths under those circumstances, because of (justified) security concerns. To enable relocation of the program we link dumpcap statically with wsutil instead. This provides a fully working relocatable installation on Linux and other platforms that support relative RPATHs.
2023-02-12CMake: Remove unnecessary wmem object libraryJoão Valverde1-9/+77
The cmake wmem sub-library code is superfluous and adds complexity if trying to build parallel different configurations of wsutil.
2023-02-10Move ui/filter_files.[ch] to wsutilJoão Valverde1-0/+1
2023-02-10Move ui/clopts_common.[ch] to wsutilJoão Valverde1-0/+2
2023-02-10Move ui/cmdarg_err.[ch] to wsutilJoão Valverde1-0/+2
2023-02-07Move ui/version_info.[ch] to wsutilJoão Valverde1-0/+8
2023-02-06Remove wsutil/netlink.h workaroundJoão Valverde1-1/+0
2023-02-06CMake: Cleanup unnecessary linking with shared librariesJoão Valverde1-7/+6
2023-01-30Revert "Enable rpathification and working relocation on Linux"Gerald Combs1-32/+0
This reverts commit 7a346c398a911a9883cc67f12542f04f87a21ee8.
2023-01-29Enable rpathification and working relocation on LinuxJoão Valverde1-0/+32
Dumpcap depends on wsutil.so. The path to the shared library is encoded in the RPATH (or RUNPATH) property of ELF binaries. This is currently an absolute path on most Unixy systems. Dumpcap could not be made to work with a relative RPATH because it uses elevated privileges and some loaders will ignore relative RPATHs and non-standard paths under those circumstances, because of (justified) security concerns. To enable relocation of the program we link dumpcap statically with wsutil instead. This provides a fully working relocatable installation on Linux and other platforms that support relative RPATHs.
2023-01-29wsutil: Filesystem routine updates.Gerald Combs1-0/+9
Make sure init_plugin_dir and get_doc_dir uses the same logic as get_datafile_dir. Update each so that the xxx_DATA_DIR and xxx_PLUGIN_DIR environment variables take precedence. CMake's ENABLE_APPLICATION_BUNDLE determines whether or not we're using an application bundle layout, so check for it instead of __APPLE__.
2023-01-26Add support for configuration path relocation on UnixJoão Valverde1-22/+14
Get the installation prefix from the program dir. We have code to obtain the directory where the executable resides for all platforms we support, Linux, BSDs, Apple, etc. On less well-known platforms where this isn't true (POSIX does not define any standard interfaces for this) we fallback on using a hard-coded installation prefix, like we have been doing until now. The path relocation allows the whole installation tree to be moved without having to recompile the program. But note there are other requirements for shared libraries to have full support for relocation. This is only partial support. We now use a header to pass the relative path definitions to avoid excessively long compilation command lines as the number of #defines increases.
2023-01-19Install documentation (HTML manuals) to DOCDIRJoão Valverde1-0/+4
Install documentation to DOCDIR instead of DATADIR. The code must be fixed to open the Help URLs from this new path. This only affects Unix-like FHS platforms. Windows installation does its own thing. Needs testing with macOS packaging.
2023-01-18CMake: Require explicit installation of development headersJoão Valverde1-0/+2
Develpment headers are a sizeable part of the binary installation and most users won't ever require them. It's recommended to package them separately in a devel package or SDK. Create a CMake installation component for development headers and add the EXCLUDE_FROM_ALL property. Headers can be installed using the invocation: cmake --install <dir> --component Development
2023-01-12MSYS2: Fix system installationJoão Valverde1-3/+18
Make the "ninja install" target in the MINGW64 shell work and allow Wireshark to run from the msys2 installation, besides the build directory. To clarify the names used here MSYSTEM is the distribution with a Linux-like environment for Windows. MINGW is the toolchain. It is possible to use MinGW without MSYS2 and we generally select the CMake variables WIN32/MSVC/MINGW/USE_MSYSTEM taking that into consideration but that WIN32+MINGW platform is not supported at the moment and it's unlikely to be supported in the near future.
2022-10-20CMake: Add -Werror to test binariesJoão Valverde1-0/+1
2022-10-11Windows: Store "gui.console_open" in the Windows registryJoão Valverde1-1/+11
This removes the last dependency of the logging subsystem on the preferences module. The latter is started much later than the former and this is an issue. The Windows-only preference "gui.console_open" is stored in the registry as HKEY_LOCAL_USER\Software\Wireshark\ConsoleOpen. The semantics are exactly the same. The preference is read by the logging subsystem for initialization and then again by the preferences (read/write) so the user can configure it as before. The code to store the preference also in the preferences file was kept, for backward compatibility and because it is not incompatible with using the Registry concurrently. The elimination of the prefs dependency also allows moving the Windows console logic to wsutil and add the functionality to wslog directly, thereby eliminating the superfluous Wireshark/Logray custom log handler. To be able to read the ws_log_console_open global variable from libwireshark it becomes necessary to add a new export macro symbol called WSUTIL_EXPORT.
2022-10-07wiretap: Add enum generationJoão Valverde1-0/+2
2022-08-03About: Reformat and expand some text.João Valverde1-2/+0
2022-04-18Revert "wsutil: Use a separate "extlog" directory for Logwolf extcaps."Gerald Combs1-1/+0
This reverts commit 54553de59d24175ede07d3b423080cb9824c3360. As noted in !6694, it would probably make more sense to handle this a different way.
2022-04-07wsutil: Use a separate "extlog" directory for Logwolf extcaps.Gerald Combs1-0/+1
If we're running in the Logwolf configuration namespace, look for extcaps in a directory named "extlog". This paves the way for adding log-specific capture utilities.
2022-03-09Rename the "image" directory to "resources".Gerald Combs1-1/+1
The "image" directory contains resource compiler assets and other application resources, so name it "resources."
2022-02-24wsutil: New API to gather compile/runtime infoDavid Perry1-0/+2
2022-01-05ws_assert: refactor assertionsJoão Valverde1-1/+0
2021-11-14Move regex code to wsutilJoão Valverde1-0/+4
2021-10-22wireshark.h: Remove wmem dependency.João Valverde1-0/+1
Start smaller. Remove the return macros from wslog.h because that pulls in a wmem dependency and the interface is not very stable yet.
2021-10-18wsutil: install missing public header wsgcrypt.hBrian Sipos1-0/+1
2021-10-11wsutil: Provide static inline g_memdup2 in glib-compat.h to not export itBalint Reczey1-1/+0
Shared libraries should not export symbols exported by other libraries to avoid collisions. Fixes #17645.
2021-09-17Merge ws_getopt source filesJoão Valverde1-1/+0
No need to keep a separate ws_getopt_long.c file.
2021-09-17Use the musl in-tree getopt_long() everywhereJoão Valverde1-4/+3
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-08-20Move LINKTYPE_WIRESHARK_UPPER_PDU definitions to a separate header.Guy Harris1-0/+1
Have wsutil/exported_pdu_tlvs.h define the LINKTYPE_WIRESHARK_UPPER_PDU TLV type and length values, as well as the port type values written to files in EXP_PDU_TAG_PORT_TYPE TLVs. Update the comment that describes the LINKTYPE_WIRESHARK_UPPER_PDU TLVs to more completely and correctly reflect reality (it was moved from epan/exported_pdu.h to wsutil/exported_pdu_tlvs.h). Rename those port type values from OLD_PT_ to EXP_PDU_PT_; there is nothing "old" about them - yes, they originally had the same numerical values as the PT_ enum values in libwireshark, but that's no longer the case, and the two are now defined independently. Rename routines that map between libwireshark PT_ values and EXP_PDU_PT_ values to remove "old" from the name while we're at it. Don't include epan/exported_pdu.h if we only need the LINKTYPE_WIRESHARK_UPPER_PDU definitions - just include wsutil/exported_pdu_tlvs.h. In extcap/udpdump.c, include wsutil/exported_pdu_tlvs.h rather than defining the TLV types ourselves.
2021-07-29Move bytes_to_str() to wsutilJoão Valverde1-0/+2
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-26Move wmem to wsutilJoão Valverde1-0/+3
This allows wmem to be used from other libraries, namely wsutil. It is often the case that a funtion exists in wsutil and cannot be used with a wmem scope, requiring some code duplication or extra memory allocations, or vice-versa, code in epan cannot be moved to wsutil because it has a wmem dependency. To this end wmem is moved to wsutil. Scope management remains part of epan because those scope semantics are specific to dissection.
2021-07-14CMake: Adjust wsutil includes and linking.Gerald Combs1-14/+15
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-11wsutil: Start adding a test suiteJoão Valverde1-0/+11
2021-06-25wsutil: Rewrite ws_assert() to minimize dependenciesJoão Valverde1-0/+1
This includes as little as possible in the assertion header, so that it can be included globally in every file without pulling any unwanted definitions. In particular pulling stdlib.h is avoided because that can have side effects if it wants to include non-portable extensions. It is possible to have side-effects from include glib.h too, for example because of G_LOG_DOMAIN. These side-effects are usually avoidable with careful ordering of pre-processor directives but with multiple levels of indirections it can be hard to track. Better to make it robust to these kinds of failures in the first place. Also integrate with our logger for a cohesive experience (but keep it a private dependency).
2021-06-16wsutil: add a header that defines some "round to power of 2" macros.Guy Harris1-0/+1
Add macros to round to multiples of 2, 4, 8, 16, and 32. Use them instead of independently defined macros. (We don't define a general "round to a power of 2" macro to avoid the risk of somebody passing something other than a power of 2 to it.)
2021-06-06wslog: Include function name in ws_debug() output formatJoão Valverde1-0/+1
The GLib documentation says G_STRLOC includes the function name but that is a lie[1]. Change ws_debug() to not use G_STRLOC and receive __FILE__, __LINE__ and G_STRFUNC separately instead. [1]https://bugzilla.gnome.org/show_bug.cgi?id=69097
2021-05-24Add ws_debug() and use itJoão Valverde1-1/+1
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.