summaryrefslogtreecommitdiffstats
path: root/src/gsm
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-03-17 10:32:07 +0100
committerHarald Welte <laforge@gnumonks.org>2018-03-17 11:28:31 +0000
commitd86055b431275cedb73bce32cb18dfc41dff0d15 (patch)
treed2e9ab3798ba62d902a9f7c3798a4b500add4edd /src/gsm
parentc9bebbd325e567333486a90b92d16ee464a4458a (diff)
abis_nm: Introduce abis_nm_dump_foh()
This is a more modern way of printing the Abis OML Formatted Object Header, without assuming that it would be used in a log statement or prescribing the log level to be used. Change-Id: I9b2c2afec28882b817d104d5b062651ade7aadd8
Diffstat (limited to 'src/gsm')
-rw-r--r--src/gsm/abis_nm.c15
-rw-r--r--src/gsm/libosmogsm.map1
2 files changed, 12 insertions, 4 deletions
diff --git a/src/gsm/abis_nm.c b/src/gsm/abis_nm.c
index 8a3886da..49d05ba5 100644
--- a/src/gsm/abis_nm.c
+++ b/src/gsm/abis_nm.c
@@ -928,15 +928,22 @@ enum gsm_phys_chan_config abis_nm_pchan4chcomb(uint8_t chcomb)
return GSM_PCHAN_NONE;
}
+const char *abis_nm_dump_foh(const struct abis_om_fom_hdr *foh)
+{
+ static char foh_buf[128];
+ snprintf(foh_buf, sizeof(foh_buf), "OC=%s(%02x) INST=(%02x,%02x,%02x)",
+ get_value_string(abis_nm_obj_class_names, foh->obj_class),
+ foh->obj_class, foh->obj_inst.bts_nr, foh->obj_inst.trx_nr,
+ foh->obj_inst.ts_nr);
+ return foh_buf;
+}
+
/* this is just for compatibility reasons, it is now a macro */
#undef abis_nm_debugp_foh
OSMO_DEPRECATED("Use abis_nm_debugp_foh macro instead")
void abis_nm_debugp_foh(int ss, struct abis_om_fom_hdr *foh)
{
- DEBUGP(ss, "OC=%s(%02x) INST=(%02x,%02x,%02x) ",
- get_value_string(abis_nm_obj_class_names, foh->obj_class),
- foh->obj_class, foh->obj_inst.bts_nr, foh->obj_inst.trx_nr,
- foh->obj_inst.ts_nr);
+ DEBUGP(ss, "%s ", abis_nm_dump_foh(foh));
}
/*! @} */
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 36a77129..fd077041 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -8,6 +8,7 @@ abis_nm_fail_evt_rep;
abis_nm_fail_evt_vrep;
abis_nm_chcomb4pchan;
abis_nm_debugp_foh;
+abis_nm_dump_foh;
abis_nm_event_type_name;
abis_nm_nack_cause_name;
abis_nm_nack_name;