From 8c5cd5d86d932df05031a319fa2dc4e28c359654 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Fri, 10 Mar 2017 02:15:20 +0100 Subject: log protocol discriminators and message types by name Depends: libosmocore change-id I0fca8e95ed5c2148b1a7440eff3fc9c7583898df Change-Id: If1c49faf6e1757cb16b383dd2db87b48bc94eee6 --- openbsc/tests/msc_vlr/msc_vlr_tests.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'openbsc/tests/msc_vlr/msc_vlr_tests.c') diff --git a/openbsc/tests/msc_vlr/msc_vlr_tests.c b/openbsc/tests/msc_vlr/msc_vlr_tests.c index 4c0126305..d2ccb2a71 100644 --- a/openbsc/tests/msc_vlr/msc_vlr_tests.c +++ b/openbsc/tests/msc_vlr/msc_vlr_tests.c @@ -69,6 +69,17 @@ struct msgb *msgb_from_hex(const char *label, uint16_t size, const char *hex) return msg; } +const char *gh_type_name(struct gsm48_hdr *gh) +{ + return gsm48_pdisc_msgtype_name(gsm48_hdr_pdisc(gh), + gsm48_hdr_msg_type(gh)); +} + +const char *msg_type_name(struct msgb *msg) +{ + return gh_type_name((void*)msg->data); +} + void dtap_expect_tx(const char *hex) { /* Has the previously expected dtap been received? */ @@ -153,8 +164,10 @@ void rx_from_ms(struct msgb *msg) int rc; struct gsm48_hdr *gh = msgb_l3(msg); - log("rx from MS: pdisc=0x%02x msg_type=0x%02x", - gh->proto_discr, gh->msg_type); + + log("MSC <--%s-- MS: %s", + ran_type_name(rx_from_ran), + gh_type_name(gh)); if (g_conn && !conn_exists(g_conn)) g_conn = NULL; @@ -425,8 +438,9 @@ int __wrap_gsup_client_send(struct gsup_client *gsupc, struct msgb *msg) int _validate_dtap(struct msgb *msg, enum ran_type to_ran) { - btw("DTAP --%s--> MS: %s", - ran_type_name(to_ran), + struct gsm48_hdr *gh = (void*)msg->data; + btw("DTAP --%s--> MS: %s: %s", + ran_type_name(to_ran), msg_type_name(msg), osmo_hexdump_nospc(msg->data, msg->len)); OSMO_ASSERT(dtap_tx_expected); -- cgit v1.2.3