*/
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_EPAN
#include <glib.h>
#include <stdio.h>
#include "capture_dissectors.h"
+#include <wsutil/wslog.h>
+
struct capture_dissector_table {
GHashTable *hash_table;
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);
*/
#include <config.h>
+#define WS_LOG_DOMAIN LOG_DOMAIN_EPAN
#include <glib.h>
#include <wsutil/filesystem.h>
#include <wsutil/file_util.h>
+#include <wsutil/wslog.h>
#include <epan/packet.h>
#include "color_filters.h"
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;
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)
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);
}
*/
#include "config.h"
+#define WS_LOG_DOMAIN "Dfilter"
#include <stdio.h>
#include <string.h>
#include "dfilter.h"
#include "dfilter-macro.h"
#include "scanner_lex.h"
+#include <wsutil/wslog.h>
#define DFILTER_TOKEN_ID_OFFSET 1
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);
}
*/
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_EPAN
#include <stdio.h>
#include <string.h>
#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"
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);
}
}
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 */
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);
}
}
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 */
#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 */
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;
}
*/
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_EPAN
#include <stdio.h>
#include <stdlib.h>
#include "wmem/wmem.h"
#include "tap.h"
+#include <wsutil/wslog.h>
+
/* proto_expert cannot be static because it's referenced in the
* print routines
*/
#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];
#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
*/
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_EPAN
#include <glib.h>
#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;
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;
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)));
}
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();
}
/* 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 */
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;
/* 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 */
}
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);
}
/* 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);
}
/* 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 */
*/
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_EPAN
#include "ws_diag_control.h"
#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>
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);
}
/*
* 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.
* 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");
}
/*
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);
}
/*
* 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;
}
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),
{
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));
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),
}
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),
*/
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
* 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 */
*/
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);
}
}
* 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
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;
* 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;
} 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:
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;
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);
}
}
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));
}
}
}
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();
}
}
}
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;
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);
}
}
*/
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_EPAN
#include <stdio.h>
#include <string.h>
#include <wsutil/sign_ext.h>
#include <wsutil/utf8_entities.h>
#include <wsutil/json_dumper.h>
+#include <wsutil/wslog.h>
#include <ftypes/ftypes-int.h>
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; \
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); \
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;
#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];
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 */
/* 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,
}
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);
}
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);
}
* 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);
}
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
//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));
}
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);
}
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,
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,
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,
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));
}
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);
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);
}
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);
}
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,
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);
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;
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;
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;
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);
}
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;
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);
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;
}
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,
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;
#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
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.");
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 */
} 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 */
#include "secrets.h"
#include <wiretap/wtap.h>
#include <wsutil/glib-compat.h>
+#include <wsutil/wslog.h>
#include <string.h>
#ifdef HAVE_LIBGNUTLS
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]));
}
}
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;
}
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;
}
/* 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;
}
#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
*/
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_EPAN
#include <glib.h>
#include <epan/packet.h>
#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;
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);
*/
#include <config.h>
+#define WS_LOG_DOMAIN LOG_DOMAIN_EPAN
#include <stdio.h>
#include <epan/packet_info.h>
#include <epan/dfilter/dfilter.h>
#include <epan/tap.h>
+#include <wsutil/wslog.h>
static gboolean tapping_is_active=FALSE;
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 */
* 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;
}
}
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;
}
}
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);
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;
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 )
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;
}
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 )
} 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;
}
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 ) {
} 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;
}
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 )
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 {
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 )
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 {
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 )
*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;
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 )
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))) {
*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;
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 )
*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;
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 )
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) {
*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;
}
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 )
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:
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
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;
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);
}
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);
}
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;
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;
}
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 {
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 {
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;
}
*/
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_EPAN
#include <stdio.h>
#include <string.h>
#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.
/* 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;
/* 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;
* SPDX-License-Identifier: GPL-2.0-or-later
*/
+#define WS_LOG_DOMAIN "wmem"
+
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#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. */
override_type = WMEM_ALLOCATOR_BLOCK_FAST;
}
else {
- g_warning("Unrecognized wmem override");
+ ws_warning("Unrecognized wmem override");
do_override = FALSE;
}
}
*/
#include "config.h"
+#define WS_LOG_DOMAIN "wmem"
#include <string.h>
#include <stdio.h>
#include "wmem_strbuf.h"
#include <wsutil/ws_assert.h>
+#include <wsutil/wslog.h>
#define DEFAULT_MINIMUM_LEN 16
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) {
}
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 */
}
#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>
/* 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;
}
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;
}
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;
}
*err = WTAP_ERR_INTERNAL;
*err_info = msg;
} else {
- g_warning("%s", msg);
+ ws_warning("%s", msg);
g_free(msg);
}
}
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;
}
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;
}
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;
}
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;
}
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();
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();
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;
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();
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 */
}
/* 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);
/* 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();
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();
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();
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();
}
/*
- * 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
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) {
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) {
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) {
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;
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;
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;
}
};
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
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;
}
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;
/* 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;
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;
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;
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;
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;
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;
*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;
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;
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;
}
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) {
*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;
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;
}
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;
}
}
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;
}
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;
}
} 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;
}
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;
}
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;
}
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;
}
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;
}
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);
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);
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");
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);
}
}
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;
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;
}
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);
}
}
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;
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;
}
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);
}
}
unsigned inc = 0;
if (!interface) {
- g_warning("No interface specified.");
+ ws_warning("No interface specified.");
return EXIT_CODE_NO_INTERFACE_SPECIFIED;
}
}
if (ret != EXIT_CODE_SUCCESS)
- g_warning("Invalid interface: <%s>", interface);
+ ws_warning("Invalid interface: <%s>", interface);
else
extcap_config_debug(&inc);
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;
}
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;
}
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;
}
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;
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
}
} else {
- g_warning("bad raw stream");
+ ws_warning("bad raw stream");
closesocket(sock);
return EXIT_CODE_GENERIC;
}
&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;
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;
}
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);
}
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;
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;
}
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) {
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;
}
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;
}
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 &&
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;
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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);
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;
}
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;
}
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;
}
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;
}
nanosecond_timestamps = TRUE;
break;
default:
- g_warning("Received incorrect magic");
+ ws_warning("Received incorrect magic");
closesocket(sock);
return EXIT_CODE_GENERIC;
}
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;
}
*/
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);
}
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;
}
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;
}
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;
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;
}
}
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;
}
*/
#include "config.h"
+#define WS_LOG_DOMAIN "ciscodump"
#include <extcap/extcap-base.h>
#include <wsutil/interface.h>
#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>
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)
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)
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;
}
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;
}
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++;
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;
}
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);
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);
/* 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;
}
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;
}
*/
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);
}
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;
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;
}
}
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;
}
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;
}
*/
#include "config.h"
+#define WS_LOG_DOMAIN "dpauxmon"
#include "extcap-base.h"
#include <wsutil/filesystem.h>
#include <wsutil/netlink.h>
#include <wsutil/privileges.h>
+#include <wsutil/wslog.h>
#include <writecap/pcapio.h>
#include <netlink/netlink.h>
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;
}
*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;
}
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;
}
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);
}
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);
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;
}
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;
}
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;
}
}
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;
}
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);
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);
*/
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);
}
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;
}
}
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;
}
}
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);
*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. */
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;
}
/*
*/
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);
}
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;
}
}
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;
}
{
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;
/* 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;
}
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);
}
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);
}
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;
}
*/
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);
}
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;
}
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;
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;
}
}
/* 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;
}
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;
}
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);
*/
#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>
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);
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);
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);
} 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;
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;
}
/* 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;
}
}
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;
}
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;
}
}
/* 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;
}
}
if (err_info) {
- g_warning("%s", err_info);
+ ws_warning("%s", err_info);
}
g_free(err_info);
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;
}
*/
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);
}
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] == '+') {
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;
}
}
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;
}
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)
*/
#include "config.h"
+#define WS_LOG_DOMAIN "sshdump"
#include <extcap/extcap-base.h>
#include <extcap/ssh-base.h>
#include <wsutil/filesystem.h>
#include <wsutil/privileges.h>
#include <wsutil/please_report_bug.h>
+#include <wsutil/wslog.h>
#include <errno.h>
#include <string.h>
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;
}
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;
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;
}
/* 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 : "");
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;
/* 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;
}
}
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;
}
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 */
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;
}
*/
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);
}
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;
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;
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;
}
}
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;
}
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);
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;
}
*/
#include "config.h"
+#define WS_LOG_DOMAIN "udpdump"
#include <extcap/extcap-base.h>
#include <wsutil/privileges.h>
#include <wsutil/socket.h>
#include <wsutil/please_report_bug.h>
+#include <wsutil/wslog.h>
#include <cli_main.h>
unsigned inc = 0;
if (!interface) {
- g_warning("No interface specified.");
+ ws_warning("No interface specified.");
return EXIT_FAILURE;
}
*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
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;
}
static void exit_from_loop(int signo _U_)
{
- g_warning("Exiting from main loop");
+ ws_warning("Exiting from main loop");
run_loop = FALSE;
}
*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;
}
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;
}
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;
}
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) {
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;
*/
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);
}
case OPT_PORT:
if (!ws_strtou16(optarg, NULL, &port)) {
- g_warning("Invalid port: %s", optarg);
+ ws_warning("Invalid port: %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;
}
}
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;
}
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;
}
*/
#include <config.h>
+#define WS_LOG_DOMAIN LOG_DOMAIN_CAPTURE
#include <time.h>
#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>
* 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;
}
/* 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;
/* 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;
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;
/* 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);
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;
}
if (prov->frames_user_comments)
return (const char *)g_tree_lookup(prov->frames_user_comments, fd);
- /* g_warning? */
+ /* ws_warning? */
return NULL;
}
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));
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);
lmp_conv->ttp = ttp;
lmp_conv->dissector = dissector;
-/*g_message("%p\n", lmp_conv); */
+/*ws_message("%p\n", lmp_conv); */
}
#define __MATE_H_
#include "config.h"
+#define WS_LOG_DOMAIN "MATE"
#include <gmodule.h>
#include <errno.h>
#include <wsutil/report_message.h>
+#include <wsutil/wslog.h>
#include <epan/packet.h>
#include <epan/exceptions.h>
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 */
/* 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
*/
va_end( list );
if (! where) {
- g_message("%s", debug_buffer);
+ ws_message("%s", debug_buffer);
} else {
fputs(debug_buffer,where);
fputs("\n",where);
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);
(*ip)--;
}
} else {
- g_warning("unsubscribe: not subscribed");
+ ws_warning("unsubscribe: not subscribed");
}
}
/* ToDo: Rework the Summarizer code (future release) */
#include "config.h"
+#define WS_LOG_DOMAIN "transum"
#include <epan/proto.h>
#include <epan/packet.h>
#include "preferences.h"
#include "extractors.h"
#include "decoders.h"
+#include <wsutil/wslog.h>
void proto_register_transum(void);
void proto_reg_handoff_transum(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);
*/
#include <config.h>
+#define WS_LOG_DOMAIN "randpkt"
#include "randpkt_core.h"
#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"
}
/* Complain */
- g_error("randpkt: Type %s not known.\n", string);
+ ws_error("randpkt: Type %s not known.\n", string);
return -1;
}
*/
#include <config.h>
+#define WS_LOG_DOMAIN LOG_DOMAIN_MAIN
#include <glib.h>
#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
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;
}
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'! */
/* 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);*/
}
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;
}
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);
rec.rec_header.packet_header.caplen,
pseudo_header);
- /*g_warning("new packet");*/
+ /*ws_warning("new packet");*/
to_read--;
}
}
#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);
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)
#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);
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)
#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);
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)
*/
#include <config.h>
+#define WS_LOG_DOMAIN LOG_DOMAIN_MAIN
#include <stdio.h>
#include <string.h>
#include <wsutil/file_util.h>
#include <wsutil/filesystem.h>
#include <wsutil/report_message.h>
+#include <wsutil/wslog.h>
#include "ui/filter_files.h"
/* "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 */
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 */
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;
}
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 */
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;
}
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 */
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;
}
#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
#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
*/
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_WIRETAP
#include <string.h>
#include <stdlib.h>
#include <wsutil/plugins.h>
#endif
#include <wsutil/ws_assert.h>
+#include <wsutil/wslog.h>
#include "wtap-int.h"
#include "wtap_modules.h"
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;
}
guint i;
if (!name) {
- g_error("Missing open_info name to de-register");
+ ws_error("Missing open_info name to de-register");
return;
}
}
}
- 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
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;
}
* 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;
}
* 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;
}
/*
* 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;
}
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;
}
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:
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
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]);
/********************************************************************/
/* 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)) {
* 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;
* 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;
}
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 */
* 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 */
{
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;
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 */
#include "config.h"
#include "inet_addr.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_WSUTIL
#include <errno.h>
#include <string.h>
#endif
#include <wsutil/ws_assert.h>
+#include <wsutil/wslog.h>
/*
* We assume and require an inet_pton/inet_ntop that supports AF_INET
/* 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();
switch (errno) {
case EAFNOSUPPORT:
errmsg = "<<EAFNOSUPPORT>>";
- g_critical("ws_inet_ntop: EAFNOSUPPORT");
+ ws_critical("ws_inet_ntop: EAFNOSUPPORT");
break;
case ENOSPC:
errmsg = "<<ENOSPC>>";
*/
#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
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]);
}
*/
#include "config.h"
+#define WS_LOG_DOMAIN LOG_DOMAIN_WSUTIL
#include <time.h>
#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>
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();
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();
*/
#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 */
#include "privileges.h"
#include <wsutil/ws_assert.h>
+#include <wsutil/wslog.h>
#ifdef _WIN32
#include <windows.h>
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));
}
#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"
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);
}