Replace g_log() calls with ws_log()
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>
Mon, 14 Jun 2021 23:06:02 +0000 (00:06 +0100)
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>
Wed, 16 Jun 2021 12:50:27 +0000 (12:50 +0000)
68 files changed:
epan/capture_dissectors.c
epan/color_filters.c
epan/crypt/dot11decrypt_debug.h
epan/dfilter/dfilter.c
epan/disabled_protos.c
epan/epan.c
epan/expert.c
epan/maxmind_db.c
epan/packet.c
epan/prefs.c
epan/proto.c
epan/secrets.c
epan/sequence_analysis.h
epan/show_exception.c
epan/tap.c
epan/tvbparse.c
epan/value_string.c
epan/wmem/wmem_core.c
epan/wmem/wmem_strbuf.c
epan/wslua/init_wslua.c
epan/wslua/wslua.h
epan/wslua/wslua_file.c
epan/wslua/wslua_file_handler.c
epan/wslua/wslua_frame_info.c
epan/wslua/wslua_gui.c
epan/wslua/wslua_internals.c
epan/wslua/wslua_listener.c
epan/wslua/wslua_util.c
extcap/androiddump.c
extcap/ciscodump.c
extcap/dpauxmon.c
extcap/etw_message.c
extcap/etwdump.c
extcap/extcap-base.c
extcap/randpktdump.c
extcap/sdjournal.c
extcap/ssh-base.c
extcap/sshdump.c
extcap/udpdump.c
file.c
file_packet_provider.c
plugins/epan/irda/packet-irda.c
plugins/epan/mate/mate.h
plugins/epan/mate/mate_util.c
plugins/epan/transum/packet-transum.c
randpkt_core/randpkt_core.c
sharkd_daemon.c
sync_pipe_write.c
ui/capture.c
ui/cli/tap-httpstat.c
ui/cli/tap-rtspstat.c
ui/cli/tap-sipstat.c
ui/filter_files.c
ui/preference_utils.c
ui/rtp_stream.h
ui/voip_calls.h
wiretap/file_access.c
wiretap/lanalyzer.c
wiretap/log3gpp.c
wiretap/pcapng.c
wiretap/wtap.c
wsutil/buffer.c
wsutil/codecs.c
wsutil/inet_addr.c
wsutil/json_dumper.c
wsutil/plugins.c
wsutil/privileges.c
wsutil/time_util.c

index 5f62d5b6047aef923a30234e66b7a5f4e61a5a79..124efaccf97047fe78c3db17e09036605fd7f5fe 100644 (file)
@@ -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);
index 08cf3da4f0c9c56af0de8742e0fa83a5faa1c212..29ddcb6b62dc6d83d4fc11f141dc756d8f6e1122 100644 (file)
@@ -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;
index d95335dc50999bc54a7f6f60fe2074170f2a60d9..9f23995e40b9463f67153a76d5f6fba573a9e781 100644 (file)
@@ -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);
 }
 
index 59924eb239117fd2708b3a634161270c42cf3b4a..e9c80c2a60829749e5af8c078134e3b5b937a391 100644 (file)
@@ -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);
        }
index a558aaf48d388c3818c1a0d148df5d6bdd94c4de..41b4cc2dd083ec8be8de240ca633843f95f8d35d 100644 (file)
@@ -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 */
index 461276b0c948b8a474c2bce4138e6b6073d7c491..20227b39bb3740a8f9d3258a622234d6d5d99bbd 100644 (file)
@@ -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;
 }
index 9a4b8c1cbac74d05066eb235dc9d76540a67723a..faef02fae01ac122d7a930079504af3cdec815c8 100644 (file)
@@ -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];
index 17e4373002f0dcac0bc0307c9f1ecb32eb52aac9..7b3016a7c99b2128a702ec1d0589de8d2dcca77c 100644 (file)
@@ -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
index 5315a28c15d79019cff361c00beb71fea9069a9f..7e64f562b20aad905dca3dd9b9d2b40bb881644a 100644 (file)
@@ -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 */
index 9707f27da46ddf95733de13babe461e7201b4ad3..9e4c450480157d9ca920360dee1a301b53adfdf1 100644 (file)
@@ -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);
             }
         }
index 34cd1b7c323b521076a5be6bc068ee2da2e99e91..2b7ad23c639392c1e4228f6d103e4dc5726870b7 100644 (file)
@@ -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 */
index 8d61ad42dfd1806ee0dc9392a028012bff1b7a1a..117ceda2640e6ed1779d74a2ddde0cecbcb9a177 100644 (file)
@@ -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;
         }
 
index 5016b51a40ec0df0d5a7829661a46d4607cbf793..638be5cb2c5a7457c3669a769cc7cddda1502570 100644 (file)
@@ -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
index c052362c224340564f915baab4e0df81f376e4be..7d5712c95f7e952917927033f8a1d985279dacdd 100644 (file)
@@ -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);
index 9e5dddfa26a6b51f91174c0b2df64a3cd5c05e42..9e2c6aec70014ebc0bf4b5d554b4fa9cd712ae82 100644 (file)
@@ -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;
                }
        }
index 8aec4c8e839112cc05ab6ce4892805dc1a22683c..b8d645d0b77be7b312276ba3d99c6896f52a260a 100644 (file)
@@ -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;
     }
index 18f42b8e750a45a5dab8525f0e511c76f489225c..237374073e01a54a6f82ccb2bdff7968a2fa5ac4 100644 (file)
@@ -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;
index b0c14499a0920e41c0e03c60699ffe03614f31b8..820fac0c6654f6f98fb512ce1e172f6c92259e0a 100644 (file)
@@ -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;
         }
     }
index cbd88656178b0f0b2480951e1568e7c3424b87a8..f0c29967249313b2369558a039296d3b263c951d 100644 (file)
@@ -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) {
index 403670fd1b7c47caab4191fe5730b67890a4dd94..7253ddab19e16927e3c35592b8a3733ae85afe04 100644 (file)
@@ -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 */
 }
 
index df6f666196aaa0ec9810f71dc21e9867521510fa..19052da7b7915d250473040cceda97d1b2222cfb 100644 (file)
@@ -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>
index 3a1d472197fc1492c57670c0b420e1f9c7d8f4fc..f85d472a2f2e1ea0ab2167dac50626fd06c48723 100644 (file)
@@ -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;
     }
 
index 8b1fc4698a5160755a9f8991bfec8eb266061526..92dd7e267ae135de122413109e492b53d173d824 100644 (file)
@@ -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;
         }
 
index f0f8b998ac8c01efdc8713bbf2bdefdda3bda61a..03d2eddf5f29f42823997b57eca752bc10cbdd63 100644 (file)
@@ -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;
     }
 
index 4898520fd032f2d4b76d87d1ba5cfcc2fc818fa2..22a32a505a0c26b534bb222eee3a1660b9503c80 100644 (file)
@@ -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();
index a00d37d2c2359eb6acad68f277d5c204182eabdf..186d6fa593ac1a9043dcc2191a517cb22c34158c 100644 (file)
@@ -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);
 
index f4e0ad2b1b1d303a33d4bb54fabfc5f0265de689..d181e41c9b32445664de54d6d3f5de6d54fee2e9 100644 (file)
@@ -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();
index 8e4c2afb442571b2af798c2605bd027fa21529b3..ce927d47f1548abcbf2512cd6edcff87beab009d 100644 (file)
@@ -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();
index 164ddebf172d96c23b04f55fae2a5e4e12c84d2a..afd13c1c4a2406ff99f7dd099a6aa7447b0277fe 100644 (file)
@@ -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;
     }
 
index 9b845fd8d7f3daf58f10fd4a7b3d69b8b8c3f872..80f8cc5418c1c99bd7578dcf41aa3cc88810ba1b 100644 (file)
@@ -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;
        }
 
index 0ab4f576cce852eaa618c44b20b387ec2fd50343..f3bed612d9c451518d749f22fada161d92e99f90 100644 (file)
@@ -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;
        }
 
index fa74d8b6376a133b3990dba6b8c644a513f9d82f..b78e7bc3ff5c7ac2cc41592109382d2bff7aa1b6 100644 (file)
@@ -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. */
index 82a0d3a64b253c510819c799b0b3a7789b7c32ad..e2ccaeb95f7c4220e44772b97920aebe178d4bc7 100644 (file)
@@ -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;
index 0f8a5e6a514eb74bc93343993f5f8e9609b19522..a8e1795104f460ba7f4fb6d166de2848fee299d4 100644 (file)
@@ -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);
 }
 
index 5014c6641fb54038ab4aad66822d046f98e592b2..1b7e3dec1bcf3369cc2331d50907411d9e0f681d 100644 (file)
@@ -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);
index fd1b9a8f74438e06ba8497b4f2e6a877b683e59c..0ffdc5b71e91e4b0955e661090f3d79ae337aeb6 100644 (file)
  */
 
 #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;
        }
 
index 98f968f6571c778e24126f69adb1f48917378dbd..37e152a89c5f6cef55c358bf9a48ae1f62bba240 100644 (file)
@@ -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)
index 94bf6d28e546e4348194e57497f34dce96e7a8aa..ae202fb22fd65acecad1cdb56ab329a68516fe84 100644 (file)
@@ -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;
        }
 
index 18b68739c246774c0d6a14b5e7f354d602b431ea..ba606dda5cbb31942841932dc16c1b5bb3002db9 100644 (file)
@@ -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 846880b003f75a3a2a45137fcdb28b8ede2ca4e7..b6b31088ebe40901c413a6504ad544759e3691f2 100644 (file)
--- 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;
   }
 
index 8d77c3886b51aedad5fde47835429656c3ab8602..c57eb00fd84303d2d21f6096de9273c48593d614 100644 (file)
@@ -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;
 }
 
index 9c4a7e197fccafe300187dc2876237a1a87a8a8f..c95dc259e7bd788adec24c8b0d31c2276341161e 100644 (file)
@@ -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); */
 }
 
 
index 085bbb768e1e3084b86b64ce5ae4d420ae9e770a..fe2644db3bdd5150d20e59307a83bce252b17b3e 100644 (file)
@@ -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 */
 
index 605c990726ff7b5416fdc8ba8f87976be9297cfe..30749b2fe7373c098ba405c749a3ca7acc2473bd 100644 (file)
@@ -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");
        }
 }
 
index 888fbfcb9f0dd02fc083468569272c14837b9022..ee4d40d926ef1e6020d594cfef53524dd0baa07a 100644 (file)
@@ -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);
 
index 5ecdac437c2fb3eea4320afc6f410271a9135c5e..03ddac0b49f34331fbd8aaf5c094ee41d324b2ea 100644 (file)
@@ -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;
 }
 
index bdb6e3739b70946a40e88180cdbd00ade052b7f1..5f6532751212e2886f2269d45d47e738f9857426 100644 (file)
@@ -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;
        }
 
index 8c9f136111c423b5ddae7cb321314b8ae7410718..b40cd98d9120b0991096cfc60a8678504858dcf7 100644 (file)
@@ -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);*/
 }
 
 
index 5cf1eb6129e24cb2c0ad084e02478277542cd96c..44e3b02202269bb1118a1a3b87c6dac74d66275e 100644 (file)
@@ -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--;
             }
         }
index d4eb53b832e3c6812366ab7245ed8c93f278c596..e1c9bf9a37be8ac444e303e234684ff7562f3494 100644 (file)
@@ -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)
index f35f6ee0cec9ad51af0d2b2c4871310261137cd3..258b852eb03f23ff9f6ce5e4150f3546de9eea54 100644 (file)
@@ -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)
index a5cd8c69ce88ebf2ea5af180d2bfc840798108e1..a2bf79910c5ffb77146ef6549a4cb30d5a2dd5f7 100644 (file)
@@ -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)
index 1609f011fb0fc9190465309b9edd2d6d840d1f3e..e3647ac8b48955897a81489c5195fb56b0e2a289 100644 (file)
@@ -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 */
index 4f83e9e959d0643a12e0cb90899ea78c1b67cf99..936b14dadbd96e1e1986df3a4ab7b75b3661d8fd 100644 (file)
@@ -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;
     }
index e5d71ce28eaccc6008099b83d57f387b4c61cdec..ad9cf0008be5a69aa2dc1549bc856822896c9a86 100644 (file)
@@ -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
index db5ef172a6743ff86b0c040234a0c0e34bc7397b..b1263b16959a0ee7bbf07fe7c4a2d540d5920c6c 100644 (file)
@@ -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
index 8a7a920ca18f1e3eb0fad405837be45b07a96319..3ceecfeb523ffb5a56dfef9fa8c57bfbf593ce80 100644 (file)
@@ -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;
        }
 
index 368b441cdaf8e1d2ba42bf7c2bba545e7dd225bc..4f74b77078bf1d50997d6a720d301d706e41519e 100644 (file)
@@ -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]);
 
index fa8bb2cdc2702cbec319b2691e5044600e303ab4..893538afb617c3855363e82d79b480190d588acb 100644 (file)
@@ -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)) {
index 9d99d8a63df42f25149cdbd249e4f21fbdffbe43..d689f7f2141d8da25673546614b0760950a1d36c 100644 (file)
@@ -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;
          }
index e37836adc84f3867261c281f513c391089ca7f5d..ba45ee08227432b9019e02caadef489348368b24 100644 (file)
@@ -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 */
 
index b922053ccb16cd938b0bb6cd98160d33d83f4f83..3b6894500a10215482a3a5cf795b96d1198c9810 100644 (file)
@@ -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;
 
index f189cdb4c209eeee604435a1a2a4170a69d86d61..7459e0c221bb3b4c8a81d64b75fb0618d10c01c6 100644 (file)
@@ -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 */
 
index 2a995afdc2459e01fbe0485278088abc4a5ec3a8..116724d33e92290b3f4b39ae657d315e59028766 100644 (file)
@@ -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>>";
index a45366aa6d4b937304c35fdb26d39ce8964cb652..038d8c216b7906844af90c2cb681be1d3ba2ba8a 100644 (file)
  */
 
 #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]);
 }
 
index 28176f5e7ee42ef6b08419f2960aea6ed3be10c2..30d01e60b21c0fba452180827a853c6b3c2ef2cb 100644 (file)
@@ -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();
index 85c58f3d55cd0262c32bb25d08545a352ab929b4..9bee5bbd398b675d1e8559e5d45dc7591df50981 100644 (file)
@@ -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));
 }
 
index a842acbaac9f7f1291db1f1adebf9138880a3474..89aa883642b7c7c4da22a5d06b2e11c392aa4de2 100644 (file)
@@ -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);
 
 }