This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Review at https://gerrit.osmocom.org/2026
add gsm48_pdisc_names and gsm48_pdisc_name()
I often want to log the protocol discriminator in the openbsc debug log. It's
more useful to get the name directly instead of looking it up every time.
Change-Id: I0f053e2a4360b27ffccda7cf82469fb1b1cbb3ae
---
M include/osmocom/gsm/protocol/gsm_04_08.h
M src/gsm/gsm48.c
M src/gsm/libosmogsm.map
3 files changed, 24 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/26/2026/1
diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h
index da17755..96fdabe 100644
--- a/include/osmocom/gsm/protocol/gsm_04_08.h
+++ b/include/osmocom/gsm/protocol/gsm_04_08.h
@@ -926,6 +926,10 @@
#define GSM48_PDISC_MASK 0x0f
#define GSM48_PDISC_USSD 0x11
+extern const struct value_string gsm48_pdisc_names[];
+static inline const char *gsm48_pdisc_name(uint8_t val)
+{ return get_value_string(gsm48_pdisc_names, val); }
+
bool gsm48_hdr_gmm_cipherable(const struct gsm48_hdr *hdr);
static inline uint8_t gsm48_hdr_pdisc(const struct gsm48_hdr *hdr)
diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c
index b626f82..d408897 100644
--- a/src/gsm/gsm48.c
+++ b/src/gsm/gsm48.c
@@ -678,3 +678,22 @@
else
return n_pag_blocks * (chan_desc->bs_pa_mfrms + 2);
}
+
+const struct value_string gsm48_pdisc_names[] = {
+ OSMO_VALUE_STRING(GSM48_PDISC_GROUP_CC),
+ OSMO_VALUE_STRING(GSM48_PDISC_BCAST_CC),
+ OSMO_VALUE_STRING(GSM48_PDISC_PDSS1),
+ OSMO_VALUE_STRING(GSM48_PDISC_CC),
+ OSMO_VALUE_STRING(GSM48_PDISC_PDSS2),
+ OSMO_VALUE_STRING(GSM48_PDISC_MM),
+ OSMO_VALUE_STRING(GSM48_PDISC_RR),
+ OSMO_VALUE_STRING(GSM48_PDISC_MM_GPRS),
+ OSMO_VALUE_STRING(GSM48_PDISC_SMS),
+ OSMO_VALUE_STRING(GSM48_PDISC_SM_GPRS),
+ OSMO_VALUE_STRING(GSM48_PDISC_NC_SS),
+ OSMO_VALUE_STRING(GSM48_PDISC_LOC),
+ OSMO_VALUE_STRING(GSM48_PDISC_EXTEND),
+ OSMO_VALUE_STRING(GSM48_PDISC_MASK),
+ OSMO_VALUE_STRING(GSM48_PDISC_USSD),
+ { 0, NULL }
+};
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 8d28476..60f83de 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -217,6 +217,7 @@
gsm48_mcc_mnc_from_bcd;
gsm48_chan_mode_names;
gsm_chan_t_names;
+gsm48_pdisc_names;
gsm_7bit_decode;
gsm_7bit_decode_ussd;
--
To view, visit https://gerrit.osmocom.org/2026
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0f053e2a4360b27ffccda7cf82469fb1b1cbb3ae
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>