diff --git a/src/Makefile.am b/src/Makefile.am index ca799ce..5f0d846 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -25,15 +25,15 @@ pcsc_test_SOURCES = driver_core.c driver_pcsc.c main.c pcsc_test_LDADD = $(OSMOCORE_LIBS) \ $(PCSC_LIBS) libosmo-rspro.la -remsim_bankd_SOURCES = bankd_slotmap.c bankd_main.c bankd_pcsc.c +remsim_bankd_SOURCES = bankd_slotmap.c bankd_main.c bankd_pcsc.c debug.c remsim_bankd_LDADD = $(OSMOCORE_LIBS) $(OSMOGSM_LIBS) \ $(PCSC_LIBS) libosmo-rspro.la -lcsv -remsim_client_SOURCES = remsim_client.c remsim_client_fsm.c +remsim_client_SOURCES = remsim_client.c remsim_client_fsm.c debug.c remsim_client_LDADD = $(OSMOCORE_LIBS) $(OSMOGSM_LIBS) $(OSMOABIS_LIBS) \ libosmo-rspro.la -simtrace2_remsim_client_SOURCES = simtrace2-remsim_client.c remsim_client_fsm.c \ +simtrace2_remsim_client_SOURCES = simtrace2-remsim_client.c remsim_client_fsm.c debug.c \ simtrace2/apdu_dispatch.c \ simtrace2/simtrace2-discovery.c \ simtrace2/libusb_util.c diff --git a/src/bankd_main.c b/src/bankd_main.c index 5e94afb..fde03cd 100644 --- a/src/bankd_main.c +++ b/src/bankd_main.c @@ -26,6 +26,7 @@ #include #include "bankd.h" +#include "debug.h" #include "rspro_util.h" __thread void *talloc_asn1_ctx; @@ -36,19 +37,6 @@ static void *worker_main(void *arg); * bankd core / main thread ***********************************************************************/ -static const struct log_info_cat default_categories[] = { - [DMAIN] = { - .name = "DMAIN", - .loglevel = LOGL_DEBUG, - .enabled = 1, - }, -}; - -static const struct log_info log_info = { - .cat = default_categories, - .num_cat = ARRAY_SIZE(default_categories), -}; - int asn_debug; static void bankd_init(struct bankd *bankd) diff --git a/src/debug.c b/src/debug.c new file mode 100644 index 0000000..046dc8c --- /dev/null +++ b/src/debug.c @@ -0,0 +1,16 @@ +#include +#include +#include "debug.h" + +static const struct log_info_cat default_categories[] = { + [DMAIN] = { + .name = "DMAIN", + .loglevel = LOGL_DEBUG, + .enabled = 1, + }, +}; + +const struct log_info log_info = { + .cat = default_categories, + .num_cat = ARRAY_SIZE(default_categories), +}; diff --git a/src/debug.h b/src/debug.h index 187d895..02551eb 100644 --- a/src/debug.h +++ b/src/debug.h @@ -3,3 +3,5 @@ enum { DMAIN, }; + +extern const struct log_info log_info; diff --git a/src/remsim_client.c b/src/remsim_client.c index 2f740d4..0c2dcbe 100644 --- a/src/remsim_client.c +++ b/src/remsim_client.c @@ -15,6 +15,7 @@ #include "rspro_util.h" #include "client.h" +#include "debug.h" static int bankd_handle_msg(struct bankd_client *bc, struct msgb *msg) { @@ -68,19 +69,6 @@ invalid: return -1; } -static const struct log_info_cat default_categories[] = { - [DMAIN] = { - .name = "DMAIN", - .loglevel = LOGL_DEBUG, - .enabled = 1, - }, -}; - -static const struct log_info log_info = { - .cat = default_categories, - .num_cat = ARRAY_SIZE(default_categories), -}; - static struct bankd_client *g_client; static void *g_tall_ctx; void __thread *talloc_asn1_ctx; diff --git a/src/simtrace2-remsim_client.c b/src/simtrace2-remsim_client.c index 79da419..0832300 100644 --- a/src/simtrace2-remsim_client.c +++ b/src/simtrace2-remsim_client.c @@ -15,6 +15,7 @@ #include "rspro_util.h" #include "client.h" +#include "debug.h" #include #include @@ -619,19 +620,6 @@ static int srvc_handle_rx(struct rspro_server_conn *srvc, const RsproPDU_t *pdu) } -static const struct log_info_cat default_categories[] = { - [DMAIN] = { - .name = "DMAIN", - .loglevel = LOGL_DEBUG, - .enabled = 1, - }, -}; - -static const struct log_info log_info = { - .cat = default_categories, - .num_cat = ARRAY_SIZE(default_categories), -}; - static void print_welcome(void) { printf("simtrace2-remsim-client - Remote SIM card client for SIMtrace\n"