summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-02-09 02:09:09 +0100
committerHarald Welte <laforge@gnumonks.org>2017-02-15 23:26:07 +0000
commit10f5fb49dbe8e79390758d8a83e826865d76929d (patch)
tree8ec560d195272fa0265419592d6bf7c24ec17417
parent3e6d5701e6aa56979165e58d896c14040966f04b (diff)
gsup: add osmo_gsup_message_type_name()
Change-Id: Ic29b588b72893821d73fe90ecc16c6bf78d5a360
-rw-r--r--include/osmocom/gsm/gsup.h5
-rw-r--r--src/gsm/gsup.c29
-rw-r--r--src/gsm/libosmogsm.map1
3 files changed, 35 insertions, 0 deletions
diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h
index e2912a64..04b31d0b 100644
--- a/include/osmocom/gsm/gsup.h
+++ b/include/osmocom/gsm/gsup.h
@@ -95,6 +95,11 @@ enum osmo_gsup_message_type {
#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 b1b97ca5..ec1dc906 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 e153d729..78e55df9 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -363,6 +363,7 @@ osmo_apn_from_str;
osmo_gsup_encode;
osmo_gsup_decode;
+osmo_gsup_message_type_names;
osmo_oap_encode;
osmo_oap_decode;