Add ws_debug() and use it
Replace most instances of ws_debug_printf() except in epan/dissectors and dissector plugins. Some replacements use printf(), some use ws_debug(), and some were removed because they were dead or judged to be temporary.
This commit is contained in:
parent
de00cdd512
commit
9ba97d12d6
|
@ -823,6 +823,13 @@ else() # ! MSVC
|
|||
elseif(DISABLE_ASSERT)
|
||||
add_definitions(-DWS_DISABLE_ASSERT)
|
||||
endif()
|
||||
if(ENABLE_DEBUG)
|
||||
add_definitions(-DWS_DEBUG)
|
||||
elseif(CMAKE_VERSION VERSION_GREATER "3.11.99")
|
||||
add_compile_definitions(
|
||||
$<$<CONFIG:Debug>:WS_DEBUG>
|
||||
)
|
||||
endif()
|
||||
|
||||
set(WIRESHARK_LD_FLAGS
|
||||
# See also CheckCLinkerFlag.cmake
|
||||
|
|
|
@ -55,6 +55,7 @@ option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan) for debugging" OF
|
|||
option(ENABLE_FUZZER "Enable libFuzzer instrumentation for use with fuzzshark" OFF)
|
||||
option(ENABLE_CHECKHF_CONFLICT "Enable hf conflict check for debugging (start-up may be slower)" OFF)
|
||||
option(ENABLE_CCACHE "Speed up compiling and linking using ccache if possible" OFF)
|
||||
option(ENABLE_DEBUG "Enable debug output" OFF)
|
||||
|
||||
if(CMAKE_GENERATOR STREQUAL "Ninja")
|
||||
option(ENABLE_COMPILER_COLOR_DIAGNOSTICS "Always enable the compiler's color diagnostic output" ON)
|
||||
|
|
|
@ -16,10 +16,6 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#ifdef DEBUG
|
||||
#include <stdio.h>
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
#endif
|
||||
|
||||
#include <epan/packet.h>
|
||||
|
||||
|
@ -260,9 +256,6 @@ double asn1_get_real(const guint8 *real_ptr, gint len) {
|
|||
p++;
|
||||
}
|
||||
val = (double) S * N * pow(2, F) * pow(B, E);
|
||||
#ifdef DEBUG
|
||||
ws_debug_printf("S = %d, N = %lu, F = %u, B = %u, E = %d -> %f\n", S, N, F, B, E, val);
|
||||
#endif
|
||||
} else if (octet & 0x40) { /* SpecialRealValue */
|
||||
switch (octet & 0x3F) {
|
||||
case 0x00: val = HUGE_VAL; break;
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include <epan/dfilter/dfilter.h>
|
||||
#include <epan/column.h>
|
||||
#include <epan/packet.h>
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
|
||||
/* Given a format number (as defined in column-utils.h), returns its equivalent
|
||||
string */
|
||||
|
@ -182,10 +181,10 @@ column_dump_column_formats(void)
|
|||
gint fmt;
|
||||
|
||||
for (fmt = 0; fmt < NUM_COL_FMTS; fmt++) {
|
||||
ws_debug_printf("%s\t%s\n", col_format_to_string(fmt), col_format_desc(fmt));
|
||||
printf("%s\t%s\n", col_format_to_string(fmt), col_format_desc(fmt));
|
||||
}
|
||||
|
||||
ws_debug_printf("\nFor example, to print Wireshark's default columns with tshark:\n\n"
|
||||
printf("\nFor example, to print Wireshark's default columns with tshark:\n\n"
|
||||
#ifdef _WIN32
|
||||
"tshark.exe -o \"gui.column.format:"
|
||||
"\\\"No.\\\",\\\"%%m\\\","
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
#ifdef DUMP_DFILTER_MACRO
|
||||
#include <stdio.h>
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
|
@ -608,70 +607,70 @@ void dfilter_macro_get_uat(uat_t **dfmu_ptr_ptr) {
|
|||
|
||||
void dump_dfilter_macro_t(const dfilter_macro_t *m, const char *function, const char *file, int line)
|
||||
{
|
||||
ws_debug_printf("\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
|
||||
printf("\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
|
||||
|
||||
if(m == NULL) {
|
||||
ws_debug_printf(" dfilter_macro_t * == NULL! (via: %s(): %s:%d)\n", function, file, line);
|
||||
ws_debug_printf("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
|
||||
printf(" dfilter_macro_t * == NULL! (via: %s(): %s:%d)\n", function, file, line);
|
||||
printf("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ws_debug_printf("DUMP of dfilter_macro_t: %p (via: %s(): %s:%d)\n", m, function, file, line);
|
||||
printf("DUMP of dfilter_macro_t: %p (via: %s(): %s:%d)\n", m, function, file, line);
|
||||
|
||||
ws_debug_printf(" &dfilter_macro->name == %p\n", &m->name);
|
||||
printf(" &dfilter_macro->name == %p\n", &m->name);
|
||||
if(m->name == NULL) {
|
||||
ws_debug_printf(" ->name == NULL\n");
|
||||
printf(" ->name == NULL\n");
|
||||
} else {
|
||||
ws_debug_printf(" ->name == %p\n", m->name);
|
||||
ws_debug_printf(" ->name == <%s>\n", m->name);
|
||||
printf(" ->name == %p\n", m->name);
|
||||
printf(" ->name == <%s>\n", m->name);
|
||||
}
|
||||
|
||||
ws_debug_printf(" &dfilter_macro->text == %p\n", &m->text);
|
||||
printf(" &dfilter_macro->text == %p\n", &m->text);
|
||||
if(m->text == NULL) {
|
||||
ws_debug_printf(" ->text == NULL\n");
|
||||
printf(" ->text == NULL\n");
|
||||
} else {
|
||||
ws_debug_printf(" ->text == %p\n", m->text);
|
||||
ws_debug_printf(" ->text == <%s>\n", m->text);
|
||||
printf(" ->text == %p\n", m->text);
|
||||
printf(" ->text == <%s>\n", m->text);
|
||||
}
|
||||
|
||||
ws_debug_printf(" &dfilter_macro->usable == %p\n", &m->usable);
|
||||
ws_debug_printf(" ->usable == %u\n", m->usable);
|
||||
printf(" &dfilter_macro->usable == %p\n", &m->usable);
|
||||
printf(" ->usable == %u\n", m->usable);
|
||||
|
||||
ws_debug_printf(" &dfilter_macro->parts == %p\n", &m->parts);
|
||||
printf(" &dfilter_macro->parts == %p\n", &m->parts);
|
||||
|
||||
if(m->parts == NULL) {
|
||||
ws_debug_printf(" ->parts == NULL\n");
|
||||
printf(" ->parts == NULL\n");
|
||||
} else {
|
||||
int i = 0;
|
||||
|
||||
while (m->parts[i]) {
|
||||
ws_debug_printf(" ->parts[%d] == %p\n", i, m->parts[i]);
|
||||
ws_debug_printf(" ->parts[%d] == <%s>\n", i, m->parts[i]);
|
||||
printf(" ->parts[%d] == %p\n", i, m->parts[i]);
|
||||
printf(" ->parts[%d] == <%s>\n", i, m->parts[i]);
|
||||
i++;
|
||||
}
|
||||
ws_debug_printf(" ->parts[%d] == NULL\n", i);
|
||||
printf(" ->parts[%d] == NULL\n", i);
|
||||
}
|
||||
|
||||
ws_debug_printf(" &dfilter_macro->args_pos == %p\n", &m->args_pos);
|
||||
printf(" &dfilter_macro->args_pos == %p\n", &m->args_pos);
|
||||
if(m->args_pos == NULL) {
|
||||
ws_debug_printf(" ->args_pos == NULL\n");
|
||||
printf(" ->args_pos == NULL\n");
|
||||
} else {
|
||||
ws_debug_printf(" ->args_pos == %p\n", m->args_pos);
|
||||
/*ws_debug_printf(" ->args_pos == <%?>\n", m->args_pos);*/
|
||||
printf(" ->args_pos == %p\n", m->args_pos);
|
||||
/*printf(" ->args_pos == <%?>\n", m->args_pos);*/
|
||||
}
|
||||
|
||||
ws_debug_printf(" &dfilter_macro->argc == %p\n", &m->argc);
|
||||
ws_debug_printf(" ->argc == %d\n", m->argc);
|
||||
printf(" &dfilter_macro->argc == %p\n", &m->argc);
|
||||
printf(" ->argc == %d\n", m->argc);
|
||||
|
||||
ws_debug_printf(" &dfilter_macro->priv == %p\n", &m->priv);
|
||||
printf(" &dfilter_macro->priv == %p\n", &m->priv);
|
||||
if(m->priv == NULL) {
|
||||
ws_debug_printf(" ->priv == NULL\n");
|
||||
printf(" ->priv == NULL\n");
|
||||
} else {
|
||||
ws_debug_printf(" ->priv == %p\n", m->priv);
|
||||
ws_debug_printf(" ->priv == <%s>\n", (char *)m->priv);
|
||||
printf(" ->priv == %p\n", m->priv);
|
||||
printf(" ->priv == <%s>\n", (char *)m->priv);
|
||||
}
|
||||
|
||||
ws_debug_printf("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
|
||||
printf("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "dfilter.h"
|
||||
#include "dfilter-macro.h"
|
||||
#include "scanner_lex.h"
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
|
||||
|
||||
#define DFILTER_TOKEN_ID_OFFSET 1
|
||||
|
@ -444,12 +443,12 @@ dfilter_dump(dfilter_t *df)
|
|||
dfvm_dump(stdout, df);
|
||||
|
||||
if (df->deprecated && df->deprecated->len) {
|
||||
ws_debug_printf("\nDeprecated tokens: ");
|
||||
printf("\nDeprecated tokens: ");
|
||||
for (i = 0; i < df->deprecated->len; i++) {
|
||||
ws_debug_printf("%s\"%s\"", sep, (char *) g_ptr_array_index(df->deprecated, i));
|
||||
printf("%s\"%s\"", sep, (char *) g_ptr_array_index(df->deprecated, i));
|
||||
sep = ", ";
|
||||
}
|
||||
ws_debug_printf("\n");
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,10 +21,6 @@
|
|||
#include <epan/exceptions.h>
|
||||
#include <epan/packet.h>
|
||||
|
||||
#ifdef DEBUG_dfilter
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
#endif
|
||||
|
||||
#include <ftypes/ftypes-int.h>
|
||||
|
||||
/* Enable debug logging by defining AM_CFLAGS
|
||||
|
@ -33,8 +29,8 @@
|
|||
|
||||
#ifdef DEBUG_dfilter
|
||||
#define DebugLog(x) \
|
||||
ws_debug_printf("%s:%u: ", __FILE__, (unsigned int)__LINE__); \
|
||||
ws_debug_printf x; \
|
||||
printf("%s:%u: ", __FILE__, (unsigned int)__LINE__); \
|
||||
printf x; \
|
||||
fflush(stdout)
|
||||
#else
|
||||
#define DebugLog(x) ;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <epan/expert.h>
|
||||
#include <epan/proto_data.h>
|
||||
#if defined(DEBUG_BEEP_HASH)
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
#include <epan/ws_printf.h>
|
||||
#endif
|
||||
|
||||
#define TCP_PORT_BEEP 10288 /* Don't think this is IANA registered */
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
#include <epan/decode_as.h>
|
||||
#include <wiretap/wtap.h>
|
||||
#ifdef DEBUG_BER
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
#include <epan/ws_printf.h>
|
||||
#endif
|
||||
|
||||
#include "packet-ber.h"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "packet-epl.h"
|
||||
#include "ws_attributes.h"
|
||||
|
||||
#include <wsutil/ws_printf.h>
|
||||
#include <epan/ws_printf.h>
|
||||
#include <epan/range.h>
|
||||
|
||||
#include <string.h>
|
||||
|
|
|
@ -282,7 +282,7 @@
|
|||
#include <wsutil/str_util.h>
|
||||
#include <wsutil/pint.h>
|
||||
#include <wsutil/report_message.h>
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
#include <epan/ws_printf.h>
|
||||
|
||||
#include "packet-giop.h"
|
||||
#include "packet-ziop.h"
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include <wsutil/filesystem.h>
|
||||
#include <wsutil/file_util.h>
|
||||
#include <wsutil/pint.h>
|
||||
#include <wsutil/ws_printf.h>
|
||||
#include <epan/ws_printf.h>
|
||||
#include <wsutil/report_message.h>
|
||||
|
||||
#include "protobuf-helper.h"
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <epan/expert.h>
|
||||
#include <epan/addr_resolv.h>
|
||||
#include <wsutil/wsgcrypt.h>
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
#include <epan/ws_printf.h>
|
||||
|
||||
#include "packet-tcp.h"
|
||||
#include "packet-tacacs.h"
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
#include <wsutil/strtoi.h>
|
||||
#include <wsutil/rsa.h>
|
||||
#include <errno.h>
|
||||
#include <wsutil/ws_printf.h>
|
||||
#include <epan/ws_printf.h>
|
||||
#include <epan/ptvcursor.h>
|
||||
|
||||
void proto_register_tibia(void);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <epan/nlpid.h>
|
||||
#include <epan/etypes.h>
|
||||
#include <stdio.h>
|
||||
#include <wsutil/ws_printf.h>
|
||||
#include <epan/ws_printf.h>
|
||||
|
||||
void proto_register_vpp(void);
|
||||
void proto_reg_handoff_vpp(void);
|
||||
|
|
|
@ -35,9 +35,6 @@
|
|||
#include <glib.h>
|
||||
|
||||
#include "except.h"
|
||||
#ifdef KAZLIB_TEST_MAIN
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
|
@ -392,13 +389,13 @@ void except_free(void *ptr)
|
|||
|
||||
static void cleanup(void *arg)
|
||||
{
|
||||
ws_debug_printf("cleanup(\"%s\") called\n", (char *) arg);
|
||||
printf("cleanup(\"%s\") called\n", (char *) arg);
|
||||
}
|
||||
|
||||
static void bottom_level(void)
|
||||
{
|
||||
char buf[256];
|
||||
ws_debug_printf("throw exception? "); fflush(stdout);
|
||||
printf("throw exception? "); fflush(stdout);
|
||||
fgets(buf, sizeof buf, stdin);
|
||||
|
||||
if (buf[0] >= 0 && (buf[0] == 'Y' || buf[0] == 'y'))
|
||||
|
@ -433,10 +430,10 @@ int main(int argc, char **argv)
|
|||
/* inner catch */
|
||||
msg = except_message(ex);
|
||||
if (msg == NULL) {
|
||||
ws_debug_printf("caught exception (inner): s=%lu, c=%lu\n",
|
||||
printf("caught exception (inner): s=%lu, c=%lu\n",
|
||||
except_group(ex), except_code(ex));
|
||||
} else {
|
||||
ws_debug_printf("caught exception (inner): \"%s\", s=%lu, c=%lu\n",
|
||||
printf("caught exception (inner): \"%s\", s=%lu, c=%lu\n",
|
||||
msg, except_group(ex), except_code(ex));
|
||||
}
|
||||
except_rethrow(ex);
|
||||
|
@ -446,10 +443,10 @@ int main(int argc, char **argv)
|
|||
/* outer catch */
|
||||
msg = except_message(ex);
|
||||
if (msg == NULL) {
|
||||
ws_debug_printf("caught exception (outer): s=%lu, c=%lu\n",
|
||||
printf("caught exception (outer): s=%lu, c=%lu\n",
|
||||
except_group(ex), except_code(ex));
|
||||
} else {
|
||||
ws_debug_printf("caught exception (outer): \"%s\", s=%lu, c=%lu\n",
|
||||
printf("caught exception (outer): \"%s\", s=%lu, c=%lu\n",
|
||||
except_message(ex), except_group(ex), except_code(ex));
|
||||
}
|
||||
}
|
||||
|
@ -459,7 +456,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* KAZLIB_TEST_MAIN */
|
||||
|
||||
/*
|
||||
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "packet.h"
|
||||
#include "wsutil/filesystem.h"
|
||||
#include "dissectors/packet-ber.h"
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
|
||||
#ifdef HAVE_LIBSMI
|
||||
#include <smi.h>
|
||||
|
@ -36,7 +35,7 @@ static gboolean load_smi_modules = FALSE;
|
|||
static gboolean suppress_smi_errors = FALSE;
|
||||
#endif
|
||||
|
||||
#define D(level,args) do if (debuglevel >= level) { ws_debug_printf args; ws_debug_printf("\n"); fflush(stdout); } while(0)
|
||||
#define D(level,args) do if (debuglevel >= level) { printf args; printf("\n"); fflush(stdout); } while(0)
|
||||
|
||||
#include "oids.h"
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include <epan/range.h>
|
||||
|
||||
#include <wsutil/str_util.h>
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
|
||||
static gint proto_malformed = -1;
|
||||
static dissector_handle_t frame_handle = NULL;
|
||||
|
@ -2975,7 +2974,7 @@ display_heur_dissector_table_entries(const char *table_name,
|
|||
heur_dtbl_entry_t *hdtbl_entry, gpointer user_data _U_)
|
||||
{
|
||||
if (hdtbl_entry->protocol != NULL) {
|
||||
ws_debug_printf("%s\t%s\t%c\n",
|
||||
printf("%s\t%s\t%c\n",
|
||||
table_name,
|
||||
proto_get_protocol_filter_name(proto_get_id(hdtbl_entry->protocol)),
|
||||
(proto_is_protocol_enabled(hdtbl_entry->protocol) && hdtbl_entry->enabled) ? 'T' : 'F');
|
||||
|
@ -3433,7 +3432,7 @@ dissector_dump_decodes_display(const gchar *table_name,
|
|||
if (proto_id != -1) {
|
||||
decode_as = proto_get_protocol_filter_name(proto_id);
|
||||
g_assert(decode_as != NULL);
|
||||
ws_debug_printf("%s\t%u\t%s\n", table_name, selector, decode_as);
|
||||
printf("%s\t%u\t%s\n", table_name, selector, decode_as);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -3467,7 +3466,7 @@ dissector_dump_dissector_tables_display (gpointer key, gpointer user_data _U_)
|
|||
dissector_table_t table;
|
||||
|
||||
table = (dissector_table_t)g_hash_table_lookup(dissector_tables, key);
|
||||
ws_debug_printf("%s\t%s\t%s", table_name, table->ui_name, ftype_name(table->type));
|
||||
printf("%s\t%s\t%s", table_name, table->ui_name, ftype_name(table->type));
|
||||
switch (table->type) {
|
||||
|
||||
case FT_UINT8:
|
||||
|
@ -3477,27 +3476,27 @@ dissector_dump_dissector_tables_display (gpointer key, gpointer user_data _U_)
|
|||
switch(table->param) {
|
||||
|
||||
case BASE_NONE:
|
||||
ws_debug_printf("\tBASE_NONE");
|
||||
printf("\tBASE_NONE");
|
||||
break;
|
||||
|
||||
case BASE_DEC:
|
||||
ws_debug_printf("\tBASE_DEC");
|
||||
printf("\tBASE_DEC");
|
||||
break;
|
||||
|
||||
case BASE_HEX:
|
||||
ws_debug_printf("\tBASE_HEX");
|
||||
printf("\tBASE_HEX");
|
||||
break;
|
||||
|
||||
case BASE_DEC_HEX:
|
||||
ws_debug_printf("\tBASE_DEC_HEX");
|
||||
printf("\tBASE_DEC_HEX");
|
||||
break;
|
||||
|
||||
case BASE_HEX_DEC:
|
||||
ws_debug_printf("\tBASE_HEX_DEC");
|
||||
printf("\tBASE_HEX_DEC");
|
||||
break;
|
||||
|
||||
default:
|
||||
ws_debug_printf("\t%d", table->param);
|
||||
printf("\t%d", table->param);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -3506,13 +3505,13 @@ dissector_dump_dissector_tables_display (gpointer key, gpointer user_data _U_)
|
|||
break;
|
||||
}
|
||||
if (table->protocol != NULL) {
|
||||
ws_debug_printf("\t%s",
|
||||
printf("\t%s",
|
||||
proto_get_protocol_short_name(table->protocol));
|
||||
} else
|
||||
ws_debug_printf("\t(no protocol)");
|
||||
ws_debug_printf("\tDecode As %ssupported",
|
||||
printf("\t(no protocol)");
|
||||
printf("\tDecode As %ssupported",
|
||||
table->supports_decode_as ? "" : "not ");
|
||||
ws_debug_printf("\n");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static gint
|
||||
|
|
43
epan/proto.c
43
epan/proto.c
|
@ -45,7 +45,6 @@
|
|||
#include "in_cksum.h"
|
||||
#include "register-int.h"
|
||||
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
#include <wsutil/crash_info.h>
|
||||
#include <wsutil/epochs.h>
|
||||
|
||||
|
@ -1418,7 +1417,7 @@ proto_tree_add_debug_text(proto_tree *tree, const char *format, ...)
|
|||
va_start(ap, format);
|
||||
vprintf(format, ap);
|
||||
va_end(ap);
|
||||
ws_debug_printf("\n");
|
||||
printf("\n");
|
||||
|
||||
return pi;
|
||||
}
|
||||
|
@ -10636,7 +10635,7 @@ proto_registrar_dump_protocols(void)
|
|||
i = proto_get_first_protocol(&cookie);
|
||||
while (i != -1) {
|
||||
protocol = find_protocol_by_id(i);
|
||||
ws_debug_printf("%s\t%s\t%s\n", protocol->name, protocol->short_name,
|
||||
printf("%s\t%s\t%s\n", protocol->name, protocol->short_name,
|
||||
protocol->filter_name);
|
||||
i = proto_get_next_protocol(&cookie);
|
||||
}
|
||||
|
@ -10785,7 +10784,7 @@ proto_registrar_dump_values(void)
|
|||
continue;
|
||||
}
|
||||
try_val64_to_str_ext(0, vse_p); /* "prime" the extended val64_string */
|
||||
ws_debug_printf("E\t%s\t%u\t%s\t%s\n",
|
||||
printf("E\t%s\t%u\t%s\t%s\n",
|
||||
hfinfo->abbrev,
|
||||
VAL64_STRING_EXT_VS_NUM_ENTRIES(vse_p),
|
||||
VAL64_STRING_EXT_VS_NAME(vse_p),
|
||||
|
@ -10797,7 +10796,7 @@ proto_registrar_dump_values(void)
|
|||
continue;
|
||||
}
|
||||
try_val_to_str_ext(0, vse_p); /* "prime" the extended value_string */
|
||||
ws_debug_printf("E\t%s\t%u\t%s\t%s\n",
|
||||
printf("E\t%s\t%u\t%s\t%s\n",
|
||||
hfinfo->abbrev,
|
||||
VALUE_STRING_EXT_VS_NUM_ENTRIES(vse_p),
|
||||
VALUE_STRING_EXT_VS_NAME(vse_p),
|
||||
|
@ -10809,19 +10808,19 @@ proto_registrar_dump_values(void)
|
|||
/* Print in the proper base */
|
||||
if (hfinfo->type == FT_CHAR) {
|
||||
if (g_ascii_isprint(vals[vi].value)) {
|
||||
ws_debug_printf("V\t%s\t'%c'\t%s\n",
|
||||
printf("V\t%s\t'%c'\t%s\n",
|
||||
hfinfo->abbrev,
|
||||
vals[vi].value,
|
||||
vals[vi].strptr);
|
||||
} else {
|
||||
if (hfinfo->display == BASE_HEX) {
|
||||
ws_debug_printf("V\t%s\t'\\x%02x'\t%s\n",
|
||||
printf("V\t%s\t'\\x%02x'\t%s\n",
|
||||
hfinfo->abbrev,
|
||||
vals[vi].value,
|
||||
vals[vi].strptr);
|
||||
}
|
||||
else {
|
||||
ws_debug_printf("V\t%s\t'\\%03o'\t%s\n",
|
||||
printf("V\t%s\t'\\%03o'\t%s\n",
|
||||
hfinfo->abbrev,
|
||||
vals[vi].value,
|
||||
vals[vi].strptr);
|
||||
|
@ -10829,13 +10828,13 @@ proto_registrar_dump_values(void)
|
|||
}
|
||||
} else {
|
||||
if (hfinfo->display == BASE_HEX) {
|
||||
ws_debug_printf("V\t%s\t0x%x\t%s\n",
|
||||
printf("V\t%s\t0x%x\t%s\n",
|
||||
hfinfo->abbrev,
|
||||
vals[vi].value,
|
||||
vals[vi].strptr);
|
||||
}
|
||||
else {
|
||||
ws_debug_printf("V\t%s\t%u\t%s\n",
|
||||
printf("V\t%s\t%u\t%s\n",
|
||||
hfinfo->abbrev,
|
||||
vals[vi].value,
|
||||
vals[vi].strptr);
|
||||
|
@ -10847,7 +10846,7 @@ proto_registrar_dump_values(void)
|
|||
else if (vals64) {
|
||||
vi = 0;
|
||||
while (vals64[vi].strptr) {
|
||||
ws_debug_printf("V64\t%s\t%" G_GINT64_MODIFIER "u\t%s\n",
|
||||
printf("V64\t%s\t%" G_GINT64_MODIFIER "u\t%s\n",
|
||||
hfinfo->abbrev,
|
||||
vals64[vi].value,
|
||||
vals64[vi].strptr);
|
||||
|
@ -10861,14 +10860,14 @@ proto_registrar_dump_values(void)
|
|||
while (range[vi].strptr) {
|
||||
/* Print in the proper base */
|
||||
if (FIELD_DISPLAY(hfinfo->display) == BASE_HEX) {
|
||||
ws_debug_printf("R\t%s\t0x%x\t0x%x\t%s\n",
|
||||
printf("R\t%s\t0x%x\t0x%x\t%s\n",
|
||||
hfinfo->abbrev,
|
||||
range[vi].value_min,
|
||||
range[vi].value_max,
|
||||
range[vi].strptr);
|
||||
}
|
||||
else {
|
||||
ws_debug_printf("R\t%s\t%u\t%u\t%s\n",
|
||||
printf("R\t%s\t%u\t%u\t%s\n",
|
||||
hfinfo->abbrev,
|
||||
range[vi].value_min,
|
||||
range[vi].value_max,
|
||||
|
@ -10880,12 +10879,12 @@ proto_registrar_dump_values(void)
|
|||
|
||||
/* Print true/false strings? */
|
||||
else if (tfs) {
|
||||
ws_debug_printf("T\t%s\t%s\t%s\n", hfinfo->abbrev,
|
||||
printf("T\t%s\t%s\t%s\n", hfinfo->abbrev,
|
||||
tfs->true_string, tfs->false_string);
|
||||
}
|
||||
/* Print unit strings? */
|
||||
else if (units) {
|
||||
ws_debug_printf("U\t%s\t%s\t%s\n", hfinfo->abbrev,
|
||||
printf("U\t%s\t%s\t%s\n", hfinfo->abbrev,
|
||||
units->singular, units->plural ? units->plural : "(no plural)");
|
||||
}
|
||||
}
|
||||
|
@ -10922,21 +10921,21 @@ proto_registrar_dump_fieldcount(void)
|
|||
same_name_count++;
|
||||
}
|
||||
|
||||
ws_debug_printf("There are %u header fields registered, of which:\n"
|
||||
printf("There are %u header fields registered, of which:\n"
|
||||
"\t%u are deregistered\n"
|
||||
"\t%u are protocols\n"
|
||||
"\t%u have the same name as another field\n\n",
|
||||
gpa_hfinfo.len, deregistered_count, protocol_count,
|
||||
same_name_count);
|
||||
|
||||
ws_debug_printf("%d fields were pre-allocated.\n%s", PROTO_PRE_ALLOC_HF_FIELDS_MEM,
|
||||
printf("%d fields were pre-allocated.\n%s", PROTO_PRE_ALLOC_HF_FIELDS_MEM,
|
||||
(gpa_hfinfo.allocated_len > PROTO_PRE_ALLOC_HF_FIELDS_MEM) ?
|
||||
"* * Please increase PROTO_PRE_ALLOC_HF_FIELDS_MEM (in epan/proto.c)! * *\n\n" :
|
||||
"\n");
|
||||
|
||||
ws_debug_printf("The header field table consumes %u KiB of memory.\n",
|
||||
printf("The header field table consumes %u KiB of memory.\n",
|
||||
(unsigned int)(gpa_hfinfo.allocated_len * sizeof(header_field_info *) / 1024));
|
||||
ws_debug_printf("The fields themselves consume %u KiB of memory.\n",
|
||||
printf("The fields themselves consume %u KiB of memory.\n",
|
||||
(unsigned int)(gpa_hfinfo.len * sizeof(header_field_info) / 1024));
|
||||
|
||||
return (gpa_hfinfo.allocated_len > PROTO_PRE_ALLOC_HF_FIELDS_MEM);
|
||||
|
@ -11194,7 +11193,7 @@ proto_registrar_dump_fields(void)
|
|||
|
||||
/* format for protocols */
|
||||
if (proto_registrar_is_protocol(i)) {
|
||||
ws_debug_printf("P\t%s\t%s\n", hfinfo->name, hfinfo->abbrev);
|
||||
printf("P\t%s\t%s\n", hfinfo->name, hfinfo->abbrev);
|
||||
}
|
||||
/* format for header fields */
|
||||
else {
|
||||
|
@ -11267,7 +11266,7 @@ proto_registrar_dump_fields(void)
|
|||
else if (strlen(blurb) == 0)
|
||||
blurb = "\"\"";
|
||||
|
||||
ws_debug_printf("F\t%s\t%s\t%s\t%s\t%s\t0x%" G_GINT64_MODIFIER "x\t%s\n",
|
||||
printf("F\t%s\t%s\t%s\t%s\t%s\t0x%" G_GINT64_MODIFIER "x\t%s\n",
|
||||
hfinfo->name, hfinfo->abbrev, enum_name,
|
||||
parent_hfinfo->abbrev, base_name,
|
||||
hfinfo->bitmask, blurb);
|
||||
|
@ -11290,7 +11289,7 @@ proto_registrar_dump_ftypes(void)
|
|||
int fte;
|
||||
|
||||
for (fte = 0; fte < FT_NUM_TYPES; fte++) {
|
||||
ws_debug_printf("%s\t%s\n", ftype_name((ftenum_t)fte), ftype_pretty_name((ftenum_t)fte));
|
||||
printf("%s\t%s\n", ftype_name((ftenum_t)fte), ftype_pretty_name((ftenum_t)fte));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,9 +16,14 @@
|
|||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define G_LOG_DOMAIN "epan"
|
||||
|
||||
#include <stdio.h>
|
||||
#include "reedsolomon.h"
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
#include <wsutil/wslog.h>
|
||||
|
||||
#ifdef CCSDS
|
||||
/* CCSDS field generator polynomial: 1+x+x^2+x^7+x^8 */
|
||||
|
@ -451,7 +456,7 @@ eras_dec_rs(dtype data[], int eras_pos[], int no_eras)
|
|||
syn_error = 0;
|
||||
for(i=1;i<=NN-KK;i++){
|
||||
syn_error |= s[i];
|
||||
/*ws_debug_printf("syndrome %d = %x\n",i,s[i]);*/
|
||||
/*ws_debug("syndrome %d = %x\n",i,s[i]);*/
|
||||
s[i] = Index_of[s[i]];
|
||||
}
|
||||
|
||||
|
@ -499,15 +504,15 @@ eras_dec_rs(dtype data[], int eras_pos[], int no_eras)
|
|||
count++;
|
||||
}
|
||||
if (count != no_eras) {
|
||||
ws_debug_printf("\n lambda(x) is WRONG\n");
|
||||
ws_debug("\n lambda(x) is WRONG\n");
|
||||
count = -1;
|
||||
goto finish;
|
||||
}
|
||||
#if DEBUG >= 2
|
||||
ws_debug_printf("\n Erasure positions as determined by roots of Eras Loc Poly:\n");
|
||||
printf("\n Erasure positions as determined by roots of Eras Loc Poly:\n");
|
||||
for (i = 0; i < count; i++)
|
||||
ws_debug_printf("%d ", loc[i]);
|
||||
ws_debug_printf("\n");
|
||||
printf("%d ", loc[i]);
|
||||
printf("\n");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -637,7 +642,7 @@ eras_dec_rs(dtype data[], int eras_pos[], int no_eras)
|
|||
}
|
||||
if (den == 0) {
|
||||
#if DEBUG >= 1
|
||||
ws_debug_printf("\n ERROR: denominator = 0\n");
|
||||
ws_debug("\n ERROR: denominator = 0\n");
|
||||
#endif
|
||||
/* Convert to dual- basis */
|
||||
count = -1;
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#define G_LOG_DOMAIN "epan"
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
@ -22,9 +24,7 @@
|
|||
#endif
|
||||
|
||||
#include "tvbuff.h"
|
||||
#ifdef TVB_Z_DEBUG
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
#endif
|
||||
#include <wsutil/wslog.h>
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
/*
|
||||
|
@ -34,8 +34,6 @@
|
|||
*/
|
||||
#define TVB_Z_MIN_BUFSIZ 32768
|
||||
#define TVB_Z_MAX_BUFSIZ 1048576 * 10
|
||||
/* #define TVB_Z_DEBUG 1 */
|
||||
#undef TVB_Z_DEBUG
|
||||
|
||||
tvbuff_t *
|
||||
tvb_uncompress(tvbuff_t *tvb, const int offset, int comprlen)
|
||||
|
@ -51,7 +49,7 @@ tvb_uncompress(tvbuff_t *tvb, const int offset, int comprlen)
|
|||
gint wbits = MAX_WBITS;
|
||||
guint8 *next;
|
||||
guint bufsiz;
|
||||
#ifdef TVB_Z_DEBUG
|
||||
#ifdef WS_DEBUG
|
||||
guint inflate_passes = 0;
|
||||
guint bytes_in = tvb_captured_length_remaining(tvb, offset);
|
||||
#endif
|
||||
|
@ -72,9 +70,7 @@ tvb_uncompress(tvbuff_t *tvb, const int offset, int comprlen)
|
|||
bufsiz = tvb_captured_length_remaining(tvb, offset) * 2;
|
||||
bufsiz = CLAMP(bufsiz, TVB_Z_MIN_BUFSIZ, TVB_Z_MAX_BUFSIZ);
|
||||
|
||||
#ifdef TVB_Z_DEBUG
|
||||
ws_debug_printf("bufsiz: %u bytes\n", bufsiz);
|
||||
#endif
|
||||
ws_debug("bufsiz: %u bytes\n", bufsiz);
|
||||
|
||||
next = compr;
|
||||
|
||||
|
@ -106,7 +102,7 @@ tvb_uncompress(tvbuff_t *tvb, const int offset, int comprlen)
|
|||
if (err == Z_OK || err == Z_STREAM_END) {
|
||||
guint bytes_pass = bufsiz - strm->avail_out;
|
||||
|
||||
#ifdef TVB_Z_DEBUG
|
||||
#ifdef WS_DEBUG
|
||||
++inflate_passes;
|
||||
#endif
|
||||
|
||||
|
@ -305,10 +301,8 @@ tvb_uncompress(tvbuff_t *tvb, const int offset, int comprlen)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef TVB_Z_DEBUG
|
||||
ws_debug_printf("inflate() total passes: %u\n", inflate_passes);
|
||||
ws_debug_printf("bytes in: %u\nbytes out: %u\n\n", bytes_in, bytes_out);
|
||||
#endif
|
||||
ws_debug("inflate() total passes: %u\n", inflate_passes);
|
||||
ws_debug("bytes in: %u\nbytes out: %u\n\n", bytes_in, bytes_out);
|
||||
|
||||
if (uncompr != NULL) {
|
||||
uncompr_tvb = tvb_new_real_data(uncompr, bytes_out, bytes_out);
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "wmem_interval_tree.h"
|
||||
#include "wmem_user_cb.h"
|
||||
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
#include <wsutil/ws_assert.h>
|
||||
|
||||
|
||||
|
@ -33,7 +32,7 @@ print_range(const void *value)
|
|||
if(!value) {
|
||||
return;
|
||||
}
|
||||
ws_debug_printf("Range: low=%" G_GUINT64_FORMAT " high=%" G_GUINT64_FORMAT " max_edge=%" G_GUINT64_FORMAT "\n", range->low, range->high, range->max_edge);
|
||||
printf("Range: low=%" G_GUINT64_FORMAT " high=%" G_GUINT64_FORMAT " max_edge=%" G_GUINT64_FORMAT "\n", range->low, range->high, range->max_edge);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "wmem_tree-int.h"
|
||||
#include "wmem_user_cb.h"
|
||||
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
#include <wsutil/ws_assert.h>
|
||||
|
||||
|
||||
|
@ -768,7 +767,7 @@ static void
|
|||
wmem_print_indent(guint32 level) {
|
||||
guint32 i;
|
||||
for (i=0; i<level; i++) {
|
||||
ws_debug_printf(" ");
|
||||
printf(" ");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -781,7 +780,7 @@ wmem_tree_print_nodes(const char *prefix, wmem_tree_node_t *node, guint32 level,
|
|||
|
||||
wmem_print_indent(level);
|
||||
|
||||
ws_debug_printf("%sNODE:%p parent:%p left:%p right:%p colour:%s key:%p %s:%p\n",
|
||||
printf("%sNODE:%p parent:%p left:%p right:%p colour:%s key:%p %s:%p\n",
|
||||
prefix,
|
||||
(void *)node, (void *)node->parent,
|
||||
(void *)node->left, (void *)node->right,
|
||||
|
@ -790,12 +789,12 @@ wmem_tree_print_nodes(const char *prefix, wmem_tree_node_t *node, guint32 level,
|
|||
if (key_printer) {
|
||||
wmem_print_indent(level);
|
||||
key_printer(node->key);
|
||||
ws_debug_printf("\n");
|
||||
printf("\n");
|
||||
}
|
||||
if (data_printer && !node->is_subtree) {
|
||||
wmem_print_indent(level);
|
||||
data_printer(node->data);
|
||||
ws_debug_printf("\n");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
if (node->left)
|
||||
|
@ -816,7 +815,7 @@ wmem_print_subtree(wmem_tree_t *tree, guint32 level, wmem_printer_func key_print
|
|||
|
||||
wmem_print_indent(level);
|
||||
|
||||
ws_debug_printf("WMEM tree:%p root:%p\n", (void *)tree, (void *)tree->root);
|
||||
printf("WMEM tree:%p root:%p\n", (void *)tree, (void *)tree->root);
|
||||
if (tree->root) {
|
||||
wmem_tree_print_nodes("Root-", tree->root, level, key_printer, data_printer);
|
||||
}
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
#include "init_wslua.h"
|
||||
#include <epan/dissectors/packet-frame.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <epan/expert.h>
|
||||
#include <epan/ex-opt.h>
|
||||
#include <wsutil/privileges.h>
|
||||
#include <wsutil/file_util.h>
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
|
||||
/* linked list of Lua plugins */
|
||||
typedef struct _wslua_plugin {
|
||||
|
@ -775,7 +775,7 @@ print_wslua_plugin_description(const char *name, const char *version,
|
|||
const char *description, const char *filename,
|
||||
void *user_data _U_)
|
||||
{
|
||||
ws_debug_printf("%s\t%s\t%s\t%s\n", name, version, description, filename);
|
||||
printf("%s\t%s\t%s\t%s\n", name, version, description, filename);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "config.h"
|
||||
#include "wslua.h"
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
#include <stdio.h>
|
||||
|
||||
/* Several implementation details (__getters, __setters, __methods) were exposed
|
||||
* to Lua code. These are normally not used by dissectors, just for debugging
|
||||
|
@ -177,9 +177,9 @@ WSLUA_API void wslua_print_stack(char* s, lua_State* L) {
|
|||
int i;
|
||||
|
||||
for (i=1;i<=lua_gettop(L);i++) {
|
||||
ws_debug_printf("%s-%i: %s\n",s,i,lua_typename (L,lua_type(L, i)));
|
||||
printf("%s-%i: %s\n",s,i,lua_typename (L,lua_type(L, i)));
|
||||
}
|
||||
ws_debug_printf("\n");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
/* C-code function equivalent of the typeof() function we created in Lua.
|
||||
|
|
3
extcap.c
3
extcap.c
|
@ -40,7 +40,6 @@
|
|||
#include <wsutil/file_util.h>
|
||||
#include <wsutil/filesystem.h>
|
||||
#include <wsutil/ws_pipe.h>
|
||||
#include <wsutil/ws_printf.h>
|
||||
#include <wsutil/tempfile.h>
|
||||
|
||||
#include "capture_opts.h"
|
||||
|
@ -217,7 +216,7 @@ print_extcap_description(const char *basename, const char *version,
|
|||
const char *description, const char *filename,
|
||||
void *user_data _U_)
|
||||
{
|
||||
ws_debug_printf("%-16s\t%s\t%s\t%s\n", basename, version, description, filename);
|
||||
printf("%-16s\t%s\t%s\t%s\n", basename, version, description, filename);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <epan/dissectors/packet-dcerpc.h>
|
||||
#include <epan/dissectors/packet-dcom.h>
|
||||
#include "packet-dcom-cba-acco.h"
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
#include <epan/ws_printf.h>
|
||||
|
||||
void proto_register_dcom_cba_acco(void);
|
||||
void proto_reg_handoff_dcom_cba_acco(void);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <epan/proto.h>
|
||||
#include <epan/packet.h>
|
||||
#include <epan/prefs.h>
|
||||
#include <wsutil/ws_printf.h>
|
||||
#include <epan/ws_printf.h>
|
||||
#include "packet-transum.h"
|
||||
#include "preferences.h"
|
||||
#include "extractors.h"
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <epan/eap.h>
|
||||
#include <wsutil/filesystem.h>
|
||||
#include <wsutil/report_message.h>
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
#include <epan/ws_printf.h>
|
||||
|
||||
#include "wimaxasncp_dict.h"
|
||||
|
||||
|
|
63
tshark.c
63
tshark.c
|
@ -12,6 +12,8 @@
|
|||
|
||||
#include <config.h>
|
||||
|
||||
#define G_LOG_DOMAIN "tshark"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -56,6 +58,7 @@
|
|||
#include <wsutil/privileges.h>
|
||||
#include <wsutil/report_message.h>
|
||||
#include <wsutil/please_report_bug.h>
|
||||
#include <wsutil/wslog.h>
|
||||
#include <cli_main.h>
|
||||
#include <version_info.h>
|
||||
#include <wiretap/wtap_opttypes.h>
|
||||
|
@ -139,12 +142,6 @@
|
|||
#define LONGOPT_NO_DUPLICATE_KEYS LONGOPT_BASE_APPLICATION+3
|
||||
#define LONGOPT_ELASTIC_MAPPING_FILTER LONGOPT_BASE_APPLICATION+4
|
||||
|
||||
#if 0
|
||||
#define tshark_debug(...) g_warning(__VA_ARGS__)
|
||||
#else
|
||||
#define tshark_debug(...)
|
||||
#endif
|
||||
|
||||
capture_file cfile;
|
||||
|
||||
static guint32 cum_bytes;
|
||||
|
@ -794,7 +791,7 @@ main(int argc, char *argv[])
|
|||
setlocale(LC_ALL, "");
|
||||
#endif
|
||||
|
||||
tshark_debug("tshark started with %d args", argc);
|
||||
ws_debug("tshark started with %d args", argc);
|
||||
|
||||
cmdarg_err_init(tshark_cmdarg_err, tshark_cmdarg_err_cont);
|
||||
|
||||
|
@ -1068,7 +1065,7 @@ main(int argc, char *argv[])
|
|||
goto clean_exit;
|
||||
}
|
||||
|
||||
tshark_debug("tshark reading settings");
|
||||
ws_debug("tshark reading settings");
|
||||
|
||||
/* Load libwireshark settings from the current profile. */
|
||||
prefs_p = epan_load_settings();
|
||||
|
@ -1940,7 +1937,7 @@ main(int argc, char *argv[])
|
|||
#endif
|
||||
|
||||
if (rfilter != NULL) {
|
||||
tshark_debug("Compiling read filter: '%s'", rfilter);
|
||||
ws_debug("Compiling read filter: '%s'", rfilter);
|
||||
if (!dfilter_compile(rfilter, &rfcode, &err_msg)) {
|
||||
cmdarg_err("%s", err_msg);
|
||||
g_free(err_msg);
|
||||
|
@ -1967,7 +1964,7 @@ main(int argc, char *argv[])
|
|||
cfile.rfcode = rfcode;
|
||||
|
||||
if (dfilter != NULL) {
|
||||
tshark_debug("Compiling display filter: '%s'", dfilter);
|
||||
ws_debug("Compiling display filter: '%s'", dfilter);
|
||||
if (!dfilter_compile(dfilter, &dfcode, &err_msg)) {
|
||||
cmdarg_err("%s", err_msg);
|
||||
g_free(err_msg);
|
||||
|
@ -2077,10 +2074,10 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
tshark_debug("tshark: do_dissection = %s", do_dissection ? "TRUE" : "FALSE");
|
||||
ws_debug("tshark: do_dissection = %s", do_dissection ? "TRUE" : "FALSE");
|
||||
|
||||
if (cf_name) {
|
||||
tshark_debug("tshark: Opening capture file: %s", cf_name);
|
||||
ws_debug("tshark: Opening capture file: %s", cf_name);
|
||||
/*
|
||||
* We're reading a capture file.
|
||||
*/
|
||||
|
@ -2105,7 +2102,7 @@ main(int argc, char *argv[])
|
|||
do_dissection = must_do_dissection(rfcode, dfcode, pdu_export_arg);
|
||||
|
||||
/* Process the packets in the file */
|
||||
tshark_debug("tshark: invoking process_cap_file() to process the packets");
|
||||
ws_debug("tshark: invoking process_cap_file() to process the packets");
|
||||
TRY {
|
||||
status = process_cap_file(&cfile, output_file_name, out_file_type, out_file_name_res,
|
||||
#ifdef HAVE_LIBPCAP
|
||||
|
@ -2164,7 +2161,7 @@ main(int argc, char *argv[])
|
|||
g_free(exp_pdu_filename);
|
||||
}
|
||||
} else {
|
||||
tshark_debug("tshark: no capture file specified");
|
||||
ws_debug("tshark: no capture file specified");
|
||||
/* No capture file specified, so we're supposed to do a live capture
|
||||
or get a list of link-layer types for a live capture device;
|
||||
do we have support for live captures? */
|
||||
|
@ -2264,7 +2261,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
tshark_debug("tshark: performing live capture");
|
||||
ws_debug("tshark: performing live capture");
|
||||
|
||||
/* Start statistics taps; we should only do so after the capture
|
||||
started successfully, so we know we have something to compute
|
||||
|
@ -3153,14 +3150,14 @@ process_cap_file_first_pass(capture_file *cf, int max_packet_count,
|
|||
create_proto_tree =
|
||||
(cf->rfcode != NULL || cf->dfcode != NULL || postdissectors_want_hfids() || dissect_color);
|
||||
|
||||
tshark_debug("tshark: create_proto_tree = %s", create_proto_tree ? "TRUE" : "FALSE");
|
||||
ws_debug("tshark: create_proto_tree = %s", create_proto_tree ? "TRUE" : "FALSE");
|
||||
|
||||
/* We're not going to display the protocol tree on this pass,
|
||||
so it's not going to be "visible". */
|
||||
edt = epan_dissect_new(cf->epan, create_proto_tree, FALSE);
|
||||
}
|
||||
|
||||
tshark_debug("tshark: reading records for first pass");
|
||||
ws_debug("tshark: reading records for first pass");
|
||||
*err = 0;
|
||||
while (wtap_read(cf->provider.wth, &rec, &buf, err, err_info, &data_offset)) {
|
||||
if (read_interrupted) {
|
||||
|
@ -3174,7 +3171,7 @@ process_cap_file_first_pass(capture_file *cf, int max_packet_count,
|
|||
* (unless we roll over max_packet_count ?)
|
||||
*/
|
||||
if ( (--max_packet_count == 0) || (max_byte_count != 0 && data_offset >= max_byte_count)) {
|
||||
tshark_debug("tshark: max_packet_count (%d) or max_byte_count (%" G_GINT64_MODIFIER "d/%" G_GINT64_MODIFIER "d) reached",
|
||||
ws_debug("tshark: max_packet_count (%d) or max_byte_count (%" G_GINT64_MODIFIER "d/%" G_GINT64_MODIFIER "d) reached",
|
||||
max_packet_count, data_offset, max_byte_count);
|
||||
*err = 0; /* This is not an error */
|
||||
break;
|
||||
|
@ -3366,7 +3363,7 @@ process_cap_file_second_pass(capture_file *cf, wtap_dumper *pdh,
|
|||
(cf->dfcode || print_details || filtering_tap_listeners ||
|
||||
(tap_flags & TL_REQUIRES_PROTO_TREE) || have_custom_cols(&cf->cinfo) || dissect_color);
|
||||
|
||||
tshark_debug("tshark: create_proto_tree = %s", create_proto_tree ? "TRUE" : "FALSE");
|
||||
ws_debug("tshark: create_proto_tree = %s", create_proto_tree ? "TRUE" : "FALSE");
|
||||
|
||||
/* The protocol tree will be "visible", i.e., printed, only if we're
|
||||
printing packet details, which is true if we're printing stuff
|
||||
|
@ -3393,16 +3390,16 @@ process_cap_file_second_pass(capture_file *cf, wtap_dumper *pdh,
|
|||
status = PASS_READ_ERROR;
|
||||
break;
|
||||
}
|
||||
tshark_debug("tshark: invoking process_packet_second_pass() for frame #%d", framenum);
|
||||
ws_debug("tshark: invoking process_packet_second_pass() for frame #%d", framenum);
|
||||
if (process_packet_second_pass(cf, edt, fdata, &rec, &buf, tap_flags)) {
|
||||
/* Either there's no read filtering or this packet passed the
|
||||
filter, so, if we're writing to a capture file, write
|
||||
this packet out. */
|
||||
if (pdh != NULL) {
|
||||
tshark_debug("tshark: writing packet #%d to outfile", framenum);
|
||||
ws_debug("tshark: writing packet #%d to outfile", framenum);
|
||||
if (!wtap_dump(pdh, &rec, ws_buffer_start_ptr(&buf), err, err_info)) {
|
||||
/* Error writing to the output file. */
|
||||
tshark_debug("tshark: error writing to a capture file (%d)", *err);
|
||||
ws_debug("tshark: error writing to a capture file (%d)", *err);
|
||||
*err_framenum = framenum;
|
||||
status = PASS_WRITE_ERROR;
|
||||
break;
|
||||
|
@ -3473,7 +3470,7 @@ process_cap_file_single_pass(capture_file *cf, wtap_dumper *pdh,
|
|||
(tap_flags & TL_REQUIRES_PROTO_TREE) || postdissectors_want_hfids() ||
|
||||
have_custom_cols(&cf->cinfo) || dissect_color);
|
||||
|
||||
tshark_debug("tshark: create_proto_tree = %s", create_proto_tree ? "TRUE" : "FALSE");
|
||||
ws_debug("tshark: create_proto_tree = %s", create_proto_tree ? "TRUE" : "FALSE");
|
||||
|
||||
/* The protocol tree will be "visible", i.e., printed, only if we're
|
||||
printing packet details, which is true if we're printing stuff
|
||||
|
@ -3506,7 +3503,7 @@ process_cap_file_single_pass(capture_file *cf, wtap_dumper *pdh,
|
|||
break;
|
||||
}
|
||||
|
||||
tshark_debug("tshark: processing packet #%d", framenum);
|
||||
ws_debug("tshark: processing packet #%d", framenum);
|
||||
|
||||
reset_epan_mem(cf, edt, create_proto_tree, print_packet_info && print_details);
|
||||
|
||||
|
@ -3515,10 +3512,10 @@ process_cap_file_single_pass(capture_file *cf, wtap_dumper *pdh,
|
|||
filter, so, if we're writing to a capture file, write
|
||||
this packet out. */
|
||||
if (pdh != NULL) {
|
||||
tshark_debug("tshark: writing packet #%d to outfile", framenum);
|
||||
ws_debug("tshark: writing packet #%d to outfile", framenum);
|
||||
if (!wtap_dump(pdh, &rec, ws_buffer_start_ptr(&buf), err, err_info)) {
|
||||
/* Error writing to the output file. */
|
||||
tshark_debug("tshark: error writing to a capture file (%d)", *err);
|
||||
ws_debug("tshark: error writing to a capture file (%d)", *err);
|
||||
*err_framenum = framenum;
|
||||
status = PASS_WRITE_ERROR;
|
||||
break;
|
||||
|
@ -3531,7 +3528,7 @@ process_cap_file_single_pass(capture_file *cf, wtap_dumper *pdh,
|
|||
* (unless we roll over max_packet_count ?)
|
||||
*/
|
||||
if ( (--max_packet_count == 0) || (max_byte_count != 0 && data_offset >= max_byte_count)) {
|
||||
tshark_debug("tshark: max_packet_count (%d) or max_byte_count (%" G_GINT64_MODIFIER "d/%" G_GINT64_MODIFIER "d) reached",
|
||||
ws_debug("tshark: max_packet_count (%d) or max_byte_count (%" G_GINT64_MODIFIER "d/%" G_GINT64_MODIFIER "d) reached",
|
||||
max_packet_count, data_offset, max_byte_count);
|
||||
*err = 0; /* This is not an error */
|
||||
break;
|
||||
|
@ -3577,7 +3574,7 @@ process_cap_file(capture_file *cf, char *save_file, int out_file_type,
|
|||
wtap_block_add_string_option_format(g_array_index(params.shb_hdrs, wtap_block_t, 0), OPT_SHB_USERAPPL, "%s", get_appname_and_version());
|
||||
}
|
||||
|
||||
tshark_debug("tshark: writing format type %d, to %s", out_file_type, save_file);
|
||||
ws_debug("tshark: writing format type %d, to %s", out_file_type, save_file);
|
||||
if (strcmp(save_file, "-") == 0) {
|
||||
/* Write to the standard output. */
|
||||
pdh = wtap_dump_open_stdout(out_file_type, WTAP_UNCOMPRESSED, ¶ms,
|
||||
|
@ -3634,14 +3631,14 @@ process_cap_file(capture_file *cf, char *save_file, int out_file_type,
|
|||
#endif /* _WIN32 */
|
||||
|
||||
if (perform_two_pass_analysis) {
|
||||
tshark_debug("tshark: perform_two_pass_analysis, do_dissection=%s", do_dissection ? "TRUE" : "FALSE");
|
||||
ws_debug("tshark: perform_two_pass_analysis, do_dissection=%s", do_dissection ? "TRUE" : "FALSE");
|
||||
|
||||
first_pass_status = process_cap_file_first_pass(cf, max_packet_count,
|
||||
max_byte_count,
|
||||
&err_pass1,
|
||||
&err_info_pass1);
|
||||
|
||||
tshark_debug("tshark: done with first pass");
|
||||
ws_debug("tshark: done with first pass");
|
||||
|
||||
if (first_pass_status == PASS_INTERRUPTED) {
|
||||
/* The first pass was interrupted; skip the second pass.
|
||||
|
@ -3658,12 +3655,12 @@ process_cap_file(capture_file *cf, char *save_file, int out_file_type,
|
|||
second_pass_status = process_cap_file_second_pass(cf, pdh, &err, &err_info,
|
||||
&err_framenum);
|
||||
|
||||
tshark_debug("tshark: done with second pass");
|
||||
ws_debug("tshark: done with second pass");
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* !perform_two_pass_analysis */
|
||||
tshark_debug("tshark: perform one pass analysis, do_dissection=%s", do_dissection ? "TRUE" : "FALSE");
|
||||
ws_debug("tshark: perform one pass analysis, do_dissection=%s", do_dissection ? "TRUE" : "FALSE");
|
||||
|
||||
first_pass_status = PASS_SUCCEEDED; /* There is no first pass */
|
||||
second_pass_status = process_cap_file_single_pass(cf, pdh,
|
||||
|
@ -3682,7 +3679,7 @@ process_cap_file(capture_file *cf, char *save_file, int out_file_type,
|
|||
if (first_pass_status != PASS_INTERRUPTED ||
|
||||
second_pass_status != PASS_INTERRUPTED) {
|
||||
/* At least one of the passes got an error. */
|
||||
tshark_debug("tshark: something failed along the line (%d)", err);
|
||||
ws_debug("tshark: something failed along the line (%d)", err);
|
||||
/*
|
||||
* If we're printing packet data, and the standard output and error
|
||||
* are going to the same place, flush the standard output, so everything
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include <wsutil/copyright_info.h>
|
||||
#include <wsutil/os_version_info.h>
|
||||
#include <wsutil/crash_info.h>
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
#include <wsutil/plugins.h>
|
||||
|
||||
static char *appname_with_version;
|
||||
|
@ -500,7 +499,7 @@ get_ws_version_number(int *major, int *minor, int *micro)
|
|||
void
|
||||
show_version(void)
|
||||
{
|
||||
ws_debug_printf("%s\n"
|
||||
printf("%s\n"
|
||||
"\n"
|
||||
"%s\n"
|
||||
"%s\n"
|
||||
|
@ -512,7 +511,7 @@ show_version(void)
|
|||
void
|
||||
show_help_header(const char *description)
|
||||
{
|
||||
ws_debug_printf("%s\n"
|
||||
printf("%s\n"
|
||||
"%s\n"
|
||||
"See https://www.wireshark.org for more information.\n",
|
||||
appname_with_version, description);
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include <gmodule.h>
|
||||
#include <wiretap/wtap.h>
|
||||
#include <wiretap/socketcan.h>
|
||||
#include <wsutil/ws_printf.h>
|
||||
|
||||
//#define BUSMASTER_DEBUG
|
||||
//#define BUSMASTER_PARSER_TRACE
|
||||
|
@ -128,7 +127,8 @@ run_busmaster_parser(busmaster_state_t *state,
|
|||
int *err, gchar **err_info);
|
||||
|
||||
#ifdef BUSMASTER_DEBUG
|
||||
#define busmaster_debug_printf(...) ws_debug_printf(__VA_ARGS__)
|
||||
#include <stdio.h>
|
||||
#define busmaster_debug_printf(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define busmaster_debug_printf(...) (void)0
|
||||
#endif
|
||||
|
|
|
@ -102,7 +102,7 @@ candump_parse(FILE_T fh, msg_t *msg, gint64 *offset, int *err, char **err_info)
|
|||
gint64 seek_off;
|
||||
|
||||
#ifdef CANDUMP_DEBUG
|
||||
ws_debug_printf("%s: Trying candump file decoder\n", G_STRFUNC);
|
||||
candump_debug_printf("%s: Trying candump file decoder\n", G_STRFUNC);
|
||||
#endif
|
||||
|
||||
state.fh = fh;
|
||||
|
@ -114,7 +114,7 @@ candump_parse(FILE_T fh, msg_t *msg, gint64 *offset, int *err, char **err_info)
|
|||
|
||||
seek_off = file_tell(fh);
|
||||
#ifdef CANDUMP_DEBUG
|
||||
ws_debug_printf("%s: Starting parser at offset %" PRIi64 "\n", G_STRFUNC, seek_off);
|
||||
candump_debug_printf("%s: Starting parser at offset %" PRIi64 "\n", G_STRFUNC, seek_off);
|
||||
#endif
|
||||
state.file_bytes_read = 0;
|
||||
ok = run_candump_parser(&state, err, err_info);
|
||||
|
@ -134,7 +134,7 @@ candump_parse(FILE_T fh, msg_t *msg, gint64 *offset, int *err, char **err_info)
|
|||
return FALSE;
|
||||
|
||||
#ifdef CANDUMP_DEBUG
|
||||
ws_debug_printf("%s: Success\n", G_STRFUNC);
|
||||
candump_debug_printf("%s: Success\n", G_STRFUNC);
|
||||
#endif
|
||||
|
||||
if (offset)
|
||||
|
@ -160,7 +160,7 @@ candump_open(wtap *wth, int *err, char **err_info)
|
|||
}
|
||||
|
||||
#ifdef CANDUMP_DEBUG
|
||||
ws_debug_printf("%s: This is our file\n", G_STRFUNC);
|
||||
candump_debug_printf("%s: This is our file\n", G_STRFUNC);
|
||||
#endif
|
||||
|
||||
if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
|
||||
|
@ -188,14 +188,14 @@ candump_read(wtap *wth, wtap_rec *rec, Buffer *buf, int *err, gchar **err_info,
|
|||
msg_t msg;
|
||||
|
||||
#ifdef CANDUMP_DEBUG
|
||||
ws_debug_printf("%s: Try reading at offset %" PRIi64 "\n", G_STRFUNC, file_tell(wth->fh));
|
||||
candump_debug_printf("%s: Try reading at offset %" PRIi64 "\n", G_STRFUNC, file_tell(wth->fh));
|
||||
#endif
|
||||
|
||||
if (!candump_parse(wth->fh, &msg, data_offset, err, err_info))
|
||||
return FALSE;
|
||||
|
||||
#ifdef CANDUMP_DEBUG
|
||||
ws_debug_printf("%s: Stopped at offset %" PRIi64 "\n", G_STRFUNC, file_tell(wth->fh));
|
||||
candump_debug_printf("%s: Stopped at offset %" PRIi64 "\n", G_STRFUNC, file_tell(wth->fh));
|
||||
#endif
|
||||
|
||||
candump_write_packet(rec, buf, &msg);
|
||||
|
@ -210,7 +210,7 @@ candump_seek_read(wtap *wth , gint64 seek_off, wtap_rec *rec,
|
|||
msg_t msg;
|
||||
|
||||
#ifdef CANDUMP_DEBUG
|
||||
ws_debug_printf("%s: Read at offset %" PRIi64 "\n", G_STRFUNC, seek_off);
|
||||
candump_debug_printf("%s: Read at offset %" PRIi64 "\n", G_STRFUNC, seek_off);
|
||||
#endif
|
||||
|
||||
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
|
||||
|
|
|
@ -57,11 +57,11 @@ DIAG_OFF(unreachable-code)
|
|||
|
||||
#ifdef CANDUMP_DEBUG
|
||||
const int n = sizeof(yyTokenName) / sizeof(yyTokenName[0]);
|
||||
ws_debug_printf("%s: got token: %s\n", G_STRFUNC, yyTokenName[yymajor]);
|
||||
candump_debug_printf("%s: got token: %s\n", G_STRFUNC, yyTokenName[yymajor]);
|
||||
for (int i = 0; i < n; ++i) {
|
||||
int a = yy_find_shift_action((YYCODETYPE)i, yypParser->yytos->stateno);
|
||||
if (a < YYNSTATE + YYNRULE) {
|
||||
ws_debug_printf("%s: possible token: %s\n", G_STRFUNC, yyTokenName[i]);
|
||||
candump_debug_printf("%s: possible token: %s\n", G_STRFUNC, yyTokenName[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -69,7 +69,7 @@ DIAG_OFF(unreachable-code)
|
|||
g_free(state->parse_error);
|
||||
state->parse_error = g_strdup_printf("Syntax Error");
|
||||
#ifdef CANDUMP_DEBUG
|
||||
ws_debug_printf("%s: Syntax Error\n", G_STRFUNC);
|
||||
candump_debug_printf("%s: Syntax Error\n", G_STRFUNC);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ DIAG_OFF(unreachable-code)
|
|||
g_free(state->parse_error);
|
||||
state->parse_error = g_strdup("Parse Error");
|
||||
#ifdef CANDUMP_DEBUG
|
||||
ws_debug_printf("%s: Parse Error\n", G_STRFUNC);
|
||||
candump_debug_printf("%s: Parse Error\n", G_STRFUNC);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ DIAG_OFF(unreachable-code)
|
|||
line ::= maybe_spaces msg(M) .
|
||||
{
|
||||
#ifdef CANDUMP_DEBUG
|
||||
ws_debug_printf("%s: read message\n", G_STRFUNC);
|
||||
candump_debug_printf("%s: read message\n", G_STRFUNC);
|
||||
#endif
|
||||
|
||||
state->msg = M;
|
||||
|
@ -123,7 +123,7 @@ line ::= maybe_spaces msg(M) .
|
|||
line ::= maybe_spaces .
|
||||
{
|
||||
#ifdef CANDUMP_DEBUG
|
||||
ws_debug_printf("%s: read empty line\n", G_STRFUNC);
|
||||
candump_debug_printf("%s: read empty line\n", G_STRFUNC);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -294,7 +294,7 @@ run_candump_parser(candump_state_t *state, int *err, gchar **err_info)
|
|||
#ifdef CANDUMP_DEBUG
|
||||
CandumpParserTrace(stdout, "parser >> ");
|
||||
|
||||
ws_debug_printf("%s: Starting parsing\n", G_STRFUNC);
|
||||
candump_debug_printf("%s: Starting parsing\n", G_STRFUNC);
|
||||
#endif
|
||||
|
||||
do
|
||||
|
@ -303,11 +303,11 @@ run_candump_parser(candump_state_t *state, int *err, gchar **err_info)
|
|||
|
||||
#ifdef CANDUMP_DEBUG
|
||||
if (lex_code)
|
||||
ws_debug_printf("%s: Feeding %s '%s'\n",
|
||||
candump_debug_printf("%s: Feeding %s '%s'\n",
|
||||
G_STRFUNC, yyTokenName[lex_code],
|
||||
candump_get_text(scanner));
|
||||
else
|
||||
ws_debug_printf("%s: Feeding %s\n",
|
||||
candump_debug_printf("%s: Feeding %s\n",
|
||||
G_STRFUNC, yyTokenName[lex_code]);
|
||||
#endif
|
||||
|
||||
|
@ -319,7 +319,7 @@ run_candump_parser(candump_state_t *state, int *err, gchar **err_info)
|
|||
while (lex_code);
|
||||
|
||||
#ifdef CANDUMP_DEBUG
|
||||
ws_debug_printf("%s: Done (%d)\n", G_STRFUNC, lex_code);
|
||||
candump_debug_printf("%s: Done (%d)\n", G_STRFUNC, lex_code);
|
||||
#endif
|
||||
|
||||
CandumpParserFree(parser, g_free);
|
||||
|
|
|
@ -59,14 +59,11 @@ typedef struct {
|
|||
gboolean
|
||||
run_candump_parser(candump_state_t *state, int *err, gchar **err_info);
|
||||
|
||||
#include <wsutil/ws_printf.h>
|
||||
|
||||
/* Uncomment the following line to make decoder verbose */
|
||||
//#undef NDEBUG
|
||||
|
||||
#ifdef NDEBUG
|
||||
#undef ws_debug_printf
|
||||
#define ws_debug_printf(...) (void)0
|
||||
#ifdef CANDUMP_DEBUG
|
||||
#include <stdio.h>
|
||||
#define candump_debug_printf(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define candump_debug_printf(...) (void)0
|
||||
#endif
|
||||
|
||||
#endif /* CANDUMP_PRIV_H__ */
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#define G_LOG_DOMAIN "wiretap"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
@ -56,12 +58,7 @@
|
|||
#include "ipfix.h"
|
||||
|
||||
#include <wsutil/strtoi.h>
|
||||
|
||||
#if 0
|
||||
#define ipfix_debug(...) g_warning(__VA_ARGS__)
|
||||
#else
|
||||
#define ipfix_debug(...)
|
||||
#endif
|
||||
#include <wsutil/wslog.h>
|
||||
|
||||
#define RECORDS_FOR_IPFIX_CHECK 20
|
||||
|
||||
|
@ -131,7 +128,7 @@ ipfix_read_message_header(ipfix_message_header_t *pfx_hdr, FILE_T fh, int *err,
|
|||
|
||||
/* go back to before header */
|
||||
if (file_seek(fh, 0 - IPFIX_MSG_HDR_SIZE, SEEK_CUR, err) == -1) {
|
||||
ipfix_debug("ipfix_read: couldn't go back in file before header");
|
||||
ws_debug("ipfix_read: couldn't go back in file before header");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -182,7 +179,7 @@ ipfix_open(wtap *wth, int *err, gchar **err_info)
|
|||
ipfix_message_header_t msg_hdr;
|
||||
ipfix_set_header_t set_hdr;
|
||||
|
||||
ipfix_debug("ipfix_open: opening file");
|
||||
ws_debug("ipfix_open: opening file");
|
||||
|
||||
/* number of records to scan before deciding if this really is IPFIX */
|
||||
if ((s = getenv("IPFIX_RECORDS_TO_CHECK")) != NULL) {
|
||||
|
@ -199,7 +196,7 @@ ipfix_open(wtap *wth, int *err, gchar **err_info)
|
|||
for (i = 0; i < records_for_ipfix_check; i++) {
|
||||
/* read first message header to check version */
|
||||
if (!ipfix_read_message_header(&msg_hdr, wth->fh, err, err_info)) {
|
||||
ipfix_debug("ipfix_open: couldn't read message header #%d with err code #%d (%s)",
|
||||
ws_debug("ipfix_open: couldn't read message header #%d with err code #%d (%s)",
|
||||
i, *err, *err_info);
|
||||
if (*err == WTAP_ERR_BAD_FILE) {
|
||||
*err = 0; /* not actually an error in this case */
|
||||
|
@ -223,7 +220,7 @@ ipfix_open(wtap *wth, int *err, gchar **err_info)
|
|||
break;
|
||||
}
|
||||
if (file_seek(wth->fh, IPFIX_MSG_HDR_SIZE, SEEK_CUR, err) == -1) {
|
||||
ipfix_debug("ipfix_open: failed seek to next message in file, %d bytes away",
|
||||
ws_debug("ipfix_open: failed seek to next message in file, %d bytes away",
|
||||
msg_hdr.message_length);
|
||||
return WTAP_OPEN_NOT_MINE;
|
||||
}
|
||||
|
@ -235,7 +232,7 @@ ipfix_open(wtap *wth, int *err, gchar **err_info)
|
|||
err, err_info)) {
|
||||
if (*err == WTAP_ERR_SHORT_READ) {
|
||||
/* Not a valid IPFIX Set, so not an IPFIX file. */
|
||||
ipfix_debug("ipfix_open: error %d reading set", *err);
|
||||
ws_debug("ipfix_open: error %d reading set", *err);
|
||||
return WTAP_OPEN_NOT_MINE;
|
||||
}
|
||||
|
||||
|
@ -245,7 +242,7 @@ ipfix_open(wtap *wth, int *err, gchar **err_info)
|
|||
set_hdr.set_length = g_ntohs(set_hdr.set_length);
|
||||
if ((set_hdr.set_length < IPFIX_SET_HDR_SIZE) ||
|
||||
((set_hdr.set_length + checked_len) > msg_hdr.message_length)) {
|
||||
ipfix_debug("ipfix_open: found invalid set_length of %d",
|
||||
ws_debug("ipfix_open: found invalid set_length of %d",
|
||||
set_hdr.set_length);
|
||||
return WTAP_OPEN_NOT_MINE;
|
||||
}
|
||||
|
@ -253,7 +250,7 @@ ipfix_open(wtap *wth, int *err, gchar **err_info)
|
|||
if (file_seek(wth->fh, set_hdr.set_length - IPFIX_SET_HDR_SIZE,
|
||||
SEEK_CUR, err) == -1)
|
||||
{
|
||||
ipfix_debug("ipfix_open: failed seek to next set in file, %d bytes away",
|
||||
ws_debug("ipfix_open: failed seek to next set in file, %d bytes away",
|
||||
set_hdr.set_length - IPFIX_SET_HDR_SIZE);
|
||||
return WTAP_OPEN_ERROR;
|
||||
}
|
||||
|
@ -293,10 +290,10 @@ ipfix_read(wtap *wth, wtap_rec *rec, Buffer *buf, int *err,
|
|||
gchar **err_info, gint64 *data_offset)
|
||||
{
|
||||
*data_offset = file_tell(wth->fh);
|
||||
ipfix_debug("ipfix_read: offset is initially %" G_GINT64_MODIFIER "d", *data_offset);
|
||||
ws_debug("ipfix_read: offset is initially %" G_GINT64_MODIFIER "d", *data_offset);
|
||||
|
||||
if (!ipfix_read_message(wth->fh, rec, buf, err, err_info)) {
|
||||
ipfix_debug("ipfix_read: couldn't read message header with code: %d\n, and error '%s'",
|
||||
ws_debug("ipfix_read: couldn't read message header with code: %d\n, and error '%s'",
|
||||
*err, *err_info);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -312,15 +309,15 @@ ipfix_seek_read(wtap *wth, gint64 seek_off, wtap_rec *rec,
|
|||
{
|
||||
/* seek to the right file position */
|
||||
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) {
|
||||
ipfix_debug("ipfix_seek_read: couldn't read message header with code: %d\n, and error '%s'",
|
||||
ws_debug("ipfix_seek_read: couldn't read message header with code: %d\n, and error '%s'",
|
||||
*err, *err_info);
|
||||
return FALSE; /* Seek error */
|
||||
}
|
||||
|
||||
ipfix_debug("ipfix_seek_read: reading at offset %" G_GINT64_MODIFIER "u", seek_off);
|
||||
ws_debug("ipfix_seek_read: reading at offset %" G_GINT64_MODIFIER "u", seek_off);
|
||||
|
||||
if (!ipfix_read_message(wth->random_fh, rec, buf, err, err_info)) {
|
||||
ipfix_debug("ipfix_seek_read: couldn't read message header");
|
||||
ws_debug("ipfix_seek_read: couldn't read message header");
|
||||
if (*err == 0)
|
||||
*err = WTAP_ERR_SHORT_READ;
|
||||
return FALSE;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#define G_LOG_DOMAIN "wiretap"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
@ -28,14 +30,9 @@
|
|||
|
||||
#include <wsutil/filesystem.h>
|
||||
#include "wsutil/os_version_info.h"
|
||||
#include <wsutil/wslog.h>
|
||||
|
||||
|
||||
#if 0
|
||||
#define merge_debug(...) g_warning(__VA_ARGS__)
|
||||
#else
|
||||
#define merge_debug(...)
|
||||
#endif
|
||||
|
||||
|
||||
static const char* idb_merge_mode_strings[] = {
|
||||
/* IDB_MERGE_MODE_NONE */
|
||||
|
@ -472,42 +469,42 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
|
|||
idb1_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(idb1);
|
||||
idb2_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(idb2);
|
||||
|
||||
merge_debug("merge::is_duplicate_idb() called");
|
||||
merge_debug("idb1_mand->wtap_encap == idb2_mand->wtap_encap: %s",
|
||||
ws_debug("merge::is_duplicate_idb() called");
|
||||
ws_debug("idb1_mand->wtap_encap == idb2_mand->wtap_encap: %s",
|
||||
(idb1_mand->wtap_encap == idb2_mand->wtap_encap) ? "TRUE":"FALSE");
|
||||
if (idb1_mand->wtap_encap != idb2_mand->wtap_encap) {
|
||||
/* Clearly not the same interface. */
|
||||
merge_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
ws_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
merge_debug("idb1_mand->time_units_per_second == idb2_mand->time_units_per_second: %s",
|
||||
ws_debug("idb1_mand->time_units_per_second == idb2_mand->time_units_per_second: %s",
|
||||
(idb1_mand->time_units_per_second == idb2_mand->time_units_per_second) ? "TRUE":"FALSE");
|
||||
if (idb1_mand->time_units_per_second != idb2_mand->time_units_per_second) {
|
||||
/*
|
||||
* Probably not the same interface, and we can't combine them
|
||||
* in any case.
|
||||
*/
|
||||
merge_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
ws_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
merge_debug("idb1_mand->tsprecision == idb2_mand->tsprecision: %s",
|
||||
ws_debug("idb1_mand->tsprecision == idb2_mand->tsprecision: %s",
|
||||
(idb1_mand->tsprecision == idb2_mand->tsprecision) ? "TRUE":"FALSE");
|
||||
if (idb1_mand->tsprecision != idb2_mand->tsprecision) {
|
||||
/*
|
||||
* Probably not the same interface, and we can't combine them
|
||||
* in any case.
|
||||
*/
|
||||
merge_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
ws_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* XXX: should snaplen not be compared? */
|
||||
merge_debug("idb1_mand->snap_len == idb2_mand->snap_len: %s",
|
||||
ws_debug("idb1_mand->snap_len == idb2_mand->snap_len: %s",
|
||||
(idb1_mand->snap_len == idb2_mand->snap_len) ? "TRUE":"FALSE");
|
||||
if (idb1_mand->snap_len != idb2_mand->snap_len) {
|
||||
merge_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
ws_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -515,10 +512,10 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
|
|||
have_idb1_value = (wtap_block_get_uint64_option_value(idb1, OPT_IDB_SPEED, &idb1_if_speed) == WTAP_OPTTYPE_SUCCESS);
|
||||
have_idb2_value = (wtap_block_get_uint64_option_value(idb2, OPT_IDB_SPEED, &idb2_if_speed) == WTAP_OPTTYPE_SUCCESS);
|
||||
if (have_idb1_value && have_idb2_value) {
|
||||
merge_debug("idb1_if_speed == idb2_if_speed: %s",
|
||||
ws_debug("idb1_if_speed == idb2_if_speed: %s",
|
||||
(idb1_if_speed == idb2_if_speed) ? "TRUE":"FALSE");
|
||||
if (idb1_if_speed != idb2_if_speed) {
|
||||
merge_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
ws_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -527,10 +524,10 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
|
|||
have_idb1_value = (wtap_block_get_uint8_option_value(idb1, OPT_IDB_TSRESOL, &idb1_if_tsresol) == WTAP_OPTTYPE_SUCCESS);
|
||||
have_idb2_value = (wtap_block_get_uint8_option_value(idb2, OPT_IDB_TSRESOL, &idb2_if_tsresol) == WTAP_OPTTYPE_SUCCESS);
|
||||
if (have_idb1_value && have_idb2_value) {
|
||||
merge_debug("idb1_if_tsresol == idb2_if_tsresol: %s",
|
||||
ws_debug("idb1_if_tsresol == idb2_if_tsresol: %s",
|
||||
(idb1_if_tsresol == idb2_if_tsresol) ? "TRUE":"FALSE");
|
||||
if (idb1_if_tsresol != idb2_if_tsresol) {
|
||||
merge_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
ws_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -539,10 +536,10 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
|
|||
have_idb1_value = (wtap_block_get_uint8_option_value(idb1, OPT_IDB_FCSLEN, &idb1_if_fcslen) == WTAP_OPTTYPE_SUCCESS);
|
||||
have_idb2_value = (wtap_block_get_uint8_option_value(idb2, OPT_IDB_FCSLEN, &idb2_if_fcslen) == WTAP_OPTTYPE_SUCCESS);
|
||||
if (have_idb1_value && have_idb2_value) {
|
||||
merge_debug("idb1_if_fcslen == idb2_if_fcslen: %s",
|
||||
ws_debug("idb1_if_fcslen == idb2_if_fcslen: %s",
|
||||
(idb1_if_fcslen == idb2_if_fcslen) ? "TRUE":"FALSE");
|
||||
if (idb1_if_fcslen == idb2_if_fcslen) {
|
||||
merge_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
ws_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -557,10 +554,10 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
|
|||
have_idb1_value = (wtap_block_get_nth_string_option_value(idb1, OPT_COMMENT, 0, &idb1_opt_comment) == WTAP_OPTTYPE_SUCCESS);
|
||||
have_idb2_value = (wtap_block_get_nth_string_option_value(idb2, OPT_COMMENT, 0, &idb2_opt_comment) == WTAP_OPTTYPE_SUCCESS);
|
||||
if (have_idb1_value && have_idb2_value) {
|
||||
merge_debug("g_strcmp0(idb1_opt_comment, idb2_opt_comment) == 0: %s",
|
||||
ws_debug("g_strcmp0(idb1_opt_comment, idb2_opt_comment) == 0: %s",
|
||||
(g_strcmp0(idb1_opt_comment, idb2_opt_comment) == 0) ? "TRUE":"FALSE");
|
||||
if (g_strcmp0(idb1_opt_comment, idb2_opt_comment) != 0) {
|
||||
merge_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
ws_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -569,10 +566,10 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
|
|||
have_idb1_value = (wtap_block_get_string_option_value(idb1, OPT_IDB_NAME, &idb1_if_name) == WTAP_OPTTYPE_SUCCESS);
|
||||
have_idb2_value = (wtap_block_get_string_option_value(idb2, OPT_IDB_NAME, &idb2_if_name) == WTAP_OPTTYPE_SUCCESS);
|
||||
if (have_idb1_value && have_idb2_value) {
|
||||
merge_debug("g_strcmp0(idb1_if_name, idb2_if_name) == 0: %s",
|
||||
ws_debug("g_strcmp0(idb1_if_name, idb2_if_name) == 0: %s",
|
||||
(g_strcmp0(idb1_if_name, idb2_if_name) == 0) ? "TRUE":"FALSE");
|
||||
if (g_strcmp0(idb1_if_name, idb2_if_name) != 0) {
|
||||
merge_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
ws_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -581,10 +578,10 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
|
|||
have_idb1_value = (wtap_block_get_string_option_value(idb1, OPT_IDB_DESCR, &idb1_if_description) == WTAP_OPTTYPE_SUCCESS);
|
||||
have_idb2_value = (wtap_block_get_string_option_value(idb2, OPT_IDB_DESCR, &idb2_if_description) == WTAP_OPTTYPE_SUCCESS);
|
||||
if (have_idb1_value && have_idb2_value) {
|
||||
merge_debug("g_strcmp0(idb1_if_description, idb2_if_description) == 0: %s",
|
||||
ws_debug("g_strcmp0(idb1_if_description, idb2_if_description) == 0: %s",
|
||||
(g_strcmp0(idb1_if_description, idb2_if_description) == 0) ? "TRUE":"FALSE");
|
||||
if (g_strcmp0(idb1_if_description, idb2_if_description) != 0) {
|
||||
merge_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
ws_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -593,10 +590,10 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
|
|||
have_idb1_value = (wtap_block_get_string_option_value(idb1, OPT_IDB_HARDWARE, &idb1_if_hardware) == WTAP_OPTTYPE_SUCCESS);
|
||||
have_idb2_value = (wtap_block_get_string_option_value(idb2, OPT_IDB_HARDWARE, &idb2_if_hardware) == WTAP_OPTTYPE_SUCCESS);
|
||||
if (have_idb1_value && have_idb2_value) {
|
||||
merge_debug("g_strcmp0(idb1_if_hardware, idb2_if_hardware) == 0: %s",
|
||||
ws_debug("g_strcmp0(idb1_if_hardware, idb2_if_hardware) == 0: %s",
|
||||
(g_strcmp0(idb1_if_hardware, idb2_if_hardware) == 0) ? "TRUE":"FALSE");
|
||||
if (g_strcmp0(idb1_if_hardware, idb2_if_hardware) != 0) {
|
||||
merge_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
ws_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -605,16 +602,16 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
|
|||
have_idb1_value = (wtap_block_get_string_option_value(idb1, OPT_IDB_OS, &idb1_if_os) == WTAP_OPTTYPE_SUCCESS);
|
||||
have_idb2_value = (wtap_block_get_string_option_value(idb2, OPT_IDB_OS, &idb2_if_os) == WTAP_OPTTYPE_SUCCESS);
|
||||
if (have_idb1_value && have_idb2_value) {
|
||||
merge_debug("g_strcmp0(idb1_if_os, idb2_if_os) == 0: %s",
|
||||
ws_debug("g_strcmp0(idb1_if_os, idb2_if_os) == 0: %s",
|
||||
(g_strcmp0(idb1_if_os, idb2_if_os) == 0) ? "TRUE":"FALSE");
|
||||
if (g_strcmp0(idb1_if_os, idb2_if_os) != 0) {
|
||||
merge_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
ws_debug("merge::is_duplicate_idb() returning FALSE");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* does not compare filters nor interface statistics */
|
||||
merge_debug("merge::is_duplicate_idb() returning TRUE");
|
||||
ws_debug("merge::is_duplicate_idb() returning TRUE");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -645,7 +642,7 @@ all_idbs_are_duplicates(const merge_in_file_t *in_files, const guint in_file_cou
|
|||
other_idb_list_size = other_idb_list->interface_data->len;
|
||||
|
||||
if (other_idb_list_size != first_idb_list_size) {
|
||||
merge_debug("merge::all_idbs_are_duplicates: sizes of IDB lists don't match: first=%u, other=%u",
|
||||
ws_debug("merge::all_idbs_are_duplicates: sizes of IDB lists don't match: first=%u, other=%u",
|
||||
first_idb_list_size, other_idb_list_size);
|
||||
g_free(other_idb_list);
|
||||
g_free(first_idb_list);
|
||||
|
@ -657,7 +654,7 @@ all_idbs_are_duplicates(const merge_in_file_t *in_files, const guint in_file_cou
|
|||
other_file_idb = g_array_index(other_idb_list->interface_data, wtap_block_t, j);
|
||||
|
||||
if (!is_duplicate_idb(first_file_idb, other_file_idb)) {
|
||||
merge_debug("merge::all_idbs_are_duplicates: IDBs at index %d do not match, returning FALSE", j);
|
||||
ws_debug("merge::all_idbs_are_duplicates: IDBs at index %d do not match, returning FALSE", j);
|
||||
g_free(other_idb_list);
|
||||
g_free(first_idb_list);
|
||||
return FALSE;
|
||||
|
@ -666,7 +663,7 @@ all_idbs_are_duplicates(const merge_in_file_t *in_files, const guint in_file_cou
|
|||
g_free(other_idb_list);
|
||||
}
|
||||
|
||||
merge_debug("merge::all_idbs_are_duplicates: returning TRUE");
|
||||
ws_debug("merge::all_idbs_are_duplicates: returning TRUE");
|
||||
|
||||
g_free(first_idb_list);
|
||||
|
||||
|
@ -750,7 +747,7 @@ generate_merged_idbs(merge_in_file_t *in_files, const guint in_file_count, const
|
|||
if (mode == IDB_MERGE_MODE_ALL_SAME && all_idbs_are_duplicates(in_files, in_file_count)) {
|
||||
guint num_idbs;
|
||||
|
||||
merge_debug("merge::generate_merged_idbs: mode ALL set and all IDBs are duplicates");
|
||||
ws_debug("merge::generate_merged_idbs: mode ALL set and all IDBs are duplicates");
|
||||
|
||||
/* they're all the same, so just get the first file's IDBs */
|
||||
input_file_idb_list = wtap_file_get_idb_info(in_files[0].wth);
|
||||
|
@ -785,7 +782,7 @@ generate_merged_idbs(merge_in_file_t *in_files, const guint in_file_count, const
|
|||
if (mode == IDB_MERGE_MODE_ANY_SAME &&
|
||||
find_duplicate_idb(input_file_idb, merged_idb_list, &merged_index))
|
||||
{
|
||||
merge_debug("merge::generate_merged_idbs: mode ANY set and found a duplicate");
|
||||
ws_debug("merge::generate_merged_idbs: mode ANY set and found a duplicate");
|
||||
/*
|
||||
* It's the same as a previous IDB, so we're going to "merge"
|
||||
* them into one by adding a map from its old IDB index to the new
|
||||
|
@ -794,7 +791,7 @@ generate_merged_idbs(merge_in_file_t *in_files, const guint in_file_count, const
|
|||
add_idb_index_map(&in_files[i], itf_count, merged_index);
|
||||
}
|
||||
else {
|
||||
merge_debug("merge::generate_merged_idbs: mode NONE set or did not find a duplicate");
|
||||
ws_debug("merge::generate_merged_idbs: mode NONE set or did not find a duplicate");
|
||||
/*
|
||||
* This IDB does not match a previous (or we want to save all IDBs),
|
||||
* so add the IDB to the merge file, and add a map of the indices.
|
||||
|
@ -825,7 +822,7 @@ map_rec_interface_id(wtap_rec *rec, const merge_in_file_t *in_file)
|
|||
|
||||
if (current_interface_id >= in_file->idb_index_map->len) {
|
||||
/* this shouldn't happen, but in a malformed input file it could */
|
||||
merge_debug("merge::map_rec_interface_id: current_interface_id (%u) >= in_file->idb_index_map->len (%u) (ERROR?)",
|
||||
ws_debug("merge::map_rec_interface_id: current_interface_id (%u) >= in_file->idb_index_map->len (%u) (ERROR?)",
|
||||
current_interface_id, in_file->idb_index_map->len);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1013,12 +1010,12 @@ merge_files_common(const gchar* out_filename, /* normal output mode */
|
|||
/* if a callback was given, it has to have a callback function ptr */
|
||||
g_assert((cb != NULL) ? (cb->callback_func != NULL) : TRUE);
|
||||
|
||||
merge_debug("merge_files: begin");
|
||||
ws_debug("merge_files: begin");
|
||||
|
||||
/* open the input files */
|
||||
if (!merge_open_in_files(in_file_count, in_filenames, &in_files, cb,
|
||||
err, err_info, err_fileno)) {
|
||||
merge_debug("merge_files: merge_open_in_files() failed with err=%d", *err);
|
||||
ws_debug("merge_files: merge_open_in_files() failed with err=%d", *err);
|
||||
*err_framenum = 0;
|
||||
return MERGE_ERR_CANT_OPEN_INFILE;
|
||||
}
|
||||
|
@ -1036,7 +1033,7 @@ merge_files_common(const gchar* out_filename, /* normal output mode */
|
|||
* whether we can merge IDBs into one or not.
|
||||
*/
|
||||
frame_type = merge_select_frame_type(in_file_count, in_files);
|
||||
merge_debug("merge_files: got frame_type=%d", frame_type);
|
||||
ws_debug("merge_files: got frame_type=%d", frame_type);
|
||||
|
||||
if (cb)
|
||||
cb->callback_func(MERGE_EVENT_FRAME_TYPE_SELECTED, frame_type, in_files, in_file_count, cb->data);
|
||||
|
@ -1055,10 +1052,10 @@ merge_files_common(const gchar* out_filename, /* normal output mode */
|
|||
if (wtap_file_type_subtype_supports_block(file_type,
|
||||
WTAP_BLOCK_IF_ID_AND_INFO) != BLOCK_NOT_SUPPORTED) {
|
||||
shb_hdrs = create_shb_header(in_files, in_file_count, app_name);
|
||||
merge_debug("merge_files: SHB created");
|
||||
ws_debug("merge_files: SHB created");
|
||||
|
||||
idb_inf = generate_merged_idbs(in_files, in_file_count, mode);
|
||||
merge_debug("merge_files: IDB merge operation complete, got %u IDBs", idb_inf ? idb_inf->interface_data->len : 0);
|
||||
ws_debug("merge_files: IDB merge operation complete, got %u IDBs", idb_inf ? idb_inf->interface_data->len : 0);
|
||||
|
||||
/* XXX other blocks like NRB are now discarded. */
|
||||
params.shb_hdrs = shb_hdrs;
|
||||
|
|
266
wiretap/pcapng.c
266
wiretap/pcapng.c
|
@ -17,11 +17,13 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#define G_LOG_DOMAIN "wiretap"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <wsutil/ws_printf.h>
|
||||
#include <wsutil/wslog.h>
|
||||
#include <wsutil/strtoi.h>
|
||||
#include <wsutil/glib-compat.h>
|
||||
|
||||
|
@ -34,12 +36,6 @@
|
|||
#include "pcapng_module.h"
|
||||
#include "secrets-types.h"
|
||||
|
||||
#if 0
|
||||
#define pcapng_debug(...) g_warning(__VA_ARGS__)
|
||||
#else
|
||||
#define pcapng_debug(...)
|
||||
#endif
|
||||
|
||||
#define ROUND_TO_4BYTE(len) ((len + 3) & ~3)
|
||||
|
||||
static gboolean
|
||||
|
@ -516,7 +512,7 @@ pcapng_read_option(FILE_T fh, const section_info_t *section_info,
|
|||
|
||||
/* read option header */
|
||||
if (!wtap_read_bytes(fh, oh, sizeof (*oh), err, err_info)) {
|
||||
pcapng_debug("pcapng_read_option: failed to read option");
|
||||
ws_debug("pcapng_read_option: failed to read option");
|
||||
return -1;
|
||||
}
|
||||
block_read = sizeof (*oh);
|
||||
|
@ -543,7 +539,7 @@ pcapng_read_option(FILE_T fh, const section_info_t *section_info,
|
|||
|
||||
/* read option content */
|
||||
if (!wtap_read_bytes(fh, content, oh->option_length, err, err_info)) {
|
||||
pcapng_debug("pcapng_read_option: failed to read content of option %u", oh->option_code);
|
||||
ws_debug("pcapng_read_option: failed to read content of option %u", oh->option_code);
|
||||
return -1;
|
||||
}
|
||||
block_read += oh->option_length;
|
||||
|
@ -716,7 +712,7 @@ pcapng_read_section_header_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
version_major = shb.version_major;
|
||||
version_minor = shb.version_minor;
|
||||
|
||||
pcapng_debug("pcapng_read_section_header_block: SHB (our byte order) V%u.%u, len %u",
|
||||
ws_debug("pcapng_read_section_header_block: SHB (our byte order) V%u.%u, len %u",
|
||||
version_major, version_minor, bh->block_total_length);
|
||||
break;
|
||||
case(0x4D3C2B1A):
|
||||
|
@ -728,7 +724,7 @@ pcapng_read_section_header_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
/* tweak the block length to meet current swapping that we know now */
|
||||
bh->block_total_length = GUINT32_SWAP_LE_BE(bh->block_total_length);
|
||||
|
||||
pcapng_debug("pcapng_read_section_header_block: SHB (byte-swapped) V%u.%u, len %u",
|
||||
ws_debug("pcapng_read_section_header_block: SHB (byte-swapped) V%u.%u, len %u",
|
||||
version_major, version_minor, bh->block_total_length);
|
||||
break;
|
||||
default:
|
||||
|
@ -817,13 +813,13 @@ pcapng_read_section_header_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
*err = ENOMEM; /* we assume we're out of memory */
|
||||
return PCAPNG_BLOCK_ERROR;
|
||||
}
|
||||
pcapng_debug("pcapng_read_section_header_block: Options %u bytes", to_read);
|
||||
ws_debug("pcapng_read_section_header_block: Options %u bytes", to_read);
|
||||
while (to_read != 0) {
|
||||
/* read option */
|
||||
pcapng_debug("pcapng_read_section_header_block: Options %u bytes remaining", to_read);
|
||||
ws_debug("pcapng_read_section_header_block: Options %u bytes remaining", to_read);
|
||||
bytes_read = pcapng_read_option(fh, section_info, &oh, option_content, opt_cont_buf_len, to_read, err, err_info, "section_header");
|
||||
if (bytes_read <= 0) {
|
||||
pcapng_debug("pcapng_read_section_header_block: failed to read option");
|
||||
ws_debug("pcapng_read_section_header_block: failed to read option");
|
||||
g_free(option_content);
|
||||
return PCAPNG_BLOCK_ERROR;
|
||||
}
|
||||
|
@ -849,11 +845,11 @@ pcapng_read_section_header_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
switch (oh.option_code) {
|
||||
case(OPT_EOFOPT):
|
||||
if (to_read != 0) {
|
||||
pcapng_debug("pcapng_read_section_header_block: %u bytes after opt_endofopt", to_read);
|
||||
ws_debug("pcapng_read_section_header_block: %u bytes after opt_endofopt", to_read);
|
||||
/* padding should be ok here, just get out of this */
|
||||
to_read = 0;
|
||||
} else {
|
||||
pcapng_debug("pcapng_read_section_header_block: opt_endofopt");
|
||||
ws_debug("pcapng_read_section_header_block: opt_endofopt");
|
||||
}
|
||||
break;
|
||||
case(OPT_COMMENT):
|
||||
|
@ -916,7 +912,7 @@ pcapng_read_if_descr_block(wtap *wth, FILE_T fh, pcapng_block_header_t *bh,
|
|||
|
||||
/* read block content */
|
||||
if (!wtap_read_bytes(fh, &idb, sizeof idb, err, err_info)) {
|
||||
pcapng_debug("pcapng_read_if_descr_block: failed to read IDB");
|
||||
ws_debug("pcapng_read_if_descr_block: failed to read IDB");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -935,7 +931,7 @@ pcapng_read_if_descr_block(wtap *wth, FILE_T fh, pcapng_block_header_t *bh,
|
|||
if_descr_mand->time_units_per_second = time_units_per_second;
|
||||
if_descr_mand->tsprecision = tsprecision;
|
||||
|
||||
pcapng_debug("pcapng_read_if_descr_block: IDB link_type %u (%s), snap %u",
|
||||
ws_debug("pcapng_read_if_descr_block: IDB link_type %u (%s), snap %u",
|
||||
link_type,
|
||||
wtap_encap_description(if_descr_mand->wtap_encap),
|
||||
if_descr_mand->snap_len);
|
||||
|
@ -945,7 +941,7 @@ pcapng_read_if_descr_block(wtap *wth, FILE_T fh, pcapng_block_header_t *bh,
|
|||
* We do not use this value, maybe we should check the
|
||||
* snap_len of the packets against it. For now, only warn.
|
||||
*/
|
||||
pcapng_debug("pcapng_read_if_descr_block: snapshot length %u unrealistic.",
|
||||
ws_debug("pcapng_read_if_descr_block: snapshot length %u unrealistic.",
|
||||
if_descr_mand->snap_len);
|
||||
/*if_descr_mand->snap_len = WTAP_MAX_PACKET_SIZE_STANDARD;*/
|
||||
}
|
||||
|
@ -965,7 +961,7 @@ pcapng_read_if_descr_block(wtap *wth, FILE_T fh, pcapng_block_header_t *bh,
|
|||
/* read option */
|
||||
bytes_read = pcapng_read_option(fh, section_info, &oh, option_content, opt_cont_buf_len, to_read, err, err_info, "if_descr");
|
||||
if (bytes_read <= 0) {
|
||||
pcapng_debug("pcapng_read_if_descr_block: failed to read option");
|
||||
ws_debug("pcapng_read_if_descr_block: failed to read option");
|
||||
g_free(option_content);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -991,7 +987,7 @@ pcapng_read_if_descr_block(wtap *wth, FILE_T fh, pcapng_block_header_t *bh,
|
|||
switch (oh.option_code) {
|
||||
case(OPT_EOFOPT): /* opt_endofopt */
|
||||
if (to_read != 0) {
|
||||
pcapng_debug("pcapng_read_if_descr_block: %u bytes after opt_endofopt", to_read);
|
||||
ws_debug("pcapng_read_if_descr_block: %u bytes after opt_endofopt", to_read);
|
||||
}
|
||||
/* padding should be ok here, just get out of this */
|
||||
to_read = 0;
|
||||
|
@ -1031,7 +1027,7 @@ pcapng_read_if_descr_block(wtap *wth, FILE_T fh, pcapng_block_header_t *bh,
|
|||
time_units_per_second = G_MAXUINT64;
|
||||
}
|
||||
if (time_units_per_second > (((guint64)1) << 32)) {
|
||||
pcapng_debug("pcapng_open: time conversion might be inaccurate");
|
||||
ws_debug("pcapng_open: time conversion might be inaccurate");
|
||||
}
|
||||
if_descr_mand->time_units_per_second = time_units_per_second;
|
||||
/* Fails with multiple options; we silently ignore the failure */
|
||||
|
@ -1049,9 +1045,9 @@ pcapng_read_if_descr_block(wtap *wth, FILE_T fh, pcapng_block_header_t *bh,
|
|||
else
|
||||
tsprecision = WTAP_TSPREC_SEC;
|
||||
if_descr_mand->tsprecision = tsprecision;
|
||||
pcapng_debug("pcapng_read_if_descr_block: if_tsresol %u, units/s %" G_GINT64_MODIFIER "u, tsprecision %d", if_tsresol, if_descr_mand->time_units_per_second, tsprecision);
|
||||
ws_debug("pcapng_read_if_descr_block: if_tsresol %u, units/s %" G_GINT64_MODIFIER "u, tsprecision %d", if_tsresol, if_descr_mand->time_units_per_second, tsprecision);
|
||||
} else {
|
||||
pcapng_debug("pcapng_read_if_descr_block: if_tsresol length %u not 1 as expected", oh.option_length);
|
||||
ws_debug("pcapng_read_if_descr_block: if_tsresol length %u not 1 as expected", oh.option_length);
|
||||
}
|
||||
break;
|
||||
/*
|
||||
|
@ -1067,7 +1063,7 @@ pcapng_read_if_descr_block(wtap *wth, FILE_T fh, pcapng_block_header_t *bh,
|
|||
if (option_content[0] == 0) {
|
||||
if_filter.type = if_filter_pcap;
|
||||
if_filter.data.filter_str = g_strndup((char *)option_content+1, oh.option_length-1);
|
||||
pcapng_debug("pcapng_read_if_descr_block: filter_str %s oh.option_length %u", if_filter.data.filter_str, oh.option_length);
|
||||
ws_debug("pcapng_read_if_descr_block: filter_str %s oh.option_length %u", if_filter.data.filter_str, oh.option_length);
|
||||
/* Fails with multiple options; we silently ignore the failure */
|
||||
wtap_block_add_if_filter_option(wblock->block, oh.option_code, &if_filter);
|
||||
g_free(if_filter.data.filter_str);
|
||||
|
@ -1108,7 +1104,7 @@ pcapng_read_if_descr_block(wtap *wth, FILE_T fh, pcapng_block_header_t *bh,
|
|||
g_free(if_filter.data.bpf_prog.bpf_prog);
|
||||
}
|
||||
} else {
|
||||
pcapng_debug("pcapng_read_if_descr_block: if_filter length %u seems strange", oh.option_length);
|
||||
ws_debug("pcapng_read_if_descr_block: if_filter length %u seems strange", oh.option_length);
|
||||
}
|
||||
break;
|
||||
case(OPT_IDB_OS): /* if_os */
|
||||
|
@ -1123,10 +1119,10 @@ pcapng_read_if_descr_block(wtap *wth, FILE_T fh, pcapng_block_header_t *bh,
|
|||
if (oh.option_length == 1) {
|
||||
/* Fails with multiple options; we silently ignore the failure */
|
||||
wtap_block_add_uint8_option(wblock->block, oh.option_code, option_content[0]);
|
||||
pcapng_debug("pcapng_read_if_descr_block: if_fcslen %u", option_content[0]);
|
||||
ws_debug("pcapng_read_if_descr_block: if_fcslen %u", option_content[0]);
|
||||
/* XXX - add sanity check */
|
||||
} else {
|
||||
pcapng_debug("pcapng_read_if_descr_block: if_fcslen length %u not 1 as expected", oh.option_length);
|
||||
ws_debug("pcapng_read_if_descr_block: if_fcslen length %u not 1 as expected", oh.option_length);
|
||||
}
|
||||
break;
|
||||
case(OPT_IDB_HARDWARE): /* if_hardware */
|
||||
|
@ -1235,7 +1231,7 @@ pcapng_read_decryption_secrets_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
|
||||
/* read block content */
|
||||
if (!wtap_read_bytes(fh, &dsb, sizeof(dsb), err, err_info)) {
|
||||
pcapng_debug("%s: failed to read DSB", G_STRFUNC);
|
||||
ws_debug("%s: failed to read DSB", G_STRFUNC);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1257,14 +1253,14 @@ pcapng_read_decryption_secrets_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
}
|
||||
dsb_mand->secrets_data = (guint8 *)g_malloc0(dsb_mand->secrets_len);
|
||||
if (!wtap_read_bytes(fh, dsb_mand->secrets_data, dsb_mand->secrets_len, err, err_info)) {
|
||||
pcapng_debug("%s: failed to read DSB", G_STRFUNC);
|
||||
ws_debug("%s: failed to read DSB", G_STRFUNC);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Skip past padding and discard options (not supported yet). */
|
||||
to_read = bh->block_total_length - MIN_DSB_SIZE - dsb_mand->secrets_len;
|
||||
if (!wtap_read_bytes(fh, NULL, to_read, err, err_info)) {
|
||||
pcapng_debug("%s: failed to read DSB options", G_STRFUNC);
|
||||
ws_debug("%s: failed to read DSB options", G_STRFUNC);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1314,7 +1310,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
return FALSE;
|
||||
}
|
||||
if (!wtap_read_bytes(fh, &epb, sizeof epb, err, err_info)) {
|
||||
pcapng_debug("pcapng_read_packet_block: failed to read packet data");
|
||||
ws_debug("pcapng_read_packet_block: failed to read packet data");
|
||||
return FALSE;
|
||||
}
|
||||
block_read = (guint)sizeof epb;
|
||||
|
@ -1334,7 +1330,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
packet.cap_len = epb.captured_len;
|
||||
packet.packet_len = epb.packet_len;
|
||||
}
|
||||
pcapng_debug("pcapng_read_packet_block: EPB on interface_id %d, cap_len %d, packet_len %d",
|
||||
ws_debug("pcapng_read_packet_block: EPB on interface_id %d, cap_len %d, packet_len %d",
|
||||
packet.interface_id, packet.cap_len, packet.packet_len);
|
||||
} else {
|
||||
/*
|
||||
|
@ -1350,7 +1346,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
return FALSE;
|
||||
}
|
||||
if (!wtap_read_bytes(fh, &pb, sizeof pb, err, err_info)) {
|
||||
pcapng_debug("pcapng_read_packet_block: failed to read packet data");
|
||||
ws_debug("pcapng_read_packet_block: failed to read packet data");
|
||||
return FALSE;
|
||||
}
|
||||
block_read = (guint)sizeof pb;
|
||||
|
@ -1370,7 +1366,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
packet.cap_len = pb.captured_len;
|
||||
packet.packet_len = pb.packet_len;
|
||||
}
|
||||
pcapng_debug("pcapng_read_packet_block: PB on interface_id %d, cap_len %d, packet_len %d",
|
||||
ws_debug("pcapng_read_packet_block: PB on interface_id %d, cap_len %d, packet_len %d",
|
||||
packet.interface_id, packet.cap_len, packet.packet_len);
|
||||
}
|
||||
|
||||
|
@ -1389,7 +1385,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
} else {
|
||||
block_total_length = bh->block_total_length;
|
||||
}
|
||||
pcapng_debug("pcapng_read_packet_block: block_total_length %d", block_total_length);
|
||||
ws_debug("pcapng_read_packet_block: block_total_length %d", block_total_length);
|
||||
|
||||
/*
|
||||
* Is this block long enough to hold the packet data?
|
||||
|
@ -1418,7 +1414,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
}
|
||||
}
|
||||
|
||||
pcapng_debug("pcapng_read_packet_block: packet data: packet_len %u captured_len %u interface_id %u",
|
||||
ws_debug("pcapng_read_packet_block: packet data: packet_len %u captured_len %u interface_id %u",
|
||||
packet.packet_len,
|
||||
packet.cap_len,
|
||||
packet.interface_id);
|
||||
|
@ -1444,7 +1440,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
wblock->rec->rec_type = REC_TYPE_PACKET;
|
||||
wblock->rec->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN|WTAP_HAS_INTERFACE_ID;
|
||||
|
||||
pcapng_debug("pcapng_read_packet_block: encapsulation = %d (%s), pseudo header size = %d.",
|
||||
ws_debug("pcapng_read_packet_block: encapsulation = %d (%s), pseudo header size = %d.",
|
||||
iface_info.wtap_encap,
|
||||
wtap_encap_description(iface_info.wtap_encap),
|
||||
pcap_get_phdr_size(iface_info.wtap_encap, &wblock->rec->rec_header.packet_header.pseudo_header));
|
||||
|
@ -1529,7 +1525,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
option_content = opt_ptr + sizeof (pcapng_option_header_t);
|
||||
bytes_read = pcapng_read_option(fh, section_info, oh, option_content, opt_cont_buf_len, to_read, err, err_info, "packet");
|
||||
if (bytes_read <= 0) {
|
||||
pcapng_debug("pcapng_read_packet_block: failed to read option");
|
||||
ws_debug("pcapng_read_packet_block: failed to read option");
|
||||
/* XXX - free anything? */
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1555,7 +1551,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
switch (oh->option_code) {
|
||||
case(OPT_EOFOPT):
|
||||
if (to_read != 0) {
|
||||
pcapng_debug("pcapng_read_packet_block: %u bytes after opt_endofopt", to_read);
|
||||
ws_debug("pcapng_read_packet_block: %u bytes after opt_endofopt", to_read);
|
||||
}
|
||||
/* padding should be ok here, just get out of this */
|
||||
to_read = 0;
|
||||
|
@ -1565,9 +1561,9 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
wblock->rec->presence_flags |= WTAP_HAS_COMMENTS;
|
||||
g_free(wblock->rec->opt_comment);
|
||||
wblock->rec->opt_comment = g_strndup((char *)option_content, oh->option_length);
|
||||
pcapng_debug("pcapng_read_packet_block: length %u opt_comment '%s'", oh->option_length, wblock->rec->opt_comment);
|
||||
ws_debug("pcapng_read_packet_block: length %u opt_comment '%s'", oh->option_length, wblock->rec->opt_comment);
|
||||
} else {
|
||||
pcapng_debug("pcapng_read_packet_block: opt_comment length %u seems strange", oh->option_length);
|
||||
ws_debug("pcapng_read_packet_block: opt_comment length %u seems strange", oh->option_length);
|
||||
}
|
||||
break;
|
||||
case(OPT_EPB_FLAGS):
|
||||
|
@ -1592,10 +1588,10 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
/* The FCS length is present */
|
||||
fcslen = PACK_FLAGS_FCS_LENGTH(wblock->rec->rec_header.packet_header.pack_flags);
|
||||
}
|
||||
pcapng_debug("pcapng_read_packet_block: pack_flags %u (ignored)", wblock->rec->rec_header.packet_header.pack_flags);
|
||||
ws_debug("pcapng_read_packet_block: pack_flags %u (ignored)", wblock->rec->rec_header.packet_header.pack_flags);
|
||||
break;
|
||||
case(OPT_EPB_HASH):
|
||||
pcapng_debug("pcapng_read_packet_block: epb_hash %u currently not handled - ignoring %u bytes",
|
||||
ws_debug("pcapng_read_packet_block: epb_hash %u currently not handled - ignoring %u bytes",
|
||||
oh->option_code, oh->option_length);
|
||||
break;
|
||||
case(OPT_EPB_DROPCOUNT):
|
||||
|
@ -1617,7 +1613,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
memcpy(option_content, &wblock->rec->rec_header.packet_header.drop_count, sizeof(guint64));
|
||||
}
|
||||
|
||||
pcapng_debug("pcapng_read_packet_block: drop_count %" G_GINT64_MODIFIER "u", wblock->rec->rec_header.packet_header.drop_count);
|
||||
ws_debug("pcapng_read_packet_block: drop_count %" G_GINT64_MODIFIER "u", wblock->rec->rec_header.packet_header.drop_count);
|
||||
break;
|
||||
case(OPT_EPB_PACKETID):
|
||||
if (oh->option_length != 8) {
|
||||
|
@ -1637,7 +1633,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
wblock->rec->rec_header.packet_header.packet_id = GUINT64_SWAP_LE_BE(wblock->rec->rec_header.packet_header.packet_id);
|
||||
memcpy(option_content, &wblock->rec->rec_header.packet_header.packet_id, sizeof(guint64));
|
||||
}
|
||||
pcapng_debug("pcapng_read_packet_block: packet_id %" G_GINT64_MODIFIER "u", wblock->rec->rec_header.packet_header.packet_id);
|
||||
ws_debug("pcapng_read_packet_block: packet_id %" G_GINT64_MODIFIER "u", wblock->rec->rec_header.packet_header.packet_id);
|
||||
break;
|
||||
case(OPT_EPB_QUEUE):
|
||||
if (oh->option_length != 4) {
|
||||
|
@ -1657,7 +1653,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
wblock->rec->rec_header.packet_header.interface_queue = GUINT32_SWAP_LE_BE(wblock->rec->rec_header.packet_header.interface_queue);
|
||||
memcpy(option_content, &wblock->rec->rec_header.packet_header.interface_queue, sizeof(guint32));
|
||||
}
|
||||
pcapng_debug("pcapng_read_packet_block: queue %u", wblock->rec->rec_header.packet_header.interface_queue);
|
||||
ws_debug("pcapng_read_packet_block: queue %u", wblock->rec->rec_header.packet_header.interface_queue);
|
||||
break;
|
||||
case(OPT_EPB_VERDICT):
|
||||
if (oh->option_length < 1 ||
|
||||
|
@ -1701,11 +1697,11 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
oh->option_length,
|
||||
g_free,
|
||||
option_content_copy));
|
||||
pcapng_debug("pcapng_read_packet_block: verdict type %u, data len %u",
|
||||
ws_debug("pcapng_read_packet_block: verdict type %u, data len %u",
|
||||
option_content[0], oh->option_length - 1);
|
||||
break;
|
||||
default:
|
||||
pcapng_debug("pcapng_read_packet_block: unknown option %u - ignoring %u bytes",
|
||||
ws_debug("pcapng_read_packet_block: unknown option %u - ignoring %u bytes",
|
||||
oh->option_code, oh->option_length);
|
||||
break;
|
||||
}
|
||||
|
@ -1752,7 +1748,7 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
|
||||
/* "Simple Packet Block" read fixed part */
|
||||
if (!wtap_read_bytes(fh, &spb, sizeof spb, err, err_info)) {
|
||||
pcapng_debug("pcapng_read_simple_packet_block: failed to read packet data");
|
||||
ws_debug("pcapng_read_simple_packet_block: failed to read packet data");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1794,7 +1790,7 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
} else {
|
||||
block_total_length = bh->block_total_length;
|
||||
}
|
||||
pcapng_debug("pcapng_read_simple_packet_block: block_total_length %d", block_total_length);
|
||||
ws_debug("pcapng_read_simple_packet_block: block_total_length %d", block_total_length);
|
||||
|
||||
/*
|
||||
* Is this block long enough to hold the packet data?
|
||||
|
@ -1819,10 +1815,10 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
wtap_max_snaplen_for_encap(iface_info.wtap_encap));
|
||||
return FALSE;
|
||||
}
|
||||
pcapng_debug("pcapng_read_simple_packet_block: packet data: packet_len %u",
|
||||
ws_debug("pcapng_read_simple_packet_block: packet data: packet_len %u",
|
||||
simple_packet.packet_len);
|
||||
|
||||
pcapng_debug("pcapng_read_simple_packet_block: Need to read pseudo header of size %d",
|
||||
ws_debug("pcapng_read_simple_packet_block: Need to read pseudo header of size %d",
|
||||
pcap_get_phdr_size(iface_info.wtap_encap, &wblock->rec->rec_header.packet_header.pseudo_header));
|
||||
|
||||
/* No time stamp in a simple packet block; no options, either */
|
||||
|
@ -1962,7 +1958,7 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
|
||||
to_read = bh->block_total_length - 8 - 4; /* We have read the header and should not read the final block_total_length */
|
||||
|
||||
pcapng_debug("pcapng_read_name_resolution_block, total %d bytes", bh->block_total_length);
|
||||
ws_debug("pcapng_read_name_resolution_block, total %d bytes", bh->block_total_length);
|
||||
|
||||
/* Ensure we have a name resolution block */
|
||||
if (wblock->block == NULL) {
|
||||
|
@ -1990,7 +1986,7 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
}
|
||||
if (!wtap_read_bytes(fh, &nrb, sizeof nrb, err, err_info)) {
|
||||
ws_buffer_free(&nrb_rec);
|
||||
pcapng_debug("pcapng_read_name_resolution_block: failed to read record header");
|
||||
ws_debug("pcapng_read_name_resolution_block: failed to read record header");
|
||||
return FALSE;
|
||||
}
|
||||
block_read += (int)sizeof nrb;
|
||||
|
@ -2039,7 +2035,7 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
if (!wtap_read_bytes(fh, ws_buffer_start_ptr(&nrb_rec),
|
||||
nrb.record_len, err, err_info)) {
|
||||
ws_buffer_free(&nrb_rec);
|
||||
pcapng_debug("pcapng_read_name_resolution_block: failed to read IPv4 record data");
|
||||
ws_debug("pcapng_read_name_resolution_block: failed to read IPv4 record data");
|
||||
return FALSE;
|
||||
}
|
||||
block_read += nrb.record_len;
|
||||
|
@ -2137,7 +2133,7 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
block_read += PADDING4(nrb.record_len);
|
||||
break;
|
||||
default:
|
||||
pcapng_debug("pcapng_read_name_resolution_block: unknown record type 0x%x", nrb.record_type);
|
||||
ws_debug("pcapng_read_name_resolution_block: unknown record type 0x%x", nrb.record_type);
|
||||
if (!wtap_read_bytes(fh, NULL, nrb.record_len + PADDING4(nrb.record_len), err, err_info)) {
|
||||
ws_buffer_free(&nrb_rec);
|
||||
return FALSE;
|
||||
|
@ -2173,7 +2169,7 @@ read_options:
|
|||
/* read option */
|
||||
bytes_read = pcapng_read_option(fh, section_info, &oh, option_content, opt_cont_buf_len, to_read, err, err_info, "name_resolution");
|
||||
if (bytes_read <= 0) {
|
||||
pcapng_debug("pcapng_read_name_resolution_block: failed to read option");
|
||||
ws_debug("pcapng_read_name_resolution_block: failed to read option");
|
||||
g_free(option_content);
|
||||
ws_buffer_free(&nrb_rec);
|
||||
return FALSE;
|
||||
|
@ -2200,7 +2196,7 @@ read_options:
|
|||
switch (oh.option_code) {
|
||||
case(OPT_EOFOPT):
|
||||
if (to_read != 0) {
|
||||
pcapng_debug("pcapng_read_name_resolution_block: %u bytes after opt_endofopt", to_read);
|
||||
ws_debug("pcapng_read_name_resolution_block: %u bytes after opt_endofopt", to_read);
|
||||
}
|
||||
/* padding should be ok here, just get out of this */
|
||||
to_read = 0;
|
||||
|
@ -2254,7 +2250,7 @@ pcapng_read_interface_statistics_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
|
||||
/* "Interface Statistics Block" read fixed part */
|
||||
if (!wtap_read_bytes(fh, &isb, sizeof isb, err, err_info)) {
|
||||
pcapng_debug("pcapng_read_interface_statistics_block: failed to read packet data");
|
||||
ws_debug("pcapng_read_interface_statistics_block: failed to read packet data");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -2269,7 +2265,7 @@ pcapng_read_interface_statistics_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
if_stats_mand->ts_high = isb.timestamp_high;
|
||||
if_stats_mand->ts_low = isb.timestamp_low;
|
||||
}
|
||||
pcapng_debug("pcapng_read_interface_statistics_block: interface_id %u", if_stats_mand->interface_id);
|
||||
ws_debug("pcapng_read_interface_statistics_block: interface_id %u", if_stats_mand->interface_id);
|
||||
|
||||
/* Options */
|
||||
to_read = bh->block_total_length -
|
||||
|
@ -2287,7 +2283,7 @@ pcapng_read_interface_statistics_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
/* read option */
|
||||
bytes_read = pcapng_read_option(fh, section_info, &oh, option_content, opt_cont_buf_len, to_read, err, err_info, "interface_statistics");
|
||||
if (bytes_read <= 0) {
|
||||
pcapng_debug("pcapng_read_interface_statistics_block: failed to read option");
|
||||
ws_debug("pcapng_read_interface_statistics_block: failed to read option");
|
||||
g_free(option_content);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -2313,7 +2309,7 @@ pcapng_read_interface_statistics_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
switch (oh.option_code) {
|
||||
case(OPT_EOFOPT): /* opt_endofopt */
|
||||
if (to_read != 0) {
|
||||
pcapng_debug("pcapng_read_interface_statistics_block: %u bytes after opt_endofopt", to_read);
|
||||
ws_debug("pcapng_read_interface_statistics_block: %u bytes after opt_endofopt", to_read);
|
||||
}
|
||||
/* padding should be ok here, just get out of this */
|
||||
to_read = 0;
|
||||
|
@ -2397,7 +2393,7 @@ pcapng_read_sysdig_event_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
block_total_length = bh->block_total_length;
|
||||
}
|
||||
|
||||
pcapng_debug("pcapng_read_sysdig_event_block: block_total_length %u",
|
||||
ws_debug("pcapng_read_sysdig_event_block: block_total_length %u",
|
||||
bh->block_total_length);
|
||||
|
||||
wblock->rec->rec_type = REC_TYPE_SYSCALL;
|
||||
|
@ -2406,28 +2402,28 @@ pcapng_read_sysdig_event_block(FILE_T fh, pcapng_block_header_t *bh,
|
|||
wblock->rec->tsprec = WTAP_TSPREC_NSEC;
|
||||
|
||||
if (!wtap_read_bytes(fh, &cpu_id, sizeof cpu_id, err, err_info)) {
|
||||
pcapng_debug("pcapng_read_packet_block: failed to read sysdig event cpu id");
|
||||
ws_debug("pcapng_read_packet_block: failed to read sysdig event cpu id");
|
||||
return FALSE;
|
||||
}
|
||||
if (!wtap_read_bytes(fh, &wire_ts, sizeof wire_ts, err, err_info)) {
|
||||
pcapng_debug("pcapng_read_packet_block: failed to read sysdig event timestamp");
|
||||
ws_debug("pcapng_read_packet_block: failed to read sysdig event timestamp");
|
||||
return FALSE;
|
||||
}
|
||||
if (!wtap_read_bytes(fh, &thread_id, sizeof thread_id, err, err_info)) {
|
||||
pcapng_debug("pcapng_read_packet_block: failed to read sysdig event thread id");
|
||||
ws_debug("pcapng_read_packet_block: failed to read sysdig event thread id");
|
||||
return FALSE;
|
||||
}
|
||||
if (!wtap_read_bytes(fh, &event_len, sizeof event_len, err, err_info)) {
|
||||
pcapng_debug("pcapng_read_packet_block: failed to read sysdig event length");
|
||||
ws_debug("pcapng_read_packet_block: failed to read sysdig event length");
|
||||
return FALSE;
|
||||
}
|
||||
if (!wtap_read_bytes(fh, &event_type, sizeof event_type, err, err_info)) {
|
||||
pcapng_debug("pcapng_read_packet_block: failed to read sysdig event type");
|
||||
ws_debug("pcapng_read_packet_block: failed to read sysdig event type");
|
||||
return FALSE;
|
||||
}
|
||||
if (bh->block_type == BLOCK_TYPE_SYSDIG_EVENT_V2) {
|
||||
if (!wtap_read_bytes(fh, &nparams, sizeof nparams, err, err_info)) {
|
||||
pcapng_debug("pcapng_read_packet_block: failed to read sysdig number of parameters");
|
||||
ws_debug("pcapng_read_packet_block: failed to read sysdig number of parameters");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -2501,7 +2497,7 @@ pcapng_read_systemd_journal_export_block(wtap *wth, FILE_T fh, pcapng_block_head
|
|||
block_total_length = bh->block_total_length;
|
||||
}
|
||||
|
||||
pcapng_debug("%s: block_total_length %u", G_STRFUNC, bh->block_total_length);
|
||||
ws_debug("%s: block_total_length %u", G_STRFUNC, bh->block_total_length);
|
||||
|
||||
entry_length = block_total_length - MIN_BLOCK_SIZE;
|
||||
|
||||
|
@ -2529,7 +2525,7 @@ pcapng_read_systemd_journal_export_block(wtap *wth, FILE_T fh, pcapng_block_head
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
pcapng_debug("%s: entry_length %u", G_STRFUNC, entry_length);
|
||||
ws_debug("%s: entry_length %u", G_STRFUNC, entry_length);
|
||||
|
||||
size_t rt_ts_len = strlen(SDJ__REALTIME_TIMESTAMP);
|
||||
|
||||
|
@ -2537,15 +2533,15 @@ pcapng_read_systemd_journal_export_block(wtap *wth, FILE_T fh, pcapng_block_head
|
|||
char *ts_pos = strstr(buf_ptr, SDJ__REALTIME_TIMESTAMP);
|
||||
|
||||
if (!ts_pos) {
|
||||
pcapng_debug("%s: no timestamp", G_STRFUNC);
|
||||
ws_debug("%s: no timestamp", G_STRFUNC);
|
||||
} else if (ts_pos+rt_ts_len >= (char *) buf_ptr+entry_length) {
|
||||
pcapng_debug("%s: timestamp past end of buffer", G_STRFUNC);
|
||||
ws_debug("%s: timestamp past end of buffer", G_STRFUNC);
|
||||
} else {
|
||||
const char *ts_end;
|
||||
have_ts = ws_strtou64(ts_pos+rt_ts_len, &ts_end, &rt_ts);
|
||||
|
||||
if (!have_ts) {
|
||||
pcapng_debug("%s: invalid timestamp", G_STRFUNC);
|
||||
ws_debug("%s: invalid timestamp", G_STRFUNC);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2649,7 +2645,7 @@ pcapng_read_and_check_block_trailer(FILE_T fh, pcapng_block_header_t *bh,
|
|||
/* sanity check: first and second block lengths must match */
|
||||
if (!wtap_read_bytes(fh, &block_total_length, sizeof block_total_length,
|
||||
err, err_info)) {
|
||||
pcapng_debug("pcapng_read_and_check_block_trailer: couldn't read second block length");
|
||||
ws_debug("pcapng_read_and_check_block_trailer: couldn't read second block length");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -2679,7 +2675,7 @@ pcapng_read_block(wtap *wth, FILE_T fh, pcapng_t *pn,
|
|||
|
||||
/* Try to read the (next) block header */
|
||||
if (!wtap_read_bytes_or_eof(fh, &bh, sizeof bh, err, err_info)) {
|
||||
pcapng_debug("pcapng_read_block: wtap_read_bytes_or_eof() failed, err = %d.", *err);
|
||||
ws_debug("pcapng_read_block: wtap_read_bytes_or_eof() failed, err = %d.", *err);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -2706,7 +2702,7 @@ pcapng_read_block(wtap *wth, FILE_T fh, pcapng_t *pn,
|
|||
*/
|
||||
wblock->type = bh.block_type;
|
||||
|
||||
pcapng_debug("pcapng_read_block: block_type 0x%x", bh.block_type);
|
||||
ws_debug("pcapng_read_block: block_type 0x%x", bh.block_type);
|
||||
|
||||
/*
|
||||
* Fill in the section_info_t passed to us for use when
|
||||
|
@ -2736,7 +2732,7 @@ pcapng_read_block(wtap *wth, FILE_T fh, pcapng_t *pn,
|
|||
|
||||
wblock->type = bh.block_type;
|
||||
|
||||
pcapng_debug("pcapng_read_block: block_type 0x%x", bh.block_type);
|
||||
ws_debug("pcapng_read_block: block_type 0x%x", bh.block_type);
|
||||
|
||||
/* Don't try to allocate memory for a huge number of options, as
|
||||
that might fail and, even if it succeeds, it might not leave
|
||||
|
@ -2800,7 +2796,7 @@ pcapng_read_block(wtap *wth, FILE_T fh, pcapng_t *pn,
|
|||
return FALSE;
|
||||
break;
|
||||
default:
|
||||
pcapng_debug("pcapng_read_block: Unknown block_type: 0x%x (block ignored), block total length %d", bh.block_type, bh.block_total_length);
|
||||
ws_debug("pcapng_read_block: Unknown block_type: 0x%x (block ignored), block total length %d", bh.block_type, bh.block_total_length);
|
||||
if (!pcapng_read_unknown_block(fh, &bh, section_info, wblock, err, err_info))
|
||||
return FALSE;
|
||||
break;
|
||||
|
@ -2871,14 +2867,14 @@ pcapng_open(wtap *wth, int *err, gchar **err_info)
|
|||
gint64 saved_offset;
|
||||
section_info_t first_section, new_section, *current_section;
|
||||
|
||||
pcapng_debug("pcapng_open: opening file");
|
||||
ws_debug("pcapng_open: opening file");
|
||||
/*
|
||||
* Read first block.
|
||||
*
|
||||
* First, try to read the block header.
|
||||
*/
|
||||
if (!wtap_read_bytes_or_eof(wth->fh, &bh, sizeof bh, err, err_info)) {
|
||||
pcapng_debug("pcapng_open: wtap_read_bytes_or_eof() failed, err = %d.", *err);
|
||||
ws_debug("pcapng_open: wtap_read_bytes_or_eof() failed, err = %d.", *err);
|
||||
if (*err == 0 || *err == WTAP_ERR_SHORT_READ) {
|
||||
/*
|
||||
* Short read or EOF.
|
||||
|
@ -2906,11 +2902,11 @@ pcapng_open(wtap *wth, int *err, gchar **err_info)
|
|||
* between Windows and UN*X as text rather than
|
||||
* binary data?
|
||||
*/
|
||||
pcapng_debug("pcapng_open: first block type %u not SHB", bh.block_type);
|
||||
ws_debug("pcapng_open: first block type %u not SHB", bh.block_type);
|
||||
return WTAP_OPEN_NOT_MINE;
|
||||
}
|
||||
|
||||
pcapng_debug("pcapng_open: got an SHB");
|
||||
ws_debug("pcapng_open: got an SHB");
|
||||
|
||||
/*
|
||||
* Now try to read the block body, filling in the section_info_t
|
||||
|
@ -3025,10 +3021,10 @@ pcapng_open(wtap *wth, int *err, gchar **err_info)
|
|||
if (!wtap_read_bytes_or_eof(wth->fh, &bh, sizeof bh, err, err_info)) {
|
||||
if (*err == 0) {
|
||||
/* EOF */
|
||||
pcapng_debug("No more IDBs available...");
|
||||
ws_debug("No more IDBs available...");
|
||||
break;
|
||||
}
|
||||
pcapng_debug("pcapng_open: Check for more IDBs, wtap_read_bytes_or_eof() failed, err = %d.", *err);
|
||||
ws_debug("pcapng_open: Check for more IDBs, wtap_read_bytes_or_eof() failed, err = %d.", *err);
|
||||
return WTAP_OPEN_ERROR;
|
||||
}
|
||||
|
||||
|
@ -3045,7 +3041,7 @@ pcapng_open(wtap *wth, int *err, gchar **err_info)
|
|||
bh.block_type = GUINT32_SWAP_LE_BE(bh.block_type);
|
||||
}
|
||||
|
||||
pcapng_debug("pcapng_open: Check for more IDBs, block_type 0x%x", bh.block_type);
|
||||
ws_debug("pcapng_open: Check for more IDBs, block_type 0x%x", bh.block_type);
|
||||
|
||||
if (bh.block_type != BLOCK_TYPE_IDB) {
|
||||
break; /* No more IDBs */
|
||||
|
@ -3055,16 +3051,16 @@ pcapng_open(wtap *wth, int *err, gchar **err_info)
|
|||
&new_section, &wblock, err, err_info)) {
|
||||
wtap_block_free(wblock.block);
|
||||
if (*err == 0) {
|
||||
pcapng_debug("No more IDBs available...");
|
||||
ws_debug("No more IDBs available...");
|
||||
break;
|
||||
} else {
|
||||
pcapng_debug("pcapng_open: couldn't read IDB");
|
||||
ws_debug("pcapng_open: couldn't read IDB");
|
||||
return WTAP_OPEN_ERROR;
|
||||
}
|
||||
}
|
||||
pcapng_process_idb(wth, current_section, &wblock);
|
||||
wtap_block_free(wblock.block);
|
||||
pcapng_debug("pcapng_open: Read IDB number_of_interfaces %u, wtap_encap %i",
|
||||
ws_debug("pcapng_open: Read IDB number_of_interfaces %u, wtap_encap %i",
|
||||
wth->interface_data->len, wth->file_encap);
|
||||
}
|
||||
return WTAP_OPEN_MINE;
|
||||
|
@ -3093,7 +3089,7 @@ pcapng_read(wtap *wth, wtap_rec *rec, Buffer *buf, int *err,
|
|||
/* read next block */
|
||||
while (1) {
|
||||
*data_offset = file_tell(wth->fh);
|
||||
pcapng_debug("pcapng_read: data_offset is %" G_GINT64_MODIFIER "d", *data_offset);
|
||||
ws_debug("pcapng_read: data_offset is %" G_GINT64_MODIFIER "d", *data_offset);
|
||||
|
||||
/*
|
||||
* Get the section_info_t for the current section.
|
||||
|
@ -3106,8 +3102,8 @@ pcapng_read(wtap *wth, wtap_rec *rec, Buffer *buf, int *err,
|
|||
*/
|
||||
if (!pcapng_read_block(wth, wth->fh, pcapng, current_section,
|
||||
&new_section, &wblock, err, err_info)) {
|
||||
pcapng_debug("pcapng_read: data_offset is finally %" G_GINT64_MODIFIER "d", *data_offset);
|
||||
pcapng_debug("pcapng_read: couldn't read packet block");
|
||||
ws_debug("pcapng_read: data_offset is finally %" G_GINT64_MODIFIER "d", *data_offset);
|
||||
ws_debug("pcapng_read: couldn't read packet block");
|
||||
wtap_block_free(wblock.block);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -3126,7 +3122,7 @@ pcapng_read(wtap *wth, wtap_rec *rec, Buffer *buf, int *err,
|
|||
switch (wblock.type) {
|
||||
|
||||
case(BLOCK_TYPE_SHB):
|
||||
pcapng_debug("pcapng_read: another section header block");
|
||||
ws_debug("pcapng_read: another section header block");
|
||||
g_array_append_val(wth->shb_hdrs, wblock.block);
|
||||
|
||||
/*
|
||||
|
@ -3142,21 +3138,21 @@ pcapng_read(wtap *wth, wtap_rec *rec, Buffer *buf, int *err,
|
|||
|
||||
case(BLOCK_TYPE_IDB):
|
||||
/* A new interface */
|
||||
pcapng_debug("pcapng_read: block type BLOCK_TYPE_IDB");
|
||||
ws_debug("pcapng_read: block type BLOCK_TYPE_IDB");
|
||||
pcapng_process_idb(wth, current_section, &wblock);
|
||||
wtap_block_free(wblock.block);
|
||||
break;
|
||||
|
||||
case(BLOCK_TYPE_DSB):
|
||||
/* Decryption secrets. */
|
||||
pcapng_debug("pcapng_read: block type BLOCK_TYPE_DSB");
|
||||
ws_debug("pcapng_read: block type BLOCK_TYPE_DSB");
|
||||
pcapng_process_dsb(wth, &wblock);
|
||||
/* Do not free wblock.block, it is consumed by pcapng_process_dsb */
|
||||
break;
|
||||
|
||||
case(BLOCK_TYPE_NRB):
|
||||
/* More name resolution entries */
|
||||
pcapng_debug("pcapng_read: block type BLOCK_TYPE_NRB");
|
||||
ws_debug("pcapng_read: block type BLOCK_TYPE_NRB");
|
||||
if (wth->nrb_hdrs == NULL) {
|
||||
wth->nrb_hdrs = g_array_new(FALSE, FALSE, sizeof(wtap_block_t));
|
||||
}
|
||||
|
@ -3184,17 +3180,17 @@ pcapng_read(wtap *wth, wtap_rec *rec, Buffer *buf, int *err,
|
|||
* that would be the best way of showing "summary"
|
||||
* statistics.
|
||||
*/
|
||||
pcapng_debug("pcapng_read: block type BLOCK_TYPE_ISB");
|
||||
ws_debug("pcapng_read: block type BLOCK_TYPE_ISB");
|
||||
if_stats_mand_block = (wtapng_if_stats_mandatory_t*)wtap_block_get_mandatory_data(wblock.block);
|
||||
if (wth->interface_data->len <= if_stats_mand_block->interface_id) {
|
||||
pcapng_debug("pcapng_read: BLOCK_TYPE_ISB wblock.if_stats.interface_id %u >= number_of_interfaces", if_stats_mand_block->interface_id);
|
||||
ws_debug("pcapng_read: BLOCK_TYPE_ISB wblock.if_stats.interface_id %u >= number_of_interfaces", if_stats_mand_block->interface_id);
|
||||
} else {
|
||||
/* Get the interface description */
|
||||
wtapng_if_descr = g_array_index(wth->interface_data, wtap_block_t, if_stats_mand_block->interface_id);
|
||||
wtapng_if_descr_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(wtapng_if_descr);
|
||||
if (wtapng_if_descr_mand->num_stat_entries == 0) {
|
||||
/* First ISB found, no previous entry */
|
||||
pcapng_debug("pcapng_read: block type BLOCK_TYPE_ISB. First ISB found, no previous entry");
|
||||
ws_debug("pcapng_read: block type BLOCK_TYPE_ISB. First ISB found, no previous entry");
|
||||
wtapng_if_descr_mand->interface_statistics = g_array_new(FALSE, FALSE, sizeof(wtap_block_t));
|
||||
}
|
||||
|
||||
|
@ -3213,13 +3209,13 @@ pcapng_read(wtap *wth, wtap_rec *rec, Buffer *buf, int *err,
|
|||
|
||||
default:
|
||||
/* XXX - improve handling of "unknown" blocks */
|
||||
pcapng_debug("pcapng_read: Unknown block type 0x%08x", wblock.type);
|
||||
ws_debug("pcapng_read: Unknown block type 0x%08x", wblock.type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*pcapng_debug("Read length: %u Packet length: %u", bytes_read, rec->rec_header.packet_header.caplen);*/
|
||||
pcapng_debug("pcapng_read: data_offset is finally %" G_GINT64_MODIFIER "d", *data_offset);
|
||||
/*ws_debug("Read length: %u Packet length: %u", bytes_read, rec->rec_header.packet_header.caplen);*/
|
||||
ws_debug("pcapng_read: data_offset is finally %" G_GINT64_MODIFIER "d", *data_offset);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -3240,7 +3236,7 @@ pcapng_seek_read(wtap *wth, gint64 seek_off,
|
|||
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) < 0) {
|
||||
return FALSE; /* Seek error */
|
||||
}
|
||||
pcapng_debug("pcapng_seek_read: reading at offset %" G_GINT64_MODIFIER "u", seek_off);
|
||||
ws_debug("pcapng_seek_read: reading at offset %" G_GINT64_MODIFIER "u", seek_off);
|
||||
|
||||
/*
|
||||
* Find the section_info_t for the section in which this block
|
||||
|
@ -3279,7 +3275,7 @@ pcapng_seek_read(wtap *wth, gint64 seek_off,
|
|||
/* read the block */
|
||||
if (!pcapng_read_block(wth, wth->random_fh, pcapng, section_info,
|
||||
&new_section, &wblock, err, err_info)) {
|
||||
pcapng_debug("pcapng_seek_read: couldn't read packet block (err=%d).",
|
||||
ws_debug("pcapng_seek_read: couldn't read packet block (err=%d).",
|
||||
*err);
|
||||
wtap_block_free(wblock.block);
|
||||
return FALSE;
|
||||
|
@ -3287,7 +3283,7 @@ pcapng_seek_read(wtap *wth, gint64 seek_off,
|
|||
|
||||
/* block must not be one we process internally rather than supplying */
|
||||
if (wblock.internal) {
|
||||
pcapng_debug("pcapng_seek_read: block type %u is not one we return",
|
||||
ws_debug("pcapng_seek_read: block type %u is not one we return",
|
||||
wblock.type);
|
||||
wtap_block_free(wblock.block);
|
||||
return FALSE;
|
||||
|
@ -3304,7 +3300,7 @@ pcapng_close(wtap *wth)
|
|||
{
|
||||
pcapng_t *pcapng = (pcapng_t *)wth->priv;
|
||||
|
||||
pcapng_debug("pcapng_close: closing file");
|
||||
ws_debug("pcapng_close: closing file");
|
||||
|
||||
/*
|
||||
* Free up the interfaces tables for all the sections.
|
||||
|
@ -3530,7 +3526,7 @@ pcapng_write_section_header_block(wtap_dumper *wdh, int *err)
|
|||
block_size.size = 0;
|
||||
bh.block_total_length = (guint32)(sizeof(bh) + sizeof(shb) + 4);
|
||||
if (wdh_shb) {
|
||||
pcapng_debug("pcapng_write_section_header_block: Have shb_hdr");
|
||||
ws_debug("pcapng_write_section_header_block: Have shb_hdr");
|
||||
|
||||
/* Compute block size */
|
||||
wtap_block_foreach_option(wdh_shb, compute_shb_option_size, &block_size);
|
||||
|
@ -3543,7 +3539,7 @@ pcapng_write_section_header_block(wtap_dumper *wdh, int *err)
|
|||
bh.block_total_length += block_size.size;
|
||||
}
|
||||
|
||||
pcapng_debug("pcapng_write_section_header_block: Total len %u", bh.block_total_length);
|
||||
ws_debug("pcapng_write_section_header_block: Total len %u", bh.block_total_length);
|
||||
|
||||
/* write block header */
|
||||
bh.block_type = BLOCK_TYPE_SHB;
|
||||
|
@ -3805,7 +3801,7 @@ pcapng_write_enhanced_packet_block(wtap_dumper *wdh, const wtap_rec *rec,
|
|||
wdh->bytes_dumped += 4;
|
||||
|
||||
/* Write the comments string */
|
||||
pcapng_debug("pcapng_write_enhanced_packet_block, comment:'%s' comment_len %u comment_pad_len %u" , rec->opt_comment, comment_len, comment_pad_len);
|
||||
ws_debug("pcapng_write_enhanced_packet_block, comment:'%s' comment_len %u comment_pad_len %u" , rec->opt_comment, comment_len, comment_pad_len);
|
||||
if (!wtap_dump_file_write(wdh, rec->opt_comment, comment_len, err))
|
||||
return FALSE;
|
||||
wdh->bytes_dumped += comment_len;
|
||||
|
@ -3817,7 +3813,7 @@ pcapng_write_enhanced_packet_block(wtap_dumper *wdh, const wtap_rec *rec,
|
|||
wdh->bytes_dumped += comment_pad_len;
|
||||
}
|
||||
|
||||
pcapng_debug("pcapng_write_enhanced_packet_block: Wrote Options comments: comment_len %u, comment_pad_len %u",
|
||||
ws_debug("pcapng_write_enhanced_packet_block: Wrote Options comments: comment_len %u, comment_pad_len %u",
|
||||
comment_len,
|
||||
comment_pad_len);
|
||||
}
|
||||
|
@ -3830,7 +3826,7 @@ pcapng_write_enhanced_packet_block(wtap_dumper *wdh, const wtap_rec *rec,
|
|||
if (!wtap_dump_file_write(wdh, &rec->rec_header.packet_header.pack_flags, 4, err))
|
||||
return FALSE;
|
||||
wdh->bytes_dumped += 4;
|
||||
pcapng_debug("pcapng_write_enhanced_packet_block: Wrote Options packet flags: %x", rec->rec_header.packet_header.pack_flags);
|
||||
ws_debug("pcapng_write_enhanced_packet_block: Wrote Options packet flags: %x", rec->rec_header.packet_header.pack_flags);
|
||||
}
|
||||
if (rec->presence_flags & WTAP_HAS_DROP_COUNT) {
|
||||
option_hdr.type = OPT_EPB_DROPCOUNT;
|
||||
|
@ -3841,7 +3837,7 @@ pcapng_write_enhanced_packet_block(wtap_dumper *wdh, const wtap_rec *rec,
|
|||
if (!wtap_dump_file_write(wdh, &rec->rec_header.packet_header.drop_count, 8, err))
|
||||
return FALSE;
|
||||
wdh->bytes_dumped += 8;
|
||||
pcapng_debug("pcapng_write_enhanced_packet_block: Wrote Options drop count: %" G_GINT64_MODIFIER "u", rec->rec_header.packet_header.drop_count);
|
||||
ws_debug("pcapng_write_enhanced_packet_block: Wrote Options drop count: %" G_GINT64_MODIFIER "u", rec->rec_header.packet_header.drop_count);
|
||||
}
|
||||
if (rec->presence_flags & WTAP_HAS_PACKET_ID) {
|
||||
option_hdr.type = OPT_EPB_PACKETID;
|
||||
|
@ -3852,7 +3848,7 @@ pcapng_write_enhanced_packet_block(wtap_dumper *wdh, const wtap_rec *rec,
|
|||
if (!wtap_dump_file_write(wdh, &rec->rec_header.packet_header.packet_id, 8, err))
|
||||
return FALSE;
|
||||
wdh->bytes_dumped += 8;
|
||||
pcapng_debug("pcapng_write_enhanced_packet_block: Wrote Options packet id: %" G_GINT64_MODIFIER "u", rec->rec_header.packet_header.packet_id);
|
||||
ws_debug("pcapng_write_enhanced_packet_block: Wrote Options packet id: %" G_GINT64_MODIFIER "u", rec->rec_header.packet_header.packet_id);
|
||||
}
|
||||
if (rec->presence_flags & WTAP_HAS_INT_QUEUE) {
|
||||
option_hdr.type = OPT_EPB_QUEUE;
|
||||
|
@ -3863,7 +3859,7 @@ pcapng_write_enhanced_packet_block(wtap_dumper *wdh, const wtap_rec *rec,
|
|||
if (!wtap_dump_file_write(wdh, &rec->rec_header.packet_header.interface_queue, 4, err))
|
||||
return FALSE;
|
||||
wdh->bytes_dumped += 4;
|
||||
pcapng_debug("pcapng_write_enhanced_packet_block: Wrote Options queue: %u", rec->rec_header.packet_header.interface_queue);
|
||||
ws_debug("pcapng_write_enhanced_packet_block: Wrote Options queue: %u", rec->rec_header.packet_header.interface_queue);
|
||||
}
|
||||
if (rec->presence_flags & WTAP_HAS_VERDICT && rec->packet_verdict != NULL) {
|
||||
|
||||
|
@ -3890,7 +3886,7 @@ pcapng_write_enhanced_packet_block(wtap_dumper *wdh, const wtap_rec *rec,
|
|||
return FALSE;
|
||||
wdh->bytes_dumped += plen;
|
||||
}
|
||||
pcapng_debug("pcapng_write_enhanced_packet_block: Wrote Options verdict: %u",
|
||||
ws_debug("pcapng_write_enhanced_packet_block: Wrote Options verdict: %u",
|
||||
verdict_data[0]);
|
||||
}
|
||||
}
|
||||
|
@ -4044,7 +4040,7 @@ pcapng_write_systemd_journal_export_block(wtap_dumper *wdh, const wtap_rec *rec,
|
|||
bh.block_type = BLOCK_TYPE_SYSTEMD_JOURNAL;
|
||||
bh.block_total_length = (guint32)sizeof(bh) + rec->rec_header.systemd_journal_header.record_len + pad_len + 4;
|
||||
|
||||
pcapng_debug("%s: writing %u bytes, %u padded", G_STRFUNC,
|
||||
ws_debug("%s: writing %u bytes, %u padded", G_STRFUNC,
|
||||
rec->rec_header.systemd_journal_header.record_len,
|
||||
bh.block_total_length);
|
||||
|
||||
|
@ -4084,7 +4080,7 @@ pcapng_write_decryption_secrets_block(wtap_dumper *wdh, wtap_block_t sdata, int
|
|||
/* write block header */
|
||||
bh.block_type = BLOCK_TYPE_DSB;
|
||||
bh.block_total_length = MIN_DSB_SIZE + mand_data->secrets_len + pad_len;
|
||||
pcapng_debug("%s: Total len %u", G_STRFUNC, bh.block_total_length);
|
||||
ws_debug("%s: Total len %u", G_STRFUNC, bh.block_total_length);
|
||||
|
||||
if (!wtap_dump_file_write(wdh, &bh, sizeof bh, err))
|
||||
return FALSE;
|
||||
|
@ -4369,7 +4365,7 @@ pcapng_write_name_resolution_block(wtap_dumper *wdh, int *err)
|
|||
/* Copy the block trailer. */
|
||||
memcpy(block_data + block_off, &bh.block_total_length, sizeof(bh.block_total_length));
|
||||
|
||||
pcapng_debug("pcapng_write_name_resolution_block: Write bh.block_total_length bytes %d, block_off %u", bh.block_total_length, block_off);
|
||||
ws_debug("pcapng_write_name_resolution_block: Write bh.block_total_length bytes %d, block_off %u", bh.block_total_length, block_off);
|
||||
|
||||
if (!wtap_dump_file_write(wdh, block_data, bh.block_total_length, err)) {
|
||||
g_free(block_data);
|
||||
|
@ -4392,7 +4388,7 @@ pcapng_write_name_resolution_block(wtap_dumper *wdh, int *err)
|
|||
block_off += namelen;
|
||||
memset(block_data + block_off, 0, PADDING4(namelen));
|
||||
block_off += PADDING4(namelen);
|
||||
pcapng_debug("NRB: added IPv4 record for %s", ipv4_hash_list_entry->name);
|
||||
ws_debug("NRB: added IPv4 record for %s", ipv4_hash_list_entry->name);
|
||||
|
||||
i++;
|
||||
ipv4_hash_list_entry = (hashipv4_t *)g_list_nth_data(wdh->addrinfo_lists->ipv4_addr_list, i);
|
||||
|
@ -4449,7 +4445,7 @@ pcapng_write_name_resolution_block(wtap_dumper *wdh, int *err)
|
|||
/* Copy the block trailer. */
|
||||
memcpy(block_data + block_off, &bh.block_total_length, sizeof(bh.block_total_length));
|
||||
|
||||
pcapng_debug("pcapng_write_name_resolution_block: Write bh.block_total_length bytes %d, block_off %u", bh.block_total_length, block_off);
|
||||
ws_debug("pcapng_write_name_resolution_block: Write bh.block_total_length bytes %d, block_off %u", bh.block_total_length, block_off);
|
||||
|
||||
if (!wtap_dump_file_write(wdh, block_data, bh.block_total_length, err)) {
|
||||
g_free(block_data);
|
||||
|
@ -4472,7 +4468,7 @@ pcapng_write_name_resolution_block(wtap_dumper *wdh, int *err)
|
|||
block_off += namelen;
|
||||
memset(block_data + block_off, 0, PADDING4(namelen));
|
||||
block_off += PADDING4(namelen);
|
||||
pcapng_debug("NRB: added IPv6 record for %s", ipv6_hash_list_entry->name);
|
||||
ws_debug("NRB: added IPv6 record for %s", ipv6_hash_list_entry->name);
|
||||
|
||||
i++;
|
||||
ipv6_hash_list_entry = (hashipv6_t *)g_list_nth_data(wdh->addrinfo_lists->ipv6_addr_list, i);
|
||||
|
@ -4499,7 +4495,7 @@ pcapng_write_name_resolution_block(wtap_dumper *wdh, int *err)
|
|||
/* Copy the block trailer. */
|
||||
memcpy(block_data + block_off, &bh.block_total_length, sizeof(bh.block_total_length));
|
||||
|
||||
pcapng_debug("pcapng_write_name_resolution_block: Write bh.block_total_length bytes %d, block_off %u", bh.block_total_length, block_off);
|
||||
ws_debug("pcapng_write_name_resolution_block: Write bh.block_total_length bytes %d, block_off %u", bh.block_total_length, block_off);
|
||||
|
||||
if (!wtap_dump_file_write(wdh, block_data, bh.block_total_length, err)) {
|
||||
g_free(block_data);
|
||||
|
@ -4599,7 +4595,7 @@ pcapng_write_interface_statistics_block(wtap_dumper *wdh, wtap_block_t if_stats,
|
|||
struct pcapng_option_header option_hdr;
|
||||
wtapng_if_stats_mandatory_t* mand_data = (wtapng_if_stats_mandatory_t*)wtap_block_get_mandatory_data(if_stats);
|
||||
|
||||
pcapng_debug("pcapng_write_interface_statistics_block");
|
||||
ws_debug("pcapng_write_interface_statistics_block");
|
||||
|
||||
/* Compute block size */
|
||||
block_size.size = 0;
|
||||
|
@ -4613,7 +4609,7 @@ pcapng_write_interface_statistics_block(wtap_dumper *wdh, wtap_block_t if_stats,
|
|||
/* write block header */
|
||||
bh.block_type = BLOCK_TYPE_ISB;
|
||||
bh.block_total_length = (guint32)(sizeof(bh) + sizeof(isb) + block_size.size + 4);
|
||||
pcapng_debug("pcapng_write_interface_statistics_block: Total len %u", bh.block_total_length);
|
||||
ws_debug("pcapng_write_interface_statistics_block: Total len %u", bh.block_total_length);
|
||||
|
||||
if (!wtap_dump_file_write(wdh, &bh, sizeof bh, err))
|
||||
return FALSE;
|
||||
|
@ -4864,7 +4860,7 @@ pcapng_write_if_descr_block(wtap_dumper *wdh, wtap_block_t int_data, int *err)
|
|||
wtapng_if_descr_mandatory_t* mand_data = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(int_data);
|
||||
int link_type;
|
||||
|
||||
pcapng_debug("pcapng_write_if_descr_block: encap = %d (%s), snaplen = %d",
|
||||
ws_debug("pcapng_write_if_descr_block: encap = %d (%s), snaplen = %d",
|
||||
mand_data->wtap_encap,
|
||||
wtap_encap_description(mand_data->wtap_encap),
|
||||
mand_data->snap_len);
|
||||
|
@ -4889,7 +4885,7 @@ pcapng_write_if_descr_block(wtap_dumper *wdh, wtap_block_t int_data, int *err)
|
|||
/* write block header */
|
||||
bh.block_type = BLOCK_TYPE_IDB;
|
||||
bh.block_total_length = (guint32)(sizeof(bh) + sizeof(idb) + block_size.size + 4);
|
||||
pcapng_debug("pcapng_write_if_descr_block: Total len %u", bh.block_total_length);
|
||||
ws_debug("pcapng_write_if_descr_block: Total len %u", bh.block_total_length);
|
||||
|
||||
if (!wtap_dump_file_write(wdh, &bh, sizeof bh, err))
|
||||
return FALSE;
|
||||
|
@ -4961,7 +4957,7 @@ static gboolean pcapng_dump(wtap_dumper *wdh,
|
|||
* reading packet blocks. */
|
||||
if (wdh->dsbs_growing) {
|
||||
for (guint i = wdh->dsbs_growing_written; i < wdh->dsbs_growing->len; i++) {
|
||||
pcapng_debug("%s: writing DSB %u", G_STRFUNC, i);
|
||||
ws_debug("%s: writing DSB %u", G_STRFUNC, i);
|
||||
wtap_block_t dsb = g_array_index(wdh->dsbs_growing, wtap_block_t, i);
|
||||
if (!pcapng_write_decryption_secrets_block(wdh, dsb, err)) {
|
||||
return FALSE;
|
||||
|
@ -4971,7 +4967,7 @@ static gboolean pcapng_dump(wtap_dumper *wdh,
|
|||
}
|
||||
|
||||
|
||||
pcapng_debug("%s: encap = %d (%s) rec type = %u", G_STRFUNC,
|
||||
ws_debug("%s: encap = %d (%s) rec type = %u", G_STRFUNC,
|
||||
rec->rec_header.packet_header.pkt_encap,
|
||||
wtap_encap_description(rec->rec_header.packet_header.pkt_encap),
|
||||
rec->rec_type);
|
||||
|
@ -5056,14 +5052,14 @@ static gboolean pcapng_dump_finish(wtap_dumper *wdh, int *err,
|
|||
wtap_block_t if_stats;
|
||||
|
||||
if_stats = g_array_index(int_data_mand->interface_statistics, wtap_block_t, j);
|
||||
pcapng_debug("pcapng_dump_finish: write ISB for interface %u", ((wtapng_if_stats_mandatory_t*)wtap_block_get_mandatory_data(if_stats))->interface_id);
|
||||
ws_debug("pcapng_dump_finish: write ISB for interface %u", ((wtapng_if_stats_mandatory_t*)wtap_block_get_mandatory_data(if_stats))->interface_id);
|
||||
if (!pcapng_write_interface_statistics_block(wdh, if_stats, err)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pcapng_debug("pcapng_dump_finish");
|
||||
ws_debug("pcapng_dump_finish");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -5075,7 +5071,7 @@ pcapng_dump_open(wtap_dumper *wdh, int *err, gchar **err_info _U_)
|
|||
{
|
||||
guint i;
|
||||
|
||||
pcapng_debug("pcapng_dump_open");
|
||||
ws_debug("pcapng_dump_open");
|
||||
/* This is a pcapng file */
|
||||
wdh->subtype_add_idb = pcapng_add_idb;
|
||||
wdh->subtype_write = pcapng_dump;
|
||||
|
@ -5085,10 +5081,10 @@ pcapng_dump_open(wtap_dumper *wdh, int *err, gchar **err_info _U_)
|
|||
if (!pcapng_write_section_header_block(wdh, err)) {
|
||||
return FALSE;
|
||||
}
|
||||
pcapng_debug("pcapng_dump_open: wrote section header block.");
|
||||
ws_debug("pcapng_dump_open: wrote section header block.");
|
||||
|
||||
/* Write the Interface description blocks */
|
||||
pcapng_debug("pcapng_dump_open: Number of IDBs to write (number of interfaces) %u",
|
||||
ws_debug("pcapng_dump_open: Number of IDBs to write (number of interfaces) %u",
|
||||
wdh->interface_data->len);
|
||||
|
||||
for (i = 0; i < wdh->interface_data->len; i++) {
|
||||
|
@ -5122,7 +5118,7 @@ pcapng_dump_open(wtap_dumper *wdh, int *err, gchar **err_info _U_)
|
|||
an error indication otherwise. */
|
||||
static int pcapng_dump_can_write_encap(int wtap_encap)
|
||||
{
|
||||
pcapng_debug("pcapng_dump_can_write_encap: encap = %d (%s)",
|
||||
ws_debug("pcapng_dump_can_write_encap: encap = %d (%s)",
|
||||
wtap_encap,
|
||||
wtap_encap_description(wtap_encap));
|
||||
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#include "wtap.h"
|
||||
#include "wtap_opttypes.h"
|
||||
|
||||
#define wtap_warn(...) g_warning(__VA_ARGS__)
|
||||
|
||||
void wtap_init_file_type_subtypes(void);
|
||||
|
||||
WS_DLL_PUBLIC
|
||||
|
|
|
@ -39,7 +39,7 @@ wtap_register_plugin(const wtap_plugin *plug)
|
|||
void
|
||||
wtap_register_plugin(const wtap_plugin *plug _U_)
|
||||
{
|
||||
wtap_warn("wtap_register_plugin: built without support for binary plugins");
|
||||
g_warning("wtap_register_plugin: built without support for binary plugins");
|
||||
}
|
||||
#endif /* HAVE_PLUGINS */
|
||||
|
||||
|
|
|
@ -18,12 +18,6 @@
|
|||
|
||||
#include <wsutil/glib-compat.h>
|
||||
|
||||
#if 0
|
||||
#define wtap_debug(...) g_warning(__VA_ARGS__)
|
||||
#else
|
||||
#define wtap_debug(...)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Structure describing a type of block.
|
||||
*/
|
||||
|
|
|
@ -71,8 +71,8 @@ set(WSUTIL_PUBLIC_HEADERS
|
|||
ws_mempbrk.h
|
||||
ws_mempbrk_int.h
|
||||
ws_pipe.h
|
||||
ws_printf.h
|
||||
wsjson.h
|
||||
wslog.h
|
||||
xtea.h
|
||||
)
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <wsutil/report_message.h>
|
||||
|
||||
#include <wsutil/plugins.h>
|
||||
#include <wsutil/ws_printf.h> /* ws_debug_printf */
|
||||
|
||||
typedef struct _plugin {
|
||||
GModule *handle; /* handle returned by g_module_open */
|
||||
|
@ -271,7 +270,7 @@ print_plugin_description(const char *name, const char *version,
|
|||
const char *description, const char *filename,
|
||||
void *user_data _U_)
|
||||
{
|
||||
ws_debug_printf("%-16s\t%s\t%s\t%s\n", name, version, description, filename);
|
||||
printf("%-16s\t%s\t%s\t%s\n", name, version, description, filename);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Wireshark - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@wireshark.org>
|
||||
* Copyright 2021 Gerald Combs
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef __WSLOG_H__
|
||||
#define __WSLOG_H__
|
||||
|
||||
/*
|
||||
* To output debug information use the environment variable
|
||||
* G_MESSAGES_DEBUG="<domain1> <domain2> ..." (separated with spaces)
|
||||
* to produce output for specic domains, or G_MESSAGES_DEBUG="all" for
|
||||
* all domains.
|
||||
*
|
||||
* Any variable that is only used with ws_debug() needs to be guarded
|
||||
* with #if WS_DEBUG.
|
||||
*/
|
||||
#if WS_DEBUG
|
||||
#define ws_debug(...) g_debug(G_STRLOC ": " __VA_ARGS__)
|
||||
#else
|
||||
#define ws_debug(...) ((void)0)
|
||||
#endif
|
||||
|
||||
#endif /* __WSLOG_H__ */
|
Loading…
Reference in New Issue