hnbgw: Introduce LOGHNB() macro for log context information
So far we don't really have any way of matching a given log message
to a specific hNB. Let's introduce a new log macro, together with
a configuration directive to select whether the hNB-ID or the
UMTS CellID shall be used.
Change-Id: I6113925216c6f88add2c6d27bdf47ccbb017f293
diff --git a/include/osmocom/iuh/hnbgw.h b/include/osmocom/iuh/hnbgw.h
index 4848c2f..fc8298d 100644
--- a/include/osmocom/iuh/hnbgw.h
+++ b/include/osmocom/iuh/hnbgw.h
@@ -18,6 +18,9 @@
DRANAP,
};
+#define LOGHNB(x, ss, lvl, fmt, args ...) \
+ LOGP(ss, lvl, "%s " fmt, hnb_context_name(x), ## args)
+
enum hnb_ctrl_node {
CTRL_NODE_HNB = _LAST_CTRL_NODE,
_LAST_CTRL_NODE_HNB
@@ -128,6 +131,8 @@
const char *iups_remote_addr_name;
uint16_t rnc_id;
bool hnbap_allow_tmsi;
+ /*! print hnb-id (true) or MCC-MNC-LAC-RAC-SAC (false) in logs */
+ bool log_prefix_hnb_id;
} config;
/*! SCTP listen socket for incoming connections */
struct osmo_stream_srv_link *iuh;
@@ -152,6 +157,7 @@
struct hnb_context *hnb_context_by_id(struct hnb_gw *gw, uint32_t cid);
struct hnb_context *hnb_context_by_identity_info(struct hnb_gw *gw, const char *identity_info);
+const char *hnb_context_name(struct hnb_context *ctx);
unsigned hnb_contexts(const struct hnb_gw *gw);
struct ue_context *ue_context_by_id(struct hnb_gw *gw, uint32_t id);