aboutsummaryrefslogtreecommitdiffstats
path: root/src/gsm/gsup.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-06-11 20:27:27 +0200
committerHarald Welte <laforge@gnumonks.org>2018-06-11 20:28:18 +0200
commit520ebc17d9351ccd1a053eeb11c769649e4d1fc1 (patch)
tree1523071684a8474c3e4e2a4fe41a602629f90822 /src/gsm/gsup.c
parent5a09f75c1e7f66869da4a17c4cc417d367687b72 (diff)
gsup: Add osmo_gsup_get_err_msg_type() function
This function can be used to resolve the error message type for a given message type. Can be used by generic error handlers that work for any incoming message type. Change-Id: Ic637bec53dd7fe3ec83da99b49b4eae34d5602b2
Diffstat (limited to 'src/gsm/gsup.c')
-rw-r--r--src/gsm/gsup.c23
1 files changed, 23 insertions, 0 deletions
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)
{