refactor VLR FSM result handling

Instead of keeping separate enums for FSM results and translating between those
and the actual 04.08 reject causes that will ultimately reach the MS, just pass
enum gsm48_reject_value cause codes around everywhere.

Collapse some VLR *_timeout() and *_cancel() api to just *_cancel() with a
gsm48 cause arg.

(Hopefully) improve a few reject causes, but otherwise just aim for more
transparent decisions on which cause value is used, for future fixes of
returned causes.

Depends: I6661f139e68a498fb1bef10c266c2f064b72774a (libosmocore)
Change-Id: I27bf8d68737ff1f8dc6d11fb1eac3d391aab0cb1
diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c
index b51fd16..2b8e4c1 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -644,7 +644,7 @@
 }
 
 static int msc_vlr_tx_cm_serv_acc(void *msc_conn_ref);
-static int msc_vlr_tx_cm_serv_rej(void *msc_conn_ref, enum vlr_proc_arq_result result);
+static int msc_vlr_tx_cm_serv_rej(void *msc_conn_ref, enum gsm48_reject_value result);
 
 static int cm_serv_reuse_conn(struct gsm_subscriber_connection *conn, const uint8_t *mi_lv)
 {
@@ -675,7 +675,7 @@
 
 	LOGP(DMM, LOGL_ERROR, "%s: CM Service Request with mismatching mobile identity: %s %s\n",
 	     vlr_subscr_name(conn->vsub), gsm48_mi_type_name(mi_type), mi_string);
-	msc_vlr_tx_cm_serv_rej(conn, VLR_PR_ARQ_RES_ILLEGAL_SUBSCR);
+	msc_vlr_tx_cm_serv_rej(conn, GSM48_REJECT_ILLEGAL_MS);
 	return -EINVAL;
 
 accept_reuse:
@@ -774,7 +774,7 @@
 	if (msc_subscr_conn_is_establishing_auth_ciph(conn)) {
 		LOGP(DMM, LOGL_ERROR,
 		     "Cannot accept CM Service Request, conn already busy establishing authenticity\n");
-		msc_vlr_tx_cm_serv_rej(conn, VLR_PR_ARQ_RES_UNKNOWN_ERROR);
+		msc_vlr_tx_cm_serv_rej(conn, GSM48_REJECT_CONGESTION);
 		return -EINVAL;
 		/* or should we accept and note down the service request anyway? */
 	}
@@ -3576,7 +3576,7 @@
 }
 
 /* VLR asks us to transmit a Location Update Reject */
-static int msc_vlr_tx_lu_rej(void *msc_conn_ref, uint8_t cause)
+static int msc_vlr_tx_lu_rej(void *msc_conn_ref, enum gsm48_reject_value cause)
 {
 	struct gsm_subscriber_connection *conn = msc_conn_ref;
 	return gsm0408_loc_upd_rej(conn, cause);
@@ -3605,36 +3605,11 @@
 }
 
 /* VLR asks us to transmit a CM Service Reject */
-static int msc_vlr_tx_cm_serv_rej(void *msc_conn_ref, enum vlr_proc_arq_result result)
+static int msc_vlr_tx_cm_serv_rej(void *msc_conn_ref, enum gsm48_reject_value cause)
 {
-	uint8_t cause;
 	struct gsm_subscriber_connection *conn = msc_conn_ref;
 	int rc;
 
-	switch (result) {
-	default:
-	case VLR_PR_ARQ_RES_NONE:
-	case VLR_PR_ARQ_RES_SYSTEM_FAILURE:
-	case VLR_PR_ARQ_RES_UNKNOWN_ERROR:
-		cause = GSM48_REJECT_NETWORK_FAILURE;
-		break;
-	case VLR_PR_ARQ_RES_ILLEGAL_SUBSCR:
-		cause = GSM48_REJECT_LOC_NOT_ALLOWED;
-		break;
-	case VLR_PR_ARQ_RES_UNIDENT_SUBSCR:
-		cause = GSM48_REJECT_INVALID_MANDANTORY_INF;
-		break;
-	case VLR_PR_ARQ_RES_ROAMING_NOTALLOWED:
-		cause = GSM48_REJECT_ROAMING_NOT_ALLOWED;
-		break;
-	case VLR_PR_ARQ_RES_ILLEGAL_EQUIP:
-		cause = GSM48_REJECT_ILLEGAL_MS;
-		break;
-	case VLR_PR_ARQ_RES_TIMEOUT:
-		cause = GSM48_REJECT_CONGESTION;
-		break;
-	};
-
 	rc = msc_gsm48_tx_mm_serv_rej(conn, cause);
 
 	if (conn->received_cm_service_request) {