2006-11-30 21:32:05 +00:00
|
|
|
/* epan.c
|
Give libethereal its own configuration file, and have that configuration
file, rather than the top-level Ethereal configuration file, check for
"inet_aton()", "inet_pton()", and "inet_ntop()". Then make its
Makefile.am include the appropriate object files if necessary.
Otherwise, they don't get built and put into libethereal, and therefore
attempts to link with anything in libethereal that uses them fail on
platforms that lack ethem, causing the build to fail.
That means a bunch of things need to be fixed to cope with libethereal
having its own "config.h" file; this means removing the include of
"config.h" from some libethereal header files. Move the definitions of
the path names used only by "resolv.c" to "resolv.c" from "resolv.h" (so
"resolv.h" doesn't need "config.h", define HAVE_PLUGINS in the configure
script (so we don't have to include it in "plugins.h" to check whether
HAVE_DLFCN_H is defined).
Unfortunately, stuff outside libethereal needs to know PLUGIN_DIR; for
now, define that in the top-level configuration file, and have Ethereal
and Tethereal pass it as an argument to "epan_init()" - that should be
cleaned up at some point.
Remove from the top-level configure script checks for things used only
in libethereal.
svn path=/trunk/; revision=2498
2000-10-16 23:18:05 +00:00
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark Protocol Analyzer Library
|
2006-11-30 21:32:05 +00:00
|
|
|
*
|
|
|
|
* Copyright (c) 2001 by Gerald Combs <gerald@wireshark.org>
|
|
|
|
*
|
2018-02-07 11:26:45 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
Give libethereal its own configuration file, and have that configuration
file, rather than the top-level Ethereal configuration file, check for
"inet_aton()", "inet_pton()", and "inet_ntop()". Then make its
Makefile.am include the appropriate object files if necessary.
Otherwise, they don't get built and put into libethereal, and therefore
attempts to link with anything in libethereal that uses them fail on
platforms that lack ethem, causing the build to fail.
That means a bunch of things need to be fixed to cope with libethereal
having its own "config.h" file; this means removing the include of
"config.h" from some libethereal header files. Move the definitions of
the path names used only by "resolv.c" to "resolv.c" from "resolv.h" (so
"resolv.h" doesn't need "config.h", define HAVE_PLUGINS in the configure
script (so we don't have to include it in "plugins.h" to check whether
HAVE_DLFCN_H is defined).
Unfortunately, stuff outside libethereal needs to know PLUGIN_DIR; for
now, define that in the top-level configuration file, and have Ethereal
and Tethereal pass it as an argument to "epan_init()" - that should be
cleaned up at some point.
Remove from the top-level configure script checks for things used only
in libethereal.
svn path=/trunk/; revision=2498
2000-10-16 23:18:05 +00:00
|
|
|
*/
|
2000-09-27 04:55:05 +00:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2015-10-28 00:41:23 +00:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
2013-02-21 18:23:29 +00:00
|
|
|
#include <wsutil/wsgcrypt.h>
|
2006-08-10 06:06:21 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LIBGNUTLS
|
|
|
|
#include <gnutls/gnutls.h>
|
|
|
|
#endif /* HAVE_LIBGNUTLS */
|
|
|
|
|
2000-09-27 04:55:05 +00:00
|
|
|
#include <glib.h>
|
2013-12-03 21:31:04 +00:00
|
|
|
|
2017-09-26 14:04:56 +00:00
|
|
|
#include <version_info.h>
|
2017-04-08 19:45:19 +00:00
|
|
|
#include <wsutil/report_message.h>
|
2015-10-28 00:41:23 +00:00
|
|
|
|
|
|
|
#include <epan/exceptions.h>
|
|
|
|
|
2001-12-18 19:09:08 +00:00
|
|
|
#include "epan.h"
|
2017-12-08 04:33:22 +00:00
|
|
|
#include "epan/frame_data.h"
|
|
|
|
|
2013-12-03 21:31:04 +00:00
|
|
|
#include "dfilter/dfilter.h"
|
2001-12-18 19:09:08 +00:00
|
|
|
#include "epan_dissect.h"
|
2000-09-27 04:55:05 +00:00
|
|
|
|
2017-12-08 04:33:22 +00:00
|
|
|
#include <wsutil/nstime.h>
|
|
|
|
|
2000-09-27 04:55:05 +00:00
|
|
|
#include "conversation.h"
|
|
|
|
#include "except.h"
|
2000-10-06 10:11:40 +00:00
|
|
|
#include "packet.h"
|
2007-11-30 09:22:01 +00:00
|
|
|
#include "prefs.h"
|
2001-12-18 19:09:08 +00:00
|
|
|
#include "column-utils.h"
|
2004-09-29 00:06:36 +00:00
|
|
|
#include "tap.h"
|
2004-08-06 19:57:49 +00:00
|
|
|
#include "addr_resolv.h"
|
2007-08-25 01:14:24 +00:00
|
|
|
#include "oids.h"
|
2012-10-27 02:42:05 +00:00
|
|
|
#include "wmem/wmem.h"
|
2005-09-11 16:55:34 +00:00
|
|
|
#include "expert.h"
|
2015-03-20 00:59:42 +00:00
|
|
|
#include "print.h"
|
2015-12-13 04:38:21 +00:00
|
|
|
#include "capture_dissectors.h"
|
2016-06-12 16:28:02 +00:00
|
|
|
#include "exported_pdu.h"
|
2017-01-16 21:08:12 +00:00
|
|
|
#include "export_object.h"
|
2017-01-16 21:41:53 +00:00
|
|
|
#include "stat_tap_ui.h"
|
2017-01-19 20:57:08 +00:00
|
|
|
#include "follow.h"
|
2017-01-19 21:32:51 +00:00
|
|
|
#include "disabled_protos.h"
|
2017-01-20 09:30:59 +00:00
|
|
|
#include "decode_as.h"
|
2019-11-04 09:42:29 +00:00
|
|
|
#include "conversation_filter.h"
|
2017-01-20 13:52:05 +00:00
|
|
|
#include "conversation_table.h"
|
2017-01-20 16:02:52 +00:00
|
|
|
#include "reassemble.h"
|
2017-02-03 22:49:27 +00:00
|
|
|
#include "srt_table.h"
|
2017-02-05 22:00:51 +00:00
|
|
|
#include "stats_tree.h"
|
2018-11-18 17:11:42 +00:00
|
|
|
#include "secrets.h"
|
2019-01-28 12:50:24 +00:00
|
|
|
#include "funnel.h"
|
2017-02-21 15:37:29 +00:00
|
|
|
#include <dtd.h>
|
2000-09-27 04:55:05 +00:00
|
|
|
|
2017-08-29 14:34:31 +00:00
|
|
|
#ifdef HAVE_PLUGINS
|
|
|
|
#include <wsutil/plugins.h>
|
|
|
|
#endif
|
|
|
|
|
2012-06-25 20:42:07 +00:00
|
|
|
#ifdef HAVE_LUA
|
2010-07-15 02:07:16 +00:00
|
|
|
#include <lua.h>
|
|
|
|
#include <wslua/wslua.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_LIBSMI
|
|
|
|
#include <smi.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <ares_version.h>
|
2006-09-25 01:09:00 +00:00
|
|
|
|
2016-08-26 13:18:29 +00:00
|
|
|
#ifdef HAVE_NGHTTP2
|
|
|
|
#include <nghttp2/nghttp2ver.h>
|
|
|
|
#endif
|
|
|
|
|
2019-04-10 10:52:52 +00:00
|
|
|
#ifdef HAVE_BROTLI
|
|
|
|
#include <brotli/decode.h>
|
|
|
|
#endif
|
|
|
|
|
2017-04-04 21:23:59 +00:00
|
|
|
#ifdef HAVE_LIBXML2
|
|
|
|
#include <libxml/xmlversion.h>
|
|
|
|
#include <libxml/parser.h>
|
|
|
|
#endif
|
|
|
|
|
2018-03-08 17:32:51 +00:00
|
|
|
#ifndef _WIN32
|
|
|
|
#include <signal.h>
|
|
|
|
#endif
|
|
|
|
|
2018-08-28 20:39:55 +00:00
|
|
|
static GSList *epan_plugin_register_all_procotols = NULL;
|
|
|
|
static GSList *epan_plugin_register_all_handoffs = NULL;
|
2017-08-29 14:34:31 +00:00
|
|
|
|
2013-11-04 14:12:59 +00:00
|
|
|
static wmem_allocator_t *pinfo_pool_cache = NULL;
|
|
|
|
|
2019-09-04 11:51:29 +00:00
|
|
|
/* Global variables holding the content of the corresponding environment variable
|
|
|
|
* to save fetching it repeatedly.
|
|
|
|
*/
|
|
|
|
gboolean wireshark_abort_on_dissector_bug = FALSE;
|
|
|
|
gboolean wireshark_abort_on_too_many_items = FALSE;
|
|
|
|
|
2017-09-30 23:56:03 +00:00
|
|
|
#ifdef HAVE_PLUGINS
|
|
|
|
plugins_t *libwireshark_plugins = NULL;
|
2017-08-29 14:34:31 +00:00
|
|
|
static GSList *epan_plugins = NULL;
|
2017-09-30 23:56:03 +00:00
|
|
|
#endif
|
|
|
|
|
2011-06-16 07:27:48 +00:00
|
|
|
const gchar*
|
2006-06-13 08:18:50 +00:00
|
|
|
epan_get_version(void) {
|
2011-06-16 07:27:48 +00:00
|
|
|
return VERSION;
|
2006-06-13 08:18:50 +00:00
|
|
|
}
|
|
|
|
|
2017-09-03 14:03:31 +00:00
|
|
|
void
|
|
|
|
epan_get_version_number(int *major, int *minor, int *micro)
|
|
|
|
{
|
|
|
|
get_ws_version_number(major, minor, micro);
|
|
|
|
}
|
|
|
|
|
2017-02-09 14:00:19 +00:00
|
|
|
#if defined(_WIN32)
|
2016-12-08 23:16:00 +00:00
|
|
|
// Libgcrypt prints all log messages to stderr by default. This is noisier
|
|
|
|
// than we would like on Windows. In particular slow_gatherer tends to print
|
|
|
|
// "NOTE: you should run 'diskperf -y' to enable the disk statistics"
|
|
|
|
// which we don't care about.
|
|
|
|
static void
|
|
|
|
quiet_gcrypt_logger (void *dummy _U_, int level, const char *format, va_list args)
|
|
|
|
{
|
|
|
|
GLogLevelFlags log_level = G_LOG_LEVEL_WARNING;
|
|
|
|
|
|
|
|
switch (level) {
|
|
|
|
case GCRY_LOG_CONT: // Continuation. Ignore for now.
|
|
|
|
case GCRY_LOG_DEBUG:
|
|
|
|
case GCRY_LOG_INFO:
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
case GCRY_LOG_WARN:
|
|
|
|
case GCRY_LOG_BUG:
|
|
|
|
log_level = G_LOG_LEVEL_WARNING;
|
|
|
|
break;
|
|
|
|
case GCRY_LOG_ERROR:
|
|
|
|
log_level = G_LOG_LEVEL_ERROR;
|
|
|
|
break;
|
|
|
|
case GCRY_LOG_FATAL:
|
|
|
|
log_level = G_LOG_LEVEL_CRITICAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
g_logv(NULL, log_level, format, args);
|
|
|
|
}
|
2017-02-09 14:00:19 +00:00
|
|
|
#endif // _WIN32
|
2016-12-08 23:16:00 +00:00
|
|
|
|
2017-08-29 14:34:31 +00:00
|
|
|
#ifdef HAVE_PLUGINS
|
|
|
|
static void
|
|
|
|
epan_plugin_init(gpointer data, gpointer user_data _U_)
|
|
|
|
{
|
|
|
|
((epan_plugin *)data)->init();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
epan_plugin_dissect_init(gpointer data, gpointer user_data)
|
|
|
|
{
|
|
|
|
((epan_plugin *)data)->dissect_init((epan_dissect_t *)user_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
epan_plugin_dissect_cleanup(gpointer data, gpointer user_data)
|
|
|
|
{
|
|
|
|
((epan_plugin *)data)->dissect_cleanup((epan_dissect_t *)user_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
epan_plugin_cleanup(gpointer data, gpointer user_data _U_)
|
|
|
|
{
|
|
|
|
((epan_plugin *)data)->cleanup();
|
|
|
|
}
|
|
|
|
|
|
|
|
void epan_register_plugin(const epan_plugin *plug)
|
|
|
|
{
|
|
|
|
epan_plugins = g_slist_prepend(epan_plugins, (epan_plugin *)plug);
|
|
|
|
if (plug->register_all_protocols)
|
2018-08-28 20:39:55 +00:00
|
|
|
epan_plugin_register_all_procotols = g_slist_prepend(epan_plugin_register_all_procotols, plug->register_all_protocols);
|
2017-08-29 14:34:31 +00:00
|
|
|
if (plug->register_all_handoffs)
|
2018-08-28 20:39:55 +00:00
|
|
|
epan_plugin_register_all_handoffs = g_slist_prepend(epan_plugin_register_all_handoffs, plug->register_all_handoffs);
|
2017-08-29 14:34:31 +00:00
|
|
|
}
|
2019-07-18 09:28:04 +00:00
|
|
|
|
|
|
|
void epan_plugin_register_all_tap_listeners(gpointer data, gpointer user_data _U_)
|
|
|
|
{
|
|
|
|
epan_plugin *plug = (epan_plugin *)data;
|
|
|
|
if (plug->register_all_tap_listeners)
|
|
|
|
plug->register_all_tap_listeners();
|
|
|
|
}
|
2017-08-29 14:34:31 +00:00
|
|
|
#endif
|
|
|
|
|
2015-10-28 00:41:23 +00:00
|
|
|
gboolean
|
2018-09-08 15:02:06 +00:00
|
|
|
epan_init(register_cb cb, gpointer client_data, gboolean load_plugins)
|
2000-09-27 04:55:05 +00:00
|
|
|
{
|
2015-10-28 12:42:23 +00:00
|
|
|
volatile gboolean status = TRUE;
|
2015-10-28 00:41:23 +00:00
|
|
|
|
2019-09-04 11:51:29 +00:00
|
|
|
/* Get the value of some environment variables and set corresponding globals for performance reasons*/
|
|
|
|
/* If the WIRESHARK_ABORT_ON_DISSECTOR_BUG environment variable is set,
|
|
|
|
* it will call abort(), instead, to make it easier to get a stack trace.
|
|
|
|
*/
|
|
|
|
if (getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL) {
|
|
|
|
wireshark_abort_on_dissector_bug = TRUE;
|
|
|
|
} else {
|
|
|
|
wireshark_abort_on_dissector_bug = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (getenv("WIRESHARK_ABORT_ON_TOO_MANY_ITEMS") != NULL) {
|
|
|
|
wireshark_abort_on_too_many_items = TRUE;
|
|
|
|
} else {
|
|
|
|
wireshark_abort_on_too_many_items = FALSE;
|
|
|
|
}
|
|
|
|
|
2017-12-24 11:59:47 +00:00
|
|
|
/*
|
|
|
|
* proto_init -> register_all_protocols -> g_async_queue_new which
|
|
|
|
* requires threads to be initialized. This happens automatically with
|
|
|
|
* GLib 2.32, before that g_thread_init must be called. But only since
|
|
|
|
* GLib 2.24, multiple invocations are allowed. Check for an earlier
|
|
|
|
* invocation just in case.
|
|
|
|
*/
|
2015-02-03 22:15:23 +00:00
|
|
|
/* initialize memory allocation subsystem */
|
2012-10-27 02:42:05 +00:00
|
|
|
wmem_init();
|
2006-11-21 00:30:36 +00:00
|
|
|
|
2006-11-21 00:16:44 +00:00
|
|
|
/* initialize the GUID to name mapping table */
|
|
|
|
guids_init();
|
|
|
|
|
2015-10-28 14:38:39 +00:00
|
|
|
/* initialize name resolution (addr_resolv.c) */
|
|
|
|
addr_resolv_init();
|
2013-08-07 16:46:08 +00:00
|
|
|
|
2000-09-27 04:55:05 +00:00
|
|
|
except_init();
|
2017-02-09 14:00:19 +00:00
|
|
|
|
2018-09-08 15:02:06 +00:00
|
|
|
if (load_plugins) {
|
2017-09-30 23:56:03 +00:00
|
|
|
#ifdef HAVE_PLUGINS
|
2018-09-08 15:02:06 +00:00
|
|
|
libwireshark_plugins = plugins_init(WS_PLUGIN_EPAN);
|
2017-09-30 23:56:03 +00:00
|
|
|
#endif
|
2018-09-08 15:02:06 +00:00
|
|
|
}
|
2017-09-30 23:56:03 +00:00
|
|
|
|
|
|
|
/* initialize libgcrypt (beware, it won't be thread-safe) */
|
2012-10-11 08:28:57 +00:00
|
|
|
gcry_check_version(NULL);
|
2017-02-09 14:00:19 +00:00
|
|
|
#if defined(_WIN32)
|
2016-12-08 23:16:00 +00:00
|
|
|
gcry_set_log_handler (quiet_gcrypt_logger, NULL);
|
|
|
|
#endif
|
2012-10-11 08:28:57 +00:00
|
|
|
gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
|
|
|
|
gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
|
2006-08-10 06:06:21 +00:00
|
|
|
#ifdef HAVE_LIBGNUTLS
|
|
|
|
gnutls_global_init();
|
2017-04-04 21:23:59 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_LIBXML2
|
|
|
|
xmlInitParser();
|
|
|
|
LIBXML_TEST_VERSION;
|
2006-08-10 06:06:21 +00:00
|
|
|
#endif
|
2018-03-08 17:32:51 +00:00
|
|
|
|
|
|
|
#ifndef _WIN32
|
|
|
|
// We might receive a SIGPIPE due to maxmind_db.
|
|
|
|
signal(SIGPIPE, SIG_IGN);
|
|
|
|
#endif
|
|
|
|
|
2015-10-28 00:41:23 +00:00
|
|
|
TRY {
|
|
|
|
tap_init();
|
|
|
|
prefs_init();
|
|
|
|
expert_init();
|
|
|
|
packet_init();
|
2018-11-18 17:11:42 +00:00
|
|
|
secrets_init();
|
2017-02-09 17:28:14 +00:00
|
|
|
conversation_init();
|
2015-12-13 18:02:19 +00:00
|
|
|
capture_dissector_init();
|
2017-01-29 00:53:36 +00:00
|
|
|
reassembly_tables_init();
|
2017-08-29 14:34:31 +00:00
|
|
|
#ifdef HAVE_PLUGINS
|
|
|
|
g_slist_foreach(epan_plugins, epan_plugin_init, NULL);
|
|
|
|
#endif
|
2018-08-28 20:39:55 +00:00
|
|
|
proto_init(epan_plugin_register_all_procotols, epan_plugin_register_all_handoffs, cb, client_data);
|
2019-07-18 09:28:04 +00:00
|
|
|
#ifdef HAVE_PLUGINS
|
|
|
|
g_slist_foreach(epan_plugins, epan_plugin_register_all_tap_listeners, NULL);
|
|
|
|
#endif
|
2015-10-28 00:41:23 +00:00
|
|
|
packet_cache_proto_handles();
|
|
|
|
dfilter_init();
|
|
|
|
final_registration_all_protocols();
|
|
|
|
print_cache_field_handles();
|
|
|
|
expert_packet_init();
|
2016-06-12 16:28:02 +00:00
|
|
|
export_pdu_init();
|
2012-06-25 20:42:07 +00:00
|
|
|
#ifdef HAVE_LUA
|
2015-10-28 00:41:23 +00:00
|
|
|
wslua_init(cb, client_data);
|
2006-09-25 01:09:00 +00:00
|
|
|
#endif
|
2015-10-28 00:41:23 +00:00
|
|
|
}
|
|
|
|
CATCH(DissectorError) {
|
|
|
|
/*
|
|
|
|
* This is probably a dissector, or something it calls,
|
|
|
|
* calling REPORT_DISSECTOR_ERROR() in a registration
|
|
|
|
* routine or something else outside the normal dissection
|
|
|
|
* code path.
|
|
|
|
*/
|
|
|
|
const char *exception_message = GET_MESSAGE;
|
|
|
|
static const char dissector_error_nomsg[] =
|
|
|
|
"Dissector writer didn't bother saying what the error was";
|
|
|
|
|
|
|
|
report_failure("Dissector bug: %s",
|
|
|
|
exception_message == NULL ?
|
|
|
|
dissector_error_nomsg : exception_message);
|
|
|
|
if (getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL)
|
|
|
|
abort();
|
|
|
|
status = FALSE;
|
|
|
|
}
|
|
|
|
ENDTRY;
|
|
|
|
return status;
|
2000-09-27 04:55:05 +00:00
|
|
|
}
|
|
|
|
|
2017-04-09 19:27:57 +00:00
|
|
|
/*
|
|
|
|
* Load all settings, from the current profile, that affect libwireshark.
|
|
|
|
*/
|
|
|
|
e_prefs *
|
|
|
|
epan_load_settings(void)
|
|
|
|
{
|
|
|
|
e_prefs *prefs_p;
|
|
|
|
|
|
|
|
/* load the decode as entries of the current profile */
|
|
|
|
load_decode_as_entries();
|
|
|
|
|
|
|
|
prefs_p = read_prefs();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Read the files that enable and disable protocols and heuristic
|
|
|
|
* dissectors.
|
|
|
|
*/
|
|
|
|
read_enabled_and_disabled_lists();
|
|
|
|
|
|
|
|
return prefs_p;
|
|
|
|
}
|
|
|
|
|
2000-09-27 04:55:05 +00:00
|
|
|
void
|
|
|
|
epan_cleanup(void)
|
|
|
|
{
|
2017-08-29 14:34:31 +00:00
|
|
|
#ifdef HAVE_PLUGINS
|
|
|
|
g_slist_foreach(epan_plugins, epan_plugin_cleanup, NULL);
|
2018-05-23 15:58:05 +00:00
|
|
|
g_slist_free(epan_plugins);
|
2017-08-29 14:34:31 +00:00
|
|
|
epan_plugins = NULL;
|
|
|
|
#endif
|
2018-08-28 20:39:55 +00:00
|
|
|
g_slist_free(epan_plugin_register_all_procotols);
|
|
|
|
epan_plugin_register_all_procotols = NULL;
|
|
|
|
g_slist_free(epan_plugin_register_all_handoffs);
|
|
|
|
epan_plugin_register_all_handoffs = NULL;
|
2017-08-29 14:34:31 +00:00
|
|
|
|
2000-09-27 04:55:05 +00:00
|
|
|
dfilter_cleanup();
|
2017-01-20 09:30:59 +00:00
|
|
|
decode_clear_all();
|
2018-05-30 07:00:16 +00:00
|
|
|
|
2019-01-25 21:55:24 +00:00
|
|
|
#ifdef HAVE_LUA
|
|
|
|
/*
|
|
|
|
* Must deregister Proto objects in Lua before destroying dissector
|
|
|
|
* tables in packet_cleanup(). Doing so will also deregister and free
|
|
|
|
* preferences, this must happen before prefs_cleanup(). That will
|
|
|
|
* update the list of deregistered fields which must be followed by
|
|
|
|
* proto_cleanup() to complete deallocation.
|
|
|
|
*/
|
|
|
|
wslua_early_cleanup();
|
|
|
|
#endif
|
|
|
|
|
2018-05-30 07:00:16 +00:00
|
|
|
/*
|
|
|
|
* Note: packet_cleanup() will call registered shutdown routines which
|
|
|
|
* may be used to deregister dynamically registered protocol fields,
|
|
|
|
* and prefs_cleanup() will call uat_clear() which also may be used to
|
|
|
|
* deregister dynamically registered protocol fields. This must be done
|
|
|
|
* before proto_cleanup() to avoid inconsistency and memory leaks.
|
|
|
|
*/
|
|
|
|
packet_cleanup();
|
|
|
|
prefs_cleanup();
|
|
|
|
proto_cleanup();
|
|
|
|
|
2018-11-18 17:11:42 +00:00
|
|
|
secrets_cleanup();
|
2017-01-20 11:19:18 +00:00
|
|
|
conversation_filters_cleanup();
|
2017-01-20 16:02:52 +00:00
|
|
|
reassembly_table_cleanup();
|
2017-01-24 13:19:22 +00:00
|
|
|
tap_cleanup();
|
2013-05-24 17:59:36 +00:00
|
|
|
expert_cleanup();
|
2015-12-13 04:38:21 +00:00
|
|
|
capture_dissector_cleanup();
|
2017-01-16 20:51:39 +00:00
|
|
|
export_pdu_cleanup();
|
2017-04-09 01:59:17 +00:00
|
|
|
cleanup_enabled_and_disabled_lists();
|
2017-02-05 22:00:51 +00:00
|
|
|
stats_tree_cleanup();
|
2019-01-28 08:16:32 +00:00
|
|
|
funnel_cleanup();
|
2017-02-21 15:37:29 +00:00
|
|
|
dtd_location(NULL);
|
2013-10-23 16:47:02 +00:00
|
|
|
#ifdef HAVE_LUA
|
|
|
|
wslua_cleanup();
|
|
|
|
#endif
|
2006-08-10 06:06:21 +00:00
|
|
|
#ifdef HAVE_LIBGNUTLS
|
|
|
|
gnutls_global_deinit();
|
2017-04-04 21:23:59 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_LIBXML2
|
|
|
|
xmlCleanupParser();
|
2006-08-10 06:06:21 +00:00
|
|
|
#endif
|
2000-09-27 04:55:05 +00:00
|
|
|
except_deinit();
|
2013-08-07 16:46:08 +00:00
|
|
|
addr_resolv_cleanup();
|
2014-04-03 16:55:51 +00:00
|
|
|
|
2017-09-30 23:56:03 +00:00
|
|
|
#ifdef HAVE_PLUGINS
|
|
|
|
plugins_cleanup(libwireshark_plugins);
|
|
|
|
libwireshark_plugins = NULL;
|
|
|
|
#endif
|
|
|
|
|
2014-04-03 16:55:51 +00:00
|
|
|
if (pinfo_pool_cache != NULL) {
|
|
|
|
wmem_destroy_allocator(pinfo_pool_cache);
|
|
|
|
pinfo_pool_cache = NULL;
|
|
|
|
}
|
|
|
|
|
2012-10-27 02:42:05 +00:00
|
|
|
wmem_cleanup();
|
2000-09-27 04:55:05 +00:00
|
|
|
}
|
|
|
|
|
2017-12-08 04:33:22 +00:00
|
|
|
struct epan_session {
|
|
|
|
struct packet_provider_data *prov; /* packet provider data for this session */
|
|
|
|
struct packet_provider_funcs funcs; /* functions using that data */
|
|
|
|
};
|
|
|
|
|
2013-07-21 18:38:03 +00:00
|
|
|
epan_t *
|
2017-12-08 04:33:22 +00:00
|
|
|
epan_new(struct packet_provider_data *prov,
|
|
|
|
const struct packet_provider_funcs *funcs)
|
2013-07-21 18:38:03 +00:00
|
|
|
{
|
2017-12-01 19:13:18 +00:00
|
|
|
epan_t *session = g_slice_new0(epan_t);
|
2013-07-21 18:38:03 +00:00
|
|
|
|
2017-12-08 03:31:43 +00:00
|
|
|
session->prov = prov;
|
2017-12-08 04:33:22 +00:00
|
|
|
session->funcs = *funcs;
|
2017-12-08 03:31:43 +00:00
|
|
|
|
2013-07-21 18:38:03 +00:00
|
|
|
/* XXX, it should take session as param */
|
|
|
|
init_dissection();
|
|
|
|
|
|
|
|
return session;
|
|
|
|
}
|
|
|
|
|
2013-08-01 20:59:38 +00:00
|
|
|
const char *
|
|
|
|
epan_get_user_comment(const epan_t *session, const frame_data *fd)
|
|
|
|
{
|
2017-12-08 04:33:22 +00:00
|
|
|
if (session->funcs.get_user_comment)
|
|
|
|
return session->funcs.get_user_comment(session->prov, fd);
|
2013-08-01 20:59:38 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-07-22 19:38:38 +00:00
|
|
|
const char *
|
|
|
|
epan_get_interface_name(const epan_t *session, guint32 interface_id)
|
|
|
|
{
|
2017-12-08 04:33:22 +00:00
|
|
|
if (session->funcs.get_interface_name)
|
|
|
|
return session->funcs.get_interface_name(session->prov, interface_id);
|
2013-07-22 19:38:38 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2017-01-30 07:45:15 +00:00
|
|
|
const char *
|
|
|
|
epan_get_interface_description(const epan_t *session, guint32 interface_id)
|
|
|
|
{
|
2017-12-08 04:33:22 +00:00
|
|
|
if (session->funcs.get_interface_description)
|
|
|
|
return session->funcs.get_interface_description(session->prov, interface_id);
|
2017-01-30 07:45:15 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-07-21 20:48:30 +00:00
|
|
|
const nstime_t *
|
|
|
|
epan_get_frame_ts(const epan_t *session, guint32 frame_num)
|
|
|
|
{
|
2013-07-21 21:04:25 +00:00
|
|
|
const nstime_t *abs_ts = NULL;
|
2013-07-21 20:48:30 +00:00
|
|
|
|
2018-06-26 21:55:27 +00:00
|
|
|
if (session && session->funcs.get_frame_ts)
|
2017-12-08 04:33:22 +00:00
|
|
|
abs_ts = session->funcs.get_frame_ts(session->prov, frame_num);
|
2013-07-21 20:48:30 +00:00
|
|
|
|
|
|
|
if (!abs_ts)
|
2018-09-18 17:09:31 +00:00
|
|
|
g_warning("!!! couldn't get frame ts for %u !!!\n", frame_num);
|
2013-07-21 20:48:30 +00:00
|
|
|
|
|
|
|
return abs_ts;
|
|
|
|
}
|
|
|
|
|
2013-07-21 18:38:03 +00:00
|
|
|
void
|
|
|
|
epan_free(epan_t *session)
|
|
|
|
{
|
2013-08-13 22:41:34 +00:00
|
|
|
if (session) {
|
|
|
|
/* XXX, it should take session as param */
|
|
|
|
cleanup_dissection();
|
2013-07-21 18:38:03 +00:00
|
|
|
|
2013-08-13 22:41:34 +00:00
|
|
|
g_slice_free(epan_t, session);
|
|
|
|
}
|
2013-07-21 18:38:03 +00:00
|
|
|
}
|
|
|
|
|
2000-09-27 04:55:05 +00:00
|
|
|
void
|
|
|
|
epan_conversation_init(void)
|
|
|
|
{
|
2017-02-09 17:28:14 +00:00
|
|
|
conversation_epan_reset();
|
2009-09-06 18:25:23 +00:00
|
|
|
}
|
|
|
|
|
2014-02-21 06:11:41 +00:00
|
|
|
/* Overrides proto_tree_visible i epan_dissect_init to make all fields visible.
|
|
|
|
* This is > 0 if a Lua script wanted to see all fields all the time.
|
|
|
|
* This is ref-counted, so clearing it won't override other taps/scripts wanting it.
|
|
|
|
*/
|
|
|
|
static gint always_visible_refcount = 0;
|
|
|
|
|
|
|
|
void
|
|
|
|
epan_set_always_visible(gboolean force)
|
|
|
|
{
|
|
|
|
if (force)
|
|
|
|
always_visible_refcount++;
|
|
|
|
else if (always_visible_refcount > 0)
|
|
|
|
always_visible_refcount--;
|
|
|
|
}
|
|
|
|
|
2017-05-09 14:11:27 +00:00
|
|
|
void
|
2013-07-21 18:38:03 +00:00
|
|
|
epan_dissect_init(epan_dissect_t *edt, epan_t *session, const gboolean create_proto_tree, const gboolean proto_tree_visible)
|
2000-10-06 10:11:40 +00:00
|
|
|
{
|
2009-08-13 19:42:46 +00:00
|
|
|
g_assert(edt);
|
2000-10-06 10:11:40 +00:00
|
|
|
|
2013-07-21 18:38:03 +00:00
|
|
|
edt->session = session;
|
2012-12-02 17:01:04 +00:00
|
|
|
|
2013-11-04 14:12:59 +00:00
|
|
|
memset(&edt->pi, 0, sizeof(edt->pi));
|
|
|
|
if (pinfo_pool_cache != NULL) {
|
|
|
|
edt->pi.pool = pinfo_pool_cache;
|
|
|
|
pinfo_pool_cache = NULL;
|
|
|
|
}
|
|
|
|
else {
|
2014-04-29 06:57:40 +00:00
|
|
|
edt->pi.pool = wmem_allocator_new(WMEM_ALLOCATOR_BLOCK_FAST);
|
2013-11-04 14:12:59 +00:00
|
|
|
}
|
|
|
|
|
2001-12-06 04:25:09 +00:00
|
|
|
if (create_proto_tree) {
|
2012-08-10 20:33:01 +00:00
|
|
|
edt->tree = proto_tree_create_root(&edt->pi);
|
2014-02-21 06:11:41 +00:00
|
|
|
proto_tree_set_visible(edt->tree, (always_visible_refcount > 0) ? TRUE : proto_tree_visible);
|
2001-12-06 04:25:09 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
edt->tree = NULL;
|
|
|
|
}
|
2001-02-01 20:21:25 +00:00
|
|
|
|
2013-10-20 19:05:00 +00:00
|
|
|
edt->tvb = NULL;
|
2017-08-29 14:34:31 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_PLUGINS
|
|
|
|
g_slist_foreach(epan_plugins, epan_plugin_dissect_init, edt);
|
|
|
|
#endif
|
2001-12-18 19:09:08 +00:00
|
|
|
}
|
2000-10-06 10:11:40 +00:00
|
|
|
|
2013-10-20 10:21:25 +00:00
|
|
|
void
|
|
|
|
epan_dissect_reset(epan_dissect_t *edt)
|
|
|
|
{
|
|
|
|
/* We have to preserve the pool pointer across the memzeroing */
|
|
|
|
wmem_allocator_t *tmp;
|
|
|
|
|
|
|
|
g_assert(edt);
|
|
|
|
|
2013-11-23 02:20:13 +00:00
|
|
|
g_slist_free(edt->pi.proto_data);
|
2013-10-20 10:21:25 +00:00
|
|
|
g_slist_free(edt->pi.dependent_frames);
|
|
|
|
|
|
|
|
/* Free the data sources list. */
|
|
|
|
free_data_sources(&edt->pi);
|
|
|
|
|
|
|
|
if (edt->tvb) {
|
|
|
|
/* Free all tvb's chained from this tvb */
|
|
|
|
tvb_free_chain(edt->tvb);
|
|
|
|
edt->tvb = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (edt->tree)
|
|
|
|
proto_tree_reset(edt->tree);
|
|
|
|
|
|
|
|
tmp = edt->pi.pool;
|
|
|
|
wmem_free_all(tmp);
|
|
|
|
|
|
|
|
memset(&edt->pi, 0, sizeof(edt->pi));
|
|
|
|
edt->pi.pool = tmp;
|
|
|
|
}
|
|
|
|
|
2009-08-13 19:42:46 +00:00
|
|
|
epan_dissect_t*
|
2013-07-21 18:38:03 +00:00
|
|
|
epan_dissect_new(epan_t *session, const gboolean create_proto_tree, const gboolean proto_tree_visible)
|
2009-08-13 19:42:46 +00:00
|
|
|
{
|
2011-09-06 09:09:36 +00:00
|
|
|
epan_dissect_t *edt;
|
2009-08-13 19:42:46 +00:00
|
|
|
|
2010-06-02 19:29:14 +00:00
|
|
|
edt = g_new0(epan_dissect_t, 1);
|
2009-08-13 19:42:46 +00:00
|
|
|
|
2017-05-09 14:11:27 +00:00
|
|
|
epan_dissect_init(edt, session, create_proto_tree, proto_tree_visible);
|
|
|
|
return edt;
|
2009-08-13 19:42:46 +00:00
|
|
|
}
|
|
|
|
|
2009-08-11 18:08:03 +00:00
|
|
|
void
|
2010-04-03 18:18:50 +00:00
|
|
|
epan_dissect_fake_protocols(epan_dissect_t *edt, const gboolean fake_protocols)
|
2009-08-11 18:08:03 +00:00
|
|
|
{
|
|
|
|
if (edt)
|
|
|
|
proto_tree_set_fake_protocols(edt->tree, fake_protocols);
|
|
|
|
}
|
|
|
|
|
2001-12-18 19:09:08 +00:00
|
|
|
void
|
2014-05-25 00:04:44 +00:00
|
|
|
epan_dissect_run(epan_dissect_t *edt, int file_type_subtype,
|
2018-02-09 00:19:12 +00:00
|
|
|
wtap_rec *rec, tvbuff_t *tvb, frame_data *fd,
|
2015-10-28 14:38:39 +00:00
|
|
|
column_info *cinfo)
|
2001-12-18 19:09:08 +00:00
|
|
|
{
|
2013-02-25 17:32:25 +00:00
|
|
|
#ifdef HAVE_LUA
|
|
|
|
wslua_prime_dfilter(edt); /* done before entering wmem scope */
|
|
|
|
#endif
|
2012-11-03 15:49:15 +00:00
|
|
|
wmem_enter_packet_scope();
|
2018-02-09 00:19:12 +00:00
|
|
|
dissect_record(edt, file_type_subtype, rec, tvb, fd, cinfo);
|
2012-10-20 20:04:40 +00:00
|
|
|
|
|
|
|
/* free all memory allocated */
|
2012-11-03 15:49:15 +00:00
|
|
|
wmem_leave_packet_scope();
|
2000-10-06 10:11:40 +00:00
|
|
|
}
|
|
|
|
|
2012-10-20 19:27:24 +00:00
|
|
|
void
|
2014-05-25 00:04:44 +00:00
|
|
|
epan_dissect_run_with_taps(epan_dissect_t *edt, int file_type_subtype,
|
2018-02-09 00:19:12 +00:00
|
|
|
wtap_rec *rec, tvbuff_t *tvb, frame_data *fd,
|
2015-10-28 14:38:39 +00:00
|
|
|
column_info *cinfo)
|
2012-10-20 19:27:24 +00:00
|
|
|
{
|
2012-11-03 15:49:15 +00:00
|
|
|
wmem_enter_packet_scope();
|
2012-10-20 19:27:24 +00:00
|
|
|
tap_queue_init(edt);
|
2018-02-09 00:19:12 +00:00
|
|
|
dissect_record(edt, file_type_subtype, rec, tvb, fd, cinfo);
|
2012-10-20 19:27:24 +00:00
|
|
|
tap_push_tapped_queue(edt);
|
2012-10-20 20:04:40 +00:00
|
|
|
|
|
|
|
/* free all memory allocated */
|
2012-11-03 15:49:15 +00:00
|
|
|
wmem_leave_packet_scope();
|
2012-10-20 19:27:24 +00:00
|
|
|
}
|
|
|
|
|
2014-01-08 04:35:28 +00:00
|
|
|
void
|
2018-02-09 00:19:12 +00:00
|
|
|
epan_dissect_file_run(epan_dissect_t *edt, wtap_rec *rec,
|
2015-10-28 14:38:39 +00:00
|
|
|
tvbuff_t *tvb, frame_data *fd, column_info *cinfo)
|
2014-01-08 04:35:28 +00:00
|
|
|
{
|
|
|
|
#ifdef HAVE_LUA
|
|
|
|
wslua_prime_dfilter(edt); /* done before entering wmem scope */
|
|
|
|
#endif
|
|
|
|
wmem_enter_packet_scope();
|
2018-02-09 00:19:12 +00:00
|
|
|
dissect_file(edt, rec, tvb, fd, cinfo);
|
2014-01-08 04:35:28 +00:00
|
|
|
|
|
|
|
/* free all memory allocated */
|
|
|
|
wmem_leave_packet_scope();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-02-09 00:19:12 +00:00
|
|
|
epan_dissect_file_run_with_taps(epan_dissect_t *edt, wtap_rec *rec,
|
2015-10-28 14:38:39 +00:00
|
|
|
tvbuff_t *tvb, frame_data *fd, column_info *cinfo)
|
2014-01-08 04:35:28 +00:00
|
|
|
{
|
|
|
|
wmem_enter_packet_scope();
|
|
|
|
tap_queue_init(edt);
|
2018-02-09 00:19:12 +00:00
|
|
|
dissect_file(edt, rec, tvb, fd, cinfo);
|
2014-01-08 04:35:28 +00:00
|
|
|
tap_push_tapped_queue(edt);
|
|
|
|
|
|
|
|
/* free all memory allocated */
|
|
|
|
wmem_leave_packet_scope();
|
|
|
|
}
|
|
|
|
|
2000-10-06 10:11:40 +00:00
|
|
|
void
|
2009-08-13 19:42:46 +00:00
|
|
|
epan_dissect_cleanup(epan_dissect_t* edt)
|
2000-10-06 10:11:40 +00:00
|
|
|
{
|
2009-08-13 19:42:46 +00:00
|
|
|
g_assert(edt);
|
|
|
|
|
2017-08-29 14:34:31 +00:00
|
|
|
#ifdef HAVE_PLUGINS
|
|
|
|
g_slist_foreach(epan_plugins, epan_plugin_dissect_cleanup, edt);
|
|
|
|
#endif
|
|
|
|
|
2013-11-23 02:20:13 +00:00
|
|
|
g_slist_free(edt->pi.proto_data);
|
2012-04-03 09:18:16 +00:00
|
|
|
g_slist_free(edt->pi.dependent_frames);
|
|
|
|
|
2002-06-04 07:03:57 +00:00
|
|
|
/* Free the data sources list. */
|
|
|
|
free_data_sources(&edt->pi);
|
|
|
|
|
2013-10-20 10:21:25 +00:00
|
|
|
if (edt->tvb) {
|
|
|
|
/* Free all tvb's chained from this tvb */
|
|
|
|
tvb_free_chain(edt->tvb);
|
|
|
|
}
|
2000-10-06 10:11:40 +00:00
|
|
|
|
2001-12-06 04:25:09 +00:00
|
|
|
if (edt->tree) {
|
|
|
|
proto_tree_free(edt->tree);
|
|
|
|
}
|
2012-12-02 17:01:04 +00:00
|
|
|
|
2013-11-04 14:12:59 +00:00
|
|
|
if (pinfo_pool_cache == NULL) {
|
|
|
|
wmem_free_all(edt->pi.pool);
|
|
|
|
pinfo_pool_cache = edt->pi.pool;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
wmem_destroy_allocator(edt->pi.pool);
|
|
|
|
}
|
2009-08-13 19:42:46 +00:00
|
|
|
}
|
2001-12-06 04:25:09 +00:00
|
|
|
|
2009-08-13 19:42:46 +00:00
|
|
|
void
|
|
|
|
epan_dissect_free(epan_dissect_t* edt)
|
|
|
|
{
|
|
|
|
epan_dissect_cleanup(edt);
|
2000-10-06 10:11:40 +00:00
|
|
|
g_free(edt);
|
|
|
|
}
|
2001-12-18 19:09:08 +00:00
|
|
|
|
|
|
|
void
|
2017-04-12 04:56:14 +00:00
|
|
|
epan_dissect_prime_with_dfilter(epan_dissect_t *edt, const dfilter_t* dfcode)
|
2001-12-18 19:09:08 +00:00
|
|
|
{
|
2016-01-04 21:14:08 +00:00
|
|
|
dfilter_prime_proto_tree(dfcode, edt->tree);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-04-12 04:56:14 +00:00
|
|
|
epan_dissect_prime_with_hfid(epan_dissect_t *edt, int hfid)
|
2016-01-04 21:14:08 +00:00
|
|
|
{
|
2017-04-12 04:56:14 +00:00
|
|
|
proto_tree_prime_with_hfid(edt->tree, hfid);
|
2009-08-25 21:10:35 +00:00
|
|
|
}
|
|
|
|
|
2017-04-12 20:52:07 +00:00
|
|
|
void
|
|
|
|
epan_dissect_prime_with_hfid_array(epan_dissect_t *edt, GArray *hfids)
|
|
|
|
{
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
for (i = 0; i < hfids->len; i++) {
|
|
|
|
proto_tree_prime_with_hfid(edt->tree,
|
|
|
|
g_array_index(hfids, int, i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-25 21:10:35 +00:00
|
|
|
/* ----------------------- */
|
|
|
|
const gchar *
|
2014-12-17 10:38:49 +00:00
|
|
|
epan_custom_set(epan_dissect_t *edt, GSList *field_ids,
|
2015-10-28 14:38:39 +00:00
|
|
|
gint occurrence,
|
|
|
|
gchar *result,
|
|
|
|
gchar *expr, const int size )
|
2009-08-25 21:10:35 +00:00
|
|
|
{
|
2015-10-28 14:38:39 +00:00
|
|
|
return proto_custom_set(edt->tree, field_ids, occurrence, result, expr, size);
|
2001-12-18 19:09:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-04-03 18:18:50 +00:00
|
|
|
epan_dissect_fill_in_columns(epan_dissect_t *edt, const gboolean fill_col_exprs, const gboolean fill_fd_colums)
|
2001-12-18 19:09:08 +00:00
|
|
|
{
|
2015-10-28 14:38:39 +00:00
|
|
|
col_custom_set_edt(edt, edt->pi.cinfo);
|
|
|
|
col_fill_in(&edt->pi, fill_col_exprs, fill_fd_colums);
|
2001-12-18 19:09:08 +00:00
|
|
|
}
|
2009-08-25 21:10:35 +00:00
|
|
|
|
2013-05-22 23:02:19 +00:00
|
|
|
gboolean
|
|
|
|
epan_dissect_packet_contains_field(epan_dissect_t* edt,
|
2015-10-28 14:38:39 +00:00
|
|
|
const char *field_name)
|
2013-05-22 23:02:19 +00:00
|
|
|
{
|
2015-10-28 14:38:39 +00:00
|
|
|
GPtrArray* array;
|
|
|
|
int field_id;
|
|
|
|
gboolean contains_field;
|
|
|
|
|
|
|
|
if (!edt || !edt->tree)
|
|
|
|
return FALSE;
|
|
|
|
field_id = proto_get_id_by_filter_name(field_name);
|
|
|
|
if (field_id < 0)
|
|
|
|
return FALSE;
|
|
|
|
array = proto_find_finfo(edt->tree, field_id);
|
|
|
|
contains_field = (array->len > 0) ? TRUE : FALSE;
|
|
|
|
g_ptr_array_free(array, TRUE);
|
|
|
|
return contains_field;
|
2013-05-22 23:02:19 +00:00
|
|
|
}
|
|
|
|
|
2010-07-15 02:07:16 +00:00
|
|
|
/*
|
|
|
|
* Get compile-time information for libraries used by libwireshark.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
epan_get_compiled_version_info(GString *str)
|
|
|
|
{
|
2015-10-28 14:38:39 +00:00
|
|
|
/* SNMP */
|
2010-07-15 02:07:16 +00:00
|
|
|
g_string_append(str, ", ");
|
|
|
|
#ifdef HAVE_LIBSMI
|
|
|
|
g_string_append(str, "with SMI " SMI_VERSION_STRING);
|
|
|
|
#else /* no SNMP library */
|
|
|
|
g_string_append(str, "without SMI");
|
|
|
|
#endif /* _SMI_H */
|
|
|
|
|
|
|
|
/* c-ares */
|
|
|
|
g_string_append(str, ", ");
|
|
|
|
g_string_append(str, "with c-ares " ARES_VERSION_STR);
|
|
|
|
|
2015-10-28 14:38:39 +00:00
|
|
|
/* LUA */
|
2010-07-15 02:07:16 +00:00
|
|
|
g_string_append(str, ", ");
|
2012-06-25 20:42:07 +00:00
|
|
|
#ifdef HAVE_LUA
|
2010-07-15 02:07:16 +00:00
|
|
|
g_string_append(str, "with ");
|
2016-08-09 16:29:00 +00:00
|
|
|
g_string_append(str, LUA_RELEASE);
|
2010-07-15 02:07:16 +00:00
|
|
|
#else
|
|
|
|
g_string_append(str, "without Lua");
|
2012-06-25 20:42:07 +00:00
|
|
|
#endif /* HAVE_LUA */
|
2010-07-15 02:07:16 +00:00
|
|
|
|
2015-10-28 14:38:39 +00:00
|
|
|
/* GnuTLS */
|
2010-07-15 02:07:16 +00:00
|
|
|
g_string_append(str, ", ");
|
|
|
|
#ifdef HAVE_LIBGNUTLS
|
|
|
|
g_string_append(str, "with GnuTLS " LIBGNUTLS_VERSION);
|
2018-12-12 13:34:00 +00:00
|
|
|
#ifdef HAVE_GNUTLS_PKCS11
|
|
|
|
g_string_append(str, " and PKCS #11 support");
|
|
|
|
#endif /* HAVE_GNUTLS_PKCS11 */
|
2010-07-15 02:07:16 +00:00
|
|
|
#else
|
|
|
|
g_string_append(str, "without GnuTLS");
|
|
|
|
#endif /* HAVE_LIBGNUTLS */
|
|
|
|
|
2015-10-28 14:38:39 +00:00
|
|
|
/* Gcrypt */
|
2010-07-15 02:07:16 +00:00
|
|
|
g_string_append(str, ", ");
|
|
|
|
g_string_append(str, "with Gcrypt " GCRYPT_VERSION);
|
|
|
|
|
2015-10-28 14:38:39 +00:00
|
|
|
/* Kerberos */
|
|
|
|
/* XXX - I don't see how to get the version number, at least for KfW */
|
2010-07-15 02:07:16 +00:00
|
|
|
g_string_append(str, ", ");
|
|
|
|
#ifdef HAVE_KERBEROS
|
|
|
|
#ifdef HAVE_MIT_KERBEROS
|
|
|
|
g_string_append(str, "with MIT Kerberos");
|
|
|
|
#else
|
2015-10-28 14:38:39 +00:00
|
|
|
/* HAVE_HEIMDAL_KERBEROS */
|
2010-07-15 02:07:16 +00:00
|
|
|
g_string_append(str, "with Heimdal Kerberos");
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
g_string_append(str, "without Kerberos");
|
|
|
|
#endif /* HAVE_KERBEROS */
|
|
|
|
|
2018-02-09 01:20:26 +00:00
|
|
|
/* MaxMindDB */
|
2010-07-15 02:07:16 +00:00
|
|
|
g_string_append(str, ", ");
|
2018-02-09 01:20:26 +00:00
|
|
|
#ifdef HAVE_MAXMINDDB
|
|
|
|
g_string_append(str, "with MaxMind DB resolver");
|
2010-07-15 02:07:16 +00:00
|
|
|
#else
|
2018-02-09 01:20:26 +00:00
|
|
|
g_string_append(str, "without MaxMind DB resolver");
|
|
|
|
#endif /* HAVE_MAXMINDDB */
|
2010-07-15 02:07:16 +00:00
|
|
|
|
2016-08-26 13:18:29 +00:00
|
|
|
/* nghttp2 */
|
|
|
|
g_string_append(str, ", ");
|
|
|
|
#ifdef HAVE_NGHTTP2
|
|
|
|
g_string_append(str, "with nghttp2 " NGHTTP2_VERSION);
|
|
|
|
#else
|
|
|
|
g_string_append(str, "without nghttp2");
|
|
|
|
#endif /* HAVE_NGHTTP2 */
|
2016-09-26 14:25:11 +00:00
|
|
|
|
2019-04-10 10:52:52 +00:00
|
|
|
/* brotli */
|
|
|
|
g_string_append(str, ", ");
|
|
|
|
#ifdef HAVE_BROTLI
|
|
|
|
g_string_append(str, "with brotli");
|
|
|
|
#else
|
|
|
|
g_string_append(str, "without brotli");
|
|
|
|
#endif /* HAVE_BROTLI */
|
|
|
|
|
2016-09-26 14:25:11 +00:00
|
|
|
/* LZ4 */
|
|
|
|
g_string_append(str, ", ");
|
|
|
|
#ifdef HAVE_LZ4
|
|
|
|
g_string_append(str, "with LZ4");
|
|
|
|
#else
|
|
|
|
g_string_append(str, "without LZ4");
|
|
|
|
#endif /* HAVE_LZ4 */
|
|
|
|
|
2019-08-12 21:57:45 +00:00
|
|
|
/* Zstandard */
|
|
|
|
g_string_append(str, ", ");
|
|
|
|
#ifdef HAVE_ZSTD
|
|
|
|
g_string_append(str, "with Zstandard");
|
|
|
|
#else
|
|
|
|
g_string_append(str, "without Zstandard");
|
|
|
|
#endif /* HAVE_ZSTD */
|
|
|
|
|
2016-09-26 14:25:11 +00:00
|
|
|
/* Snappy */
|
|
|
|
g_string_append(str, ", ");
|
|
|
|
#ifdef HAVE_SNAPPY
|
|
|
|
g_string_append(str, "with Snappy");
|
|
|
|
#else
|
|
|
|
g_string_append(str, "without Snappy");
|
|
|
|
#endif /* HAVE_SNAPPY */
|
|
|
|
|
2017-04-04 21:23:59 +00:00
|
|
|
/* libxml2 */
|
|
|
|
g_string_append(str, ", ");
|
|
|
|
#ifdef HAVE_LIBXML2
|
|
|
|
g_string_append(str, "with libxml2 " LIBXML_DOTTED_VERSION);
|
|
|
|
#else
|
|
|
|
g_string_append(str, "without libxml2");
|
|
|
|
#endif /* HAVE_LIBXML2 */
|
|
|
|
|
2010-07-15 02:07:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get runtime information for libraries used by libwireshark.
|
|
|
|
*/
|
|
|
|
void
|
2017-02-09 14:00:19 +00:00
|
|
|
epan_get_runtime_version_info(GString *str)
|
2010-07-15 02:07:16 +00:00
|
|
|
{
|
2015-10-28 14:38:39 +00:00
|
|
|
/* GnuTLS */
|
2010-07-15 02:07:16 +00:00
|
|
|
#ifdef HAVE_LIBGNUTLS
|
2014-06-23 21:55:56 +00:00
|
|
|
g_string_append_printf(str, ", with GnuTLS %s", gnutls_check_version(NULL));
|
2010-07-15 02:07:16 +00:00
|
|
|
#endif /* HAVE_LIBGNUTLS */
|
|
|
|
|
2015-10-28 14:38:39 +00:00
|
|
|
/* Gcrypt */
|
2014-06-23 21:55:56 +00:00
|
|
|
g_string_append_printf(str, ", with Gcrypt %s", gcry_check_version(NULL));
|
2019-04-10 10:52:52 +00:00
|
|
|
|
|
|
|
/* brotli */
|
|
|
|
#ifdef HAVE_BROTLI
|
|
|
|
g_string_append_printf(str, ", with brotli %d.%d.%d", BrotliDecoderVersion() >> 24,
|
|
|
|
(BrotliDecoderVersion() >> 12) & 0xFFF, BrotliDecoderVersion() & 0xFFF);
|
|
|
|
#endif
|
2010-07-15 02:07:16 +00:00
|
|
|
}
|
2012-10-08 15:23:36 +00:00
|
|
|
|
|
|
|
/*
|
2019-07-26 18:43:17 +00:00
|
|
|
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
2012-10-08 15:23:36 +00:00
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: t
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
|
|
|
* :indentSize=8:tabSize=8:noTabs=false:
|
|
|
|
*/
|