summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/gsm/gsup.h1
-rw-r--r--src/gsm/gsup.c23
-rw-r--r--src/gsm/libosmogsm.map1
3 files changed, 25 insertions, 0 deletions
diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h
index dd274934..e246639a 100644
--- a/include/osmocom/gsm/gsup.h
+++ b/include/osmocom/gsm/gsup.h
@@ -213,5 +213,6 @@ struct osmo_gsup_message {
int osmo_gsup_decode(const uint8_t *data, size_t data_len,
struct osmo_gsup_message *gsup_msg);
int osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg);
+int osmo_gsup_get_err_msg_type(enum osmo_gsup_message_type type_in);
/*! @} */
diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c
index b4b60b20..e3eef02e 100644
--- a/src/gsm/gsup.c
+++ b/src/gsm/gsup.c
@@ -70,6 +70,29 @@ const struct value_string osmo_gsup_message_type_names[] = {
{ 0, NULL }
};
+
+/*! return the error message type corresponding to \a type_in
+ * \returns matching error message type; -1 on error */
+int osmo_gsup_get_err_msg_type(enum osmo_gsup_message_type type_in)
+{
+ switch (type_in) {
+ case OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST:
+ return OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR;
+ case OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST:
+ return OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR;
+ case OSMO_GSUP_MSGT_PURGE_MS_REQUEST:
+ return OSMO_GSUP_MSGT_PURGE_MS_ERROR;
+ case OSMO_GSUP_MSGT_INSERT_DATA_REQUEST:
+ return OSMO_GSUP_MSGT_INSERT_DATA_ERROR;
+ case OSMO_GSUP_MSGT_DELETE_DATA_REQUEST:
+ return OSMO_GSUP_MSGT_DELETE_DATA_ERROR;
+ case OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST:
+ return OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR;
+ default:
+ return -1;
+ }
+}
+
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 0a6742cc..f98f7c94 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -469,6 +469,7 @@ osmo_apn_from_str;
osmo_gsup_encode;
osmo_gsup_decode;
osmo_gsup_message_type_names;
+osmo_gsup_get_err_msg_type;
osmo_oap_encode;
osmo_oap_decode;