[PATCH] libosmocore[master]: gsup: add osmo_gsup_message_type_name()

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Tue Feb 14 11:12:06 UTC 2017


Review at  https://gerrit.osmocom.org/1816

gsup: add osmo_gsup_message_type_name()

Change-Id: Ic29b588b72893821d73fe90ecc16c6bf78d5a360
---
M include/osmocom/gsm/gsup.h
M src/gsm/gsup.c
M src/gsm/libosmogsm.map
3 files changed, 35 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/16/1816/1

diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h
index e2912a6..04b31d0 100644
--- a/include/osmocom/gsm/gsup.h
+++ b/include/osmocom/gsm/gsup.h
@@ -95,6 +95,11 @@
 #define OSMO_GSUP_IS_MSGT_ERROR(msgt)   (((msgt) & 0b00000011) == 0b01)
 #define OSMO_GSUP_TO_MSGT_ERROR(msgt)   (((msgt) & 0b11111100) | 0b01)
 
+extern const struct value_string osmo_gsup_message_type_names[];
+static inline const char *
+osmo_gsup_message_type_name(enum osmo_gsup_message_type val)
+{	return get_value_string(osmo_gsup_message_type_names, val); }
+
 enum osmo_gsup_cancel_type {
 	OSMO_GSUP_CANCEL_TYPE_UPDATE		= 1, /* on wire: 0 */
 	OSMO_GSUP_CANCEL_TYPE_WITHDRAW		= 2, /* on wire: 1 */
diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c
index b1b97ca..ec1dc90 100644
--- a/src/gsm/gsup.c
+++ b/src/gsm/gsup.c
@@ -31,6 +31,35 @@
 
 #include <stdint.h>
 
+const struct value_string osmo_gsup_message_type_names[] = {
+	OSMO_VALUE_STRING(OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST),
+	OSMO_VALUE_STRING(OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR),
+	OSMO_VALUE_STRING(OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT),
+
+	OSMO_VALUE_STRING(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST),
+	OSMO_VALUE_STRING(OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR),
+	OSMO_VALUE_STRING(OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT),
+
+	OSMO_VALUE_STRING(OSMO_GSUP_MSGT_AUTH_FAIL_REPORT),
+
+	OSMO_VALUE_STRING(OSMO_GSUP_MSGT_PURGE_MS_REQUEST),
+	OSMO_VALUE_STRING(OSMO_GSUP_MSGT_PURGE_MS_ERROR),
+	OSMO_VALUE_STRING(OSMO_GSUP_MSGT_PURGE_MS_RESULT),
+
+	OSMO_VALUE_STRING(OSMO_GSUP_MSGT_INSERT_DATA_REQUEST),
+	OSMO_VALUE_STRING(OSMO_GSUP_MSGT_INSERT_DATA_ERROR),
+	OSMO_VALUE_STRING(OSMO_GSUP_MSGT_INSERT_DATA_RESULT),
+
+	OSMO_VALUE_STRING(OSMO_GSUP_MSGT_DELETE_DATA_REQUEST),
+	OSMO_VALUE_STRING(OSMO_GSUP_MSGT_DELETE_DATA_ERROR),
+	OSMO_VALUE_STRING(OSMO_GSUP_MSGT_DELETE_DATA_RESULT),
+
+	OSMO_VALUE_STRING(OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST),
+	OSMO_VALUE_STRING(OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR),
+	OSMO_VALUE_STRING(OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT),
+	{ 0, NULL }
+};
+
 static int decode_pdp_info(uint8_t *data, size_t data_len,
 			  struct osmo_gsup_pdp_info *pdp_info)
 {
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index e153d72..78e55df 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -363,6 +363,7 @@
 
 osmo_gsup_encode;
 osmo_gsup_decode;
+osmo_gsup_message_type_names;
 
 osmo_oap_encode;
 osmo_oap_decode;

-- 
To view, visit https://gerrit.osmocom.org/1816
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic29b588b72893821d73fe90ecc16c6bf78d5a360
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>


More information about the gerrit-log mailing list