share debug.[ch] across all executables

This avoids us having to re-define log_info/log_info_cat for each
program.

Change-Id: I22f4f8a51b91ee09c5be26b1ed1bfca41730c577
changes/76/13176/1
Harald Welte 4 years ago
parent e56f2b9b46
commit 61d98e9f3e
  1. 6
      src/Makefile.am
  2. 14
      src/bankd_main.c
  3. 16
      src/debug.c
  4. 2
      src/debug.h
  5. 14
      src/remsim_client.c
  6. 14
      src/simtrace2-remsim_client.c

@ -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

@ -26,6 +26,7 @@
#include <osmocom/rspro/RsproPDU.h>
#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)

@ -0,0 +1,16 @@
#include <osmocom/core/logging.h>
#include <osmocom/core/utils.h>
#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),
};

@ -3,3 +3,5 @@
enum {
DMAIN,
};
extern const struct log_info log_info;

@ -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;

@ -15,6 +15,7 @@
#include "rspro_util.h"
#include "client.h"
#include "debug.h"
#include <unistd.h>
#include <stdio.h>
@ -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"

Loading…
Cancel
Save