aboutsummaryrefslogtreecommitdiffstats
path: root/src/gb/gprs_ns2_internal.h
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2021-01-18 17:55:35 +0100
committerlynxis lazus <lynxis@fe80.eu>2021-03-24 15:42:45 +0000
commit6cf65d9d81d4c4d8863d06876b292679513d1fc8 (patch)
tree9abd6b48b1247be58b57f079d0229dd7cf0916ea /src/gb/gprs_ns2_internal.h
parent2d807b6c7d8ea58ad79e11ed5c66cf43c8b21163 (diff)
gprs_ns2: rework logging of Rx and Tx NS PDU
Introduce 2 new logging sub systems for signal and unit data. Unify log messages so all log messages look similiar. Log also Rx PDUs. Ensure dropped Tx packets (BLOCK/RESET on SNS) contain *Tx*. Change-Id: I34b8fde2955ecc010d1dcd9512e1bba9211e2c0d
Diffstat (limited to 'src/gb/gprs_ns2_internal.h')
-rw-r--r--src/gb/gprs_ns2_internal.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index b4d0a0d6..df51ff5e 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -5,6 +5,7 @@
#include <stdbool.h>
#include <stdint.h>
+#include <osmocom/core/logging.h>
#include <osmocom/gprs/protocol/gsm_08_16.h>
#include <osmocom/gprs/gprs_ns2.h>
@@ -14,18 +15,30 @@
#define LOGBIND(bind, lvl, fmt, args ...) \
LOGP(DLNS, lvl, "BIND(%s) " fmt, (bind)->name, ## args)
-
-#define LOGNSVC(nsvc, lvl, fmt, args ...) \
+#define LOGNSVC_SS(ss, nsvc, lvl, fmt, args ...) \
do { \
if ((nsvc)->nsvci_is_valid) { \
- LOGP(DLNS, lvl, "NSE(%05u)-NSVC(%05u) " fmt, \
+ LOGP(ss, lvl, "NSE(%05u)-NSVC(%05u) " fmt, \
(nsvc)->nse->nsei, (nsvc)->nsvci, ## args); \
} else { \
- LOGP(DLNS, lvl, "NSE(%05u)-NSVC(none) " fmt, \
+ LOGP(ss, lvl, "NSE(%05u)-NSVC(none) " fmt, \
(nsvc)->nse->nsei, ## args); \
} \
} while (0)
+#define LOGNSVC(nsvc, lvl, fmt, args ...) \
+ LOGNSVC_SS(DLNS, nsvc, lvl, fmt, ## args)
+
+#define LOG_NS_SIGNAL(nsvc, direction, pdu_type, lvl, fmt, args ...) \
+ LOGNSVC_SS(DLNSSIGNAL, nsvc, lvl, "%s %s" fmt, direction, get_value_string(gprs_ns_pdu_strings, pdu_type), ## args)
+
+#define LOG_NS_DATA(nsvc, direction, pdu_type, lvl, fmt, args ...) \
+ LOGNSVC_SS(DLNSDATA, nsvc, lvl, "%s %s" fmt, direction, get_value_string(gprs_ns_pdu_strings, pdu_type), ## args)
+
+#define LOG_NS_RX_SIGNAL(nsvc, pdu_type) LOG_NS_SIGNAL(nsvc, "Rx", pdu_type, LOGL_INFO, "\n")
+#define LOG_NS_TX_SIGNAL(nsvc, pdu_type) LOG_NS_SIGNAL(nsvc, "Tx", pdu_type, LOGL_INFO, "\n")
+
+
struct osmo_fsm_inst;
struct tlv_parsed;
struct vty;