aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2021-06-15 00:06:02 +0100
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-06-16 12:50:27 +0000
commit39df3ae3c0ff12da5f5630b89a147b65588cc4c2 (patch)
tree280be0d508116a8fdb3d3a719f249497868a12c2
parent4c4bb915c866f234e527ae0a5fc296ef3f732a0e (diff)
Replace g_log() calls with ws_log()
-rw-r--r--epan/capture_dissectors.c5
-rw-r--r--epan/color_filters.c4
-rw-r--r--epan/crypt/dot11decrypt_debug.h4
-rw-r--r--epan/dfilter/dfilter.c4
-rw-r--r--epan/disabled_protos.c10
-rw-r--r--epan/epan.c4
-rw-r--r--epan/expert.c5
-rw-r--r--epan/maxmind_db.c2
-rw-r--r--epan/packet.c22
-rw-r--r--epan/prefs.c64
-rw-r--r--epan/proto.c112
-rw-r--r--epan/secrets.c15
-rw-r--r--epan/sequence_analysis.h2
-rw-r--r--epan/show_exception.c5
-rw-r--r--epan/tap.c8
-rw-r--r--epan/tvbparse.c90
-rw-r--r--epan/value_string.c11
-rw-r--r--epan/wmem/wmem_core.c5
-rw-r--r--epan/wmem/wmem_strbuf.c4
-rw-r--r--epan/wslua/init_wslua.c4
-rw-r--r--epan/wslua/wslua.h1
-rw-r--r--epan/wslua/wslua_file.c8
-rw-r--r--epan/wslua/wslua_file_handler.c8
-rw-r--r--epan/wslua/wslua_frame_info.c4
-rw-r--r--epan/wslua/wslua_gui.c24
-rw-r--r--epan/wslua/wslua_internals.c4
-rw-r--r--epan/wslua/wslua_listener.c16
-rw-r--r--epan/wslua/wslua_util.c6
-rw-r--r--extcap/androiddump.c274
-rw-r--r--extcap/ciscodump.c58
-rw-r--r--extcap/dpauxmon.c60
-rw-r--r--extcap/etw_message.c4
-rw-r--r--extcap/etwdump.c26
-rw-r--r--extcap/extcap-base.c6
-rw-r--r--extcap/randpktdump.c26
-rw-r--r--extcap/sdjournal.c66
-rw-r--r--extcap/ssh-base.c2
-rw-r--r--extcap/sshdump.c54
-rw-r--r--extcap/udpdump.c42
-rw-r--r--file.c18
-rw-r--r--file_packet_provider.c2
-rw-r--r--plugins/epan/irda/packet-irda.c8
-rw-r--r--plugins/epan/mate/mate.h4
-rw-r--r--plugins/epan/mate/mate_util.c8
-rw-r--r--plugins/epan/transum/packet-transum.c4
-rw-r--r--randpkt_core/randpkt_core.c4
-rw-r--r--sharkd_daemon.c6
-rw-r--r--sync_pipe_write.c8
-rw-r--r--ui/capture.c6
-rw-r--r--ui/cli/tap-httpstat.c4
-rw-r--r--ui/cli/tap-rtspstat.c4
-rw-r--r--ui/cli/tap-sipstat.c4
-rw-r--r--ui/filter_files.c14
-rw-r--r--ui/preference_utils.c2
-rw-r--r--ui/rtp_stream.h2
-rw-r--r--ui/voip_calls.h2
-rw-r--r--wiretap/file_access.c22
-rw-r--r--wiretap/lanalyzer.c6
-rw-r--r--wiretap/log3gpp.c2
-rw-r--r--wiretap/pcapng.c4
-rw-r--r--wiretap/wtap.c2
-rw-r--r--wsutil/buffer.c6
-rw-r--r--wsutil/codecs.c2
-rw-r--r--wsutil/inet_addr.c8
-rw-r--r--wsutil/json_dumper.c5
-rw-r--r--wsutil/plugins.c6
-rw-r--r--wsutil/privileges.c4
-rw-r--r--wsutil/time_util.c4
68 files changed, 658 insertions, 582 deletions
diff --git a/epan/capture_dissectors.c b/epan/capture_dissectors.c
index 5f62d5b604..124efaccf9 100644
--- a/epan/capture_dissectors.c
+++ b/epan/capture_dissectors.c
@@ -9,6 +9,7 @@
*/
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_EPAN
#include <glib.h>
#include <stdio.h>
@@ -17,6 +18,8 @@
#include "capture_dissectors.h"
+#include <wsutil/wslog.h>
+
struct capture_dissector_table {
GHashTable *hash_table;
const char *ui_name;
@@ -65,7 +68,7 @@ void register_capture_dissector_table(const char *name, const char *ui_name)
/* Make sure the registration is unique */
if(g_hash_table_lookup( capture_dissector_tables, name )) {
- g_error("The capture dissector table %s (%s) is already registered - are you using a buggy plugin?", name, ui_name);
+ ws_error("The capture dissector table %s (%s) is already registered - are you using a buggy plugin?", name, ui_name);
}
sub_dissectors = g_new(struct capture_dissector_table, 1);
diff --git a/epan/color_filters.c b/epan/color_filters.c
index 08cf3da4f0..29ddcb6b62 100644
--- a/epan/color_filters.c
+++ b/epan/color_filters.c
@@ -12,6 +12,7 @@
*/
#include <config.h>
+#define WS_LOG_DOMAIN LOG_DOMAIN_EPAN
#include <glib.h>
@@ -21,6 +22,7 @@
#include <wsutil/filesystem.h>
#include <wsutil/file_util.h>
+#include <wsutil/wslog.h>
#include <epan/packet.h>
#include "color_filters.h"
@@ -651,7 +653,7 @@ read_filters_file(const gchar *path, FILE *f, gpointer user_data, color_filter_a
gchar *local_err_msg = NULL;
if (!disabled && !dfilter_compile(filter_exp, &temp_dfilter, &local_err_msg)) {
- g_warning("Could not compile \"%s\" in colorfilters file \"%s\".\n%s",
+ ws_warning("Could not compile \"%s\" in colorfilters file \"%s\".\n%s",
name, path, local_err_msg);
g_free(local_err_msg);
prefs.unknown_colorfilters = TRUE;
diff --git a/epan/crypt/dot11decrypt_debug.h b/epan/crypt/dot11decrypt_debug.h
index d95335dc50..9f23995e40 100644
--- a/epan/crypt/dot11decrypt_debug.h
+++ b/epan/crypt/dot11decrypt_debug.h
@@ -34,7 +34,7 @@
static inline void print_debug_line(const CHAR *function, const CHAR *msg, const INT level)
{
if (level <= DEBUG_USED_LEVEL)
- g_warning("dbg(%d)|(%s) %s", level, function, msg);
+ ws_warning("dbg(%d)|(%s) %s", level, function, msg);
}
#define DEBUG_PRINT_LINE(msg, level) print_debug_line(G_STRFUNC , msg, level)
@@ -42,7 +42,7 @@ static inline void print_debug_line(const CHAR *function, const CHAR *msg, const
static inline void DEBUG_DUMP(const char* x, const guint8* y, int z)
{
char* tmp_str = bytes_to_str(NULL, y, (z));
- g_warning("%s: %s", x, tmp_str);
+ ws_warning("%s: %s", x, tmp_str);
wmem_free(NULL, tmp_str);
}
diff --git a/epan/dfilter/dfilter.c b/epan/dfilter/dfilter.c
index 59924eb239..e9c80c2a60 100644
--- a/epan/dfilter/dfilter.c
+++ b/epan/dfilter/dfilter.c
@@ -7,6 +7,7 @@
*/
#include "config.h"
+#define WS_LOG_DOMAIN "Dfilter"
#include <stdio.h>
#include <string.h>
@@ -20,6 +21,7 @@
#include "dfilter.h"
#include "dfilter-macro.h"
#include "scanner_lex.h"
+#include <wsutil/wslog.h>
#define DFILTER_TOKEN_ID_OFFSET 1
@@ -52,7 +54,7 @@ void
dfilter_init(void)
{
if (ParserObj) {
- g_message("I expected ParserObj to be NULL\n");
+ ws_message("I expected ParserObj to be NULL\n");
/* Free the Lemon Parser object */
DfilterFree(ParserObj, g_free);
}
diff --git a/epan/disabled_protos.c b/epan/disabled_protos.c
index a558aaf48d..41b4cc2dd0 100644
--- a/epan/disabled_protos.c
+++ b/epan/disabled_protos.c
@@ -10,6 +10,7 @@
*/
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_EPAN
#include <stdio.h>
#include <string.h>
@@ -24,6 +25,7 @@
#include "disabled_protos.h"
#include <wsutil/file_util.h>
#include <wsutil/report_message.h>
+#include <wsutil/wslog.h>
#define ENABLED_PROTOCOLS_FILE_NAME "enabled_protos"
#define DISABLED_PROTOCOLS_FILE_NAME "disabled_protos"
@@ -320,7 +322,7 @@ read_protos_list_file(const char *ff_path, FILE *ff, GList **flp)
if (c != EOF && c != '\n' && c != '#') {
/* Non-white-space after the protocol name; warn about it,
in case we come up with a reason to use it. */
- g_warning("'%s' line %d has extra stuff after the protocol name.",
+ ws_warning("'%s' line %d has extra stuff after the protocol name.",
ff_path, line);
}
}
@@ -335,7 +337,7 @@ read_protos_list_file(const char *ff_path, FILE *ff, GList **flp)
goto error; /* I/O error */
else {
/* EOF, not error; no newline seen before EOF */
- g_warning("'%s' line %d doesn't have a newline.", ff_path,
+ ws_warning("'%s' line %d doesn't have a newline.", ff_path,
line);
}
break; /* nothing more to read */
@@ -641,7 +643,7 @@ read_heur_dissector_list_file(const char *ff_path, FILE *ff, GList **flp)
if (c != EOF && c != '\n' && c != '#') {
/* Non-white-space after the protocol name; warn about it,
in case we come up with a reason to use it. */
- g_warning("'%s' line %d has extra stuff after the protocol name.",
+ ws_warning("'%s' line %d has extra stuff after the protocol name.",
ff_path, line);
}
}
@@ -656,7 +658,7 @@ read_heur_dissector_list_file(const char *ff_path, FILE *ff, GList **flp)
goto error; /* I/O error */
else {
/* EOF, not error; no newline seen before EOF */
- g_warning("'%s' line %d doesn't have a newline.", ff_path,
+ ws_warning("'%s' line %d doesn't have a newline.", ff_path,
line);
}
break; /* nothing more to read */
diff --git a/epan/epan.c b/epan/epan.c
index 461276b0c9..20227b39bb 100644
--- a/epan/epan.c
+++ b/epan/epan.c
@@ -199,7 +199,7 @@ void epan_register_plugin(const epan_plugin *plug)
#else /* HAVE_PLUGINS */
void epan_register_plugin(const epan_plugin *plug _U_)
{
- g_warning("epan_register_plugin: built without support for binary plugins");
+ ws_warning("epan_register_plugin: built without support for binary plugins");
}
#endif /* HAVE_PLUGINS */
@@ -479,7 +479,7 @@ epan_get_frame_ts(const epan_t *session, guint32 frame_num)
abs_ts = session->funcs.get_frame_ts(session->prov, frame_num);
if (!abs_ts)
- g_warning("!!! couldn't get frame ts for %u !!!\n", frame_num);
+ ws_warning("!!! couldn't get frame ts for %u !!!\n", frame_num);
return abs_ts;
}
diff --git a/epan/expert.c b/epan/expert.c
index 9a4b8c1cba..faef02fae0 100644
--- a/epan/expert.c
+++ b/epan/expert.c
@@ -11,6 +11,7 @@
*/
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_EPAN
#include <stdio.h>
#include <stdlib.h>
@@ -22,6 +23,8 @@
#include "wmem/wmem.h"
#include "tap.h"
+#include <wsutil/wslog.h>
+
/* proto_expert cannot be static because it's referenced in the
* print routines
*/
@@ -173,7 +176,7 @@ static void uat_expert_post_update_cb(void)
#define EXPERT_REGISTRAR_GET_NTH(eiindex, expinfo) \
if((guint)eiindex >= gpa_expertinfo.len && wireshark_abort_on_dissector_bug) \
- g_error("Unregistered expert info! index=%d", eiindex); \
+ ws_error("Unregistered expert info! index=%d", eiindex); \
DISSECTOR_ASSERT_HINT((guint)eiindex < gpa_expertinfo.len, "Unregistered expert info!"); \
DISSECTOR_ASSERT_HINT(gpa_expertinfo.ei[eiindex] != NULL, "Unregistered expert info!"); \
expinfo = gpa_expertinfo.ei[eiindex];
diff --git a/epan/maxmind_db.c b/epan/maxmind_db.c
index 17e4373002..7b3016a7c9 100644
--- a/epan/maxmind_db.c
+++ b/epan/maxmind_db.c
@@ -104,7 +104,7 @@ static gboolean resolve_synchronously = FALSE;
#if 0
#define MMDB_DEBUG(...) { \
char *MMDB_DEBUG_MSG = g_strdup_printf(__VA_ARGS__); \
- g_warning("mmdb: %s:%d %s", G_STRFUNC, __LINE__, MMDB_DEBUG_MSG); \
+ ws_warning("mmdb: %s:%d %s", G_STRFUNC, __LINE__, MMDB_DEBUG_MSG); \
g_free(MMDB_DEBUG_MSG); \
}
#else
diff --git a/epan/packet.c b/epan/packet.c
index 5315a28c15..7e64f562b2 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -9,6 +9,7 @@
*/
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_EPAN
#include <glib.h>
@@ -39,6 +40,7 @@
#include <epan/range.h>
#include <wsutil/str_util.h>
+#include <wsutil/wslog.h>
static gint proto_malformed = -1;
static dissector_handle_t frame_handle = NULL;
@@ -970,7 +972,7 @@ find_dissector_table(const char *name)
dissector_table = (dissector_table_t) g_hash_table_lookup(dissector_tables, new_name);
}
if (dissector_table) {
- g_warning("%s is now %s", name, new_name);
+ ws_warning("%s is now %s", name, new_name);
}
}
return dissector_table;
@@ -1016,13 +1018,13 @@ dissector_add_uint_sanity_check(const char *name, guint32 pattern, dissector_han
dtbl_entry_t *dtbl_entry;
if (pattern == 0) {
- g_warning("%s: %s registering using a pattern of 0",
+ ws_warning("%s: %s registering using a pattern of 0",
name, proto_get_protocol_filter_name(proto_get_id(handle->protocol)));
}
dtbl_entry = g_hash_table_lookup(sub_dissectors->hash_table, GUINT_TO_POINTER(pattern));
if (dtbl_entry != NULL) {
- g_warning("%s: %s registering using pattern %d already registered by %s",
+ ws_warning("%s: %s registering using pattern %d already registered by %s",
name, proto_get_protocol_filter_name(proto_get_id(handle->protocol)),
pattern, proto_get_protocol_filter_name(proto_get_id(dtbl_entry->initial->protocol)));
}
@@ -1209,7 +1211,7 @@ void dissector_add_uint_range_with_preference(const char *name, const char* rang
break;
default:
- g_error("The dissector table %s (%s) is not an integer type - are you using a buggy plugin?", name, pref_dissector_table->ui_name);
+ ws_error("The dissector table %s (%s) is not an integer type - are you using a buggy plugin?", name, pref_dissector_table->ui_name);
g_assert_not_reached();
}
@@ -2451,7 +2453,7 @@ register_dissector_table(const char *name, const char *ui_name, const int proto,
/* Make sure the registration is unique */
if (g_hash_table_lookup(dissector_tables, name)) {
- g_error("The dissector table %s (%s) is already registered - are you using a buggy plugin?", name, ui_name);
+ ws_error("The dissector table %s (%s) is already registered - are you using a buggy plugin?", name, ui_name);
}
/* Create and register the dissector table for this name; returns */
@@ -2503,7 +2505,7 @@ register_dissector_table(const char *name, const char *ui_name, const int proto,
break;
default:
- g_error("The dissector table %s (%s) is registering an unsupported type - are you using a buggy plugin?", name, ui_name);
+ ws_error("The dissector table %s (%s) is registering an unsupported type - are you using a buggy plugin?", name, ui_name);
g_assert_not_reached();
}
sub_dissectors->dissector_handles = NULL;
@@ -2523,7 +2525,7 @@ dissector_table_t register_custom_dissector_table(const char *name,
/* Make sure the registration is unique */
if (g_hash_table_lookup(dissector_tables, name)) {
- g_error("The dissector table %s (%s) is already registered - are you using a buggy plugin?", name, ui_name);
+ ws_error("The dissector table %s (%s) is already registered - are you using a buggy plugin?", name, ui_name);
}
/* Create and register the dissector table for this name; returns */
@@ -2624,7 +2626,7 @@ check_valid_heur_name_or_fail(const char *heur_name)
}
if (found_invalid) {
- g_error("Heuristic Protocol internal name \"%s\" has one or more invalid characters."
+ ws_error("Heuristic Protocol internal name \"%s\" has one or more invalid characters."
" Allowed are lowercase, digits, '-', '_' and non-repeating '.'."
" This might be caused by an inappropriate plugin or a development error.", heur_name);
}
@@ -2697,7 +2699,7 @@ heur_dissector_add(const char *name, heur_dissector_t dissector, const char *dis
/* Ensure short_name is unique */
if (g_hash_table_lookup(heuristic_short_names, internal_name) != NULL) {
- g_error("Duplicate heuristic short_name \"%s\"!"
+ ws_error("Duplicate heuristic short_name \"%s\"!"
" This might be caused by an inappropriate plugin or a development error.", internal_name);
}
@@ -3012,7 +3014,7 @@ register_heur_dissector_list(const char *name, const int proto)
/* Make sure the registration is unique */
if (g_hash_table_lookup(heur_dissector_lists, name) != NULL) {
- g_error("The heuristic dissector list %s is already registered - are you using a buggy plugin?", name);
+ ws_error("The heuristic dissector list %s is already registered - are you using a buggy plugin?", name);
}
/* Create and register the dissector table for this name; returns */
diff --git a/epan/prefs.c b/epan/prefs.c
index 9707f27da4..9e4c450480 100644
--- a/epan/prefs.c
+++ b/epan/prefs.c
@@ -9,6 +9,7 @@
*/
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_EPAN
#include "ws_diag_control.h"
@@ -33,6 +34,7 @@
#include "print.h"
#include <wsutil/file_util.h>
#include <wsutil/report_message.h>
+#include <wsutil/wslog.h>
#include <epan/prefs-int.h>
#include <epan/uat-int.h>
@@ -504,7 +506,7 @@ prefs_register_module_or_subtree(module_t *parent, const char *name,
for (p = name; (c = *p) != '\0'; p++) {
if (!(g_ascii_islower(c) || g_ascii_isdigit(c) || c == '_' ||
c == '-' || c == '.'))
- g_error("Preference module \"%s\" contains invalid characters", name);
+ ws_error("Preference module \"%s\" contains invalid characters", name);
}
/*
@@ -520,7 +522,7 @@ prefs_register_module_or_subtree(module_t *parent, const char *name,
* something such as that, to be added to all their names).
*/
if (prefs_find_module(name) != NULL)
- g_error("Preference module \"%s\" is being registered twice", name);
+ ws_error("Preference module \"%s\" is being registered twice", name);
/*
* Insert this module in the list of all modules.
@@ -532,7 +534,7 @@ prefs_register_module_or_subtree(module_t *parent, const char *name,
* subtree, and crash if it's not.
*/
if (!is_subtree)
- g_error("Preferences module with no name is being registered at the top level");
+ ws_error("Preferences module with no name is being registered at the top level");
}
/*
@@ -579,7 +581,7 @@ prefs_register_module_alias(const char *name, module_t *module)
for (p = name; (c = *p) != '\0'; p++) {
if (!(g_ascii_isalpha(c) || g_ascii_isdigit(c) || c == '_' ||
c == '-' || c == '.'))
- g_error("Preference module alias \"%s\" contains invalid characters", name);
+ ws_error("Preference module alias \"%s\" contains invalid characters", name);
}
/*
@@ -591,7 +593,7 @@ prefs_register_module_alias(const char *name, module_t *module)
* We search the list of all aliases.
*/
if (prefs_find_module_alias(name) != NULL)
- g_error("Preference module alias \"%s\" is being registered twice", name);
+ ws_error("Preference module alias \"%s\" is being registered twice", name);
alias = wmem_new(wmem_epan_scope(), module_alias_t);
alias->name = name;
@@ -626,7 +628,7 @@ prefs_register_protocol(int id, void (*apply_cb)(void))
}
protocol = find_protocol_by_id(id);
if (protocol == NULL)
- g_error("Protocol preferences being registered with an invalid protocol ID");
+ ws_error("Protocol preferences being registered with an invalid protocol ID");
return prefs_register_module(protocols_module,
proto_get_protocol_filter_name(id),
proto_get_protocol_short_name(protocol),
@@ -638,7 +640,7 @@ prefs_deregister_protocol (int id)
{
protocol_t *protocol = find_protocol_by_id(id);
if (protocol == NULL)
- g_error("Protocol preferences being de-registered with an invalid protocol ID");
+ ws_error("Protocol preferences being de-registered with an invalid protocol ID");
prefs_deregister_module (protocols_module,
proto_get_protocol_filter_name(id),
proto_get_protocol_short_name(protocol));
@@ -698,7 +700,7 @@ prefs_register_protocol_subtree(const char *subtree, int id, void (*apply_cb)(vo
protocol = find_protocol_by_id(id);
if (protocol == NULL)
- g_error("Protocol subtree being registered with an invalid protocol ID");
+ ws_error("Protocol subtree being registered with an invalid protocol ID");
return prefs_register_module(subtree_module,
proto_get_protocol_filter_name(id),
proto_get_protocol_short_name(protocol),
@@ -729,7 +731,7 @@ prefs_register_protocol_obsolete(int id)
}
protocol = find_protocol_by_id(id);
if (protocol == NULL)
- g_error("Protocol being registered with an invalid protocol ID");
+ ws_error("Protocol being registered with an invalid protocol ID");
module = prefs_register_module(protocols_module,
proto_get_protocol_filter_name(id),
proto_get_protocol_short_name(protocol),
@@ -1005,7 +1007,7 @@ register_preference(module_t *module, const char *name, const char *title,
*/
for (p = name; *p != '\0'; p++)
if (!(g_ascii_islower(*p) || g_ascii_isdigit(*p) || *p == '_' || *p == '.'))
- g_error("Preference \"%s.%s\" contains invalid characters", module->name, name);
+ ws_error("Preference \"%s.%s\" contains invalid characters", module->name, name);
/*
* Make sure there's not already a preference with that
@@ -1014,7 +1016,7 @@ register_preference(module_t *module, const char *name, const char *title,
* more than one preference with the same name.
*/
if (prefs_find_preference(module, name) != NULL)
- g_error("Preference %s has already been registered", name);
+ ws_error("Preference %s has already been registered", name);
if ((!IS_PREF_OBSOLETE(type)) &&
/* Don't compare if it's a subtree */
@@ -1025,30 +1027,30 @@ register_preference(module_t *module, const char *name, const char *title,
*/
if (!((strncmp(name, module->name, strlen(module->name)) != 0) ||
(((name[strlen(module->name)]) != '.') && ((name[strlen(module->name)]) != '_'))))
- g_error("Preference %s begins with the module name", name);
+ ws_error("Preference %s begins with the module name", name);
}
/* The title shows up in the preferences dialog. Make sure it's UI-friendly. */
if (preference->title) {
const char *cur_char;
if (preference->type != PREF_STATIC_TEXT && g_utf8_strlen(preference->title, -1) > 80) { // Arbitrary.
- g_error("Title for preference %s.%s is too long: %s", name_prefix, preference->name, preference->title);
+ ws_error("Title for preference %s.%s is too long: %s", name_prefix, preference->name, preference->title);
}
if (!g_utf8_validate(preference->title, -1, NULL)) {
- g_error("Title for preference %s.%s isn't valid UTF-8.", name_prefix, preference->name);
+ ws_error("Title for preference %s.%s isn't valid UTF-8.", name_prefix, preference->name);
}
for (cur_char = preference->title; *cur_char; cur_char = g_utf8_next_char(cur_char)) {
if (!g_unichar_isprint(g_utf8_get_char(cur_char))) {
- g_error("Title for preference %s.%s isn't printable UTF-8.", name_prefix, preference->name);
+ ws_error("Title for preference %s.%s isn't printable UTF-8.", name_prefix, preference->name);
}
}
}
if (preference->description) {
if (!g_utf8_validate(preference->description, -1, NULL)) {
- g_error("Description for preference %s.%s isn't valid UTF-8.", name_prefix, preference->name);
+ ws_error("Description for preference %s.%s isn't valid UTF-8.", name_prefix, preference->name);
}
}
@@ -4521,7 +4523,7 @@ read_prefs_file(const char *pf_path, FILE *pf,
* If the pref has a trailing comma, eliminate it.
*/
cur_val->str[cur_val->len-1] = '\0';
- g_warning ("%s line %d: trailing comma in \"%s\" %s", pf_path, pline, cur_var->str, hint);
+ ws_warning("%s line %d: trailing comma in \"%s\" %s", pf_path, pline, cur_var->str, hint);
}
}
/* Call the routine to set the preference; it will parse
@@ -4537,12 +4539,12 @@ read_prefs_file(const char *pf_path, FILE *pf,
break;
case PREFS_SET_SYNTAX_ERR:
- g_warning ("Syntax error in preference \"%s\" at line %d of\n%s %s",
+ ws_warning("Syntax error in preference \"%s\" at line %d of\n%s %s",
cur_var->str, pline, pf_path, hint);
break;
case PREFS_SET_NO_SUCH_PREF:
- g_warning ("No such preference \"%s\" at line %d of\n%s %s",
+ ws_warning("No such preference \"%s\" at line %d of\n%s %s",
cur_var->str, pline, pf_path, hint);
prefs.unknown_prefs = TRUE;
break;
@@ -4559,13 +4561,13 @@ read_prefs_file(const char *pf_path, FILE *pf,
* in the console window so that the
* user can make an informed choice.
*/
- g_warning ("Obsolete preference \"%s\" at line %d of\n%s %s",
+ ws_warning("Obsolete preference \"%s\" at line %d of\n%s %s",
cur_var->str, pline, pf_path, hint);
prefs.unknown_prefs = TRUE;
break;
}
} else {
- g_warning ("Incomplete preference at line %d: of\n%s %s", pline, pf_path, hint);
+ ws_warning("Incomplete preference at line %d: of\n%s %s", pline, pf_path, hint);
}
}
state = IN_VAR;
@@ -4578,7 +4580,7 @@ read_prefs_file(const char *pf_path, FILE *pf,
} else if (got_c == '#') {
state = IN_SKIP;
} else {
- g_warning ("Malformed preference at line %d of\n%s %s", fline, pf_path, hint);
+ ws_warning("Malformed preference at line %d of\n%s %s", fline, pf_path, hint);
}
break;
case IN_VAR:
@@ -4623,12 +4625,12 @@ read_prefs_file(const char *pf_path, FILE *pf,
break;
case PREFS_SET_SYNTAX_ERR:
- g_warning ("Syntax error in preference %s at line %d of\n%s %s",
+ ws_warning("Syntax error in preference %s at line %d of\n%s %s",
cur_var->str, pline, pf_path, hint);
break;
case PREFS_SET_NO_SUCH_PREF:
- g_warning ("No such preference \"%s\" at line %d of\n%s %s",
+ ws_warning("No such preference \"%s\" at line %d of\n%s %s",
cur_var->str, pline, pf_path, hint);
prefs.unknown_prefs = TRUE;
break;
@@ -4638,7 +4640,7 @@ read_prefs_file(const char *pf_path, FILE *pf,
break;
}
} else {
- g_warning("Incomplete preference at line %d of\n%s %s",
+ ws_warning("Incomplete preference at line %d of\n%s %s",
pline, pf_path, hint);
}
}
@@ -5291,16 +5293,16 @@ deprecated_port_pref(gchar *pref_name, const gchar *value)
for (i = 0; i < G_N_ELEMENTS(port_prefs); i++) {
module = prefs_find_module(port_prefs[i].module_name);
if (!module) {
- g_warning("Deprecated ports pref check - module '%s' not found", port_prefs[i].module_name);
+ ws_warning("Deprecated ports pref check - module '%s' not found", port_prefs[i].module_name);
continue;
}
pref = prefs_find_preference(module, port_prefs[i].table_name);
if (!pref) {
- g_warning("Deprecated ports pref '%s.%s' not found", module->name, port_prefs[i].table_name);
+ ws_warning("Deprecated ports pref '%s.%s' not found", module->name, port_prefs[i].table_name);
continue;
}
if (pref->type != PREF_DECODE_AS_UINT && pref->type != PREF_DECODE_AS_RANGE) {
- g_warning("Deprecated ports pref '%s.%s' has wrong type: %#x (%s)", module->name, port_prefs[i].table_name, pref->type, prefs_pref_type_name(pref));
+ ws_warning("Deprecated ports pref '%s.%s' has wrong type: %#x (%s)", module->name, port_prefs[i].table_name, pref->type, prefs_pref_type_name(pref));
}
}
}
@@ -5358,7 +5360,7 @@ deprecated_port_pref(gchar *pref_name, const gchar *value)
break;
default:
- g_error("The dissector table %s (%s) is not an integer type - are you using a buggy plugin?", port_range_prefs[i].table_name, get_dissector_table_ui_name(port_range_prefs[i].table_name));
+ ws_error("The dissector table %s (%s) is not an integer type - are you using a buggy plugin?", port_range_prefs[i].table_name, get_dissector_table_ui_name(port_range_prefs[i].table_name));
g_assert_not_reached();
}
@@ -5568,7 +5570,7 @@ set_pref(gchar *pref_name, const gchar *value, void *private_data _U_,
}
}
if (module) {
- g_warning ("Preference \"%s.%s\" has been converted to \"%s.%s\"\n"
+ ws_warning("Preference \"%s.%s\" has been converted to \"%s.%s\"\n"
"Save your preferences to make this change permanent.",
pref_name, dotp+1, module->name, dotp+1);
prefs.unknown_prefs = TRUE;
@@ -6671,7 +6673,7 @@ write_prefs(char **pf_path_return)
char *err = NULL;
prefs.filter_expressions_old = FALSE;
if (!uat_save(uat_get_table_by_name("Display expressions"), &err)) {
- g_warning("Unable to save Display expressions: %s", err);
+ ws_warning("Unable to save Display expressions: %s", err);
g_free(err);
}
}
diff --git a/epan/proto.c b/epan/proto.c
index 34cd1b7c32..2b7ad23c63 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -9,6 +9,7 @@
*/
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_EPAN
#include <stdio.h>
#include <string.h>
@@ -21,6 +22,7 @@
#include <wsutil/sign_ext.h>
#include <wsutil/utf8_entities.h>
#include <wsutil/json_dumper.h>
+#include <wsutil/wslog.h>
#include <ftypes/ftypes-int.h>
@@ -109,7 +111,7 @@ struct ptvcursor {
if (PTREE_DATA(tree)->count > prefs.gui_max_tree_items) { \
free_block; \
if (wireshark_abort_on_too_many_items) \
- g_error("Adding %s would put more than %d items in the tree -- possible infinite loop (max number of items can be increased in advanced preferences)", \
+ ws_error("Adding %s would put more than %d items in the tree -- possible infinite loop (max number of items can be increased in advanced preferences)", \
hfinfo->abbrev, prefs.gui_max_tree_items); \
/* Let the exception handler add items to the tree */ \
PTREE_DATA(tree)->count = 0; \
@@ -182,7 +184,7 @@ struct ptvcursor {
so only report if different... */ \
if ((start_values[m].value == current->value) && \
(strcmp(start_values[m].strptr, current->strptr) != 0)) { \
- g_warning("Field '%s' (%s) has a conflicting entry in its" \
+ ws_warning("Field '%s' (%s) has a conflicting entry in its" \
" value_string: %" modifier "u is at indices %u (%s) and %u (%s)", \
hfinfo->name, hfinfo->abbrev, \
current->value, m, start_values[m].strptr, n, current->strptr); \
@@ -325,7 +327,7 @@ static void register_type_length_mismatch(void);
static int proto_number_string_decoding_error = -1;
static expert_field ei_number_string_decoding_failed_error = EI_INIT;
static expert_field ei_number_string_decoding_erange_error = EI_INIT;
-static void register_number_string_decoding_error(void);
+static void register_number_string_decodinws_error(void);
/* Handle string errors expert info */
static int proto_string_errors = -1;
@@ -388,7 +390,7 @@ static GHashTable* prefixes = NULL;
#define PROTO_REGISTRAR_GET_NTH(hfindex, hfinfo) \
if((guint)hfindex >= gpa_hfinfo.len && wireshark_abort_on_dissector_bug) \
- g_error("Unregistered hf! index=%d", hfindex); \
+ ws_error("Unregistered hf! index=%d", hfindex); \
DISSECTOR_ASSERT_HINT((guint)hfindex < gpa_hfinfo.len, "Unregistered hf!"); \
DISSECTOR_ASSERT_HINT(gpa_hfinfo.hfi[hfindex] != NULL, "Unregistered hf!"); \
hfinfo = gpa_hfinfo.hfi[hfindex];
@@ -455,7 +457,7 @@ proto_register_plugin(const proto_plugin *plug)
void
proto_register_plugin(const proto_plugin *plug _U_)
{
- g_warning("proto_register_plugin: built without support for binary plugins");
+ ws_warning("proto_register_plugin: built without support for binary plugins");
}
#endif /* HAVE_PLUGINS */
@@ -514,7 +516,7 @@ proto_init(GSList *register_all_plugin_protocols_list,
/* Register the pseudo-protocols used for exceptions. */
register_show_exception();
register_type_length_mismatch();
- register_number_string_decoding_error();
+ register_number_string_decodinws_error();
register_string_errors();
/* Have each built-in dissector register its protocols, fields,
@@ -7327,7 +7329,7 @@ check_valid_filter_name_or_fail(const char *filter_name)
}
if (found_invalid) {
- g_error("Protocol filter name \"%s\" has one or more invalid characters."
+ ws_error("Protocol filter name \"%s\" has one or more invalid characters."
" Allowed are lower characters, digits, '-', '_' and non-repeating '.'."
" This might be caused by an inappropriate plugin or a development error.", filter_name);
}
@@ -7350,19 +7352,19 @@ proto_register_protocol(const char *name, const char *short_name,
if (g_hash_table_lookup(proto_names, name)) {
/* g_error will terminate the program */
- g_error("Duplicate protocol name \"%s\"!"
+ ws_error("Duplicate protocol name \"%s\"!"
" This might be caused by an inappropriate plugin or a development error.", name);
}
if (g_hash_table_lookup(proto_short_names, short_name)) {
- g_error("Duplicate protocol short_name \"%s\"!"
+ ws_error("Duplicate protocol short_name \"%s\"!"
" This might be caused by an inappropriate plugin or a development error.", short_name);
}
check_valid_filter_name_or_fail(filter_name);
if (g_hash_table_lookup(proto_filter_names, filter_name)) {
- g_error("Duplicate protocol filter_name \"%s\"!"
+ ws_error("Duplicate protocol filter_name \"%s\"!"
" This might be caused by an inappropriate plugin or a development error.", filter_name);
}
@@ -7414,11 +7416,11 @@ proto_register_protocol_in_name_only(const char *name, const char *short_name, c
* Just register it in a list and make a hf_ field from it
*/
if ((field_type != FT_PROTOCOL) && (field_type != FT_BYTES)) {
- g_error("Pino \"%s\" must be of type FT_PROTOCOL or FT_BYTES.", name);
+ ws_error("Pino \"%s\" must be of type FT_PROTOCOL or FT_BYTES.", name);
}
if (parent_proto < 0) {
- g_error("Must have a valid parent protocol for helper protocol \"%s\"!"
+ ws_error("Must have a valid parent protocol for helper protocol \"%s\"!"
" This might be caused by an inappropriate plugin or a development error.", name);
}
@@ -8221,16 +8223,16 @@ tmp_fld_check_assert(header_field_info *hfinfo)
if (!hfinfo->name || !hfinfo->name[0]) {
if (hfinfo->abbrev)
/* Try to identify the field */
- g_error("Field (abbrev='%s') does not have a name\n",
+ ws_error("Field (abbrev='%s') does not have a name\n",
hfinfo->abbrev);
else
/* Hum, no luck */
- g_error("Field does not have a name (nor an abbreviation)\n");
+ ws_error("Field does not have a name (nor an abbreviation)\n");
}
/* fields with an empty string for an abbreviation aren't filterable */
if (!hfinfo->abbrev || !hfinfo->abbrev[0])
- g_error("Field '%s' does not have an abbreviation\n", hfinfo->name);
+ ws_error("Field '%s' does not have an abbreviation\n", hfinfo->name);
/* These types of fields are allowed to have value_strings,
* true_false_strings or a protocol_t struct
@@ -8272,7 +8274,7 @@ tmp_fld_check_assert(header_field_info *hfinfo)
//fallthrough
default:
- g_error("Field '%s' (%s) has a 'strings' value but is of type %s"
+ ws_error("Field '%s' (%s) has a 'strings' value but is of type %s"
" (which is not allowed to have strings)\n",
hfinfo->name, hfinfo->abbrev, ftype_name(hfinfo->type));
}
@@ -8318,7 +8320,7 @@ tmp_fld_check_assert(header_field_info *hfinfo)
const true_false_string *tfs = (const true_false_string*)hfinfo->strings;
if (tfs) {
if (strcmp(tfs->false_string, tfs->true_string) == 0) {
- g_warning("Field '%s' (%s) has identical true and false strings (\"%s\", \"%s\")",
+ ws_warning("Field '%s' (%s) has identical true and false strings (\"%s\", \"%s\")",
hfinfo->name, hfinfo->abbrev,
tfs->false_string, tfs->true_string);
}
@@ -8332,7 +8334,7 @@ tmp_fld_check_assert(header_field_info *hfinfo)
do {
if (this_it->value_max < this_it->value_min) {
- g_warning("value_range_string error: %s (%s) entry for \"%s\" - max(%u 0x%x) is less than min(%u 0x%x)",
+ ws_warning("value_range_string error: %s (%s) entry for \"%s\" - max(%u 0x%x) is less than min(%u 0x%x)",
hfinfo->name, hfinfo->abbrev,
this_it->strptr,
this_it->value_max, this_it->value_max,
@@ -8344,7 +8346,7 @@ tmp_fld_check_assert(header_field_info *hfinfo)
for (const range_string *prev_it=rs; prev_it < this_it; ++prev_it) {
/* Not OK if this one is completely hidden by an earlier one! */
if ((prev_it->value_min <= this_it->value_min) && (prev_it->value_max >= this_it->value_max)) {
- g_warning("value_range_string error: %s (%s) hidden by earlier entry "
+ ws_warning("value_range_string error: %s (%s) hidden by earlier entry "
"(prev=\"%s\": %u 0x%x -> %u 0x%x) (this=\"%s\": %u 0x%x -> %u 0x%x)",
hfinfo->name, hfinfo->abbrev,
prev_it->strptr, prev_it->value_min, prev_it->value_min,
@@ -8378,7 +8380,7 @@ tmp_fld_check_assert(header_field_info *hfinfo)
break;
case BASE_NONE:
if (hfinfo->strings == NULL)
- g_error("Field '%s' (%s) is an integral value (%s)"
+ ws_error("Field '%s' (%s) is an integral value (%s)"
" but is being displayed as BASE_NONE but"
" without a strings conversion",
hfinfo->name, hfinfo->abbrev,
@@ -8386,14 +8388,14 @@ tmp_fld_check_assert(header_field_info *hfinfo)
break;
default:
tmp_str = val_to_str_wmem(NULL, hfinfo->display, hf_display, "(Unknown: 0x%x)");
- g_error("Field '%s' (%s) is a character value (%s)"
+ ws_error("Field '%s' (%s) is a character value (%s)"
" but is being displayed as %s\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type), tmp_str);
wmem_free(NULL, tmp_str);
}
if (hfinfo->display & BASE_UNIT_STRING) {
- g_error("Field '%s' (%s) is a character value (%s) but has a unit string\n",
+ ws_error("Field '%s' (%s) is a character value (%s) but has a unit string\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type));
}
@@ -8417,7 +8419,7 @@ tmp_fld_check_assert(header_field_info *hfinfo)
case BASE_DEC_HEX:
case BASE_HEX_DEC:
tmp_str = val_to_str_wmem(NULL, hfinfo->display, hf_display, "(Bit count: %d)");
- g_error("Field '%s' (%s) is signed (%s) but is being displayed unsigned (%s)\n",
+ ws_error("Field '%s' (%s) is signed (%s) but is being displayed unsigned (%s)\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type), tmp_str);
wmem_free(NULL, tmp_str);
@@ -8434,17 +8436,17 @@ tmp_fld_check_assert(header_field_info *hfinfo)
if (IS_BASE_PORT(hfinfo->display)) {
tmp_str = val_to_str_wmem(NULL, hfinfo->display, hf_display, "(Unknown: 0x%x)");
if (hfinfo->type != FT_UINT16) {
- g_error("Field '%s' (%s) has 'display' value %s but it can only be used with FT_UINT16, not %s\n",
+ ws_error("Field '%s' (%s) has 'display' value %s but it can only be used with FT_UINT16, not %s\n",
hfinfo->name, hfinfo->abbrev,
tmp_str, ftype_name(hfinfo->type));
}
if (hfinfo->strings != NULL) {
- g_error("Field '%s' (%s) is an %s (%s) but has a strings value\n",
+ ws_error("Field '%s' (%s) is an %s (%s) but has a strings value\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type), tmp_str);
}
if (hfinfo->bitmask != 0) {
- g_error("Field '%s' (%s) is an %s (%s) but has a bitmask\n",
+ ws_error("Field '%s' (%s) is an %s (%s) but has a bitmask\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type), tmp_str);
}
@@ -8455,17 +8457,17 @@ tmp_fld_check_assert(header_field_info *hfinfo)
if (hfinfo->display == BASE_OUI) {
tmp_str = val_to_str_wmem(NULL, hfinfo->display, hf_display, "(Unknown: 0x%x)");
if (hfinfo->type != FT_UINT24) {
- g_error("Field '%s' (%s) has 'display' value %s but it can only be used with FT_UINT24, not %s\n",
+ ws_error("Field '%s' (%s) has 'display' value %s but it can only be used with FT_UINT24, not %s\n",
hfinfo->name, hfinfo->abbrev,
tmp_str, ftype_name(hfinfo->type));
}
if (hfinfo->strings != NULL) {
- g_error("Field '%s' (%s) is an %s (%s) but has a strings value\n",
+ ws_error("Field '%s' (%s) is an %s (%s) but has a strings value\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type), tmp_str);
}
if (hfinfo->bitmask != 0) {
- g_error("Field '%s' (%s) is an %s (%s) but has a bitmask\n",
+ ws_error("Field '%s' (%s) is an %s (%s) but has a bitmask\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type), tmp_str);
}
@@ -8493,14 +8495,14 @@ tmp_fld_check_assert(header_field_info *hfinfo)
break;
case BASE_NONE:
if (hfinfo->strings == NULL) {
- g_error("Field '%s' (%s) is an integral value (%s)"
+ ws_error("Field '%s' (%s) is an integral value (%s)"
" but is being displayed as BASE_NONE but"
" without a strings conversion",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type));
}
if (hfinfo->display & BASE_SPECIAL_VALS) {
- g_error("Field '%s' (%s) is an integral value (%s)"
+ ws_error("Field '%s' (%s) is an integral value (%s)"
" that is being displayed as BASE_NONE but"
" with BASE_SPECIAL_VALS",
hfinfo->name, hfinfo->abbrev,
@@ -8510,7 +8512,7 @@ tmp_fld_check_assert(header_field_info *hfinfo)
default:
tmp_str = val_to_str_wmem(NULL, hfinfo->display, hf_display, "(Unknown: 0x%x)");
- g_error("Field '%s' (%s) is an integral value (%s)"
+ ws_error("Field '%s' (%s) is an integral value (%s)"
" but is being displayed as %s\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type), tmp_str);
@@ -8531,17 +8533,17 @@ tmp_fld_check_assert(header_field_info *hfinfo)
break;
default:
tmp_str = val_to_str_wmem(NULL, hfinfo->display, hf_display, "(Bit count: %d)");
- g_error("Field '%s' (%s) is an byte array but is being displayed as %s instead of BASE_NONE, SEP_DOT, SEP_DASH, SEP_COLON, or SEP_SPACE\n",
+ ws_error("Field '%s' (%s) is an byte array but is being displayed as %s instead of BASE_NONE, SEP_DOT, SEP_DASH, SEP_COLON, or SEP_SPACE\n",
hfinfo->name, hfinfo->abbrev, tmp_str);
wmem_free(NULL, tmp_str);
}
if (hfinfo->bitmask != 0)
- g_error("Field '%s' (%s) is an %s but has a bitmask\n",
+ ws_error("Field '%s' (%s) is an %s but has a bitmask\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type));
//allowed to support string if its a protocol (for pinos)
if ((hfinfo->strings != NULL) && (!(hfinfo->display & BASE_PROTOCOL_INFO)))
- g_error("Field '%s' (%s) is an %s but has a strings value\n",
+ ws_error("Field '%s' (%s) is an %s but has a strings value\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type));
break;
@@ -8550,13 +8552,13 @@ tmp_fld_check_assert(header_field_info *hfinfo)
case FT_FRAMENUM:
if (hfinfo->display != BASE_NONE) {
tmp_str = val_to_str_wmem(NULL, hfinfo->display, hf_display, "(Bit count: %d)");
- g_error("Field '%s' (%s) is an %s but is being displayed as %s instead of BASE_NONE\n",
+ ws_error("Field '%s' (%s) is an %s but is being displayed as %s instead of BASE_NONE\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type), tmp_str);
wmem_free(NULL, tmp_str);
}
if (hfinfo->bitmask != 0)
- g_error("Field '%s' (%s) is an %s but has a bitmask\n",
+ ws_error("Field '%s' (%s) is an %s but has a bitmask\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type));
break;
@@ -8570,12 +8572,12 @@ tmp_fld_check_assert(header_field_info *hfinfo)
hfinfo->display == ABSOLUTE_TIME_NTP_UTC ||
hfinfo->display == ABSOLUTE_TIME_DOY_UTC)) {
tmp_str = val_to_str_wmem(NULL, hfinfo->display, hf_display, "(Bit count: %d)");
- g_error("Field '%s' (%s) is a %s but is being displayed as %s instead of as a time\n",
+ ws_error("Field '%s' (%s) is a %s but is being displayed as %s instead of as a time\n",
hfinfo->name, hfinfo->abbrev, ftype_name(hfinfo->type), tmp_str);
wmem_free(NULL, tmp_str);
}
if (hfinfo->bitmask != 0)
- g_error("Field '%s' (%s) is an %s but has a bitmask\n",
+ ws_error("Field '%s' (%s) is an %s but has a bitmask\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type));
break;
@@ -8592,7 +8594,7 @@ tmp_fld_check_assert(header_field_info *hfinfo)
default:
tmp_str = val_to_str_wmem(NULL, hfinfo->display, hf_display, "(Unknown: 0x%x)");
- g_error("Field '%s' (%s) is an string value (%s)"
+ ws_error("Field '%s' (%s) is an string value (%s)"
" but is being displayed as %s\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type), tmp_str);
@@ -8600,11 +8602,11 @@ tmp_fld_check_assert(header_field_info *hfinfo)
}
if (hfinfo->bitmask != 0)
- g_error("Field '%s' (%s) is an %s but has a bitmask\n",
+ ws_error("Field '%s' (%s) is an %s but has a bitmask\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type));
if (hfinfo->strings != NULL)
- g_error("Field '%s' (%s) is an %s but has a strings value\n",
+ ws_error("Field '%s' (%s) is an %s but has a strings value\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type));
break;
@@ -8617,7 +8619,7 @@ tmp_fld_check_assert(header_field_info *hfinfo)
default:
tmp_str = val_to_str_wmem(NULL, hfinfo->display, hf_display, "(Unknown: 0x%x)");
- g_error("Field '%s' (%s) is an IPv4 value (%s)"
+ ws_error("Field '%s' (%s) is an IPv4 value (%s)"
" but is being displayed as %s\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type), tmp_str);
@@ -8629,36 +8631,36 @@ tmp_fld_check_assert(header_field_info *hfinfo)
case FT_DOUBLE:
if (FIELD_DISPLAY(hfinfo->display) != BASE_NONE) {
tmp_str = val_to_str_wmem(NULL, hfinfo->display, hf_display, "(Bit count: %d)");
- g_error("Field '%s' (%s) is an %s but is being displayed as %s instead of BASE_NONE\n",
+ ws_error("Field '%s' (%s) is an %s but is being displayed as %s instead of BASE_NONE\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type),
tmp_str);
wmem_free(NULL, tmp_str);
}
if (hfinfo->bitmask != 0)
- g_error("Field '%s' (%s) is an %s but has a bitmask\n",
+ ws_error("Field '%s' (%s) is an %s but has a bitmask\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type));
if ((hfinfo->strings != NULL) && (!(hfinfo->display & BASE_UNIT_STRING)))
- g_error("Field '%s' (%s) is an %s but has a strings value\n",
+ ws_error("Field '%s' (%s) is an %s but has a strings value\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type));
break;
default:
if (hfinfo->display != BASE_NONE) {
tmp_str = val_to_str_wmem(NULL, hfinfo->display, hf_display, "(Bit count: %d)");
- g_error("Field '%s' (%s) is an %s but is being displayed as %s instead of BASE_NONE\n",
+ ws_error("Field '%s' (%s) is an %s but is being displayed as %s instead of BASE_NONE\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type),
tmp_str);
wmem_free(NULL, tmp_str);
}
if (hfinfo->bitmask != 0)
- g_error("Field '%s' (%s) is an %s but has a bitmask\n",
+ ws_error("Field '%s' (%s) is an %s but has a bitmask\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type));
if (hfinfo->strings != NULL)
- g_error("Field '%s' (%s) is an %s but has a strings value\n",
+ ws_error("Field '%s' (%s) is an %s but has a strings value\n",
hfinfo->name, hfinfo->abbrev,
ftype_name(hfinfo->type));
break;
@@ -8735,7 +8737,7 @@ register_type_length_mismatch(void)
}
static void
-register_number_string_decoding_error(void)
+register_number_string_decodinws_error(void)
{
static ei_register_info ei[] = {
{ &ei_number_string_decoding_failed_error,
@@ -8807,7 +8809,7 @@ proto_register_field_init(header_field_info *hfinfo, const int parent)
gpa_hfinfo.allocated_len += 1000;
gpa_hfinfo.hfi = (header_field_info **)g_realloc(gpa_hfinfo.hfi,
sizeof(header_field_info *)*gpa_hfinfo.allocated_len);
- /*g_warning("gpa_hfinfo.allocated_len %u", gpa_hfinfo.allocated_len);*/
+ /*ws_warning("gpa_hfinfo.allocated_len %u", gpa_hfinfo.allocated_len);*/
}
}
gpa_hfinfo.hfi[gpa_hfinfo.len] = hfinfo;
@@ -8869,7 +8871,7 @@ proto_register_field_init(header_field_info *hfinfo, const int parent)
#ifdef ENABLE_CHECK_FILTER
while (same_name_hfinfo) {
if (_ftype_common(hfinfo->type) != _ftype_common(same_name_hfinfo->type))
- g_warning("'%s' exists multiple times with incompatible types: %s and %s", hfinfo->abbrev, ftype_name(hfinfo->type), ftype_name(same_name_hfinfo->type));
+ ws_warning("'%s' exists multiple times with incompatible types: %s and %s", hfinfo->abbrev, ftype_name(hfinfo->type), ftype_name(same_name_hfinfo->type));
same_name_hfinfo = same_name_hfinfo->same_name_next;
}
#endif
@@ -8914,7 +8916,7 @@ proto_register_subtree_array(gint * const *indices, const int num_indices)
for (i = 0; i < num_indices; i++, ptr++, num_tree_types++) {
if (**ptr != -1) {
/* g_error will terminate the program */
- g_error("register_subtree_array: subtree item type (ett_...) not -1 !"
+ ws_error("register_subtree_array: subtree item type (ett_...) not -1 !"
" This is a development error:"
" Either the subtree item type has already been assigned or"
" was not initialized to -1.");
@@ -10780,7 +10782,7 @@ proto_registrar_dump_values(void)
if (hfinfo->display & BASE_VAL64_STRING) {
val64_string_ext *vse_p = (val64_string_ext *)hfinfo->strings;
if (!val64_string_ext_validate(vse_p)) {
- g_warning("Invalid val64_string_ext ptr for: %s", hfinfo->abbrev);
+ ws_warning("Invalid val64_string_ext ptr for: %s", hfinfo->abbrev);
continue;
}
try_val64_to_str_ext(0, vse_p); /* "prime" the extended val64_string */
@@ -10792,7 +10794,7 @@ proto_registrar_dump_values(void)
} else {
value_string_ext *vse_p = (value_string_ext *)hfinfo->strings;
if (!value_string_ext_validate(vse_p)) {
- g_warning("Invalid value_string_ext ptr for: %s", hfinfo->abbrev);
+ ws_warning("Invalid value_string_ext ptr for: %s", hfinfo->abbrev);
continue;
}
try_val_to_str_ext(0, vse_p); /* "prime" the extended value_string */
diff --git a/epan/secrets.c b/epan/secrets.c
index 8d61ad42df..117ceda264 100644
--- a/epan/secrets.c
+++ b/epan/secrets.c
@@ -16,6 +16,7 @@
#include "secrets.h"
#include <wiretap/wtap.h>
#include <wsutil/glib-compat.h>
+#include <wsutil/wslog.h>
#include <string.h>
#ifdef HAVE_LIBGNUTLS
@@ -138,7 +139,7 @@ rsa_privkey_add(const cert_key_id_t *key_id, gnutls_privkey_t pkey)
void *ht_key = g_memdup2(key_id->key_id, sizeof(cert_key_id_t));
const guint32 *dw = (const guint32 *)key_id->key_id;
g_hash_table_insert(rsa_privkeys, ht_key, pkey);
- g_debug("Adding RSA private, Key ID %08x%08x%08x%08x%08x", g_htonl(dw[0]),
+ ws_debug("Adding RSA private, Key ID %08x%08x%08x%08x%08x", g_htonl(dw[0]),
g_htonl(dw[1]), g_htonl(dw[2]), g_htonl(dw[3]), g_htonl(dw[4]));
}
@@ -175,13 +176,13 @@ get_pkcs11_token_uris(void)
}
if (ret < 0) {
- g_debug("Failed to query token %u: %s\n", i, gnutls_strerror(ret));
+ ws_debug("Failed to query token %u: %s\n", i, gnutls_strerror(ret));
break;
}
ret = gnutls_pkcs11_token_get_flags(uri, &flags);
if (ret < 0) {
- g_debug("Failed to query token flags for %s: %s\n", uri, gnutls_strerror(ret));
+ ws_debug("Failed to query token flags for %s: %s\n", uri, gnutls_strerror(ret));
gnutls_free(uri);
continue;
}
@@ -297,12 +298,12 @@ pkcs11_load_keys_from_token(const char *token_uri, const char *pin, char **err)
ret = gnutls_privkey_import_url(privkey, obj_uri, 0);
if (ret < 0) {
/* Bad PIN or some other system error? */
- g_debug("Failed to import private key %s: %s", obj_uri, gnutls_strerror(ret));
+ ws_debug("Failed to import private key %s: %s", obj_uri, gnutls_strerror(ret));
goto cont;
}
if (gnutls_privkey_get_pk_algorithm(privkey, NULL) != GNUTLS_PK_RSA) {
- g_debug("Skipping private key %s, not RSA.", obj_uri);
+ ws_debug("Skipping private key %s, not RSA.", obj_uri);
goto cont;
}
@@ -315,14 +316,14 @@ pkcs11_load_keys_from_token(const char *token_uri, const char *pin, char **err)
/* This requires GnuTLS 3.4.0 and will fail on older versions. */
ret = gnutls_pubkey_import_privkey(pubkey, privkey, 0, 0);
if (ret < 0) {
- g_debug("Failed to import public key %s: %s", obj_uri, gnutls_strerror(ret));
+ ws_debug("Failed to import public key %s: %s", obj_uri, gnutls_strerror(ret));
goto cont;
}
size = sizeof(key_id);
ret = gnutls_pubkey_get_key_id(pubkey, GNUTLS_KEYID_USE_SHA1, key_id.key_id, &size);
if (ret < 0 || size != sizeof(key_id)) {
- g_debug("Failed to calculate Key ID for %s: %s", obj_uri, gnutls_strerror(ret));
+ ws_debug("Failed to calculate Key ID for %s: %s", obj_uri, gnutls_strerror(ret));
goto cont;
}
diff --git a/epan/sequence_analysis.h b/epan/sequence_analysis.h
index 5016b51a40..638be5cb2c 100644
--- a/epan/sequence_analysis.h
+++ b/epan/sequence_analysis.h
@@ -73,7 +73,7 @@ typedef struct register_analysis register_analysis_t;
#if 0
#define SEQ_ANALYSIS_DEBUG(...) { \
char *SEQ_ANALYSIS_DEBUG_MSG = g_strdup_printf(__VA_ARGS__); \
- g_warning("sequence analysis: %s:%d %s", G_STRFUNC, __LINE__, SEQ_ANALYSIS_DEBUG_MSG); \
+ ws_warning("sequence analysis: %s:%d %s", G_STRFUNC, __LINE__, SEQ_ANALYSIS_DEBUG_MSG); \
g_free(SEQ_ANALYSIS_DEBUG_MSG); \
}
#else
diff --git a/epan/show_exception.c b/epan/show_exception.c
index c052362c22..7d5712c95f 100644
--- a/epan/show_exception.c
+++ b/epan/show_exception.c
@@ -10,6 +10,7 @@
*/
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_EPAN
#include <glib.h>
#include <epan/packet.h>
@@ -19,6 +20,8 @@
#include <epan/prefs-int.h>
#include <epan/show_exception.h>
+#include <wsutil/wslog.h>
+
static int proto_short = -1;
static int proto_malformed = -1;
static int proto_unreassembled = -1;
@@ -136,7 +139,7 @@ show_exception(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
pinfo->current_proto,
exception_message == NULL ?
dissector_error_nomsg : exception_message);
- g_warning("Dissector bug, protocol %s, in packet %u: %s",
+ ws_warning("Dissector bug, protocol %s, in packet %u: %s",
pinfo->current_proto, pinfo->num,
exception_message == NULL ?
dissector_error_nomsg : exception_message);
diff --git a/epan/tap.c b/epan/tap.c
index 9e5dddfa26..9e2c6aec70 100644
--- a/epan/tap.c
+++ b/epan/tap.c
@@ -9,6 +9,7 @@
*/
#include <config.h>
+#define WS_LOG_DOMAIN LOG_DOMAIN_EPAN
#include <stdio.h>
@@ -25,6 +26,7 @@
#include <epan/packet_info.h>
#include <epan/dfilter/dfilter.h>
#include <epan/tap.h>
+#include <wsutil/wslog.h>
static gboolean tapping_is_active=FALSE;
@@ -105,7 +107,7 @@ tap_register_plugin(const tap_plugin *plug)
void
tap_register_plugin(const tap_plugin *plug _U_)
{
- g_warning("tap_register_plugin: built without support for binary plugins");
+ ws_warning("tap_register_plugin: built without support for binary plugins");
}
#endif /* HAVE_PLUGINS */
@@ -236,7 +238,7 @@ tap_queue_packet(int tap_id, packet_info *pinfo, const void *tap_specific_data)
* rather than having a fixed maximum number of entries?
*/
if(tap_packet_index >= TAP_PACKET_QUEUE_LEN){
- g_warning("Too many taps queued");
+ ws_warning("Too many taps queued");
return;
}
@@ -679,7 +681,7 @@ remove_tap_listener(void *tapdata)
}
if(!tl) {
- g_warning("remove_tap_listener(): no listener found with that tap data");
+ ws_warning("remove_tap_listener(): no listener found with that tap data");
return;
}
}
diff --git a/epan/tvbparse.c b/epan/tvbparse.c
index 8aec4c8e83..b8d645d0b7 100644
--- a/epan/tvbparse.c
+++ b/epan/tvbparse.c
@@ -77,7 +77,7 @@ static tvbparse_elem_t* new_tok(tvbparse_t* tt,
tvbparse_elem_t* tok;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_NEWTOK) g_warning("new_tok: id=%i offset=%u len=%u",id,offset,len);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_NEWTOK) ws_warning("new_tok: id=%i offset=%u len=%u",id,offset,len);
#endif
tok = wmem_new(wmem_packet_scope(), tvbparse_elem_t);
@@ -103,20 +103,20 @@ static int ignore_fcn(tvbparse_t* tt, int offset) {
if (!tt->ignore) return 0;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_IGNORE) g_warning("ignore: enter");
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_IGNORE) ws_warning("ignore: enter");
#endif
while ((consumed = tt->ignore->condition(tt,offset,tt->ignore,&ignored)) > 0) {
len += consumed;
offset += consumed;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_IGNORE) g_warning("ignore: consumed=%i",consumed);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_IGNORE) ws_warning("ignore: consumed=%i",consumed);
#endif
}
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_IGNORE) g_warning("ignore: len=%i",len);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_IGNORE) ws_warning("ignore: len=%i",len);
#endif
return len;
@@ -128,7 +128,7 @@ static int cond_char (tvbparse_t* tt, const int offset, const tvbparse_wanted_t
guint i;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_CHAR) g_warning("cond_char: control='%s'",wanted->control.str);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_CHAR) ws_warning("cond_char: control='%s'",wanted->control.str);
#endif
if ( offset + 1 > tt->end_offset )
@@ -140,7 +140,7 @@ static int cond_char (tvbparse_t* tt, const int offset, const tvbparse_wanted_t
if ( c == t ) {
*tok = new_tok(tt,wanted->id,offset,1,wanted);
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_CHAR) g_warning("cond_char: GOT: '%c'",c);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_CHAR) ws_warning("cond_char: GOT: '%c'",c);
#endif
return 1;
}
@@ -173,7 +173,7 @@ static int cond_chars_common(tvbparse_t* tt, int offset, const tvbparse_wanted_t
int left = tt->end_offset - offset;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_CHARS) g_warning("cond_chars_common: control='%s'",wanted->control.str);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_CHARS) ws_warning("cond_chars_common: control='%s'",wanted->control.str);
#endif
if ( offset + (int)wanted->min > tt->end_offset )
@@ -196,7 +196,7 @@ static int cond_chars_common(tvbparse_t* tt, int offset, const tvbparse_wanted_t
} else {
*tok = new_tok(tt,wanted->id,start,length,wanted);
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_CHARS) g_warning("cond_chars_common: GOT len=%i",length);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_CHARS) ws_warning("cond_chars_common: GOT len=%i",length);
#endif
return length;
}
@@ -238,7 +238,7 @@ static int cond_not_char(tvbparse_t* tt, const int offset, const tvbparse_wanted
gboolean not_matched = FALSE;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_NOT_CHAR) g_warning("cond_not_char: control='%s'",wanted->control.str);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_NOT_CHAR) ws_warning("cond_not_char: control='%s'",wanted->control.str);
#endif
if ( offset >= tt->end_offset ) {
@@ -258,7 +258,7 @@ static int cond_not_char(tvbparse_t* tt, const int offset, const tvbparse_wanted
} else {
*tok = new_tok(tt,wanted->id,offset,1,wanted);
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_NOT_CHAR) g_warning("cond_not_char: GOT='%c'",t);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_NOT_CHAR) ws_warning("cond_not_char: GOT='%c'",t);
#endif
return 1;
}
@@ -316,7 +316,7 @@ tvbparse_wanted_t* tvbparse_not_chars(const int id,
static int cond_string(tvbparse_t* tt, const int offset, const tvbparse_wanted_t * wanted, tvbparse_elem_t** tok) {
int len = wanted->len;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_STRING) g_warning("cond_string: control='%s'",wanted->control.str);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_STRING) ws_warning("cond_string: control='%s'",wanted->control.str);
#endif
if ( offset + wanted->len > tt->end_offset )
@@ -325,7 +325,7 @@ static int cond_string(tvbparse_t* tt, const int offset, const tvbparse_wanted_t
if ( tvb_strneql(tt->tvb, offset, wanted->control.str, len) == 0 ) {
*tok = new_tok(tt,wanted->id,offset,len,wanted);
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_STRING) g_warning("cond_string: GOT len=%i",len);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_STRING) ws_warning("cond_string: GOT len=%i",len);
#endif
return len;
} else {
@@ -354,7 +354,7 @@ tvbparse_wanted_t* tvbparse_string(const int id,
static int cond_casestring(tvbparse_t* tt, const int offset, const tvbparse_wanted_t * wanted, tvbparse_elem_t** tok) {
int len = wanted->len;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_CASESTRING) g_warning("cond_casestring: control='%s'",wanted->control.str);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_CASESTRING) ws_warning("cond_casestring: control='%s'",wanted->control.str);
#endif
if ( offset + len > tt->end_offset )
@@ -363,7 +363,7 @@ static int cond_casestring(tvbparse_t* tt, const int offset, const tvbparse_want
if ( tvb_strncaseeql(tt->tvb, offset, wanted->control.str, len) == 0 ) {
*tok = new_tok(tt,wanted->id,offset,len,wanted);
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_CASESTRING) g_warning("cond_casestring: GOT len=%i",len);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_CASESTRING) ws_warning("cond_casestring: GOT len=%i",len);
#endif
return len;
} else {
@@ -393,7 +393,7 @@ tvbparse_wanted_t* tvbparse_casestring(const int id,
static int cond_one_of(tvbparse_t* tt, const int offset, const tvbparse_wanted_t * wanted, tvbparse_elem_t** tok) {
guint i;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_ONEOF) g_warning("cond_one_of: START");
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_ONEOF) ws_warning("cond_one_of: START");
#endif
if ( offset > tt->end_offset )
@@ -416,7 +416,7 @@ static int cond_one_of(tvbparse_t* tt, const int offset, const tvbparse_wanted_t
*tok = new_tok(tt, wanted->id, new_elem->offset, new_elem->len, wanted);
(*tok)->sub = new_elem;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_ONEOF) g_warning("cond_one_of: GOT len=%i",curr_len);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_ONEOF) ws_warning("cond_one_of: GOT len=%i",curr_len);
#endif
tt->recursion_depth--;
return curr_len;
@@ -474,7 +474,7 @@ static int cond_hash(tvbparse_t* tt, const int offset, const tvbparse_wanted_t*
tvbparse_elem_t* ret_tok;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_HASH) g_warning("cond_hash: START");
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_HASH) ws_warning("cond_hash: START");
#endif
if ( offset > tt->end_offset )
@@ -492,7 +492,7 @@ static int cond_hash(tvbparse_t* tt, const int offset, const tvbparse_wanted_t*
key = tvb_get_string_enc(wmem_packet_scope(),key_elem->tvb,key_elem->offset,key_elem->len, ENC_ASCII);
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_HASH) g_warning("cond_hash: got key='%s'",key);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_HASH) ws_warning("cond_hash: got key='%s'",key);
#endif
if ((value_wanted = (tvbparse_wanted_t *)wmem_map_lookup(wanted->control.hash.table,key))) {
@@ -518,7 +518,7 @@ static int cond_hash(tvbparse_t* tt, const int offset, const tvbparse_wanted_t*
*tok = ret_tok;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_HASH) g_warning("cond_hash: GOT len=%i",tot_len);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_HASH) ws_warning("cond_hash: GOT len=%i",tot_len);
#endif
return tot_len;
@@ -579,7 +579,7 @@ static int cond_seq(tvbparse_t* tt, int offset, const tvbparse_wanted_t * wanted
tvbparse_elem_t* ret_tok = NULL;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_SEQ) g_warning("cond_seq: START");
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_SEQ) ws_warning("cond_seq: START");
#endif
if ( offset > tt->end_offset )
@@ -624,7 +624,7 @@ static int cond_seq(tvbparse_t* tt, int offset, const tvbparse_wanted_t * wanted
*tok = ret_tok;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_SEQ) g_warning("cond_seq: GOT len=%i",offset - start);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_SEQ) ws_warning("cond_seq: GOT len=%i",offset - start);
#endif
return offset - start;
@@ -663,7 +663,7 @@ static int cond_some(tvbparse_t* tt, int offset, const tvbparse_wanted_t * wante
int start = offset;
tvbparse_elem_t* ret_tok = NULL;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_SOME) g_warning("cond_some: START");
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_SOME) ws_warning("cond_some: START");
#endif
if ( offset > tt->end_offset )
@@ -713,7 +713,7 @@ static int cond_some(tvbparse_t* tt, int offset, const tvbparse_wanted_t * wante
tt->recursion_depth--;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_SOME) g_warning("cond_some: got num=%u",got_so_far);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_SOME) ws_warning("cond_some: got num=%u",got_so_far);
#endif
if(got_so_far < wanted->min) {
@@ -722,7 +722,7 @@ static int cond_some(tvbparse_t* tt, int offset, const tvbparse_wanted_t * wante
*tok = ret_tok;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_SOME) g_warning("cond_some: GOT len=%i",offset - start);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_SOME) ws_warning("cond_some: GOT len=%i",offset - start);
#endif
return offset - start;
}
@@ -757,7 +757,7 @@ static int cond_until(tvbparse_t* tt, const int offset, const tvbparse_wanted_t
int len = 0;
int target_offset = offset;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_UNTIL) g_warning("cond_until: START");
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_UNTIL) ws_warning("cond_until: START");
#endif
if ( offset + wanted->control.until.subelem->len > tt->end_offset )
@@ -786,19 +786,19 @@ static int cond_until(tvbparse_t* tt, const int offset, const tvbparse_wanted_t
case TP_UNTIL_INCLUDE:
new_elem->len = target_offset - offset - 1 + len;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_UNTIL) g_warning("cond_until: GOT len=%i",target_offset - offset -1 + len);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_UNTIL) ws_warning("cond_until: GOT len=%i",target_offset - offset -1 + len);
#endif
return target_offset - offset -1 + len;
case TP_UNTIL_SPEND:
new_elem->len = target_offset - offset - 1;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_UNTIL) g_warning("cond_until: GOT len=%i",target_offset - offset -1 + len);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_UNTIL) ws_warning("cond_until: GOT len=%i",target_offset - offset -1 + len);
#endif
return target_offset - offset - 1 + len;
case TP_UNTIL_LEAVE:
new_elem->len = target_offset - offset - 1;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_UNTIL) g_warning("cond_until: GOT len=%i",target_offset - offset -1);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_UNTIL) ws_warning("cond_until: GOT len=%i",target_offset - offset -1);
#endif
return target_offset - offset -1;
default:
@@ -1216,7 +1216,7 @@ tvbparse_t* tvbparse_init(tvbuff_t* tvb,
tvbparse_t* tt = wmem_new(wmem_packet_scope(), tvbparse_t);
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_TT) g_warning("tvbparse_init: offset=%i len=%i",offset,len);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_TT) ws_warning("tvbparse_init: offset=%i len=%i",offset,len);
#endif
@@ -1235,7 +1235,7 @@ gboolean tvbparse_reset(tvbparse_t* tt,
int len) {
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_TT) g_warning("tvbparse_init: offset=%i len=%i",offset,len);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_TT) ws_warning("tvbparse_init: offset=%i len=%i",offset,len);
#endif
len = (len == -1) ? (int) tvb_captured_length(tt->tvb) : len;
@@ -1259,7 +1259,7 @@ static void execute_callbacks(tvbparse_t* tt, tvbparse_elem_t* curr) {
while (curr) {
if(curr->wanted->before) {
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_CB) g_warning("execute_callbacks: BEFORE: id=%i offset=%i len=%i",curr->id,curr->offset,curr->len);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_CB) ws_warning("execute_callbacks: BEFORE: id=%i offset=%i len=%i",curr->id,curr->offset,curr->len);
#endif
curr->wanted->before(tt->data, curr->wanted->data, curr);
}
@@ -1270,7 +1270,7 @@ static void execute_callbacks(tvbparse_t* tt, tvbparse_elem_t* curr) {
continue;
} else {
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_CB) g_warning("execute_callbacks: AFTER: id=%i offset=%i len=%i",curr->id,curr->offset,curr->len);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_CB) ws_warning("execute_callbacks: AFTER: id=%i offset=%i len=%i",curr->id,curr->offset,curr->len);
#endif
if(curr->wanted->after) curr->wanted->after(tt->data, curr->wanted->data, curr);
}
@@ -1280,7 +1280,7 @@ static void execute_callbacks(tvbparse_t* tt, tvbparse_elem_t* curr) {
while( !curr && wmem_stack_count(stack) > 0 ) {
curr = (tvbparse_elem_t *)wmem_stack_pop(stack);
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_CB) g_warning("execute_callbacks: AFTER: id=%i offset=%i len=%i",curr->id,curr->offset,curr->len);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_CB) ws_warning("execute_callbacks: AFTER: id=%i offset=%i len=%i",curr->id,curr->offset,curr->len);
#endif
if( curr->wanted->after ) curr->wanted->after(tt->data, curr->wanted->data, curr);
curr = curr->next;
@@ -1296,25 +1296,25 @@ gboolean tvbparse_peek(tvbparse_t* tt,
int offset = tt->offset;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_PEEK) g_warning("tvbparse_peek: ENTER offset=%i",offset);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_PEEK) ws_warning("tvbparse_peek: ENTER offset=%i",offset);
#endif
offset += ignore_fcn(tt,offset);
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_PEEK) g_warning("tvbparse_peek: after ignore offset=%i",offset);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_PEEK) ws_warning("tvbparse_peek: after ignore offset=%i",offset);
#endif
consumed = wanted->condition(tt,offset,wanted,&tok);
if (consumed >= 0) {
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_PEEK) g_warning("tvbparse_peek: GOT len=%i",consumed);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_PEEK) ws_warning("tvbparse_peek: GOT len=%i",consumed);
#endif
return TRUE;
} else {
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_PEEK) g_warning("tvbparse_peek: NOT GOT");
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_PEEK) ws_warning("tvbparse_peek: NOT GOT");
#endif
return FALSE;
}
@@ -1328,25 +1328,25 @@ tvbparse_elem_t* tvbparse_get(tvbparse_t* tt,
int offset = tt->offset;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_GET) g_warning("tvbparse_get: ENTER offset=%i",offset);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_GET) ws_warning("tvbparse_get: ENTER offset=%i",offset);
#endif
offset += ignore_fcn(tt,offset);
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_GET) g_warning("tvbparse_get: after ignore offset=%i",offset);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_GET) ws_warning("tvbparse_get: after ignore offset=%i",offset);
#endif
consumed = wanted->condition(tt,offset,wanted,&tok);
if (consumed >= 0) {
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_GET) g_warning("tvbparse_get: GOT len=%i",consumed);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_GET) ws_warning("tvbparse_get: GOT len=%i",consumed);
#endif
execute_callbacks(tt,tok);
tt->offset = offset + consumed;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_GET) g_warning("tvbparse_get: DONE offset=%i", tt->offset);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_GET) ws_warning("tvbparse_get: DONE offset=%i", tt->offset);
#endif
return tok;
} else {
@@ -1363,7 +1363,7 @@ tvbparse_elem_t* tvbparse_find(tvbparse_t* tt, const tvbparse_wanted_t* wanted)
int target_offset = offset -1;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_FIND) g_warning("tvbparse_get: ENTER offset=%i", tt->offset);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_FIND) ws_warning("tvbparse_get: ENTER offset=%i", tt->offset);
#endif
do {
@@ -1372,18 +1372,18 @@ tvbparse_elem_t* tvbparse_find(tvbparse_t* tt, const tvbparse_wanted_t* wanted)
if (len >= 0) {
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_FIND) g_warning("tvbparse_get: FOUND offset=%i len=%i", target_offset,len);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_FIND) ws_warning("tvbparse_get: FOUND offset=%i len=%i", target_offset,len);
#endif
execute_callbacks(tt,tok);
tt->offset = target_offset + len;
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_FIND) g_warning("tvbparse_get: DONE offset=%i", tt->offset);
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_FIND) ws_warning("tvbparse_get: DONE offset=%i", tt->offset);
#endif
return tok;
} else {
#ifdef TVBPARSE_DEBUG
- if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_FIND) g_warning("tvbparse_get: NOT FOUND");
+ if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_FIND) ws_warning("tvbparse_get: NOT FOUND");
#endif
return NULL;
}
diff --git a/epan/value_string.c b/epan/value_string.c
index 18f42b8e75..237374073e 100644
--- a/epan/value_string.c
+++ b/epan/value_string.c
@@ -9,6 +9,7 @@
*/
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_EPAN
#include <stdio.h>
#include <string.h>
@@ -18,6 +19,8 @@
#include "to_str.h"
#include "value_string.h"
+#include <wsutil/wslog.h>
+
/* REGULAR VALUE STRING */
/* Tries to match val against each element in the value_string array vs.
@@ -452,14 +455,14 @@ _try_val_to_str_ext_init(const guint32 val, value_string_ext *vse)
/* XXX: Should check for dups ?? */
if (type == VS_BIN_TREE) {
if (prev_value > vs_p[i].value) {
- g_warning("Extended value string '%s' forced to fall back to linear search:\n"
+ ws_warning("Extended value string '%s' forced to fall back to linear search:\n"
" entry %u, value %u [%#x] < previous entry, value %u [%#x]",
vse->_vs_name, i, vs_p[i].value, vs_p[i].value, prev_value, prev_value);
type = VS_SEARCH;
break;
}
if (first_value > vs_p[i].value) {
- g_warning("Extended value string '%s' forced to fall back to linear search:\n"
+ ws_warning("Extended value string '%s' forced to fall back to linear search:\n"
" entry %u, value %u [%#x] < first entry, value %u [%#x]",
vse->_vs_name, i, vs_p[i].value, vs_p[i].value, first_value, first_value);
type = VS_SEARCH;
@@ -737,14 +740,14 @@ _try_val64_to_str_ext_init(const guint64 val, val64_string_ext *vse)
/* XXX: Should check for dups ?? */
if (type == VS_BIN_TREE) {
if (prev_value > vs_p[i].value) {
- g_warning("Extended value string '%s' forced to fall back to linear search:\n"
+ ws_warning("Extended value string '%s' forced to fall back to linear search:\n"
" entry %u, value %" G_GINT64_MODIFIER "u [%#" G_GINT64_MODIFIER "x] < previous entry, value %" G_GINT64_MODIFIER "u [%#" G_GINT64_MODIFIER "x]",
vse->_vs_name, i, vs_p[i].value, vs_p[i].value, prev_value, prev_value);
type = VS_SEARCH;
break;
}
if (first_value > vs_p[i].value) {
- g_warning("Extended value string '%s' forced to fall back to linear search:\n"
+ ws_warning("Extended value string '%s' forced to fall back to linear search:\n"
" entry %u, value %" G_GINT64_MODIFIER "u [%#" G_GINT64_MODIFIER "x] < first entry, value %" G_GINT64_MODIFIER "u [%#" G_GINT64_MODIFIER "x]",
vse->_vs_name, i, vs_p[i].value, vs_p[i].value, first_value, first_value);
type = VS_SEARCH;
diff --git a/epan/wmem/wmem_core.c b/epan/wmem/wmem_core.c
index b0c14499a0..820fac0c66 100644
--- a/epan/wmem/wmem_core.c
+++ b/epan/wmem/wmem_core.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
+#define WS_LOG_DOMAIN "wmem"
+
#include <stdlib.h>
#include <string.h>
#include <glib.h>
@@ -24,6 +26,7 @@
#include "wmem_allocator_strict.h"
#include <wsutil/ws_assert.h>
+#include <wsutil/wslog.h>
/* Set according to the WIRESHARK_DEBUG_WMEM_OVERRIDE environment variable in
* wmem_init. Should not be set again. */
@@ -195,7 +198,7 @@ wmem_init(void)
override_type = WMEM_ALLOCATOR_BLOCK_FAST;
}
else {
- g_warning("Unrecognized wmem override");
+ ws_warning("Unrecognized wmem override");
do_override = FALSE;
}
}
diff --git a/epan/wmem/wmem_strbuf.c b/epan/wmem/wmem_strbuf.c
index cbd8865617..f0c2996724 100644
--- a/epan/wmem/wmem_strbuf.c
+++ b/epan/wmem/wmem_strbuf.c
@@ -10,6 +10,7 @@
*/
#include "config.h"
+#define WS_LOG_DOMAIN "wmem"
#include <string.h>
#include <stdio.h>
@@ -20,6 +21,7 @@
#include "wmem_strbuf.h"
#include <wsutil/ws_assert.h>
+#include <wsutil/wslog.h>
#define DEFAULT_MINIMUM_LEN 16
@@ -177,7 +179,7 @@ int _strbuf_vsnprintf(wmem_strbuf_t *strbuf, const char *format, va_list ap, gbo
want_len = vsnprintf(buffer, buffer_size, format, ap);
if (want_len < 0) {
/* Error. */
- g_warning("%s: vsnprintf (%d): %s", G_STRFUNC, want_len, g_strerror(errno));
+ ws_warning("%s: vsnprintf (%d): %s", G_STRFUNC, want_len, g_strerror(errno));
return -1;
}
if ((size_t)want_len < buffer_size) {
diff --git a/epan/wslua/init_wslua.c b/epan/wslua/init_wslua.c
index 403670fd1b..7253ddab19 100644
--- a/epan/wslua/init_wslua.c
+++ b/epan/wslua/init_wslua.c
@@ -613,8 +613,8 @@ static void basic_logger(const gchar *log_domain _U_,
}
static int wslua_panic(lua_State* LS) {
- g_error("LUA PANIC: %s",lua_tostring(LS,-1));
- /** g_error() does an abort() and thus never returns **/
+ ws_error("LUA PANIC: %s",lua_tostring(LS,-1));
+ /** ws_error() does an abort() and thus never returns **/
return 0; /* keep gcc happy */
}
diff --git a/epan/wslua/wslua.h b/epan/wslua/wslua.h
index df6f666196..19052da7b7 100644
--- a/epan/wslua/wslua.h
+++ b/epan/wslua/wslua.h
@@ -31,6 +31,7 @@
#include <wsutil/report_message.h>
#include <wsutil/nstime.h>
#include <wsutil/ws_assert.h>
+#include <wsutil/wslog.h>
#include <epan/packet.h>
#include <epan/strutil.h>
diff --git a/epan/wslua/wslua_file.c b/epan/wslua/wslua_file.c
index 3a1d472197..f85d472a2f 100644
--- a/epan/wslua/wslua_file.c
+++ b/epan/wslua/wslua_file.c
@@ -277,12 +277,12 @@ WSLUA_METHOD File_read(lua_State* L) {
/* shiftFile() doesn't verify things like expired */
if (f->expired) {
- g_warning("Error in File read: Lua File has expired");
+ ws_warning("Error in File read: Lua File has expired");
return 0;
}
if (!file_is_reader(f)) {
- g_warning("Error in File read: this File object instance is for writing only");
+ ws_warning("Error in File read: this File object instance is for writing only");
return 0;
}
@@ -399,7 +399,7 @@ WSLUA_METHOD File_lines(lua_State* L) {
return luaL_error(L, "Error getting File handle for lines");
if (!file_is_reader(f)) {
- g_warning("Error in File read: this File object instance is for writing only");
+ ws_warning("Error in File read: this File object instance is for writing only");
return 0;
}
@@ -421,7 +421,7 @@ WSLUA_METHOD File_write(lua_State* L) {
int err = 0;
if (!f->wdh) {
- g_warning("Error in File read: this File object instance is for reading only");
+ ws_warning("Error in File read: this File object instance is for reading only");
return 0;
}
diff --git a/epan/wslua/wslua_file_handler.c b/epan/wslua/wslua_file_handler.c
index 8b1fc4698a..92dd7e267a 100644
--- a/epan/wslua/wslua_file_handler.c
+++ b/epan/wslua/wslua_file_handler.c
@@ -63,7 +63,7 @@ report_error(int *err, gchar **err_info, const char *fmt, ...)
*err = WTAP_ERR_INTERNAL;
*err_info = msg;
} else {
- g_warning("%s", msg);
+ ws_warning("%s", msg);
g_free(msg);
}
}
@@ -185,7 +185,7 @@ wslua_filehandler_open(wtap *wth, int *err, gchar **err_info)
wth->subtype_read = wslua_filehandler_read;
}
else {
- g_warning("Lua file format module lacks a read routine");
+ ws_warning("Lua file format module lacks a read routine");
return WTAP_OPEN_NOT_MINE;
}
@@ -193,7 +193,7 @@ wslua_filehandler_open(wtap *wth, int *err, gchar **err_info)
wth->subtype_seek_read = wslua_filehandler_seek_read;
}
else {
- g_warning("Lua file format module lacks a seek-read routine");
+ ws_warning("Lua file format module lacks a seek-read routine");
return WTAP_OPEN_NOT_MINE;
}
@@ -506,7 +506,7 @@ wslua_filehandler_dump_open(wtap_dumper *wdh, int *err, gchar **err_info)
wdh->subtype_write = wslua_filehandler_dump;
}
else {
- g_warning("FileHandler was not set with a write function, even though write_open() returned true");
+ ws_warning("FileHandler was not set with a write function, even though write_open() returned true");
return 0;
}
diff --git a/epan/wslua/wslua_frame_info.c b/epan/wslua/wslua_frame_info.c
index f0f8b998ac..03d2eddf5f 100644
--- a/epan/wslua/wslua_frame_info.c
+++ b/epan/wslua/wslua_frame_info.c
@@ -144,12 +144,12 @@ static int FrameInfo_set_data (lua_State* L) {
FrameInfo fi = checkFrameInfo(L,1);
if (!fi->rec) {
- g_warning("Error in FrameInfo set data: NULL pointer");
+ ws_warning("Error in FrameInfo set data: NULL pointer");
return 0;
}
if (!fi->buf) {
- g_warning("Error in FrameInfo set data: NULL frame_buffer pointer");
+ ws_warning("Error in FrameInfo set data: NULL frame_buffer pointer");
return 0;
}
diff --git a/epan/wslua/wslua_gui.c b/epan/wslua/wslua_gui.c
index 4898520fd0..22a32a505a 100644
--- a/epan/wslua/wslua_gui.c
+++ b/epan/wslua/wslua_gui.c
@@ -48,13 +48,13 @@ static void lua_menu_callback(gpointer data) {
case 0:
break;
case LUA_ERRRUN:
- g_warning("Runtime error while calling menu callback");
+ ws_warning("Runtime error while calling menu callback");
break;
case LUA_ERRMEM:
- g_warning("Memory alloc error while calling menu callback");
+ ws_warning("Memory alloc error while calling menu callback");
break;
case LUA_ERRERR:
- g_warning("Error while running the error handler function for menu callback");
+ ws_warning("Error while running the error handler function for menu callback");
break;
default:
ws_assert_not_reached();
@@ -151,13 +151,13 @@ static void lua_dialog_cb(gchar** user_input, void* data) {
case 0:
break;
case LUA_ERRRUN:
- g_warning("Runtime error while calling dialog callback");
+ ws_warning("Runtime error while calling dialog callback");
break;
case LUA_ERRMEM:
- g_warning("Memory alloc error while calling dialog callback");
+ ws_warning("Memory alloc error while calling dialog callback");
break;
case LUA_ERRERR:
- g_warning("Error while running the error handler function for dialog callback");
+ ws_warning("Error while running the error handler function for dialog callback");
break;
default:
ws_assert_not_reached();
@@ -193,13 +193,13 @@ static void text_win_close_cb(void* data) {
case 0:
break;
case LUA_ERRRUN:
- g_warning("Runtime error during execution of TextWindow close callback");
+ ws_warning("Runtime error during execution of TextWindow close callback");
break;
case LUA_ERRMEM:
- g_warning("Memory alloc error during execution of TextWindow close callback");
+ ws_warning("Memory alloc error during execution of TextWindow close callback");
break;
case LUA_ERRERR:
- g_warning("Error while running the error handler function for TextWindow close callback");
+ ws_warning("Error while running the error handler function for TextWindow close callback");
break;
default:
break;
@@ -765,13 +765,13 @@ static gboolean wslua_button_callback(funnel_text_window_t* ws_tw, void* data) {
case 0:
break;
case LUA_ERRRUN:
- g_warning("Runtime error while calling button callback");
+ ws_warning("Runtime error while calling button callback");
break;
case LUA_ERRMEM:
- g_warning("Memory alloc error while calling button callback");
+ ws_warning("Memory alloc error while calling button callback");
break;
case LUA_ERRERR:
- g_warning("Error while running the error handler function for button callback");
+ ws_warning("Error while running the error handler function for button callback");
break;
default:
ws_assert_not_reached();
diff --git a/epan/wslua/wslua_internals.c b/epan/wslua/wslua_internals.c
index a00d37d2c2..186d6fa593 100644
--- a/epan/wslua/wslua_internals.c
+++ b/epan/wslua/wslua_internals.c
@@ -445,7 +445,7 @@ static void wslua_push_attributes(lua_State *L, const wslua_attribute_table *t,
if (methods_idx) {
lua_rawgetfield(L, methods_idx, t->fieldname);
if (!lua_isnil(L, -1)) {
- g_error("'%s' attribute name already exists as method name for class\n", t->fieldname);
+ ws_error("'%s' attribute name already exists as method name for class\n", t->fieldname);
}
lua_pop(L,1); /* pop the nil */
}
@@ -541,7 +541,7 @@ void wslua_register_class(lua_State *L, const wslua_class *cls_def)
/* Check for existing global variables/classes with the same name. */
lua_getglobal(L, cls_def->name);
if (!lua_isnil (L, -1)) {
- g_error("Attempt to register class '%s' which already exists in global Lua table\n", cls_def->name);
+ ws_error("Attempt to register class '%s' which already exists in global Lua table\n", cls_def->name);
}
lua_pop(L, 1);
diff --git a/epan/wslua/wslua_listener.c b/epan/wslua/wslua_listener.c
index f4e0ad2b1b..d181e41c9b 100644
--- a/epan/wslua/wslua_listener.c
+++ b/epan/wslua/wslua_listener.c
@@ -101,11 +101,11 @@ static tap_packet_status lua_tap_packet(void *tapdata, packet_info *pinfo, epan_
/* XXX - TAP_PACKET_FAILED? */
break;
case LUA_ERRMEM:
- g_warning("Memory alloc error while calling listener tap callback packet");
+ ws_warning("Memory alloc error while calling listener tap callback packet");
/* XXX - TAP_PACKET_FAILED? */
break;
case LUA_ERRERR:
- g_warning("Error while running the error handler function for listener tap callback");
+ ws_warning("Error while running the error handler function for listener tap callback");
break;
default:
ws_assert_not_reached();
@@ -141,13 +141,13 @@ static void lua_tap_reset(void *tapdata) {
case 0:
break;
case LUA_ERRRUN:
- g_warning("Runtime error while calling a listener's init()");
+ ws_warning("Runtime error while calling a listener's init()");
break;
case LUA_ERRMEM:
- g_warning("Memory alloc error while calling a listener's init()");
+ ws_warning("Memory alloc error while calling a listener's init()");
break;
case LUA_ERRERR:
- g_warning("Error while running the error handler function for a listener's init()");
+ ws_warning("Error while running the error handler function for a listener's init()");
break;
default:
ws_assert_not_reached();
@@ -176,13 +176,13 @@ static void lua_tap_draw(void *tapdata) {
break;
case LUA_ERRRUN:
error = lua_tostring(tap->L,-1);
- g_warning("Runtime error while calling a listener's draw(): %s",error);
+ ws_warning("Runtime error while calling a listener's draw(): %s",error);
break;
case LUA_ERRMEM:
- g_warning("Memory alloc error while calling a listener's draw()");
+ ws_warning("Memory alloc error while calling a listener's draw()");
break;
case LUA_ERRERR:
- g_warning("Error while running the error handler function for a listener's draw()");
+ ws_warning("Error while running the error handler function for a listener's draw()");
break;
default:
ws_assert_not_reached();
diff --git a/epan/wslua/wslua_util.c b/epan/wslua/wslua_util.c
index 8e4c2afb44..ce927d47f1 100644
--- a/epan/wslua/wslua_util.c
+++ b/epan/wslua/wslua_util.c
@@ -492,13 +492,13 @@ static void statcmd_init(const char *opt_arg, void* userdata) {
case 0:
break;
case LUA_ERRRUN:
- g_warning("Runtime error while calling statcmd callback");
+ ws_warning("Runtime error while calling statcmd callback");
break;
case LUA_ERRMEM:
- g_warning("Memory alloc error while calling statcmd callback");
+ ws_warning("Memory alloc error while calling statcmd callback");
break;
case LUA_ERRERR:
- g_warning("Error while running the error handler function for statcmd callback");
+ ws_warning("Error while running the error handler function for statcmd callback");
break;
default:
ws_assert_not_reached();
diff --git a/extcap/androiddump.c b/extcap/androiddump.c
index 164ddebf17..afd13c1c4a 100644
--- a/extcap/androiddump.c
+++ b/extcap/androiddump.c
@@ -354,10 +354,10 @@ static const char* interface_to_logbuf(char* interface)
}
/*
- * General errors and warnings are reported through g_warning() in
+ * General errors and warnings are reported through ws_warning() in
* androiddump.
*
- * Unfortunately, g_warning() may be a macro, so we do it by calling
+ * Unfortunately, ws_warning() may be a macro, so we do it by calling
* g_logv() with the appropriate arguments.
*/
static void
@@ -381,7 +381,7 @@ static void useSndTimeout(socket_handle_t sock) {
res = setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, &socket_timeout, (socklen_t)sizeof(socket_timeout));
#endif
if (res != 0)
- g_debug("Can't set socket timeout, using default");
+ ws_debug("Can't set socket timeout, using default");
}
static void useNonBlockingConnectTimeout(socket_handle_t sock) {
@@ -406,9 +406,9 @@ static void useNonBlockingConnectTimeout(socket_handle_t sock) {
res_rcv = setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &socket_timeout, sizeof(socket_timeout));
#endif
if (res_snd != 0)
- g_debug("Can't set socket timeout, using default");
+ ws_debug("Can't set socket timeout, using default");
if (res_rcv != 0)
- g_debug("Can't set socket timeout, using default");
+ ws_debug("Can't set socket timeout, using default");
}
static void useNormalConnectTimeout(socket_handle_t sock) {
@@ -428,7 +428,7 @@ static void useNormalConnectTimeout(socket_handle_t sock) {
res_rcv = setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &socket_timeout, sizeof(socket_timeout));
#endif
if (res_rcv != 0)
- g_debug("Can't set socket timeout, using default");
+ ws_debug("Can't set socket timeout, using default");
}
static struct extcap_dumper extcap_dumper_open(char *fifo, int encap) {
@@ -440,13 +440,13 @@ static struct extcap_dumper extcap_dumper_open(char *fifo, int encap) {
pcap = pcap_open_dead_with_tstamp_precision(encap, PACKET_LENGTH, PCAP_TSTAMP_PRECISION_NANO);
extcap_dumper.dumper.pcap = pcap_dump_open(pcap, fifo);
if (!extcap_dumper.dumper.pcap) {
- g_warning("Can't open %s for saving packets: %s", fifo, pcap_geterr(pcap));
+ ws_warning("Can't open %s for saving packets: %s", fifo, pcap_geterr(pcap));
pcap_close(pcap);
exit(EXIT_CODE_CANNOT_SAVE_LIBPCAP_DUMP);
}
extcap_dumper.encap = encap;
if (pcap_dump_flush(extcap_dumper.dumper.pcap) == -1) {
- g_warning("Write to %s failed: %s", fifo, g_strerror(errno));
+ ws_warning("Write to %s failed: %s", fifo, g_strerror(errno));
}
#else
wtap_dump_params params = WTAP_DUMP_PARAMS_INIT;
@@ -488,7 +488,7 @@ static gboolean extcap_dumper_dump(struct extcap_dumper extcap_dumper,
pcap_dump((u_char *) extcap_dumper.dumper.pcap, &pcap_header, buffer);
if (pcap_dump_flush(extcap_dumper.dumper.pcap) == -1) {
- g_warning("Write to %s failed: %s", fifo, g_strerror(errno));
+ ws_warning("Write to %s failed: %s", fifo, g_strerror(errno));
}
#else
int err = 0;
@@ -555,7 +555,7 @@ static socket_handle_t adb_connect(const char *server_ip, unsigned short *server
ws_inet_pton4(server_ip, &(server.sin_addr.s_addr));
if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) {
- g_warning("Cannot open system TCP socket: %s", strerror(errno));
+ ws_warning("Cannot open system TCP socket: %s", strerror(errno));
return INVALID_SOCKET;
}
@@ -605,12 +605,12 @@ static socket_handle_t adb_connect(const char *server_ip, unsigned short *server
};
if (connect(sock, (struct sockaddr *) &server, (socklen_t)sizeof(server)) == SOCKET_ERROR) {
- g_warning("Cannot connect to ADB: <%s> Please check that adb daemon is running.", strerror(errno));
+ ws_warning("Cannot connect to ADB: <%s> Please check that adb daemon is running.", strerror(errno));
closesocket(sock);
return INVALID_SOCKET;
}
#else
- g_debug("Cannot connect to ADB: <%s> Please check that adb daemon is running.", strerror(errno));
+ ws_debug("Cannot connect to ADB: <%s> Please check that adb daemon is running.", strerror(errno));
closesocket(sock);
return INVALID_SOCKET;
#endif
@@ -618,18 +618,18 @@ static socket_handle_t adb_connect(const char *server_ip, unsigned short *server
length = sizeof(client);
if (getsockname(sock, (struct sockaddr *) &client, &length)) {
- g_warning("getsockname: %s", strerror(errno));
+ ws_warning("getsockname: %s", strerror(errno));
closesocket(sock);
return INVALID_SOCKET;
}
if (length != sizeof(client)) {
- g_warning("incorrect length");
+ ws_warning("incorrect length");
closesocket(sock);
return INVALID_SOCKET;
}
- g_debug("Client port %u", GUINT16_FROM_BE(client.sin_port));
+ ws_debug("Client port %u", GUINT16_FROM_BE(client.sin_port));
return sock;
}
@@ -647,7 +647,7 @@ static char *adb_send_and_receive(socket_handle_t sock, const char *adb_service,
adb_service_length = strlen(adb_service);
if (adb_service_length > INT_MAX) {
- g_warning("Service name too long when sending <%s> to ADB daemon", adb_service);
+ ws_warning("Service name too long when sending <%s> to ADB daemon", adb_service);
if (data_length)
*data_length = 0;
return NULL;
@@ -655,7 +655,7 @@ static char *adb_send_and_receive(socket_handle_t sock, const char *adb_service,
/* 8 bytes of hex length + terminating NUL */
if (buffer_length < 9) {
- g_warning("Buffer for response too short while sending <%s> to ADB daemon", adb_service);
+ ws_warning("Buffer for response too short while sending <%s> to ADB daemon", adb_service);
if (data_length)
*data_length = 0;
return NULL;
@@ -664,13 +664,13 @@ static char *adb_send_and_receive(socket_handle_t sock, const char *adb_service,
g_snprintf(buffer, (gulong)buffer_length, ADB_HEX4_FORMAT, adb_service_length);
result = send(sock, buffer, ADB_HEX4_LEN, 0);
if (result < ADB_HEX4_LEN) {
- g_warning("Error while sending <%s> length to ADB daemon", adb_service);
+ ws_warning("Error while sending <%s> length to ADB daemon", adb_service);
return NULL;
}
result = send(sock, adb_service, (int) adb_service_length, 0);
if (result != (gssize) adb_service_length) {
- g_warning("Error while sending <%s> to ADB daemon", adb_service);
+ ws_warning("Error while sending <%s> to ADB daemon", adb_service);
if (data_length)
*data_length = 0;
return NULL;
@@ -684,7 +684,7 @@ static char *adb_send_and_receive(socket_handle_t sock, const char *adb_service,
result = recv(sock, buffer + used_buffer_length, (int)bytes_to_read, 0);
if (result <= 0) {
- g_warning("Broken socket connection while fetching reply status for <%s>", adb_service);
+ ws_warning("Broken socket connection while fetching reply status for <%s>", adb_service);
if (data_length)
*data_length = 0;
return NULL;
@@ -697,7 +697,7 @@ static char *adb_send_and_receive(socket_handle_t sock, const char *adb_service,
tmp_buffer = buffer[8];
buffer[8] = '\0';
if (!ws_hexstrtou32(buffer + 4, NULL, &length)) {
- g_warning("Invalid reply length <%s> while reading reply for <%s>", buffer + 4, adb_service);
+ ws_warning("Invalid reply length <%s> while reading reply for <%s>", buffer + 4, adb_service);
if (data_length)
*data_length = 0;
return NULL;
@@ -705,7 +705,7 @@ static char *adb_send_and_receive(socket_handle_t sock, const char *adb_service,
buffer[8] = tmp_buffer;
if (buffer_length < length + 8) {
- g_warning("Buffer for response too short while sending <%s> to ADB daemon", adb_service);
+ ws_warning("Buffer for response too short while sending <%s> to ADB daemon", adb_service);
if (data_length)
*data_length = 0;
return NULL;
@@ -718,7 +718,7 @@ static char *adb_send_and_receive(socket_handle_t sock, const char *adb_service,
result = recv(sock, buffer + used_buffer_length, (int)bytes_to_read, 0);
if (result <= 0) {
- g_warning("Broken socket connection while reading reply for <%s>", adb_service);
+ ws_warning("Broken socket connection while reading reply for <%s>", adb_service);
if (data_length)
*data_length = 0;
return NULL;
@@ -731,7 +731,7 @@ static char *adb_send_and_receive(socket_handle_t sock, const char *adb_service,
*data_length = used_buffer_length - 8;
if (memcmp(status, "OKAY", 4)) {
- g_warning("Error while receiving by ADB for <%s>", adb_service);
+ ws_warning("Error while receiving by ADB for <%s>", adb_service);
if (data_length)
*data_length = 0;
return NULL;
@@ -753,13 +753,13 @@ static char *adb_send_and_read(socket_handle_t sock, const char *adb_service, ch
result = send(sock, buffer, ADB_HEX4_LEN, 0);
if (result < ADB_HEX4_LEN) {
- g_warning("Error while sending <%s> to ADB daemon", adb_service);
+ ws_warning("Error while sending <%s> to ADB daemon", adb_service);
return NULL;
}
result = send(sock, adb_service, (int) adb_service_length, 0);
if (result != (gssize) adb_service_length) {
- g_warning("Error while sending <%s> to ADB", adb_service);
+ ws_warning("Error while sending <%s> to ADB", adb_service);
if (data_length)
*data_length = 0;
return NULL;
@@ -770,7 +770,7 @@ static char *adb_send_and_read(socket_handle_t sock, const char *adb_service, ch
result = recv(sock, buffer + used_buffer_length, (int)(buffer_length - used_buffer_length), 0);
if (result <= 0) {
- g_warning("Broken socket connection while fetching reply status for <%s>", adb_service);
+ ws_warning("Broken socket connection while fetching reply status for <%s>", adb_service);
return NULL;
}
@@ -784,7 +784,7 @@ static char *adb_send_and_read(socket_handle_t sock, const char *adb_service, ch
result= recv(sock, buffer + used_buffer_length, (int)(buffer_length - used_buffer_length), 0);
if (result < 0) {
- g_warning("Broken socket connection while reading reply for <%s>", adb_service);
+ ws_warning("Broken socket connection while reading reply for <%s>", adb_service);
return NULL;
} else if (result == 0) {
@@ -798,7 +798,7 @@ static char *adb_send_and_read(socket_handle_t sock, const char *adb_service, ch
*data_length = used_buffer_length - 4;
if (memcmp(status, "OKAY", 4)) {
- g_warning("Error while receiving by ADB for <%s>", adb_service);
+ ws_warning("Error while receiving by ADB for <%s>", adb_service);
if (data_length)
*data_length = 0;
return NULL;
@@ -819,13 +819,13 @@ static int adb_send(socket_handle_t sock, const char *adb_service) {
result = send(sock, buffer, ADB_HEX4_LEN, 0);
if (result < ADB_HEX4_LEN) {
- g_warning("Error while sending <%s> to ADB daemon", adb_service);
+ ws_warning("Error while sending <%s> to ADB daemon", adb_service);
return EXIT_CODE_ERROR_WHILE_SENDING_ADB_PACKET_1;
}
result = send(sock, adb_service, (int) adb_service_length, 0);
if (result != (gssize) adb_service_length) {
- g_warning("Error while sending <%s> to ADB", adb_service);
+ ws_warning("Error while sending <%s> to ADB", adb_service);
return EXIT_CODE_ERROR_WHILE_SENDING_ADB_PACKET_1;
}
@@ -834,7 +834,7 @@ static int adb_send(socket_handle_t sock, const char *adb_service) {
result = recv(sock, buffer + used_buffer_length, 4 - used_buffer_length, 0);
if (result <= 0) {
- g_warning("Broken socket connection while fetching reply status for <%s>", adb_service);
+ ws_warning("Broken socket connection while fetching reply status for <%s>", adb_service);
return EXIT_CODE_ERROR_WHILE_RECEIVING_ADB_PACKET_STATUS;
}
@@ -843,7 +843,7 @@ static int adb_send(socket_handle_t sock, const char *adb_service) {
}
if (memcmp(buffer, "OKAY", 4)) {
- g_debug("Error while receiving by ADB for <%s>", adb_service);
+ ws_debug("Error while receiving by ADB for <%s>", adb_service);
return EXIT_CODE_ERROR_WHILE_RECEIVING_ADB_PACKET_DATA;
}
@@ -865,7 +865,7 @@ adb_connect_transport(const char *server_ip, unsigned short *server_tcp_port,
sock = adb_connect(server_ip, server_tcp_port);
if (sock == INVALID_SOCKET) {
- g_warning("Error while connecting to adb server");
+ ws_warning("Error while connecting to adb server");
return sock;
}
@@ -874,7 +874,7 @@ adb_connect_transport(const char *server_ip, unsigned short *server_tcp_port,
} else {
result = g_snprintf(transport_buf, sizeof(transport_buf), adb_transport_serial_templace, serial_number);
if (result <= 0 || result > (int)sizeof(transport_buf)) {
- g_warning("Error while completing adb packet for transport");
+ ws_warning("Error while completing adb packet for transport");
closesocket(sock);
return INVALID_SOCKET;
}
@@ -882,7 +882,7 @@ adb_connect_transport(const char *server_ip, unsigned short *server_tcp_port,
result = adb_send(sock, transport);
if (result) {
- g_warning("Error while setting adb transport for <%s>", transport_buf);
+ ws_warning("Error while setting adb transport for <%s>", transport_buf);
closesocket(sock);
return INVALID_SOCKET;
}
@@ -943,7 +943,7 @@ static int add_tcpdump_interfaces(extcap_parameters * extcap_conf, const char *a
sock = adb_connect_transport(adb_server_ip, adb_server_tcp_port, serial_number);
if (sock == INVALID_SOCKET) {
- g_warning("Failed to connect to adb server");
+ ws_warning("Failed to connect to adb server");
return EXIT_CODE_GENERIC;
}
@@ -951,14 +951,14 @@ static int add_tcpdump_interfaces(extcap_parameters * extcap_conf, const char *a
closesocket(sock);
if (!response) {
- g_warning("Failed to get list of available tcpdump interfaces");
+ ws_warning("Failed to get list of available tcpdump interfaces");
return EXIT_CODE_GENERIC;
}
response[data_length] = '\0';
regex = g_regex_new(regex_ifaces, G_REGEX_RAW, (GRegexMatchFlags)0, &err);
if (!regex) {
- g_warning("Failed to compile regex for tcpdump interface matching");
+ ws_warning("Failed to compile regex for tcpdump interface matching");
return EXIT_CODE_GENERIC;
}
@@ -1025,7 +1025,7 @@ static int register_interfaces(extcap_parameters * extcap_conf, const char *adb_
closesocket(sock);
if (!device_list) {
- g_warning("Cannot get list of interfaces from devices");
+ ws_warning("Cannot get list of interfaces from devices");
return EXIT_CODE_CANNOT_GET_INTERFACES_LIST;
}
@@ -1040,7 +1040,7 @@ static int register_interfaces(extcap_parameters * extcap_conf, const char *adb_
result = (int) (pos - prev_pos);
pos = strchr(pos, '\n') + 1;
if (result >= (int) sizeof(serial_number)) {
- g_warning("Serial number too long, ignore device");
+ ws_warning("Serial number too long, ignore device");
continue;
}
memcpy(serial_number, prev_pos, result);
@@ -1059,12 +1059,12 @@ static int register_interfaces(extcap_parameters * extcap_conf, const char *adb_
if (model_name[0] == '\0')
strcpy(model_name, "unknown");
- g_debug("Processing device: \"%s\" <%s>" , serial_number, model_name);
+ ws_debug("Processing device: \"%s\" <%s>" , serial_number, model_name);
/* Function will only add tcpdump interfaces if tcpdump is present on the device */
result = add_tcpdump_interfaces(extcap_conf, adb_server_ip, adb_server_tcp_port, serial_number );
if (result) {
- g_warning("Error while adding tcpdump interfaces");
+ ws_warning("Error while adding tcpdump interfaces");
}
sock = adb_connect_transport(adb_server_ip, adb_server_tcp_port, serial_number);
@@ -1074,13 +1074,13 @@ static int register_interfaces(extcap_parameters * extcap_conf, const char *adb_
closesocket(sock);
if (!response) {
- g_warning("Error on socket: <%s>", helpful_packet);
+ ws_warning("Error on socket: <%s>", helpful_packet);
continue;
}
response[data_length] = '\0';
api_level = (int) g_ascii_strtoll(response, NULL, 10);
- g_debug("Android API Level for %s is %i", serial_number, api_level);
+ ws_debug("Android API Level for %s is %i", serial_number, api_level);
if (api_level < 21) {
new_interface(extcap_conf, INTERFACE_ANDROID_LOGCAT_MAIN, model_name, serial_number, "Android Logcat Main");
@@ -1110,18 +1110,18 @@ static int register_interfaces(extcap_parameters * extcap_conf, const char *adb_
closesocket(sock);
if (!response || data_length < 1) {
- g_warning("Error while getting hcidump version by <%s> (%p len=%"G_GSSIZE_FORMAT")",
+ ws_warning("Error while getting hcidump version by <%s> (%p len=%"G_GSSIZE_FORMAT")",
adb_hcidump_version, (void*)response, data_length);
- g_debug("Android hcidump version for %s is unknown", serial_number);
+ ws_debug("Android hcidump version for %s is unknown", serial_number);
disable_interface = 1;
} else {
response[data_length] = '\0';
if (g_ascii_strtoull(response, NULL, 10) == 0) {
- g_debug("Android hcidump version for %s is unknown", serial_number);
+ ws_debug("Android hcidump version for %s is unknown", serial_number);
disable_interface = 1;
} else {
- g_debug("Android hcidump version for %s is %s", serial_number, response);
+ ws_debug("Android hcidump version for %s is %s", serial_number, response);
}
}
@@ -1138,9 +1138,9 @@ static int register_interfaces(extcap_parameters * extcap_conf, const char *adb_
response = adb_send_and_read(sock, adb_ps_droid_bluetooth, helpful_packet, sizeof(helpful_packet), &data_length);
closesocket(sock);
if (!response || data_length < 1) {
- g_warning("Error while getting Bluetooth application process id by <%s> "
+ ws_warning("Error while getting Bluetooth application process id by <%s> "
"(%p len=%"G_GSSIZE_FORMAT")", adb_ps_droid_bluetooth, (void*)response, data_length);
- g_debug( "Android Bluetooth application PID for %s is unknown", serial_number);
+ ws_debug( "Android Bluetooth application PID for %s is unknown", serial_number);
disable_interface = 1;
} else {
char *data_str;
@@ -1151,11 +1151,11 @@ static int register_interfaces(extcap_parameters * extcap_conf, const char *adb_
data_str = strchr(response, '\n');
if (data_str && sscanf(data_str, "%*s %15s", pid) == 1) {
- g_debug("Android Bluetooth application PID for %s is %s", serial_number, pid);
+ ws_debug("Android Bluetooth application PID for %s is %s", serial_number, pid);
result = g_snprintf(check_port_buf, sizeof(check_port_buf), adb_check_port_templace, pid);
if (result <= 0 || result > (int)sizeof(check_port_buf)) {
- g_warning("Error while completing adb packet");
+ ws_warning("Error while completing adb packet");
return EXIT_CODE_BAD_SIZE_OF_ASSEMBLED_ADB_PACKET_6;
}
@@ -1172,15 +1172,15 @@ static int register_interfaces(extcap_parameters * extcap_conf, const char *adb_
data_str = strchr(response, '\n');
if (data_str && sscanf(data_str, "%*s %15s", pid) == 1 && strlen(pid) > 10 && strcmp(pid + 9, "10EA") == 0) {
- g_debug("Bluedroid External Parser Port for %s is %s", serial_number, pid + 9);
+ ws_debug("Bluedroid External Parser Port for %s is %s", serial_number, pid + 9);
} else {
disable_interface = 1;
- g_debug("Bluedroid External Parser Port for %s is unknown", serial_number);
+ ws_debug("Bluedroid External Parser Port for %s is unknown", serial_number);
}
}
} else {
disable_interface = 1;
- g_debug("Android Bluetooth application PID for %s is unknown", serial_number);
+ ws_debug("Android Bluetooth application PID for %s is unknown", serial_number);
}
}
@@ -1209,9 +1209,9 @@ static int register_interfaces(extcap_parameters * extcap_conf, const char *adb_
closesocket(sock);
if (!response || data_length < 1) {
- g_warning("Error while getting Bluetooth application process id by <%s> "
+ ws_warning("Error while getting Bluetooth application process id by <%s> "
"(%p len=%"G_GSSIZE_FORMAT")", ps_cmd, (void*)response, data_length);
- g_debug("Android Bluetooth application PID for %s is unknown", serial_number);
+ ws_debug("Android Bluetooth application PID for %s is unknown", serial_number);
disable_interface = 1;
} else {
char *data_str;
@@ -1226,11 +1226,11 @@ static int register_interfaces(extcap_parameters * extcap_conf, const char *adb_
data_str = strchr(response, '\n');
if (data_str && sscanf(data_str, "%*s %15s", pid) == 1) {
- g_debug("Android Bluetooth application PID for %s is %s", serial_number, pid);
+ ws_debug("Android Bluetooth application PID for %s is %s", serial_number, pid);
result = g_snprintf(check_port_buf, sizeof(check_port_buf), adb_check_port_templace, pid);
if (result <= 0 || result > (int)sizeof(check_port_buf)) {
- g_warning("Error while completing adb packet");
+ ws_warning("Error while completing adb packet");
return EXIT_CODE_BAD_SIZE_OF_ASSEMBLED_ADB_PACKET_9;
}
@@ -1247,19 +1247,19 @@ static int register_interfaces(extcap_parameters * extcap_conf, const char *adb_
data_str = strtok(response, "\n");
while (data_str != NULL) {
if (sscanf(data_str, "%*s %15s", pid) == 1 && strlen(pid) > 10 && strcmp(pid + 9, "22A8") == 0) {
- g_debug("Btsnoop Net Port for %s is %s", serial_number, pid + 9);
+ ws_debug("Btsnoop Net Port for %s is %s", serial_number, pid + 9);
break;
}
data_str = strtok(NULL, "\n");
}
if (data_str == NULL) {
disable_interface = 1;
- g_debug("Btsnoop Net Port for %s is unknown", serial_number);
+ ws_debug("Btsnoop Net Port for %s is unknown", serial_number);
}
}
} else {
disable_interface = 1;
- g_debug("Android Bluetooth application PID for %s is unknown", serial_number);
+ ws_debug("Android Bluetooth application PID for %s is unknown", serial_number);
}
}
@@ -1277,7 +1277,7 @@ static int list_config(char *interface) {
unsigned inc = 0;
if (!interface) {
- g_warning("No interface specified.");
+ ws_warning("No interface specified.");
return EXIT_CODE_NO_INTERFACE_SPECIFIED;
}
@@ -1311,7 +1311,7 @@ static int list_config(char *interface) {
}
if (ret != EXIT_CODE_SUCCESS)
- g_warning("Invalid interface: <%s>", interface);
+ ws_warning("Invalid interface: <%s>", interface);
else
extcap_config_debug(&inc);
@@ -1357,7 +1357,7 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
result = adb_send(sock, adb_shell_hcidump);
if (result) {
- g_warning("Error while starting capture by sending command: %s", adb_shell_hcidump);
+ ws_warning("Error while starting capture by sending command: %s", adb_shell_hcidump);
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -1375,13 +1375,13 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
continue;
}
else if (errno != 0) {
- g_warning("ERROR capture: %s", strerror(errno));
+ ws_warning("ERROR capture: %s", strerror(errno));
closesocket(sock);
return EXIT_CODE_GENERIC;
}
if (length <= 0) {
- g_warning("Broken socket connection.");
+ ws_warning("Broken socket connection.");
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -1392,7 +1392,7 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
char *state_line_position = i_position + 1;
if (!strncmp(data, "/system/bin/sh: hcidump: not found", 34)) {
- g_warning("Command not found for <%s>", adb_shell_hcidump);
+ ws_warning("Command not found for <%s>", adb_shell_hcidump);
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -1401,7 +1401,7 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
if (i_position) {
i_position += 1;
if (!strncmp(state_line_position, "Can't access device: Permission denied", 38)) {
- g_warning("No permission for command <%s>", adb_shell_hcidump);
+ ws_warning("No permission for command <%s>", adb_shell_hcidump);
used_buffer_length = 0;
closesocket(sock);
sock = INVALID_SOCKET;
@@ -1421,7 +1421,7 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
result = adb_send(sock, adb_shell_su_hcidump);
if (result) {
- g_warning("Error while starting capture by sending command: <%s>", adb_shell_su_hcidump);
+ ws_warning("Error while starting capture by sending command: <%s>", adb_shell_su_hcidump);
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -1440,13 +1440,13 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
continue;
}
else if (errno != 0) {
- g_warning("ERROR capture: %s", strerror(errno));
+ ws_warning("ERROR capture: %s", strerror(errno));
closesocket(sock);
return EXIT_CODE_GENERIC;
}
if (length <= 0) {
- g_warning("Broken socket connection.");
+ ws_warning("Broken socket connection.");
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -1455,7 +1455,7 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
i_position = (char *) memchr(data, '\n', used_buffer_length);
if (i_position && i_position < data + used_buffer_length) {
if (!strncmp(data, "/system/bin/sh: su: not found", 29)) {
- g_warning("Command 'su' not found for <%s>", adb_shell_su_hcidump);
+ ws_warning("Command 'su' not found for <%s>", adb_shell_su_hcidump);
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -1482,13 +1482,13 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
continue;
}
else if (errno != 0) {
- g_warning("ERROR capture: %s", strerror(errno));
+ ws_warning("ERROR capture: %s", strerror(errno));
closesocket(sock);
return EXIT_CODE_GENERIC;
}
if (length <= 0) {
- g_warning("Broken socket connection.");
+ ws_warning("Broken socket connection.");
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -1506,7 +1506,7 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
hex_data = new_hex_data;
hex = g_ascii_strtoll(hex_data, &new_hex_data, 16);
if (hex < 0 || hex >= 256 || hex_data == new_hex_data) {
- g_warning("data format %s", strerror(errno));
+ ws_warning("data format %s", strerror(errno));
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -1514,7 +1514,7 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
hex_data = new_hex_data;
hex = g_ascii_strtoll(hex_data, &new_hex_data, 16);
if (hex < 0 || hex >= 256 || hex_data == new_hex_data) {
- g_warning("data format %s", strerror(errno));
+ ws_warning("data format %s", strerror(errno));
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -1527,7 +1527,7 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
hex_data = new_hex_data;
hex = g_ascii_strtoll(hex_data, &new_hex_data, 16);
if (hex < 0 || hex >= 256 || hex_data == new_hex_data) {
- g_warning("data format %s", strerror(errno));
+ ws_warning("data format %s", strerror(errno));
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -1540,7 +1540,7 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
hex_data = new_hex_data;
hex = g_ascii_strtoll(hex_data, &new_hex_data, 16);
if (hex < 0 || hex >= 256 || hex_data == new_hex_data) {
- g_warning("data format %s", strerror(errno));
+ ws_warning("data format %s", strerror(errno));
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -1548,7 +1548,7 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
hex_data = new_hex_data;
hex = g_ascii_strtoll(hex_data, &new_hex_data, 16);
if (hex < 0 || hex >= 256 || hex_data == new_hex_data) {
- g_warning("data format %s", strerror(errno));
+ ws_warning("data format %s", strerror(errno));
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -1563,7 +1563,7 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
}
} else {
- g_warning("bad raw stream");
+ ws_warning("bad raw stream");
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -1583,7 +1583,7 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
&date.tm_year, &date.tm_mon, &date.tm_mday, &date.tm_hour,
&date.tm_min, &date.tm_sec, &ms, &direction_character)) {
- g_debug("time %04d-%02d-%02d %02d:%02d:%02d.%06d %c",
+ ws_debug("time %04d-%02d-%02d %02d:%02d:%02d.%06d %c",
date.tm_year, date.tm_mon, date.tm_mday, date.tm_hour,
date.tm_min, date.tm_sec, ms, direction_character);
date.tm_mon -= 1;
@@ -1653,7 +1653,7 @@ static int adb_forward(char *serial_number, const char *adb_server_ip, unsigned
result = g_snprintf(helpful_packet, PACKET_LENGTH, adb_forward_template, (serial_number) ? "host-serial:" : "host", (serial_number) ? serial_number: "", local_tcp_port, server_tcp_port);
if (result <= 0 || result > PACKET_LENGTH) {
- g_warning("Error while completing adb packet");
+ ws_warning("Error while completing adb packet");
closesocket(sock);
return EXIT_CODE_BAD_SIZE_OF_ASSEMBLED_ADB_PACKET_12;
}
@@ -1694,18 +1694,18 @@ static int capture_android_bluetooth_external_parser(char *interface,
if (bt_forward_socket) {
if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) {
- g_warning("Cannot open system TCP socket: %s", strerror(errno));
+ ws_warning("Cannot open system TCP socket: %s", strerror(errno));
return EXIT_CODE_GENERIC;
}
- g_debug("Using config: Server TCP Port=%u, Local IP=%s, Local TCP Port=%u",
+ ws_debug("Using config: Server TCP Port=%u, Local IP=%s, Local TCP Port=%u",
*bt_server_tcp_port, bt_local_ip, *bt_local_tcp_port);
if (*bt_local_tcp_port != 0) {
int result;
result = adb_forward(serial_number, adb_server_ip, adb_server_tcp_port, *bt_local_tcp_port, *bt_server_tcp_port);
- g_debug("DO: adb forward tcp:%u (local) tcp:%u (remote) result=%i",
+ ws_debug("DO: adb forward tcp:%u (local) tcp:%u (remote) result=%i",
*bt_local_tcp_port, *bt_server_tcp_port, result);
}
@@ -1717,25 +1717,25 @@ static int capture_android_bluetooth_external_parser(char *interface,
useSndTimeout(sock);
if (connect(sock, (struct sockaddr *) &server, sizeof(server)) == SOCKET_ERROR) {
- g_warning("<%s> Please check that adb daemon is running.", strerror(errno));
+ ws_warning("<%s> Please check that adb daemon is running.", strerror(errno));
closesocket(sock);
return EXIT_CODE_GENERIC;
}
slen = (socklen_t)sizeof(client);
if (getsockname(sock, (struct sockaddr *) &client, &slen)) {
- g_warning("getsockname: %s", strerror(errno));
+ ws_warning("getsockname: %s", strerror(errno));
closesocket(sock);
return EXIT_CODE_GENERIC;
}
if (slen != sizeof(client)) {
- g_warning("incorrect length");
+ ws_warning("incorrect length");
closesocket(sock);
return EXIT_CODE_GENERIC;
}
- g_debug("Client port %u", GUINT16_FROM_BE(client.sin_port));
+ ws_debug("Client port %u", GUINT16_FROM_BE(client.sin_port));
} else {
int result;
@@ -1745,14 +1745,14 @@ static int capture_android_bluetooth_external_parser(char *interface,
result = g_snprintf((char *) buffer, PACKET_LENGTH, adb_tcp_bluedroid_external_parser_template, *bt_server_tcp_port);
if (result <= 0 || result > PACKET_LENGTH) {
- g_warning("Error while completing adb packet");
+ ws_warning("Error while completing adb packet");
closesocket(sock);
return EXIT_CODE_BAD_SIZE_OF_ASSEMBLED_ADB_PACKET_14;
}
result = adb_send(sock, buffer);
if (result) {
- g_warning("Error while forwarding adb port");
+ ws_warning("Error while forwarding adb port");
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -1769,7 +1769,7 @@ static int capture_android_bluetooth_external_parser(char *interface,
continue;
}
else if (errno != 0) {
- g_warning("ERROR capture: %s", strerror(errno));
+ ws_warning("ERROR capture: %s", strerror(errno));
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -1777,11 +1777,11 @@ static int capture_android_bluetooth_external_parser(char *interface,
if (length <= 0) {
if (bt_forward_socket) {
/* NOTE: Workaround... It seems that Bluedroid is slower and we can connect to socket that are not really ready... */
- g_warning("Broken socket connection. Try reconnect.");
+ ws_warning("Broken socket connection. Try reconnect.");
closesocket(sock);
if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) {
- g_warning("%s", strerror(errno));
+ ws_warning("%s", strerror(errno));
return EXIT_CODE_GENERIC;
}
@@ -1792,12 +1792,12 @@ static int capture_android_bluetooth_external_parser(char *interface,
useSndTimeout(sock);
if (connect(sock, (struct sockaddr *) &server, sizeof(server)) == SOCKET_ERROR) {
- g_warning("ERROR reconnect: <%s> Please check that adb daemon is running.", strerror(errno));
+ ws_warning("ERROR reconnect: <%s> Please check that adb daemon is running.", strerror(errno));
closesocket(sock);
return EXIT_CODE_GENERIC;
}
} else {
- g_warning("Broken socket connection.");
+ ws_warning("Broken socket connection.");
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -1807,7 +1807,7 @@ static int capture_android_bluetooth_external_parser(char *interface,
used_buffer_length += length;
- g_debug("Received: length=%"G_GSSIZE_FORMAT"", length);
+ ws_debug("Received: length=%"G_GSSIZE_FORMAT"", length);
while (((payload[BLUEDROID_H4_PACKET_TYPE] == BLUEDROID_H4_PACKET_TYPE_HCI_CMD || payload[BLUEDROID_H4_PACKET_TYPE] == BLUEDROID_H4_PACKET_TYPE_SCO) &&
used_buffer_length >= BLUEDROID_TIMESTAMP_SIZE + BLUEDROID_H4_SIZE + 2 + 1 &&
@@ -1858,14 +1858,14 @@ static int capture_android_bluetooth_external_parser(char *interface,
break;
default:
- g_warning("Invalid stream");
+ ws_warning("Invalid stream");
closesocket(sock);
return EXIT_CODE_GENERIC;
}
- g_debug("\t Packet %u: used_buffer_length=%"G_GSSIZE_FORMAT" length=%"G_GSSIZE_FORMAT" captured_length=%i type=0x%02x", id, used_buffer_length, length, captured_length, payload[BLUEDROID_H4_PACKET_TYPE]);
+ ws_debug("\t Packet %u: used_buffer_length=%"G_GSSIZE_FORMAT" length=%"G_GSSIZE_FORMAT" captured_length=%i type=0x%02x", id, used_buffer_length, length, captured_length, payload[BLUEDROID_H4_PACKET_TYPE]);
if (payload[BLUEDROID_H4_PACKET_TYPE] == BLUEDROID_H4_PACKET_TYPE_HCI_EVT)
- g_debug("\t Packet: %02x %02x %02x", (unsigned int) payload[0], (unsigned int) payload[1], (unsigned int)payload[2]);
+ ws_debug("\t Packet: %02x %02x %02x", (unsigned int) payload[0], (unsigned int) payload[1], (unsigned int)payload[2]);
id +=1;
ts -= BLUEDROID_TIMESTAMP_BASE;
@@ -1878,7 +1878,7 @@ static int capture_android_bluetooth_external_parser(char *interface,
used_buffer_length -= length - sizeof(own_pcap_bluetooth_h4_header) + BLUEDROID_TIMESTAMP_SIZE;
if (used_buffer_length < 0) {
- g_warning("Internal Negative used buffer length.");
+ ws_warning("Internal Negative used buffer length.");
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -1929,7 +1929,7 @@ static int capture_android_bluetooth_btsnoop_net(char *interface, char *fifo,
result = adb_send(sock, adb_tcp_btsnoop_net);
if (result) {
- g_warning("Error while sending command <%s>", adb_tcp_btsnoop_net);
+ ws_warning("Error while sending command <%s>", adb_tcp_btsnoop_net);
closesocket(sock);
return EXIT_CODE_ERROR_WHILE_SENDING_ADB_PACKET_2;
}
@@ -1938,7 +1938,7 @@ static int capture_android_bluetooth_btsnoop_net(char *interface, char *fifo,
while (used_buffer_length < BTSNOOP_HDR_LEN) {
length = recv(sock, packet + used_buffer_length, (int)(BTSNOOP_HDR_LEN - used_buffer_length), 0);
if (length <= 0) {
- g_warning("Broken socket connection.");
+ ws_warning("Broken socket connection.");
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -1958,13 +1958,13 @@ static int capture_android_bluetooth_btsnoop_net(char *interface, char *fifo,
continue;
}
else if (errno != 0) {
- g_warning("ERROR capture: %s", strerror(errno));
+ ws_warning("ERROR capture: %s", strerror(errno));
closesocket(sock);
return EXIT_CODE_GENERIC;
}
if (length <= 0) {
- g_warning("Broken socket connection.");
+ ws_warning("Broken socket connection.");
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -1990,7 +1990,7 @@ static int capture_android_bluetooth_btsnoop_net(char *interface, char *fifo,
used_buffer_length -= 24 + GINT32_FROM_BE(*captured_length);
if (used_buffer_length < 0) {
- g_warning("Internal Negative used buffer length.");
+ ws_warning("Internal Negative used buffer length.");
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -2051,7 +2051,7 @@ static int capture_android_logcat_text(char *interface, char *fifo,
else if (is_specified_interface(interface, INTERFACE_ANDROID_LOGCAT_TEXT_CRASH))
logcat_buffer = " -b crash";
else {
- g_warning("Unknown interface: <%s>", interface);
+ ws_warning("Unknown interface: <%s>", interface);
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -2066,14 +2066,14 @@ static int capture_android_logcat_text(char *interface, char *fifo,
result = g_snprintf((char *) packet, PACKET_LENGTH, adb_logcat_template, logcat_buffer, logcat_log_buffer, logcat_custom_parameter);
if (result <= 0 || result > PACKET_LENGTH) {
- g_warning("Error while completing adb packet");
+ ws_warning("Error while completing adb packet");
closesocket(sock);
return EXIT_CODE_BAD_SIZE_OF_ASSEMBLED_ADB_PACKET_17;
}
result = adb_send(sock, packet);
if (result) {
- g_warning("Error while sending command <%s>", packet);
+ ws_warning("Error while sending command <%s>", packet);
closesocket(sock);
return EXIT_CODE_ERROR_WHILE_SENDING_ADB_PACKET_3;
}
@@ -2105,13 +2105,13 @@ static int capture_android_logcat_text(char *interface, char *fifo,
continue;
}
else if (errno != 0) {
- g_warning("ERROR capture: %s", strerror(errno));
+ ws_warning("ERROR capture: %s", strerror(errno));
closesocket(sock);
return EXIT_CODE_GENERIC;
}
if (length <= 0) {
- g_warning("Broken socket connection. Try reconnect.");
+ ws_warning("Broken socket connection. Try reconnect.");
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -2198,14 +2198,14 @@ static int capture_android_logcat(char *interface, char *fifo,
adb_command = interface_to_logbuf(interface);
if (!adb_command) {
- g_warning("Unknown interface: <%s>", interface);
+ ws_warning("Unknown interface: <%s>", interface);
closesocket(sock);
return EXIT_CODE_GENERIC;
}
result = adb_send(sock, adb_command);
if (result) {
- g_warning("Error while sending command <%s>", adb_command);
+ ws_warning("Error while sending command <%s>", adb_command);
closesocket(sock);
return EXIT_CODE_ERROR_WHILE_SENDING_ADB_PACKET_4;
}
@@ -2247,14 +2247,14 @@ static int capture_android_logcat(char *interface, char *fifo,
continue;
}
else if (errno != 0) {
- g_warning("ERROR capture: %s", strerror(errno));
+ ws_warning("ERROR capture: %s", strerror(errno));
closesocket(sock);
return EXIT_CODE_GENERIC;
}
if (length <= 0) {
while (endless_loop) {
- g_warning("Broken socket connection. Try reconnect.");
+ ws_warning("Broken socket connection. Try reconnect.");
used_buffer_length = 0;
closesocket(sock);
@@ -2264,7 +2264,7 @@ static int capture_android_logcat(char *interface, char *fifo,
result = adb_send(sock, adb_command);
if (result) {
- g_warning("WARNING: Error while sending command <%s>", adb_command);
+ ws_warning("WARNING: Error while sending command <%s>", adb_command);
continue;
}
@@ -2337,13 +2337,13 @@ static int capture_android_tcpdump(char *interface, char *fifo,
regex = g_regex_new(regex_interface, G_REGEX_RAW, (GRegexMatchFlags)0, &err);
if (!regex) {
- g_warning("Failed to compile regex for tcpdump interface");
+ ws_warning("Failed to compile regex for tcpdump interface");
return EXIT_CODE_GENERIC;
}
g_regex_match(regex, interface, (GRegexMatchFlags)0, &match);
if (!g_match_info_matches(match)) {
- g_warning("Failed to determine iface name and serial number");
+ ws_warning("Failed to determine iface name and serial number");
g_regex_unref(regex);
return EXIT_CODE_GENERIC;
}
@@ -2365,7 +2365,7 @@ static int capture_android_tcpdump(char *interface, char *fifo,
g_free(iface);
result = adb_send(sock, tcpdump_cmd);
if (result) {
- g_warning("Error while setting adb transport");
+ ws_warning("Error while setting adb transport");
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -2381,13 +2381,13 @@ static int capture_android_tcpdump(char *interface, char *fifo,
continue;
}
else if (errno != 0) {
- g_warning("ERROR capture: %s", strerror(errno));
+ ws_warning("ERROR capture: %s", strerror(errno));
closesocket(sock);
return EXIT_CODE_GENERIC;
}
if (length <= 0) {
- g_warning("Broken socket connection.");
+ ws_warning("Broken socket connection.");
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -2414,7 +2414,7 @@ static int capture_android_tcpdump(char *interface, char *fifo,
nanosecond_timestamps = TRUE;
break;
default:
- g_warning("Received incorrect magic");
+ ws_warning("Received incorrect magic");
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -2438,13 +2438,13 @@ static int capture_android_tcpdump(char *interface, char *fifo,
continue;
}
else if (errno != 0) {
- g_warning("ERROR capture: %s", strerror(errno));
+ ws_warning("ERROR capture: %s", strerror(errno));
closesocket(sock);
return EXIT_CODE_GENERIC;
}
if (length <= 0) {
- g_warning("Broken socket connection.");
+ ws_warning("Broken socket connection.");
closesocket(sock);
return EXIT_CODE_GENERIC;
}
@@ -2551,7 +2551,7 @@ int main(int argc, char *argv[]) {
*/
err_msg = init_progfile_dir(argv[0]);
if (err_msg != NULL) {
- g_warning("Can't get pathname of directory containing the captype program: %s.",
+ ws_warning("Can't get pathname of directory containing the captype program: %s.",
err_msg);
g_free(err_msg);
}
@@ -2632,11 +2632,11 @@ int main(int argc, char *argv[]) {
case OPT_CONFIG_ADB_SERVER_TCP_PORT:
adb_server_tcp_port = &local_adb_server_tcp_port;
if (!optarg){
- g_warning("Impossible exception. Parameter required argument, but there is no it right now.");
+ ws_warning("Impossible exception. Parameter required argument, but there is no it right now.");
goto end;
}
if (!ws_strtou16(optarg, NULL, adb_server_tcp_port)) {
- g_warning("Invalid adb server TCP port: %s", optarg);
+ ws_warning("Invalid adb server TCP port: %s", optarg);
goto end;
}
break;
@@ -2659,7 +2659,7 @@ int main(int argc, char *argv[]) {
}
if (g_regex_match_simple("(^|\\s)-[bBcDfgLnpPrv]", optarg, G_REGEX_RAW, (GRegexMatchFlags)0)) {
- g_error("Found prohibited option in logcat-custom-options");
+ ws_error("Found prohibited option in logcat-custom-options");
return EXIT_CODE_GENERIC;
}
@@ -2669,11 +2669,11 @@ int main(int argc, char *argv[]) {
case OPT_CONFIG_BT_SERVER_TCP_PORT:
bt_server_tcp_port = &local_bt_server_tcp_port;
if (!optarg){
- g_warning("Impossible exception. Parameter required argument, but there is no it right now.");
+ ws_warning("Impossible exception. Parameter required argument, but there is no it right now.");
goto end;
}
if (!ws_strtou16(optarg, NULL, bt_server_tcp_port)) {
- g_warning("Invalid bluetooth server TCP port: %s", optarg);
+ ws_warning("Invalid bluetooth server TCP port: %s", optarg);
goto end;
}
break;
@@ -2686,18 +2686,18 @@ int main(int argc, char *argv[]) {
case OPT_CONFIG_BT_LOCAL_TCP_PORT:
bt_local_tcp_port = &local_bt_local_tcp_port;
if (!optarg){
- g_warning("Impossible exception. Parameter required argument, but there is no it right now.");
+ ws_warning("Impossible exception. Parameter required argument, but there is no it right now.");
goto end;
}
if (!ws_strtou16(optarg, NULL, bt_local_tcp_port)) {
- g_warning("Invalid bluetooth local tcp port: %s", optarg);
+ ws_warning("Invalid bluetooth local tcp port: %s", optarg);
goto end;
}
break;
default:
if (!extcap_base_parse_options(extcap_conf, result - EXTCAP_OPT_LIST_INTERFACES, optarg))
{
- g_warning("Invalid argument <%s>. Try --help.\n", argv[optind - 1]);
+ ws_warning("Invalid argument <%s>. Try --help.\n", argv[optind - 1]);
goto end;
}
}
@@ -2720,9 +2720,9 @@ int main(int argc, char *argv[]) {
err_msg = ws_init_sockets();
if (err_msg != NULL) {
- g_warning("ERROR: %s", err_msg);
+ ws_warning("ERROR: %s", err_msg);
g_free(err_msg);
- g_warning("%s", please_report_bug());
+ ws_warning("%s", please_report_bug());
goto end;
}
diff --git a/extcap/ciscodump.c b/extcap/ciscodump.c
index 9b845fd8d7..80f8cc5418 100644
--- a/extcap/ciscodump.c
+++ b/extcap/ciscodump.c
@@ -11,6 +11,7 @@
*/
#include "config.h"
+#define WS_LOG_DOMAIN "ciscodump"
#include <extcap/extcap-base.h>
#include <wsutil/interface.h>
@@ -18,6 +19,7 @@
#include <wsutil/filesystem.h>
#include <wsutil/privileges.h>
#include <wsutil/please_report_bug.h>
+#include <wsutil/wslog.h>
#include <extcap/ssh-base.h>
#include <writecap/pcapio.h>
@@ -121,7 +123,7 @@ static int read_output_bytes(ssh_channel channel, int bytes, char* outbuf)
bytes_read = 0;
while(ssh_channel_read_timeout(channel, &chr, 1, 0, 2000) > 0 && bytes_read < total) {
- g_debug("%c", chr);
+ ws_debug("%c", chr);
if (chr == '^')
return EXIT_FAILURE;
if (outbuf)
@@ -157,7 +159,7 @@ static int wait_until_data(ssh_channel channel, const guint32 count)
while (got < count && rounds--) {
if (ssh_channel_printf(channel, "show monitor capture buffer %s parameters\n", WIRESHARK_CAPTURE_BUFFER) == EXIT_FAILURE) {
- g_warning("Can't write to channel");
+ ws_warning("Can't write to channel");
return EXIT_FAILURE;
}
if (read_output_bytes(channel, SSH_READ_BLOCK_SIZE, output) == EXIT_FAILURE)
@@ -165,14 +167,14 @@ static int wait_until_data(ssh_channel channel, const guint32 count)
output_ptr = g_strstr_len(output, strlen(output), "Packets");
if (!output_ptr) {
- g_warning("Error in sscanf()");
+ ws_warning("Error in sscanf()");
return EXIT_FAILURE;
} else {
if (sscanf(output_ptr, "Packets : %lu", &got) != 1)
return EXIT_FAILURE;
}
}
- g_debug("All packets got: dumping");
+ ws_debug("All packets got: dumping");
return EXIT_SUCCESS;
}
@@ -239,7 +241,7 @@ static void ssh_loop_read(ssh_channel channel, FILE* fp, const guint32 count)
do {
if (ssh_channel_read_timeout(channel, &chr, 1, FALSE, SSH_READ_TIMEOUT) == SSH_ERROR) {
- g_warning("Error reading from channel");
+ ws_warning("Error reading from channel");
g_free(packet);
return;
}
@@ -257,10 +259,10 @@ static void ssh_loop_read(ssh_channel channel, FILE* fp, const guint32 count)
if (!libpcap_write_packet(fp,
(guint32)(curtime / G_USEC_PER_SEC), (guint32)(curtime % G_USEC_PER_SEC),
packet_size, packet_size, packet, &bytes_written, &err)) {
- g_debug("Error in libpcap_write_packet(): %s", g_strerror(err));
+ ws_debug("Error in libpcap_write_packet(): %s", g_strerror(err));
break;
}
- g_debug("Dumped packet %lu size: %u", packets, packet_size);
+ ws_debug("Dumped packet %lu size: %u", packets, packet_size);
packet_size = 0;
status = CISCODUMP_PARSER_STARTING;
packets++;
@@ -297,14 +299,14 @@ static int check_ios_version(ssh_channel channel)
return FALSE;
if ((major > MINIMUM_IOS_MAJOR) || (major == MINIMUM_IOS_MAJOR && minor >= MINIMUM_IOS_MINOR)) {
- g_debug("Current IOS Version: %u.%u", major, minor);
+ ws_debug("Current IOS Version: %u.%u", major, minor);
if (read_output_bytes(channel, -1, NULL) == EXIT_FAILURE)
return FALSE;
return TRUE;
}
}
- g_warning("Invalid IOS version. Minimum version: 12.4, current: %u.%u", major, minor);
+ ws_warning("Invalid IOS version. Minimum version: 12.4, current: %u.%u", major, minor);
return FALSE;
}
@@ -356,7 +358,7 @@ static ssh_channel run_capture(ssh_session sshs, const char* iface, const char*
chr = multiline_filter;
while((chr = g_strstr_len(chr, strlen(chr), ",")) != NULL) {
chr[0] = '\n';
- g_debug("Splitting filter into multiline");
+ ws_debug("Splitting filter into multiline");
}
ret = ssh_channel_write(channel, multiline_filter, (uint32_t)strlen(multiline_filter));
g_free(multiline_filter);
@@ -402,7 +404,7 @@ static ssh_channel run_capture(ssh_session sshs, const char* iface, const char*
return channel;
error:
g_free(cmdline);
- g_warning("Error running ssh remote command");
+ ws_warning("Error running ssh remote command");
read_output_bytes(channel, -1, NULL);
ssh_channel_close(channel);
@@ -425,19 +427,19 @@ static int ssh_open_remote_connection(const ssh_params_t* ssh_params, const char
/* Open or create the output file */
fp = fopen(fifo, "wb");
if (!fp) {
- g_warning("Error creating output file: %s", g_strerror(errno));
+ ws_warning("Error creating output file: %s", g_strerror(errno));
return EXIT_FAILURE;
}
}
sshs = create_ssh_connection(ssh_params, &err_info);
if (!sshs) {
- g_warning("Error creating connection: %s", err_info);
+ ws_warning("Error creating connection: %s", err_info);
goto cleanup;
}
if (!libpcap_write_file_header(fp, 1, PCAP_SNAPLEN, FALSE, &bytes_written, &err)) {
- g_warning("Can't write pcap file header");
+ ws_warning("Can't write pcap file header");
goto cleanup;
}
@@ -467,12 +469,12 @@ static int list_config(char *interface, unsigned int remote_port)
char* ipfilter;
if (!interface) {
- g_warning("No interface specified.");
+ ws_warning("No interface specified.");
return EXIT_FAILURE;
}
if (g_strcmp0(interface, CISCODUMP_EXTCAP_INTERFACE)) {
- g_warning("interface must be %s", CISCODUMP_EXTCAP_INTERFACE);
+ ws_warning("interface must be %s", CISCODUMP_EXTCAP_INTERFACE);
return EXIT_FAILURE;
}
@@ -543,7 +545,7 @@ int main(int argc, char *argv[])
*/
err_msg = init_progfile_dir(argv[0]);
if (err_msg != NULL) {
- g_warning("Can't get pathname of directory containing the captype program: %s.",
+ ws_warning("Can't get pathname of directory containing the captype program: %s.",
err_msg);
g_free(err_msg);
}
@@ -608,7 +610,7 @@ int main(int argc, char *argv[])
case OPT_REMOTE_PORT:
if (!ws_strtou16(optarg, NULL, &ssh_params->port) || ssh_params->port == 0) {
- g_warning("Invalid port: %s", optarg);
+ ws_warning("Invalid port: %s", optarg);
goto end;
}
break;
@@ -652,19 +654,19 @@ int main(int argc, char *argv[])
case OPT_REMOTE_COUNT:
if (!ws_strtou32(optarg, NULL, &count)) {
- g_warning("Invalid packet count: %s", optarg);
+ ws_warning("Invalid packet count: %s", optarg);
goto end;
}
break;
case ':':
/* missing option argument */
- g_warning("Option '%s' requires an argument", argv[optind - 1]);
+ ws_warning("Option '%s' requires an argument", argv[optind - 1]);
break;
default:
if (!extcap_base_parse_options(extcap_conf, result - EXTCAP_OPT_LIST_INTERFACES, optarg)) {
- g_warning("Invalid option: %s", argv[optind - 1]);
+ ws_warning("Invalid option: %s", argv[optind - 1]);
goto end;
}
}
@@ -673,7 +675,7 @@ int main(int argc, char *argv[])
extcap_cmdline_debug(argv, argc);
if (optind != argc) {
- g_warning("Unexpected extra option: %s", argv[optind]);
+ ws_warning("Unexpected extra option: %s", argv[optind]);
goto end;
}
@@ -689,31 +691,31 @@ int main(int argc, char *argv[])
err_msg = ws_init_sockets();
if (err_msg != NULL) {
- g_warning("ERROR: %s", err_msg);
+ ws_warning("ERROR: %s", err_msg);
g_free(err_msg);
- g_warning("%s", please_report_bug());
+ ws_warning("%s", please_report_bug());
goto end;
}
if (extcap_conf->capture) {
if (!ssh_params->host) {
- g_warning("Missing parameter: --remote-host");
+ ws_warning("Missing parameter: --remote-host");
goto end;
}
if (!remote_interface) {
- g_warning("ERROR: No interface specified (--remote-interface)");
+ ws_warning("ERROR: No interface specified (--remote-interface)");
goto end;
}
if (count == 0) {
- g_warning("ERROR: count of packets must be specified (--remote-count)");
+ ws_warning("ERROR: count of packets must be specified (--remote-count)");
goto end;
}
ssh_params->debug = extcap_conf->debug;
ret = ssh_open_remote_connection(ssh_params, remote_interface,
remote_filter, count, extcap_conf->fifo);
} else {
- g_debug("You should not come here... maybe some parameter missing?");
+ ws_debug("You should not come here... maybe some parameter missing?");
ret = EXIT_FAILURE;
}
diff --git a/extcap/dpauxmon.c b/extcap/dpauxmon.c
index 0ab4f576cc..f3bed612d9 100644
--- a/extcap/dpauxmon.c
+++ b/extcap/dpauxmon.c
@@ -11,6 +11,7 @@
*/
#include "config.h"
+#define WS_LOG_DOMAIN "dpauxmon"
#include "extcap-base.h"
@@ -18,6 +19,7 @@
#include <wsutil/filesystem.h>
#include <wsutil/netlink.h>
#include <wsutil/privileges.h>
+#include <wsutil/wslog.h>
#include <writecap/pcapio.h>
#include <netlink/netlink.h>
@@ -75,12 +77,12 @@ static int list_config(char *interface)
unsigned inc = 0;
if (!interface) {
- g_warning("No interface specified.");
+ ws_warning("No interface specified.");
return EXIT_FAILURE;
}
if (g_strcmp0(interface, DPAUXMON_EXTCAP_INTERFACE)) {
- g_warning("interface must be %s", DPAUXMON_EXTCAP_INTERFACE);
+ ws_warning("interface must be %s", DPAUXMON_EXTCAP_INTERFACE);
return EXIT_FAILURE;
}
@@ -110,12 +112,12 @@ static int setup_dumpfile(const char* fifo, FILE** fp)
*fp = fopen(fifo, "wb");
if (!(*fp)) {
- g_warning("Error creating output file: %s", g_strerror(errno));
+ ws_warning("Error creating output file: %s", g_strerror(errno));
return EXIT_FAILURE;
}
if (!libpcap_write_file_header(*fp, 275, PCAP_SNAPLEN, FALSE, &bytes_written, &err)) {
- g_warning("Can't write pcap file header");
+ ws_warning("Can't write pcap file header");
return EXIT_FAILURE;
}
@@ -129,7 +131,7 @@ static int dump_packet(FILE* fp, const char* buf, const guint32 buflen, guint64
int ret = EXIT_SUCCESS;
if (!libpcap_write_packet(fp, ts_usecs / 1000000, ts_usecs % 1000000, buflen, buflen, buf, &bytes_written, &err)) {
- g_warning("Can't write packet");
+ ws_warning("Can't write packet");
ret = EXIT_FAILURE;
}
@@ -250,7 +252,7 @@ static int nl_receive_timeout(struct nl_sock* sk, struct sockaddr_nl* nla, unsig
int poll_res = poll(&fds, 1, 500);
if (poll_res < 0) {
- g_debug("poll() failed in nl_receive_timeout");
+ ws_debug("poll() failed in nl_receive_timeout");
g_usleep(500000);
return -nl_syserr2nlerr(errno);
}
@@ -267,26 +269,26 @@ static int send_start(struct nl_sock *sock, int family, unsigned int interface_i
msg = nlmsg_alloc();
if (msg == NULL) {
- g_critical("Unable to allocate netlink message");
+ ws_critical("Unable to allocate netlink message");
return -ENOMEM;
}
hdr = genlmsg_put(msg, NL_AUTO_PID, NL_AUTO_SEQ, family, 0, 0,
DPAUXMON_CMD_START, 1);
if (hdr == NULL) {
- g_critical("Unable to write genl header");
+ ws_critical("Unable to write genl header");
res = -ENOMEM;
goto out_free;
}
if ((err = nla_put_u32(msg, DPAUXMON_ATTR_IFINDEX, interface_id)) < 0) {
- g_critical("Unable to add attribute: %s", nl_geterror(err));
+ ws_critical("Unable to add attribute: %s", nl_geterror(err));
res = -EIO;
goto out_free;
}
if ((err = nl_send_auto_complete(sock, msg)) < 0)
- g_debug("Starting monitor failed, already running?");
+ ws_debug("Starting monitor failed, already running?");
out_free:
nlmsg_free(msg);
@@ -301,24 +303,24 @@ static void send_stop(struct nl_sock *sock, int family, unsigned int interface_i
msg = nlmsg_alloc();
if (msg == NULL) {
- g_critical("Unable to allocate netlink message");
+ ws_critical("Unable to allocate netlink message");
return;
}
hdr = genlmsg_put(msg, NL_AUTO_PID, NL_AUTO_SEQ, family, 0, 0,
DPAUXMON_CMD_STOP, 1);
if (hdr == NULL) {
- g_critical("Unable to write genl header");
+ ws_critical("Unable to write genl header");
goto out_free;
}
if ((err = nla_put_u32(msg, DPAUXMON_ATTR_IFINDEX, interface_id)) < 0) {
- g_critical("Unable to add attribute: %s", nl_geterror(err));
+ ws_critical("Unable to add attribute: %s", nl_geterror(err));
goto out_free;
}
if ((err = nl_send_auto_complete(sock, msg)) < 0) {
- g_critical("Unable to send message: %s", nl_geterror(err));
+ ws_critical("Unable to send message: %s", nl_geterror(err));
goto out_free;
}
@@ -341,7 +343,7 @@ static int handle_data(struct nl_cache_ops *unused _U_, struct genl_cmd *cmd _U_
data_size = nla_len(info->attrs[DPAUXMON_ATTR_DATA]);
if (data_size > 19) {
- g_debug("Invalid packet size %u", data_size);
+ ws_debug("Invalid packet size %u", data_size);
return NL_SKIP;
}
@@ -407,7 +409,7 @@ static void run_listener(const char* fifo, unsigned int interface_id)
struct nl_cb *socket_cb;
if (sigaction(SIGINT, &int_handler, 0)) {
- g_warning("Can't set signal handler");
+ ws_warning("Can't set signal handler");
return;
}
@@ -417,30 +419,30 @@ static void run_listener(const char* fifo, unsigned int interface_id)
}
if (!(sock = nl_socket_alloc())) {
- g_critical("Unable to allocate netlink socket");
+ ws_critical("Unable to allocate netlink socket");
goto close_out;
}
if ((err = nl_connect(sock, NETLINK_GENERIC)) < 0) {
- g_critical("Unable to connect netlink socket: %s",
+ ws_critical("Unable to connect netlink socket: %s",
nl_geterror(err));
goto free_out;
}
if ((err = genl_register_family(&ops)) < 0) {
- g_critical("Unable to register Generic Netlink family");
+ ws_critical("Unable to register Generic Netlink family");
goto err_out;
}
if ((err = genl_ops_resolve(sock, &ops)) < 0) {
- g_critical("Unable to resolve family name");
+ ws_critical("Unable to resolve family name");
goto err_out;
}
/* register notification handler callback */
if ((err = nl_socket_modify_cb(sock, NL_CB_VALID, NL_CB_CUSTOM,
parse_cb, NULL)) < 0) {
- g_critical("Unable to modify valid message callback");
+ ws_critical("Unable to modify valid message callback");
goto err_out;
}
@@ -448,7 +450,7 @@ static void run_listener(const char* fifo, unsigned int interface_id)
nl_socket_add_membership(sock, grp);
if (!(socket_cb = nl_socket_get_cb(sock))) {
- g_warning("Can't overwrite recv callback");
+ ws_warning("Can't overwrite recv callback");
} else {
nl_cb_overwrite_recv(socket_cb, nl_receive_timeout);
nl_cb_put(socket_cb);
@@ -460,11 +462,11 @@ static void run_listener(const char* fifo, unsigned int interface_id)
nl_socket_disable_seq_check(sock);
- g_debug("DisplayPort AUX monitor running on interface %u", interface_id);
+ ws_debug("DisplayPort AUX monitor running on interface %u", interface_id);
while(run_loop == TRUE) {
if ((err = nl_recvmsgs_default(sock)) < 0)
- g_warning("Unable to receive message: %s", nl_geterror(err));
+ ws_warning("Unable to receive message: %s", nl_geterror(err));
}
send_stop(sock, ops.o_id, interface_id);
@@ -498,7 +500,7 @@ int main(int argc, char *argv[])
*/
init_progfile_dir_error = init_progfile_dir(argv[0]);
if (init_progfile_dir_error != NULL) {
- g_warning("Can't get pathname of directory containing the captype program: %s.",
+ ws_warning("Can't get pathname of directory containing the captype program: %s.",
init_progfile_dir_error);
g_free(init_progfile_dir_error);
}
@@ -541,19 +543,19 @@ int main(int argc, char *argv[])
case OPT_INTERFACE_ID:
if (!ws_strtou32(optarg, NULL, &interface_id)) {
- g_warning("Invalid interface id: %s", optarg);
+ ws_warning("Invalid interface id: %s", optarg);
goto end;
}
break;
case ':':
/* missing option argument */
- g_warning("Option '%s' requires an argument", argv[optind - 1]);
+ ws_warning("Option '%s' requires an argument", argv[optind - 1]);
break;
default:
if (!extcap_base_parse_options(extcap_conf, result - EXTCAP_OPT_LIST_INTERFACES, optarg)) {
- g_warning("Invalid option: %s", argv[optind - 1]);
+ ws_warning("Invalid option: %s", argv[optind - 1]);
goto end;
}
}
@@ -562,7 +564,7 @@ int main(int argc, char *argv[])
extcap_cmdline_debug(argv, argc);
if (optind != argc) {
- g_warning("Unexpected extra option: %s", argv[optind]);
+ ws_warning("Unexpected extra option: %s", argv[optind]);
goto end;
}
diff --git a/extcap/etw_message.c b/extcap/etw_message.c
index fa74d8b637..b78e7bc3ff 100644
--- a/extcap/etw_message.c
+++ b/extcap/etw_message.c
@@ -131,7 +131,7 @@ DWORD GetPropertyLength(PEVENT_RECORD pEvent, PTRACE_EVENT_INFO pInfo, USHORT i,
}
else
{
- g_debug("Event %d Unexpected length of 0 for intype %d and outtype %d", g_num_events,
+ ws_debug("Event %d Unexpected length of 0 for intype %d and outtype %d", g_num_events,
pInfo->EventPropertyInfoArray[i].nonStructType.InType,
pInfo->EventPropertyInfoArray[i].nonStructType.OutType);
@@ -385,7 +385,7 @@ BOOL get_event_information(PEVENT_RECORD pEvent, PTRACE_EVENT_INFO* pInfo)
*pInfo = (TRACE_EVENT_INFO*)g_malloc(BufferSize);
if (*pInfo == NULL)
{
- g_debug("Event %d GetEventInformation Failed to allocate memory for event info (size=%lu).", g_num_events, BufferSize);
+ ws_debug("Event %d GetEventInformation Failed to allocate memory for event info (size=%lu).", g_num_events, BufferSize);
goto Exit;
}
/* Retrieve the event metadata. */
diff --git a/extcap/etwdump.c b/extcap/etwdump.c
index 82a0d3a64b..e2ccaeb95f 100644
--- a/extcap/etwdump.c
+++ b/extcap/etwdump.c
@@ -74,12 +74,12 @@ static int list_config(char* interface)
unsigned inc = 0;
if (!interface) {
- g_warning("No interface specified.");
+ ws_warning("No interface specified.");
return EXIT_FAILURE;
}
if (g_strcmp0(interface, ETW_EXTCAP_INTERFACE)) {
- g_warning("Interface must be %s", ETW_EXTCAP_INTERFACE);
+ ws_warning("Interface must be %s", ETW_EXTCAP_INTERFACE);
return EXIT_FAILURE;
}
/*
@@ -132,7 +132,7 @@ int main(int argc, char* argv[])
*/
err_msg = init_progfile_dir(argv[0]);
if (err_msg != NULL) {
- g_warning("Can't get pathname of directory containing the captype program: %s.",
+ ws_warning("Can't get pathname of directory containing the captype program: %s.",
err_msg);
g_free(err_msg);
}
@@ -190,14 +190,14 @@ int main(int argc, char* argv[])
case ':':
/* missing option argument */
- g_warning("Option '%s' requires an argument", argv[optind - 1]);
+ ws_warning("Option '%s' requires an argument", argv[optind - 1]);
break;
default:
/* Handle extcap specific options */
if (!extcap_base_parse_options(extcap_conf, result - EXTCAP_OPT_LIST_INTERFACES, optarg))
{
- g_warning("Invalid option: %s", argv[optind - 1]);
+ ws_warning("Invalid option: %s", argv[optind - 1]);
goto end;
}
}
@@ -218,13 +218,13 @@ int main(int argc, char* argv[])
if (extcap_conf->capture) {
if (g_strcmp0(extcap_conf->interface, ETW_EXTCAP_INTERFACE)) {
- g_warning("ERROR: invalid interface");
+ ws_warning("ERROR: invalid interface");
goto end;
}
if (etlfile == NULL && params == NULL)
{
- g_warning("ERROR: Both --etlfile and --params arguments are empty");
+ ws_warning("ERROR: Both --etlfile and --params arguments are empty");
goto end;
}
@@ -236,38 +236,38 @@ int main(int argc, char* argv[])
{
case WTAP_OPEN_ERROR:
if (err_msg != NULL) {
- g_warning("etw_dump failed: %s.",
+ ws_warning("etw_dump failed: %s.",
err_msg);
g_free(err_msg);
}
else
{
- g_warning("etw_dump failed");
+ ws_warning("etw_dump failed");
}
break;
case WTAP_OPEN_NOT_MINE:
if (etlfile == NULL)
{
if (err_msg != NULL) {
- g_warning("The live session didn't caputre any event. Error message: %s.",
+ ws_warning("The live session didn't caputre any event. Error message: %s.",
err_msg);
g_free(err_msg);
}
else
{
- g_warning("The live session didn't caputre any event");
+ ws_warning("The live session didn't caputre any event");
}
}
else
{
if (err_msg != NULL) {
- g_warning("The file %s is not etl format. Error message: %s.",
+ ws_warning("The file %s is not etl format. Error message: %s.",
etlfile, err_msg);
g_free(err_msg);
}
else
{
- g_warning("The file %s is not etl format", etlfile);
+ ws_warning("The file %s is not etl format", etlfile);
}
}
break;
diff --git a/extcap/extcap-base.c b/extcap/extcap-base.c
index 0f8a5e6a51..a8e1795104 100644
--- a/extcap/extcap-base.c
+++ b/extcap/extcap-base.c
@@ -215,7 +215,7 @@ uint8_t extcap_base_handle_interface(extcap_parameters * extcap)
/* A fifo must be provided for capture */
if (extcap->capture && (extcap->fifo == NULL || strlen(extcap->fifo) <= 0)) {
extcap->capture = 0;
- g_error("Extcap Error: No FIFO pipe provided");
+ ws_error("Extcap Error: No FIFO pipe provided");
return 0;
}
@@ -320,7 +320,7 @@ void extcap_init_custom_log(const char* filename)
return;
custom_log = fopen(filename, "w");
if (!custom_log)
- g_error("Can't open custom log file: %s (%s)", filename, strerror(errno));
+ ws_error("Can't open custom log file: %s (%s)", filename, strerror(errno));
ws_log_add_custom_file(custom_log);
}
@@ -340,7 +340,7 @@ void extcap_cmdline_debug(char** ar, const unsigned n)
unsigned i;
for (i = 0; i < n; i++)
g_string_append_printf(cmdline, "%s ", ar[i]);
- g_debug("%s", cmdline->str);
+ ws_debug("%s", cmdline->str);
g_string_free(cmdline, TRUE);
}
diff --git a/extcap/randpktdump.c b/extcap/randpktdump.c
index 5014c6641f..1b7e3dec1b 100644
--- a/extcap/randpktdump.c
+++ b/extcap/randpktdump.c
@@ -83,12 +83,12 @@ static int list_config(char *interface)
char** longname_list;
if (!interface) {
- g_warning("No interface specified.");
+ ws_warning("No interface specified.");
return EXIT_FAILURE;
}
if (g_strcmp0(interface, RANDPKT_EXTCAP_INTERFACE)) {
- g_warning("Interface must be %s", RANDPKT_EXTCAP_INTERFACE);
+ ws_warning("Interface must be %s", RANDPKT_EXTCAP_INTERFACE);
return EXIT_FAILURE;
}
@@ -174,7 +174,7 @@ int main(int argc, char *argv[])
*/
err_msg = init_progfile_dir(argv[0]);
if (err_msg != NULL) {
- g_warning("Can't get pathname of directory containing the captype program: %s.",
+ ws_warning("Can't get pathname of directory containing the captype program: %s.",
err_msg);
g_free(err_msg);
}
@@ -223,7 +223,7 @@ int main(int argc, char *argv[])
case OPT_MAXBYTES:
if (!ws_strtou16(optarg, NULL, &maxbytes)) {
- g_warning("Invalid parameter maxbytes: %s (max value is %u)",
+ ws_warning("Invalid parameter maxbytes: %s (max value is %u)",
optarg, G_MAXUINT16);
goto end;
}
@@ -231,14 +231,14 @@ int main(int argc, char *argv[])
case OPT_COUNT:
if (!ws_strtou64(optarg, NULL, &count)) {
- g_warning("Invalid packet count: %s", optarg);
+ ws_warning("Invalid packet count: %s", optarg);
goto end;
}
break;
case OPT_DELAY:
if (!ws_strtou64(optarg, NULL, &packet_delay_ms)) {
- g_warning("Invalid packet delay: %s", optarg);
+ ws_warning("Invalid packet delay: %s", optarg);
goto end;
}
break;
@@ -258,14 +258,14 @@ int main(int argc, char *argv[])
case ':':
/* missing option argument */
- g_warning("Option '%s' requires an argument", argv[optind - 1]);
+ ws_warning("Option '%s' requires an argument", argv[optind - 1]);
break;
default:
/* Handle extcap specific options */
if (!extcap_base_parse_options(extcap_conf, result - EXTCAP_OPT_LIST_INTERFACES, optarg))
{
- g_warning("Invalid option: %s", argv[optind - 1]);
+ ws_warning("Invalid option: %s", argv[optind - 1]);
goto end;
}
}
@@ -285,7 +285,7 @@ int main(int argc, char *argv[])
/* Some sanity checks */
if ((random_type) && (all_random)) {
- g_warning("You can specify only one between: --random-type, --all-random");
+ ws_warning("You can specify only one between: --random-type, --all-random");
goto end;
}
@@ -297,16 +297,16 @@ int main(int argc, char *argv[])
err_msg = ws_init_sockets();
if (err_msg != NULL) {
- g_warning("ERROR: %s", err_msg);
+ ws_warning("ERROR: %s", err_msg);
g_free(err_msg);
- g_warning("%s", please_report_bug());
+ ws_warning("%s", please_report_bug());
goto end;
}
if (extcap_conf->capture) {
if (g_strcmp0(extcap_conf->interface, RANDPKT_EXTCAP_INTERFACE)) {
- g_warning("ERROR: invalid interface");
+ ws_warning("ERROR: invalid interface");
goto end;
}
@@ -319,7 +319,7 @@ int main(int argc, char *argv[])
if (!example)
goto end;
- g_debug("Generating packets: %s", example->abbrev);
+ ws_debug("Generating packets: %s", example->abbrev);
randpkt_example_init(example, extcap_conf->fifo, maxbytes);
randpkt_loop(example, count, packet_delay_ms);
diff --git a/extcap/sdjournal.c b/extcap/sdjournal.c
index fd1b9a8f74..0ffdc5b71e 100644
--- a/extcap/sdjournal.c
+++ b/extcap/sdjournal.c
@@ -18,12 +18,14 @@
*/
#include "config.h"
+#define WS_LOG_DOMAIN "sdjournal"
#include <extcap/extcap-base.h>
#include <wsutil/interface.h>
#include <wsutil/file_util.h>
#include <wsutil/filesystem.h>
#include <wsutil/privileges.h>
+#include <wsutil/wslog.h>
#include <writecap/pcapio.h>
#include <wiretap/wtap.h>
@@ -89,9 +91,9 @@ static int sdj_dump_entries(sd_journal *jnl, FILE* fp)
memcpy(entry_buff, &block_type, 4);
jr = sd_journal_next(jnl);
- g_debug("sd_journal_next: %d", jr);
+ ws_debug("sd_journal_next: %d", jr);
if (jr < 0) {
- g_warning("Error fetching journal entry: %s", g_strerror(jr));
+ ws_warning("Error fetching journal entry: %s", g_strerror(jr));
goto end;
} else if (jr == 0) {
sd_journal_wait(jnl, (uint64_t) -1);
@@ -100,7 +102,7 @@ static int sdj_dump_entries(sd_journal *jnl, FILE* fp)
jr = sd_journal_get_cursor(jnl, &cursor);
if (jr < 0) {
- g_warning("Error fetching cursor: %s", g_strerror(jr));
+ ws_warning("Error fetching cursor: %s", g_strerror(jr));
goto end;
}
data_end += g_snprintf(entry_buff+data_end, MAX_EXPORT_ENTRY_LENGTH-data_end, "__CURSOR=%s\n", cursor);
@@ -108,31 +110,31 @@ static int sdj_dump_entries(sd_journal *jnl, FILE* fp)
jr = sd_journal_get_realtime_usec(jnl, &pkt_rt_ts);
if (jr < 0) {
- g_warning("Error fetching realtime timestamp: %s", g_strerror(jr));
+ ws_warning("Error fetching realtime timestamp: %s", g_strerror(jr));
goto end;
}
data_end += g_snprintf(entry_buff+data_end, MAX_EXPORT_ENTRY_LENGTH-data_end, "__REALTIME_TIMESTAMP=%" G_GUINT64_FORMAT "\n", pkt_rt_ts);
jr = sd_journal_get_monotonic_usec(jnl, &mono_ts, &boot_id);
if (jr < 0) {
- g_warning("Error fetching monotonic timestamp: %s", g_strerror(jr));
+ ws_warning("Error fetching monotonic timestamp: %s", g_strerror(jr));
goto end;
}
sd_id128_to_string(boot_id, boot_id_str + strlen(FLD_BOOT_ID));
data_end += g_snprintf(entry_buff+data_end, MAX_EXPORT_ENTRY_LENGTH-data_end, "__MONOTONIC_TIMESTAMP=%" G_GUINT64_FORMAT "\n%s\n", mono_ts, boot_id_str);
- g_debug("Entry header is %u bytes", data_end);
+ ws_debug("Entry header is %u bytes", data_end);
SD_JOURNAL_FOREACH_DATA(jnl, fld_data, fld_len) {
guint8 *eq_ptr = (guint8 *) memchr(fld_data, '=', fld_len);
if (!eq_ptr) {
- g_warning("Invalid field.");
+ ws_warning("Invalid field.");
goto end;
}
if (g_utf8_validate((const char *) fld_data, (gssize) fld_len, NULL)) {
// Allow for two trailing newlines, one here and one
// at the end of the buffer.
if (fld_len > MAX_EXPORT_ENTRY_LENGTH-data_end-2) {
- g_debug("Breaking on UTF-8 field: %u + %zd", data_end, fld_len);
+ ws_debug("Breaking on UTF-8 field: %u + %zd", data_end, fld_len);
break;
}
memcpy(entry_buff+data_end, fld_data, fld_len);
@@ -142,7 +144,7 @@ static int sdj_dump_entries(sd_journal *jnl, FILE* fp)
} else {
// \n + 64-bit size + \n + trailing \n = 11
if (fld_len > MAX_EXPORT_ENTRY_LENGTH-data_end-11) {
- g_debug("Breaking on binary field: %u + %zd", data_end, fld_len);
+ ws_debug("Breaking on binary field: %u + %zd", data_end, fld_len);
break;
}
ptrdiff_t name_len = eq_ptr - (const guint8 *) fld_data;
@@ -169,9 +171,9 @@ static int sdj_dump_entries(sd_journal *jnl, FILE* fp)
memcpy (entry_buff+4, &total_len, 4);
memcpy (entry_buff+data_end, &total_len, 4);
- g_debug("Attempting to write %u bytes", total_len);
+ ws_debug("Attempting to write %u bytes", total_len);
if (!pcapng_write_block(fp, entry_buff, total_len, &bytes_written, &err)) {
- g_warning("Can't write event: %s", strerror(err));
+ ws_warning("Can't write event: %s", strerror(err));
ret = EXIT_FAILURE;
break;
}
@@ -202,7 +204,7 @@ static int sdj_start_export(const int start_from_entries, const gboolean start_f
/* Open or create the output file */
fp = fopen(fifo, "wb");
if (fp == NULL) {
- g_warning("Error creating output file: %s (%s)", fifo, g_strerror(errno));
+ ws_warning("Error creating output file: %s (%s)", fifo, g_strerror(errno));
return EXIT_FAILURE;
}
}
@@ -221,26 +223,26 @@ static int sdj_start_export(const int start_from_entries, const gboolean start_f
g_free(appname);
if (!success) {
- g_warning("Can't write pcapng file header");
+ ws_warning("Can't write pcapng file header");
goto cleanup;
}
jr = sd_journal_open(&jnl, 0);
if (jr < 0) {
- g_warning("Error opening journal: %s", g_strerror(jr));
+ ws_warning("Error opening journal: %s", g_strerror(jr));
goto cleanup;
}
jr = sd_id128_get_boot(&boot_id);
if (jr < 0) {
- g_warning("Error fetching system boot ID: %s", g_strerror(jr));
+ ws_warning("Error fetching system boot ID: %s", g_strerror(jr));
goto cleanup;
}
sd_id128_to_string(boot_id, boot_id_str + strlen(FLD_BOOT_ID));
jr = sd_journal_add_match(jnl, boot_id_str, strlen(boot_id_str));
if (jr < 0) {
- g_warning("Error adding match: %s", g_strerror(jr));
+ ws_warning("Error adding match: %s", g_strerror(jr));
goto cleanup;
}
@@ -250,28 +252,28 @@ static int sdj_start_export(const int start_from_entries, const gboolean start_f
sd_journal_set_data_threshold(jnl, 2048);
if (start_from_end) {
- g_debug("Attempting to seek %d entries from the end", start_from_entries);
+ ws_debug("Attempting to seek %d entries from the end", start_from_entries);
jr = sd_journal_seek_tail(jnl);
if (jr < 0) {
- g_warning("Error starting at end: %s", g_strerror(jr));
+ ws_warning("Error starting at end: %s", g_strerror(jr));
goto cleanup;
}
jr = sd_journal_previous_skip(jnl, (uint64_t) start_from_entries + 1);
if (jr < 0) {
- g_warning("Error skipping backward: %s", g_strerror(jr));
+ ws_warning("Error skipping backward: %s", g_strerror(jr));
goto cleanup;
}
} else {
- g_debug("Attempting to seek %d entries from the beginning", start_from_entries);
+ ws_debug("Attempting to seek %d entries from the beginning", start_from_entries);
jr = sd_journal_seek_head(jnl);
if (jr < 0) {
- g_warning("Error starting at beginning: %s", g_strerror(jr));
+ ws_warning("Error starting at beginning: %s", g_strerror(jr));
goto cleanup;
}
if (start_from_entries > 0) {
jr = sd_journal_next_skip(jnl, (uint64_t) start_from_entries);
if (jr < 0) {
- g_warning("Error skipping forward: %s", g_strerror(jr));
+ ws_warning("Error skipping forward: %s", g_strerror(jr));
goto cleanup;
}
}
@@ -279,7 +281,7 @@ static int sdj_start_export(const int start_from_entries, const gboolean start_f
/* read from channel and write into fp */
if (sdj_dump_entries(jnl, fp) != 0) {
- g_warning("Error dumping entries");
+ ws_warning("Error dumping entries");
goto cleanup;
}
@@ -291,7 +293,7 @@ cleanup:
}
if (err_info) {
- g_warning("%s", err_info);
+ ws_warning("%s", err_info);
}
g_free(err_info);
@@ -308,12 +310,12 @@ static int list_config(char *interface)
unsigned inc = 0;
if (!interface) {
- g_warning("ERROR: No interface specified.");
+ ws_warning("ERROR: No interface specified.");
return EXIT_FAILURE;
}
if (g_strcmp0(interface, SDJOURNAL_EXTCAP_INTERFACE)) {
- g_warning("ERROR: interface must be %s", SDJOURNAL_EXTCAP_INTERFACE);
+ ws_warning("ERROR: interface must be %s", SDJOURNAL_EXTCAP_INTERFACE);
return EXIT_FAILURE;
}
@@ -350,7 +352,7 @@ int main(int argc, char **argv)
*/
init_progfile_dir_error = init_progfile_dir(argv[0]);
if (init_progfile_dir_error != NULL) {
- g_warning("Can't get pathname of directory containing the captype program: %s.",
+ ws_warning("Can't get pathname of directory containing the captype program: %s.",
init_progfile_dir_error);
g_free(init_progfile_dir_error);
}
@@ -402,7 +404,7 @@ int main(int argc, char **argv)
case OPT_START_FROM:
start_from_entries = (int) strtol(optarg, NULL, 10);
if (errno == EINVAL) {
- g_warning("Invalid entry count: %s", optarg);
+ ws_warning("Invalid entry count: %s", optarg);
goto end;
}
if (strlen(optarg) > 0 && optarg[0] == '+') {
@@ -412,17 +414,17 @@ int main(int argc, char **argv)
start_from_end = TRUE;
start_from_entries *= -1;
}
- g_debug("start %d from %s", start_from_entries, start_from_end ? "end" : "beginning");
+ ws_debug("start %d from %s", start_from_entries, start_from_end ? "end" : "beginning");
break;
case ':':
/* missing option argument */
- g_warning("Option '%s' requires an argument", argv[optind - 1]);
+ ws_warning("Option '%s' requires an argument", argv[optind - 1]);
break;
default:
if (!extcap_base_parse_options(extcap_conf, result - EXTCAP_OPT_LIST_INTERFACES, optarg)) {
- g_warning("Invalid option: %s", argv[optind - 1]);
+ ws_warning("Invalid option: %s", argv[optind - 1]);
goto end;
}
}
@@ -443,7 +445,7 @@ int main(int argc, char **argv)
if (extcap_conf->capture) {
ret = sdj_start_export(start_from_entries, start_from_end, extcap_conf->fifo);
} else {
- g_debug("You should not come here... maybe some parameter missing?");
+ ws_debug("You should not come here... maybe some parameter missing?");
ret = EXIT_FAILURE;
}
diff --git a/extcap/ssh-base.c b/extcap/ssh-base.c
index 98f968f657..37e152a89c 100644
--- a/extcap/ssh-base.c
+++ b/extcap/ssh-base.c
@@ -22,7 +22,7 @@
static void extcap_log(int priority _U_, const char *function, const char *buffer, void *userdata _U_)
{
- g_debug("[%s] %s", function, buffer);
+ ws_debug("[%s] %s", function, buffer);
}
void add_libssh_info(extcap_parameters * extcap_conf)
diff --git a/extcap/sshdump.c b/extcap/sshdump.c
index 94bf6d28e5..ae202fb22f 100644
--- a/extcap/sshdump.c
+++ b/extcap/sshdump.c
@@ -11,6 +11,7 @@
*/
#include "config.h"
+#define WS_LOG_DOMAIN "sshdump"
#include <extcap/extcap-base.h>
#include <extcap/ssh-base.h>
@@ -20,6 +21,7 @@
#include <wsutil/filesystem.h>
#include <wsutil/privileges.h>
#include <wsutil/please_report_bug.h>
+#include <wsutil/wslog.h>
#include <errno.h>
#include <string.h>
@@ -82,14 +84,14 @@ static int ssh_loop_read(ssh_channel channel, FILE* fp)
while (ssh_channel_is_open(channel) && !ssh_channel_is_eof(channel)) {
nbytes = ssh_channel_read(channel, buffer, SSH_READ_BLOCK_SIZE, 0);
if (nbytes < 0) {
- g_warning("Error reading from channel");
+ ws_warning("Error reading from channel");
goto end;
}
if (nbytes == 0) {
break;
}
if (fwrite(buffer, 1, nbytes, fp) != (guint)nbytes) {
- g_warning("Error writing to fifo");
+ ws_warning("Error writing to fifo");
ret = EXIT_FAILURE;
goto end;
}
@@ -100,18 +102,18 @@ static int ssh_loop_read(ssh_channel channel, FILE* fp)
while (ssh_channel_is_open(channel) && !ssh_channel_is_eof(channel)) {
nbytes = ssh_channel_read(channel, buffer, SSH_READ_BLOCK_SIZE, 1);
if (nbytes < 0) {
- g_warning("Error reading from channel");
+ ws_warning("Error reading from channel");
goto end;
}
if (fwrite(buffer, 1, nbytes, stderr) != (guint)nbytes) {
- g_warning("Error writing to stderr");
+ ws_warning("Error writing to stderr");
break;
}
}
end:
if (ssh_channel_send_eof(channel) != SSH_OK) {
- g_warning("Error sending EOF in ssh channel");
+ ws_warning("Error sending EOF in ssh channel");
ret = EXIT_FAILURE;
}
return ret;
@@ -137,12 +139,12 @@ static ssh_channel run_ssh_command(ssh_session sshs, const char* capture_command
channel = ssh_channel_new(sshs);
if (!channel) {
- g_warning("Can't create channel");
+ ws_warning("Can't create channel");
return NULL;
}
if (ssh_channel_open_session(channel) != SSH_OK) {
- g_warning("Can't open session");
+ ws_warning("Can't open session");
ssh_channel_free(channel);
return NULL;
}
@@ -152,7 +154,7 @@ static ssh_channel run_ssh_command(ssh_session sshs, const char* capture_command
/* escape parameters to go save with the shell */
if (capture_command && *capture_command) {
cmdline = g_strdup(capture_command);
- g_debug("Remote capture command has disabled other options");
+ ws_debug("Remote capture command has disabled other options");
} else {
quoted_iface = iface ? g_shell_quote(iface) : NULL;
quoted_filter = g_shell_quote(cfilter ? cfilter : "");
@@ -168,9 +170,9 @@ static ssh_channel run_ssh_command(ssh_session sshs, const char* capture_command
quoted_filter);
}
- g_debug("Running: %s", cmdline);
+ ws_debug("Running: %s", cmdline);
if (ssh_channel_request_exec(channel, cmdline) != SSH_OK) {
- g_warning("Can't request exec");
+ ws_warning("Can't request exec");
ssh_channel_close(channel);
ssh_channel_free(channel);
channel = NULL;
@@ -197,7 +199,7 @@ static int ssh_open_remote_connection(const ssh_params_t* params, const char* if
/* Open or create the output file */
fp = fopen(fifo, "wb");
if (fp == NULL) {
- g_warning("Error creating output file: %s (%s)", fifo, g_strerror(errno));
+ ws_warning("Error creating output file: %s (%s)", fifo, g_strerror(errno));
return EXIT_FAILURE;
}
}
@@ -205,20 +207,20 @@ static int ssh_open_remote_connection(const ssh_params_t* params, const char* if
sshs = create_ssh_connection(params, &err_info);
if (!sshs) {
- g_warning("Error creating connection.");
+ ws_warning("Error creating connection.");
goto cleanup;
}
channel = run_ssh_command(sshs, capture_command, use_sudo, noprom, iface, cfilter, count);
if (!channel) {
- g_warning("Can't run ssh command.");
+ ws_warning("Can't run ssh command.");
goto cleanup;
}
/* read from channel and write into fp */
if (ssh_loop_read(channel, fp) != EXIT_SUCCESS) {
- g_warning("Error in read loop.");
+ ws_warning("Error in read loop.");
ret = EXIT_FAILURE;
goto cleanup;
}
@@ -226,7 +228,7 @@ static int ssh_open_remote_connection(const ssh_params_t* params, const char* if
ret = EXIT_SUCCESS;
cleanup:
if (err_info)
- g_warning("%s", err_info);
+ ws_warning("%s", err_info);
g_free(err_info);
/* clean up and exit */
@@ -269,12 +271,12 @@ static int list_config(char *interface, unsigned int remote_port)
char* ipfilter;
if (!interface) {
- g_warning("ERROR: No interface specified.");
+ ws_warning("ERROR: No interface specified.");
return EXIT_FAILURE;
}
if (g_strcmp0(interface, sshdump_extcap_interface)) {
- g_warning("ERROR: interface must be %s", sshdump_extcap_interface);
+ ws_warning("ERROR: interface must be %s", sshdump_extcap_interface);
return EXIT_FAILURE;
}
@@ -373,7 +375,7 @@ int main(int argc, char *argv[])
*/
err_msg = init_progfile_dir(argv[0]);
if (err_msg != NULL) {
- g_warning("Can't get pathname of directory containing the captype program: %s.",
+ ws_warning("Can't get pathname of directory containing the captype program: %s.",
err_msg);
g_free(err_msg);
}
@@ -447,7 +449,7 @@ int main(int argc, char *argv[])
case OPT_REMOTE_PORT:
if (!ws_strtou16(optarg, NULL, &ssh_params->port) || ssh_params->port == 0) {
- g_warning("Invalid port: %s", optarg);
+ ws_warning("Invalid port: %s", optarg);
goto end;
}
break;
@@ -500,7 +502,7 @@ int main(int argc, char *argv[])
case OPT_REMOTE_COUNT:
if (!ws_strtou32(optarg, NULL, &count)) {
- g_warning("Invalid value for count: %s", optarg);
+ ws_warning("Invalid value for count: %s", optarg);
goto end;
}
break;
@@ -511,12 +513,12 @@ int main(int argc, char *argv[])
case ':':
/* missing option argument */
- g_warning("Option '%s' requires an argument", argv[optind - 1]);
+ ws_warning("Option '%s' requires an argument", argv[optind - 1]);
break;
default:
if (!extcap_base_parse_options(extcap_conf, result - EXTCAP_OPT_LIST_INTERFACES, optarg)) {
- g_warning("Invalid option: %s", argv[optind - 1]);
+ ws_warning("Invalid option: %s", argv[optind - 1]);
goto end;
}
}
@@ -536,9 +538,9 @@ int main(int argc, char *argv[])
err_msg = ws_init_sockets();
if (err_msg != NULL) {
- g_warning("ERROR: %s", err_msg);
+ ws_warning("ERROR: %s", err_msg);
g_free(err_msg);
- g_warning("%s", please_report_bug());
+ ws_warning("%s", please_report_bug());
goto end;
}
@@ -546,7 +548,7 @@ int main(int argc, char *argv[])
char* filter;
if (!ssh_params->host) {
- g_warning("Missing parameter: --remote-host");
+ ws_warning("Missing parameter: --remote-host");
goto end;
}
filter = concat_filters(extcap_conf->capture_filter, remote_filter);
@@ -555,7 +557,7 @@ int main(int argc, char *argv[])
filter, remote_capture_command, use_sudo, noprom, count, extcap_conf->fifo);
g_free(filter);
} else {
- g_debug("You should not come here... maybe some parameter missing?");
+ ws_debug("You should not come here... maybe some parameter missing?");
ret = EXIT_FAILURE;
}
diff --git a/extcap/udpdump.c b/extcap/udpdump.c
index 18b68739c2..ba606dda5c 100644
--- a/extcap/udpdump.c
+++ b/extcap/udpdump.c
@@ -12,6 +12,7 @@
*/
#include "config.h"
+#define WS_LOG_DOMAIN "udpdump"
#include <extcap/extcap-base.h>
@@ -42,6 +43,7 @@
#include <wsutil/privileges.h>
#include <wsutil/socket.h>
#include <wsutil/please_report_bug.h>
+#include <wsutil/wslog.h>
#include <cli_main.h>
@@ -91,7 +93,7 @@ static int list_config(char *interface)
unsigned inc = 0;
if (!interface) {
- g_warning("No interface specified.");
+ ws_warning("No interface specified.");
return EXIT_FAILURE;
}
@@ -118,19 +120,19 @@ static int setup_listener(const guint16 port, socket_handle_t* sock)
*sock = socket(AF_INET, SOCK_DGRAM, 0);
if (*sock == INVALID_SOCKET) {
- g_warning("Error opening socket: %s", strerror(errno));
+ ws_warning("Error opening socket: %s", strerror(errno));
return EXIT_FAILURE;
}
optval = 1;
if (setsockopt(*sock, SOL_SOCKET, SO_REUSEADDR, (char*)&optval, (socklen_t)sizeof(int)) < 0) {
- g_warning("Can't set socket option SO_REUSEADDR: %s", strerror(errno));
+ ws_warning("Can't set socket option SO_REUSEADDR: %s", strerror(errno));
goto cleanup_setup_listener;
}
#ifndef _WIN32
if (setsockopt (*sock, SOL_SOCKET, SO_RCVTIMEO, (char*)&timeout, (socklen_t)sizeof(timeout)) < 0) {
- g_warning("Can't set socket option SO_RCVTIMEO: %s", strerror(errno));
+ ws_warning("Can't set socket option SO_RCVTIMEO: %s", strerror(errno));
goto cleanup_setup_listener;
}
#endif
@@ -141,7 +143,7 @@ static int setup_listener(const guint16 port, socket_handle_t* sock)
serveraddr.sin_port = htons(port);
if (bind(*sock, (struct sockaddr *)&serveraddr, (socklen_t)sizeof(serveraddr)) < 0) {
- g_warning("Error on binding: %s", strerror(errno));
+ ws_warning("Error on binding: %s", strerror(errno));
goto cleanup_setup_listener;
}
@@ -155,7 +157,7 @@ cleanup_setup_listener:
static void exit_from_loop(int signo _U_)
{
- g_warning("Exiting from main loop");
+ ws_warning("Exiting from main loop");
run_loop = FALSE;
}
@@ -171,12 +173,12 @@ static int setup_dumpfile(const char* fifo, FILE** fp)
*fp = fopen(fifo, "wb");
if (!(*fp)) {
- g_warning("Error creating output file: %s", g_strerror(errno));
+ ws_warning("Error creating output file: %s", g_strerror(errno));
return EXIT_FAILURE;
}
if (!libpcap_write_file_header(*fp, 252, PCAP_SNAPLEN, FALSE, &bytes_written, &err)) {
- g_warning("Can't write pcap file header: %s", g_strerror(err));
+ ws_warning("Can't write pcap file header: %s", g_strerror(err));
return EXIT_FAILURE;
}
@@ -279,7 +281,7 @@ static int dump_packet(const char* proto_name, const guint16 listenport, const c
if (!libpcap_write_packet(fp,
(guint32)(curtime / G_USEC_PER_SEC), (guint32)(curtime % G_USEC_PER_SEC),
offset, offset, mbuf, &bytes_written, &err)) {
- g_warning("Can't write packet: %s", g_strerror(err));
+ ws_warning("Can't write packet: %s", g_strerror(err));
ret = EXIT_FAILURE;
}
@@ -299,7 +301,7 @@ static void run_listener(const char* fifo, const guint16 port, const char* proto
FILE* fp = NULL;
if (signal(SIGINT, exit_from_loop) == SIG_ERR) {
- g_warning("Can't set signal handler");
+ ws_warning("Can't set signal handler");
return;
}
@@ -312,7 +314,7 @@ static void run_listener(const char* fifo, const guint16 port, const char* proto
if (setup_listener(port, &sock) == EXIT_FAILURE)
return;
- g_debug("Listener running on port %u", port);
+ ws_debug("Listener running on port %u", port);
buf = (char*)g_malloc(PKT_BUF_SIZE);
while(run_loop == TRUE) {
@@ -333,11 +335,11 @@ static void run_listener(const char* fifo, const guint16 port, const char* proto
NULL, err,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPWSTR)&errmsg, 0, NULL);
- g_warning("Error in recvfrom: %S (err=%d)", errmsg, err);
+ ws_warning("Error in recvfrom: %S (err=%d)", errmsg, err);
LocalFree(errmsg);
}
#else
- g_warning("Error in recvfrom: %s (errno=%d)", strerror(errno), errno);
+ ws_warning("Error in recvfrom: %s (errno=%d)", strerror(errno), errno);
#endif
run_loop = FALSE;
break;
@@ -377,7 +379,7 @@ int main(int argc, char *argv[])
*/
err_msg = init_progfile_dir(argv[0]);
if (err_msg != NULL) {
- g_warning("Can't get pathname of directory containing the captype program: %s.",
+ ws_warning("Can't get pathname of directory containing the captype program: %s.",
err_msg);
g_free(err_msg);
}
@@ -424,7 +426,7 @@ int main(int argc, char *argv[])
case OPT_PORT:
if (!ws_strtou16(optarg, NULL, &port)) {
- g_warning("Invalid port: %s", optarg);
+ ws_warning("Invalid port: %s", optarg);
goto end;
}
break;
@@ -436,12 +438,12 @@ int main(int argc, char *argv[])
case ':':
/* missing option argument */
- g_warning("Option '%s' requires an argument", argv[optind - 1]);
+ ws_warning("Option '%s' requires an argument", argv[optind - 1]);
break;
default:
if (!extcap_base_parse_options(extcap_conf, result - EXTCAP_OPT_LIST_INTERFACES, optarg)) {
- g_warning("Invalid option: %s", argv[optind - 1]);
+ ws_warning("Invalid option: %s", argv[optind - 1]);
goto end;
}
}
@@ -450,7 +452,7 @@ int main(int argc, char *argv[])
extcap_cmdline_debug(argv, argc);
if (optind != argc) {
- g_warning("Unexpected extra option: %s", argv[optind]);
+ ws_warning("Unexpected extra option: %s", argv[optind]);
goto end;
}
@@ -469,9 +471,9 @@ int main(int argc, char *argv[])
err_msg = ws_init_sockets();
if (err_msg != NULL) {
- g_warning("Error: %s", err_msg);
+ ws_warning("Error: %s", err_msg);
g_free(err_msg);
- g_warning("%s", please_report_bug());
+ ws_warning("%s", please_report_bug());
goto end;
}
diff --git a/file.c b/file.c
index 846880b003..b6b31088eb 100644
--- a/file.c
+++ b/file.c
@@ -9,6 +9,7 @@
*/
#include <config.h>
+#define WS_LOG_DOMAIN LOG_DOMAIN_CAPTURE
#include <time.h>
@@ -21,6 +22,7 @@
#include <wsutil/file_util.h>
#include <wsutil/filesystem.h>
#include <wsutil/json_dumper.h>
+#include <wsutil/wslog.h>
#include <version_info.h>
#include <wiretap/merge.h>
@@ -515,7 +517,7 @@ cf_read(capture_file *cf, gboolean reloading)
* case it occurs let's fail gracefully.
*/
if (cf->read_lock) {
- g_warning("Failing due to recursive cf_read(\"%s\", %d) call!",
+ ws_warning("Failing due to recursive cf_read(\"%s\", %d) call!",
cf->filename, reloading);
return CF_READ_ERROR;
}
@@ -888,11 +890,11 @@ cf_continue_tail(capture_file *cf, volatile int to_read, wtap_rec *rec,
/* We got an error reading the capture file.
XXX - pop up a dialog box instead? */
if (err_info != NULL) {
- g_warning("Error \"%s\" while reading \"%s\" (\"%s\")",
+ ws_warning("Error \"%s\" while reading \"%s\" (\"%s\")",
wtap_strerror(*err), cf->filename, err_info);
g_free(err_info);
} else {
- g_warning("Error \"%s\" while reading \"%s\"",
+ ws_warning("Error \"%s\" while reading \"%s\"",
wtap_strerror(*err), cf->filename);
}
return CF_READ_ERROR;
@@ -1008,11 +1010,11 @@ cf_finish_tail(capture_file *cf, wtap_rec *rec, Buffer *buf, int *err)
/* We got an error reading the capture file.
XXX - pop up a dialog box? */
if (err_info != NULL) {
- g_warning("Error \"%s\" while reading \"%s\" (\"%s\")",
+ ws_warning("Error \"%s\" while reading \"%s\" (\"%s\")",
wtap_strerror(*err), cf->filename, err_info);
g_free(err_info);
} else {
- g_warning("Error \"%s\" while reading \"%s\"",
+ ws_warning("Error \"%s\" while reading \"%s\"",
wtap_strerror(*err), cf->filename);
}
return CF_READ_ERROR;
@@ -2129,7 +2131,7 @@ process_specified_records(capture_file *cf, packet_range_t *range,
progbar_val = 0.0f;
if (cf->read_lock) {
- g_warning("Failing due to nested process_specified_records(\"%s\") call!", cf->filename);
+ ws_warning("Failing due to nested process_specified_records(\"%s\") call!", cf->filename);
return PSP_FAILED;
}
cf->read_lock = TRUE;
@@ -4453,7 +4455,7 @@ cf_save_records(capture_file *cf, const char *fname, guint save_format,
/* XXX caller should avoid saving the file while a read is pending
* (e.g. by delaying the save action) */
if (cf->read_lock) {
- g_warning("cf_save_records(\"%s\") while the file is being read, potential crash ahead", fname);
+ ws_warning("cf_save_records(\"%s\") while the file is being read, potential crash ahead", fname);
}
cf_callback_invoke(cf_cb_file_save_started, (gpointer)fname);
@@ -4962,7 +4964,7 @@ cf_reload(capture_file *cf) {
int err;
if (cf->read_lock) {
- g_warning("Failing cf_reload(\"%s\") since a read is in progress", cf->filename);
+ ws_warning("Failing cf_reload(\"%s\") since a read is in progress", cf->filename);
return;
}
diff --git a/file_packet_provider.c b/file_packet_provider.c
index 8d77c3886b..c57eb00fd8 100644
--- a/file_packet_provider.c
+++ b/file_packet_provider.c
@@ -75,7 +75,7 @@ cap_file_provider_get_user_comment(struct packet_provider_data *prov, const fram
if (prov->frames_user_comments)
return (const char *)g_tree_lookup(prov->frames_user_comments, fd);
- /* g_warning? */
+ /* ws_warning? */
return NULL;
}
diff --git a/plugins/epan/irda/packet-irda.c b/plugins/epan/irda/packet-irda.c
index 9c4a7e197f..c95dc259e7 100644
--- a/plugins/epan/irda/packet-irda.c
+++ b/plugins/epan/irda/packet-irda.c
@@ -1007,8 +1007,8 @@ static void dissect_appl_proto(tvbuff_t* tvb, packet_info* pinfo, proto_tree* ro
if (lmp_conv)
{
-/*g_message("%x:%d->%x:%d = %p\n", src, pinfo->srcport, circuit_id, pinfo->destport, lmp_conv); */
-/*g_message("->%d: %d %d %p\n", pinfo->num, lmp_conv->iap_result_frame, lmp_conv->ttp, lmp_conv->proto_dissector); */
+/*ws_message("%x:%d->%x:%d = %p\n", src, pinfo->srcport, circuit_id, pinfo->destport, lmp_conv); */
+/*ws_message("->%d: %d %d %p\n", pinfo->num, lmp_conv->iap_result_frame, lmp_conv->ttp, lmp_conv->proto_dissector); */
if ((lmp_conv->ttp) && (pdu_type != DISCONNECT_PDU))
{
offset += dissect_ttp(tvb, pinfo, root, (pdu_type == DATA_PDU));
@@ -1203,7 +1203,7 @@ void add_lmp_conversation(packet_info* pinfo, guint8 dlsap, gboolean ttp, dissec
lmp_conversation_t* lmp_conv = NULL;
-/*g_message("%d: add_lmp_conversation(%p, %d, %d, %p) = ", pinfo->num, pinfo, dlsap, ttp, proto_dissector); */
+/*ws_message("%d: add_lmp_conversation(%p, %d, %d, %p) = ", pinfo->num, pinfo, dlsap, ttp, proto_dissector); */
set_address(&srcaddr, irda_address_type, 1, &circuit_id);
dest = circuit_id ^ CMD_FRAME;
set_address(&destaddr, irda_address_type, 1, &dest);
@@ -1239,7 +1239,7 @@ void add_lmp_conversation(packet_info* pinfo, guint8 dlsap, gboolean ttp, dissec
lmp_conv->ttp = ttp;
lmp_conv->dissector = dissector;
-/*g_message("%p\n", lmp_conv); */
+/*ws_message("%p\n", lmp_conv); */
}
diff --git a/plugins/epan/mate/mate.h b/plugins/epan/mate/mate.h
index 085bbb768e..fe2644db3b 100644
--- a/plugins/epan/mate/mate.h
+++ b/plugins/epan/mate/mate.h
@@ -15,6 +15,7 @@
#define __MATE_H_
#include "config.h"
+#define WS_LOG_DOMAIN "MATE"
#include <gmodule.h>
@@ -23,6 +24,7 @@
#include <errno.h>
#include <wsutil/report_message.h>
+#include <wsutil/wslog.h>
#include <epan/packet.h>
#include <epan/exceptions.h>
@@ -182,7 +184,7 @@ typedef struct _mate_config {
GArray *wanted_hfids; /* hfids of protocols and fields MATE needs */
guint num_fields_wanted; /* number of fields MATE will look at */
- FILE* dbg_facility; /* where to dump dbgprint output g_message if null */
+ FILE* dbg_facility; /* where to dump dbgprint output ws_message if null */
gchar* mate_lib_path; /* where to look for "Include" files first */
diff --git a/plugins/epan/mate/mate_util.c b/plugins/epan/mate/mate_util.c
index 605c990726..30749b2fe7 100644
--- a/plugins/epan/mate/mate_util.c
+++ b/plugins/epan/mate/mate_util.c
@@ -25,7 +25,7 @@
/* dbg_print:
* which: a pointer to the current level of debugging for a feature
* how: the level over which this message should be printed out
- * where: the file on which to print (g_message if null)
+ * where: the file on which to print (ws_message if null)
* fmt, ...: what to print
*/
@@ -40,7 +40,7 @@ void dbg_print(const gint* which, gint how, FILE* where, const gchar* fmt, ... )
va_end( list );
if (! where) {
- g_message("%s", debug_buffer);
+ ws_message("%s", debug_buffer);
} else {
fputs(debug_buffer,where);
fputs("\n",where);
@@ -123,7 +123,7 @@ gchar* scs_subscribe(SCS_collection* c, const gchar* s) {
len = SCS_HUGE_SIZE;
} else {
len = SCS_HUGE_SIZE;
- g_warning("mate SCS: string truncated due to huge size");
+ ws_warning("mate SCS: string truncated due to huge size");
}
orig = (gchar *)g_slice_alloc(len);
@@ -173,7 +173,7 @@ void scs_unsubscribe(SCS_collection* c, gchar* s) {
(*ip)--;
}
} else {
- g_warning("unsubscribe: not subscribed");
+ ws_warning("unsubscribe: not subscribed");
}
}
diff --git a/plugins/epan/transum/packet-transum.c b/plugins/epan/transum/packet-transum.c
index 888fbfcb9f..ee4d40d926 100644
--- a/plugins/epan/transum/packet-transum.c
+++ b/plugins/epan/transum/packet-transum.c
@@ -14,6 +14,7 @@
/* ToDo: Rework the Summarizer code (future release) */
#include "config.h"
+#define WS_LOG_DOMAIN "transum"
#include <epan/proto.h>
#include <epan/packet.h>
@@ -23,6 +24,7 @@
#include "preferences.h"
#include "extractors.h"
#include "decoders.h"
+#include <wsutil/wslog.h>
void proto_register_transum(void);
void proto_reg_handoff_transum(void);
@@ -772,7 +774,7 @@ static void init_globals(void)
if (hf_of_interest[i].hf != -1)
g_array_append_val(wanted_fields, hf_of_interest[i].hf);
else
- g_warning("TRANSUM: unknown field %s", hf_of_interest[i].proto_name);
+ ws_warning("TRANSUM: unknown field %s", hf_of_interest[i].proto_name);
}
set_postdissector_wanted_hfids(transum_handle, wanted_fields);
diff --git a/randpkt_core/randpkt_core.c b/randpkt_core/randpkt_core.c
index 5ecdac437c..03ddac0b49 100644
--- a/randpkt_core/randpkt_core.c
+++ b/randpkt_core/randpkt_core.c
@@ -10,6 +10,7 @@
*/
#include <config.h>
+#define WS_LOG_DOMAIN "randpkt"
#include "randpkt_core.h"
@@ -18,6 +19,7 @@
#include <stdlib.h>
#include <string.h>
#include <wsutil/file_util.h>
+#include <wsutil/wslog.h>
#include <wiretap/wtap_opttypes.h>
#include "ui/failure_message.h"
@@ -719,7 +721,7 @@ int randpkt_parse_type(char *string)
}
/* Complain */
- g_error("randpkt: Type %s not known.\n", string);
+ ws_error("randpkt: Type %s not known.\n", string);
return -1;
}
diff --git a/sharkd_daemon.c b/sharkd_daemon.c
index bdb6e3739b..5f65327512 100644
--- a/sharkd_daemon.c
+++ b/sharkd_daemon.c
@@ -10,6 +10,7 @@
*/
#include <config.h>
+#define WS_LOG_DOMAIN LOG_DOMAIN_MAIN
#include <glib.h>
@@ -28,6 +29,7 @@
#include <wsutil/socket.h>
#include <wsutil/inet_addr.h>
#include <wsutil/please_report_bug.h>
+#include <wsutil/wslog.h>
/*
* If we have getopt_long() in the system library, include <getopt.h>.
* Otherwise, we're using our own getopt_long() (either because the
@@ -70,9 +72,9 @@ socket_init(char *path)
err_msg = ws_init_sockets();
if (err_msg != NULL) {
- g_warning("ERROR: %s", err_msg);
+ ws_warning("ERROR: %s", err_msg);
g_free(err_msg);
- g_warning("%s", please_report_bug());
+ ws_warning("%s", please_report_bug());
return fd;
}
diff --git a/sync_pipe_write.c b/sync_pipe_write.c
index 8c9f136111..b40cd98d91 100644
--- a/sync_pipe_write.c
+++ b/sync_pipe_write.c
@@ -51,7 +51,7 @@ pipe_write_block(int pipe_fd, char indicator, const char *msg)
ssize_t ret;
int len;
- /*g_warning("write %d enter", pipe_fd);*/
+ /*ws_warning("write %d enter", pipe_fd);*/
if(msg != NULL) {
len = (int) strlen(msg) + 1; /* including the terminating '\0'! */
@@ -67,16 +67,16 @@ pipe_write_block(int pipe_fd, char indicator, const char *msg)
/* write value (if we have one) */
if(len) {
- /*g_warning("write %d indicator: %c value len: %u msg: %s", pipe_fd, indicator, len, msg);*/
+ /*ws_warning("write %d indicator: %c value len: %u msg: %s", pipe_fd, indicator, len, msg);*/
ret = ws_write(pipe_fd, msg, len);
if(ret == -1) {
return;
}
} else {
- /*g_warning("write %d indicator: %c no value", pipe_fd, indicator);*/
+ /*ws_warning("write %d indicator: %c no value", pipe_fd, indicator);*/
}
- /*g_warning("write %d leave", pipe_fd);*/
+ /*ws_warning("write %d leave", pipe_fd);*/
}
diff --git a/ui/capture.c b/ui/capture.c
index 5cf1eb6129..44e3b02202 100644
--- a/ui/capture.c
+++ b/ui/capture.c
@@ -438,7 +438,7 @@ capture_input_new_file(capture_session *cap_session, gchar *new_file)
if (!cap_session->wtap) {
err_msg = g_strdup_printf(cf_open_error_message(err, err_info),
new_file);
- g_warning("capture_input_new_file: %d (%s)", err, err_msg);
+ ws_warning("capture_input_new_file: %d (%s)", err, err_msg);
g_free(err_msg);
return FALSE;
}
@@ -481,7 +481,7 @@ capture_info_new_packets(int to_read, wtap *wth, info_data_t* cap_info)
cap_info->ui.new_packets = to_read;
- /*g_warning("new packets: %u", to_read);*/
+ /*ws_warning("new packets: %u", to_read);*/
wtap_rec_init(&rec);
ws_buffer_init(&buf, 1514);
@@ -497,7 +497,7 @@ capture_info_new_packets(int to_read, wtap *wth, info_data_t* cap_info)
rec.rec_header.packet_header.caplen,
pseudo_header);
- /*g_warning("new packet");*/
+ /*ws_warning("new packet");*/
to_read--;
}
}
diff --git a/ui/cli/tap-httpstat.c b/ui/cli/tap-httpstat.c
index d4eb53b832..e1c9bf9a37 100644
--- a/ui/cli/tap-httpstat.c
+++ b/ui/cli/tap-httpstat.c
@@ -22,6 +22,8 @@
#include <epan/stat_tap_ui.h>
#include <epan/dissectors/packet-http.h>
+#include <wsutil/wslog.h>
+
#include <ui/cmdarg_err.h>
void register_tap_listener_httpstat(void);
@@ -82,7 +84,7 @@ static void
http_draw_hash_responses(gint * key _U_, http_response_code_t *data, char *format)
{
if (data == NULL) {
- g_warning("No data available, key=%d\n", *key);
+ ws_warning("No data available, key=%d\n", *key);
exit(EXIT_FAILURE);
}
if (data->packets == 0)
diff --git a/ui/cli/tap-rtspstat.c b/ui/cli/tap-rtspstat.c
index f35f6ee0ce..258b852eb0 100644
--- a/ui/cli/tap-rtspstat.c
+++ b/ui/cli/tap-rtspstat.c
@@ -25,6 +25,8 @@
#include <epan/stat_tap_ui.h>
#include <epan/dissectors/packet-rtsp.h>
+#include <wsutil/wslog.h>
+
#include <ui/cmdarg_err.h>
void register_tap_listener_rtspstat(void);
@@ -85,7 +87,7 @@ static void
rtsp_draw_hash_responses( gpointer* key _U_ , rtsp_response_code_t *data, char * format)
{
if (data == NULL) {
- g_warning("No data available, key=%d\n", GPOINTER_TO_INT(key));
+ ws_warning("No data available, key=%d\n", GPOINTER_TO_INT(key));
exit(EXIT_FAILURE);
}
if (data->packets == 0)
diff --git a/ui/cli/tap-sipstat.c b/ui/cli/tap-sipstat.c
index a5cd8c69ce..a2bf79910c 100644
--- a/ui/cli/tap-sipstat.c
+++ b/ui/cli/tap-sipstat.c
@@ -24,6 +24,8 @@
#include <epan/value_string.h>
#include <epan/dissectors/packet-sip.h>
+#include <wsutil/wslog.h>
+
#include <ui/cmdarg_err.h>
void register_tap_listener_sipstat(void);
@@ -98,7 +100,7 @@ static void
sip_draw_hash_responses( gint *key _U_ , sip_response_code_t *data, char *format)
{
if (data == NULL) {
- g_warning("C'est quoi ce borderl key=%d\n", *key);
+ ws_warning("C'est quoi ce borderl key=%d\n", *key);
exit(EXIT_FAILURE);
}
if (data->packets == 0)
diff --git a/ui/filter_files.c b/ui/filter_files.c
index 1609f011fb..e3647ac8b4 100644
--- a/ui/filter_files.c
+++ b/ui/filter_files.c
@@ -9,6 +9,7 @@
*/
#include <config.h>
+#define WS_LOG_DOMAIN LOG_DOMAIN_MAIN
#include <stdio.h>
#include <string.h>
@@ -19,6 +20,7 @@
#include <wsutil/file_util.h>
#include <wsutil/filesystem.h>
#include <wsutil/report_message.h>
+#include <wsutil/wslog.h>
#include "ui/filter_files.h"
@@ -239,7 +241,7 @@ read_filter_list(filter_list_type_t list_type)
/* "c" is the first non-white-space character.
If it's not a quote, it's an error. */
if (c != '"') {
- g_warning("'%s' line %d doesn't have a quoted filter name.", ff_path,
+ ws_warning("'%s' line %d doesn't have a quoted filter name.", ff_path,
line);
while (c != '\n')
c = getc(ff); /* skip to the end of the line */
@@ -281,7 +283,7 @@ read_filter_list(filter_list_type_t list_type)
if (c == EOF) {
if (!ferror(ff)) {
/* EOF, not error; no newline seen before EOF */
- g_warning("'%s' line %d doesn't have a newline.", ff_path,
+ ws_warning("'%s' line %d doesn't have a newline.", ff_path,
line);
}
break; /* nothing more to read */
@@ -289,7 +291,7 @@ read_filter_list(filter_list_type_t list_type)
if (c != '"') {
/* No newline seen before end-of-line */
- g_warning("'%s' line %d doesn't have a closing quote.", ff_path,
+ ws_warning("'%s' line %d doesn't have a closing quote.", ff_path,
line);
continue;
}
@@ -300,7 +302,7 @@ read_filter_list(filter_list_type_t list_type)
if (c == EOF) {
if (!ferror(ff)) {
/* EOF, not error; no newline seen before EOF */
- g_warning("'%s' line %d doesn't have a newline.", ff_path,
+ ws_warning("'%s' line %d doesn't have a newline.", ff_path,
line);
}
break; /* nothing more to read */
@@ -308,7 +310,7 @@ read_filter_list(filter_list_type_t list_type)
if (c == '\n') {
/* No filter expression */
- g_warning("'%s' line %d doesn't have a filter expression.", ff_path,
+ ws_warning("'%s' line %d doesn't have a filter expression.", ff_path,
line);
continue;
}
@@ -335,7 +337,7 @@ read_filter_list(filter_list_type_t list_type)
if (c == EOF) {
if (!ferror(ff)) {
/* EOF, not error; no newline seen before EOF */
- g_warning("'%s' line %d doesn't have a newline.", ff_path,
+ ws_warning("'%s' line %d doesn't have a newline.", ff_path,
line);
}
break; /* nothing more to read */
diff --git a/ui/preference_utils.c b/ui/preference_utils.c
index 4f83e9e959..936b14dadb 100644
--- a/ui/preference_utils.c
+++ b/ui/preference_utils.c
@@ -248,7 +248,7 @@ void save_migrated_uat(const char *uat_name, gboolean *old_pref)
char *err = NULL;
if (!uat_save(uat_get_table_by_name(uat_name), &err)) {
- g_warning("Unable to save %s: %s", uat_name, err);
+ ws_warning("Unable to save %s: %s", uat_name, err);
g_free(err);
return;
}
diff --git a/ui/rtp_stream.h b/ui/rtp_stream.h
index e5d71ce28e..ad9cf0008b 100644
--- a/ui/rtp_stream.h
+++ b/ui/rtp_stream.h
@@ -106,7 +106,7 @@ struct _rtpstream_tapinfo {
#if 0
#define RTP_STREAM_DEBUG(...) { \
char *RTP_STREAM_DEBUG_MSG = g_strdup_printf(__VA_ARGS__); \
- g_warning("rtp_stream: %s:%d %s", G_STRFUNC, __LINE__, RTP_STREAM_DEBUG_MSG); \
+ ws_warning("rtp_stream: %s:%d %s", G_STRFUNC, __LINE__, RTP_STREAM_DEBUG_MSG); \
g_free(RTP_STREAM_DEBUG_MSG); \
}
#else
diff --git a/ui/voip_calls.h b/ui/voip_calls.h
index db5ef172a6..b1263b1695 100644
--- a/ui/voip_calls.h
+++ b/ui/voip_calls.h
@@ -223,7 +223,7 @@ typedef struct _voip_calls_tapinfo {
#if 0
#define VOIP_CALLS_DEBUG(...) { \
char *VOIP_CALLS_DEBUG_MSG = g_strdup_printf(__VA_ARGS__); \
- g_warning("voip_calls: %s:%d %s", G_STRFUNC, __LINE__, VOIP_CALLS_DEBUG_MSG); \
+ ws_warning("voip_calls: %s:%d %s", G_STRFUNC, __LINE__, VOIP_CALLS_DEBUG_MSG); \
g_free(VOIP_CALLS_DEBUG_MSG); \
}
#else
diff --git a/wiretap/file_access.c b/wiretap/file_access.c
index 8a7a920ca1..3ceecfeb52 100644
--- a/wiretap/file_access.c
+++ b/wiretap/file_access.c
@@ -7,6 +7,7 @@
*/
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_WIRETAP
#include <string.h>
#include <stdlib.h>
@@ -19,6 +20,7 @@
#include <wsutil/plugins.h>
#endif
#include <wsutil/ws_assert.h>
+#include <wsutil/wslog.h>
#include "wtap-int.h"
#include "wtap_modules.h"
@@ -510,13 +512,13 @@ void
wtap_register_open_info(struct open_info *oi, const gboolean first_routine)
{
if (!oi || !oi->name) {
- g_error("No open_info name given to register");
+ ws_error("No open_info name given to register");
return;
}
/* verify name doesn't already exist */
if (wtap_has_open_info(oi->name)) {
- g_error("Name given to register_open_info already exists");
+ ws_error("Name given to register_open_info already exists");
return;
}
@@ -548,7 +550,7 @@ wtap_deregister_open_info(const gchar *name)
guint i;
if (!name) {
- g_error("Missing open_info name to de-register");
+ ws_error("Missing open_info name to de-register");
return;
}
@@ -561,7 +563,7 @@ wtap_deregister_open_info(const gchar *name)
}
}
- g_error("deregister_open_info: name not found");
+ ws_error("deregister_open_info: name not found");
}
/* Determines if a open routine short name already exists
@@ -572,7 +574,7 @@ wtap_has_open_info(const gchar *name)
guint i;
if (!name) {
- g_error("No name given to wtap_has_open_info!");
+ ws_error("No name given to wtap_has_open_info!");
return FALSE;
}
@@ -1315,7 +1317,7 @@ wtap_register_file_type_subtype(const struct file_type_subtype_info* fi)
* Check for required fields (description and name).
*/
if (!fi || !fi->description || !fi->name) {
- g_warning("no file type info");
+ ws_warning("no file type info");
return -1;
}
@@ -1324,7 +1326,7 @@ wtap_register_file_type_subtype(const struct file_type_subtype_info* fi)
* type/subtype supports.
*/
if (fi->num_supported_blocks == 0 || fi->supported_blocks == NULL) {
- g_warning("no blocks supported by file type \"%s\"", fi->name);
+ ws_warning("no blocks supported by file type \"%s\"", fi->name);
return -1;
}
@@ -1335,7 +1337,7 @@ wtap_register_file_type_subtype(const struct file_type_subtype_info* fi)
/*
* Yes. You don't get to replace an existing handler.
*/
- g_warning("file type \"%s\" is already registered", fi->name);
+ ws_warning("file type \"%s\" is already registered", fi->name);
return -1;
}
@@ -1388,11 +1390,11 @@ wtap_deregister_file_type_subtype(const int subtype)
struct file_type_subtype_info* finfo;
if (subtype < 0 || subtype >= (int)file_type_subtype_table_arr->len) {
- g_error("invalid file type to de-register");
+ ws_error("invalid file type to de-register");
return;
}
if ((guint)subtype >= wtap_num_builtin_file_types_subtypes) {
- g_error("built-in file types cannot be de-registered");
+ ws_error("built-in file types cannot be de-registered");
return;
}
diff --git a/wiretap/lanalyzer.c b/wiretap/lanalyzer.c
index 368b441cda..4f74b77078 100644
--- a/wiretap/lanalyzer.c
+++ b/wiretap/lanalyzer.c
@@ -355,7 +355,7 @@ wtap_open_return_val lanalyzer_open(wtap *wth, int *err, gchar **err_info)
record_type = pletoh16(rec_header.record_type);
record_length = pletoh16(rec_header.record_length);
- /*g_message("Record 0x%04X Length %d", record_type, record_length);*/
+ /*ws_message("Record 0x%04X Length %d", record_type, record_length);*/
switch (record_type) {
/* Trace Summary Record */
case RT_Summary:
@@ -378,7 +378,7 @@ wtap_open_return_val lanalyzer_open(wtap *wth, int *err, gchar **err_info)
cr_day = summary[0];
cr_month = summary[1];
cr_year = pletoh16(&summary[2]);
- /*g_message("Day %d Month %d Year %d (%04X)", cr_day, cr_month,
+ /*ws_message("Day %d Month %d Year %d (%04X)", cr_day, cr_month,
cr_year, cr_year);*/
/* Get capture start time. I learned how to do
@@ -392,7 +392,7 @@ wtap_open_return_val lanalyzer_open(wtap *wth, int *err, gchar **err_info)
tm.tm_sec = 0;
tm.tm_isdst = -1;
start = mktime(&tm);
- /*g_message("Day %d Month %d Year %d", tm.tm_mday,
+ /*ws_message("Day %d Month %d Year %d", tm.tm_mday,
tm.tm_mon, tm.tm_year);*/
mxslc = pletoh16(&summary[30]);
diff --git a/wiretap/log3gpp.c b/wiretap/log3gpp.c
index fa8bb2cdc2..893538afb6 100644
--- a/wiretap/log3gpp.c
+++ b/wiretap/log3gpp.c
@@ -142,7 +142,7 @@ log3gpp_open(wtap *wth, int *err, gchar **err_info _U_)
/********************************************************************/
/* First line needs to contain at least as many characters as magic */
- /*g_warning("Open file"); */
+ /*ws_warning("Open file"); */
if (!read_new_line(wth->fh, &firstline_length, linebuff,
sizeof linebuff, err, err_info)) {
diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c
index 9d99d8a63d..d689f7f214 100644
--- a/wiretap/pcapng.c
+++ b/wiretap/pcapng.c
@@ -305,7 +305,7 @@ register_pcapng_block_type_handler(guint block_type, block_reader reader,
* something we don't handle in that block, submit a change
* to the main Wireshark source).
*/
- g_warning("Attempt to register plugin for block type 0x%08x not allowed",
+ ws_warning("Attempt to register plugin for block type 0x%08x not allowed",
block_type);
return;
@@ -329,7 +329,7 @@ register_pcapng_block_type_handler(guint block_type, block_reader reader,
* No; don't allow a plugin to be registered for it, as
* the block type needs to be registered before it's used.
*/
- g_warning("Attempt to register plugin for reserved block type 0x%08x not allowed",
+ ws_warning("Attempt to register plugin for reserved block type 0x%08x not allowed",
block_type);
return;
}
diff --git a/wiretap/wtap.c b/wiretap/wtap.c
index e37836adc8..ba45ee0822 100644
--- a/wiretap/wtap.c
+++ b/wiretap/wtap.c
@@ -40,7 +40,7 @@ wtap_register_plugin(const wtap_plugin *plug)
void
wtap_register_plugin(const wtap_plugin *plug _U_)
{
- g_warning("wtap_register_plugin: built without support for binary plugins");
+ ws_warning("wtap_register_plugin: built without support for binary plugins");
}
#endif /* HAVE_PLUGINS */
diff --git a/wsutil/buffer.c b/wsutil/buffer.c
index b922053ccb..3b6894500a 100644
--- a/wsutil/buffer.c
+++ b/wsutil/buffer.c
@@ -6,12 +6,14 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_WSUTIL
#include <stdlib.h>
#include <string.h>
#include "buffer.h"
#include <wsutil/ws_assert.h>
+#include <wsutil/wslog.h>
#define SMALL_BUFFER_SIZE (2 * 1024) /* Everyone still uses 1500 byte frames, right? */
static GPtrArray *small_buffers = NULL; /* Guaranteed to be at least SMALL_BUFFER_SIZE */
@@ -112,10 +114,10 @@ ws_buffer_remove_start(Buffer* buffer, gsize bytes)
{
ws_assert(buffer);
if (buffer->start + bytes > buffer->first_free) {
- g_error("ws_buffer_remove_start trying to remove %" G_GINT64_MODIFIER "u bytes. s=%" G_GINT64_MODIFIER "u ff=%" G_GINT64_MODIFIER "u!\n",
+ ws_error("ws_buffer_remove_start trying to remove %" G_GINT64_MODIFIER "u bytes. s=%" G_GINT64_MODIFIER "u ff=%" G_GINT64_MODIFIER "u!\n",
(guint64)bytes, (guint64)buffer->start,
(guint64)buffer->first_free);
- /** g_error() does an abort() and thus never returns **/
+ /** ws_error() does an abort() and thus never returns **/
}
buffer->start += bytes;
diff --git a/wsutil/codecs.c b/wsutil/codecs.c
index f189cdb4c2..7459e0c221 100644
--- a/wsutil/codecs.c
+++ b/wsutil/codecs.c
@@ -33,7 +33,7 @@ codecs_register_plugin(const codecs_plugin *plug)
void
codecs_register_plugin(const codecs_plugin *plug _U_)
{
- g_warning("codecs_register_plugin: built without support for binary plugins");
+ ws_warning("codecs_register_plugin: built without support for binary plugins");
}
#endif /* HAVE_PLUGINS */
diff --git a/wsutil/inet_addr.c b/wsutil/inet_addr.c
index 2a995afdc2..116724d33e 100644
--- a/wsutil/inet_addr.c
+++ b/wsutil/inet_addr.c
@@ -9,6 +9,7 @@
#include "config.h"
#include "inet_addr.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_WSUTIL
#include <errno.h>
#include <string.h>
@@ -35,6 +36,7 @@
#endif
#include <wsutil/ws_assert.h>
+#include <wsutil/wslog.h>
/*
* We assume and require an inet_pton/inet_ntop that supports AF_INET
@@ -49,11 +51,11 @@ _inet_pton(int af, const gchar *src, gpointer dst)
/* EAFNOSUPPORT */
if (af == AF_INET) {
memset(dst, 0, sizeof(struct in_addr));
- g_critical("ws_inet_pton4: EAFNOSUPPORT");
+ ws_critical("ws_inet_pton4: EAFNOSUPPORT");
}
else if (af == AF_INET6) {
memset(dst, 0, sizeof(struct in6_addr));
- g_critical("ws_inet_pton6: EAFNOSUPPORT");
+ ws_critical("ws_inet_pton6: EAFNOSUPPORT");
}
else {
ws_assert_not_reached();
@@ -73,7 +75,7 @@ _inet_ntop(int af, gconstpointer src, gchar *dst, guint dst_size)
switch (errno) {
case EAFNOSUPPORT:
errmsg = "<<EAFNOSUPPORT>>";
- g_critical("ws_inet_ntop: EAFNOSUPPORT");
+ ws_critical("ws_inet_ntop: EAFNOSUPPORT");
break;
case ENOSPC:
errmsg = "<<ENOSPC>>";
diff --git a/wsutil/json_dumper.c b/wsutil/json_dumper.c
index a45366aa6d..038d8c216b 100644
--- a/wsutil/json_dumper.c
+++ b/wsutil/json_dumper.c
@@ -12,9 +12,12 @@
*/
#include "json_dumper.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_WSUTIL
#include <math.h>
+#include <wsutil/wslog.h>
+
/*
* json_dumper.state[current_depth] describes a nested element:
* - type: none/object/array/value
@@ -101,7 +104,7 @@ json_dumper_bad(json_dumper *dumper, enum json_dumper_change change,
return;
}
fflush(dumper->output_file);
- g_error("Bad json_dumper state: %s; change=%d type=%d depth=%d prev/curr/next state=%02x %02x %02x",
+ ws_error("Bad json_dumper state: %s; change=%d type=%d depth=%d prev/curr/next state=%02x %02x %02x",
what, change, type, dumper->current_depth, states[0], states[1], states[2]);
}
diff --git a/wsutil/plugins.c b/wsutil/plugins.c
index 28176f5e7e..30d01e60b2 100644
--- a/wsutil/plugins.c
+++ b/wsutil/plugins.c
@@ -9,6 +9,7 @@
*/
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_WSUTIL
#include <time.h>
@@ -24,6 +25,7 @@
#include <wsutil/privileges.h>
#include <wsutil/file_util.h>
#include <wsutil/report_message.h>
+#include <wsutil/wslog.h>
#include <wsutil/plugins.h>
#include <wsutil/ws_assert.h>
@@ -58,7 +60,7 @@ type_to_dir(plugin_type_e type)
case WS_PLUGIN_CODEC:
return TYPE_DIR_CODECS;
default:
- g_error("Unknown plugin type: %u. Aborting.", (unsigned) type);
+ ws_error("Unknown plugin type: %u. Aborting.", (unsigned) type);
break;
}
ws_assert_not_reached();
@@ -75,7 +77,7 @@ type_to_name(plugin_type_e type)
case WS_PLUGIN_CODEC:
return TYPE_NAME_CODEC;
default:
- g_error("Unknown plugin type: %u. Aborting.", (unsigned) type);
+ ws_error("Unknown plugin type: %u. Aborting.", (unsigned) type);
break;
}
ws_assert_not_reached();
diff --git a/wsutil/privileges.c b/wsutil/privileges.c
index 85c58f3d55..9bee5bbd39 100644
--- a/wsutil/privileges.c
+++ b/wsutil/privileges.c
@@ -9,6 +9,7 @@
*/
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_WSUTIL
#if defined(HAVE_SETRESUID) || defined(HAVE_SETREGUID)
#define _GNU_SOURCE /* Otherwise [sg]etres[gu]id won't be defined on Linux */
@@ -18,6 +19,7 @@
#include "privileges.h"
#include <wsutil/ws_assert.h>
+#include <wsutil/wslog.h>
#ifdef _WIN32
#include <windows.h>
@@ -204,7 +206,7 @@ running_with_special_privs(void)
static void
setxid_fail(const gchar *str)
{
- g_error("Attempt to relinquish privileges failed [%s()] - aborting: %s\n",
+ ws_error("Attempt to relinquish privileges failed [%s()] - aborting: %s\n",
str, g_strerror(errno));
}
diff --git a/wsutil/time_util.c b/wsutil/time_util.c
index a842acbaac..89aa883642 100644
--- a/wsutil/time_util.c
+++ b/wsutil/time_util.c
@@ -9,10 +9,12 @@
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_WSUTIL
#include <glib.h>
#include <wsutil/epochs.h>
+#include <wsutil/wslog.h>
#include "time_util.h"
@@ -148,7 +150,7 @@ void log_resource_usage(gboolean reset_delta, const char *format, ...) {
g_string_append_vprintf(log_str, format, ap);
va_end(ap);
- g_warning("%s", log_str->str);
+ ws_warning("%s", log_str->str);
g_string_free(log_str, TRUE);
}