From f72155a3a42d74a0367ecde504ff394ad22374de Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 15 Jun 2019 23:05:19 +0200 Subject: cbsp: Introduce osmo_cbsp_errstr Rather than having the encoder/decoder library print some log messages in case of encoding/decoding errors, let's provide something akin to 'errno', but with a string instead of a numeric error code. The 'osmo_cbsp_errstr' global variable (if set) contains a human-readable string describing the most recent encoding/decoding error. It exists separately for each thread and hence can be used safely in multi-threaded environments. Change-Id: Id9a5a595a76ba278647aee9470ded213d8464103 --- include/osmocom/gsm/cbsp.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/osmocom/gsm') diff --git a/include/osmocom/gsm/cbsp.h b/include/osmocom/gsm/cbsp.h index d47b37bb..90516cb7 100644 --- a/include/osmocom/gsm/cbsp.h +++ b/include/osmocom/gsm/cbsp.h @@ -283,6 +283,8 @@ struct osmo_cbsp_decoded { } u; }; +extern const __thread char *osmo_cbsp_errstr; + struct msgb *osmo_cbsp_msgb_alloc(void *ctx, const char *name); struct msgb *osmo_cbsp_encode(void *ctx, const struct osmo_cbsp_decoded *in); struct osmo_cbsp_decoded *osmo_cbsp_decode(void *ctx, struct msgb *in); -- cgit v1.2.3