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

add gsm48_reject_value_names

There seems to be quite some confusion / overlap between enum
gsm48_reject_value, gsm48_gsm_cause and gsm48_gmm_cause. I tried to go with
gsm48_gsm_cause_names[], but e.g. GSM48_REJECT_CONGESTION is not represented.

Instead of attempting to mix/merge those enums, provide a separate value string
array for enum gsm48_reject_value.

This will be used by osmo-msc's libvlr (refactoring of FSM result handling),
I27bf8d68737ff1f8dc6d11fb1eac3d391aab0cb1.

Change-Id: I6661f139e68a498fb1bef10c266c2f064b72774a
---
M include/osmocom/gsm/protocol/gsm_04_08.h
M src/gsm/gsm48.c
M src/gsm/libosmogsm.map
3 files changed, 38 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/83/7683/1

diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h 
b/include/osmocom/gsm/protocol/gsm_04_08.h
index 4a821cc..6a5fb3b 100644
--- a/include/osmocom/gsm/protocol/gsm_04_08.h
+++ b/include/osmocom/gsm/protocol/gsm_04_08.h
@@ -1509,6 +1509,10 @@
        GSM48_REJECT_MSC_TMP_NOT_REACHABLE      = 16,
 };
 
+extern const struct value_string gsm48_reject_value_names[];
+static inline const char *gsm48_reject_value_name(enum gsm48_reject_value val)
+{ return get_value_string(gsm48_reject_value_names, val); }
+
 enum chreq_type {
        CHREQ_T_EMERG_CALL,
        CHREQ_T_CALL_REEST_TCH_F,
diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c
index c2affae..468b2a9 100644
--- a/src/gsm/gsm48.c
+++ b/src/gsm/gsm48.c
@@ -980,4 +980,37 @@
        return namebuf;
 }
 
+const struct value_string gsm48_reject_value_names[] = {
+        { GSM48_REJECT_IMSI_UNKNOWN_IN_HLR, "IMSI_UNKNOWN_IN_HLR" },
+        { GSM48_REJECT_ILLEGAL_MS, "ILLEGAL_MS" },
+        { GSM48_REJECT_IMSI_UNKNOWN_IN_VLR, "IMSI_UNKNOWN_IN_VLR" },
+        { GSM48_REJECT_IMEI_NOT_ACCEPTED, "IMEI_NOT_ACCEPTED" },
+        { GSM48_REJECT_ILLEGAL_ME, "ILLEGAL_ME" },
+        { GSM48_REJECT_PLMN_NOT_ALLOWED, "PLMN_NOT_ALLOWED" },
+        { GSM48_REJECT_LOC_NOT_ALLOWED, "LOC_NOT_ALLOWED" },
+        { GSM48_REJECT_ROAMING_NOT_ALLOWED, "ROAMING_NOT_ALLOWED" },
+        { GSM48_REJECT_NETWORK_FAILURE, "NETWORK_FAILURE" },
+        { GSM48_REJECT_SYNCH_FAILURE, "SYNCH_FAILURE" },
+        { GSM48_REJECT_CONGESTION, "CONGESTION" },
+        { GSM48_REJECT_SRV_OPT_NOT_SUPPORTED, "SRV_OPT_NOT_SUPPORTED" },
+        { GSM48_REJECT_RQD_SRV_OPT_NOT_SUPPORTED, "RQD_SRV_OPT_NOT_SUPPORTED" 
},
+        { GSM48_REJECT_SRV_OPT_TMP_OUT_OF_ORDER, "SRV_OPT_TMP_OUT_OF_ORDER" },
+        { GSM48_REJECT_CALL_CAN_NOT_BE_IDENTIFIED, 
"CALL_CAN_NOT_BE_IDENTIFIED" },
+        { GSM48_REJECT_INCORRECT_MESSAGE, "INCORRECT_MESSAGE" },
+        { GSM48_REJECT_INVALID_MANDANTORY_INF, "INVALID_MANDANTORY_INF" },
+        { GSM48_REJECT_MSG_TYPE_NOT_IMPLEMENTED, "MSG_TYPE_NOT_IMPLEMENTED" },
+        { GSM48_REJECT_MSG_TYPE_NOT_COMPATIBLE, "MSG_TYPE_NOT_COMPATIBLE" },
+        { GSM48_REJECT_INF_ELEME_NOT_IMPLEMENTED, "INF_ELEME_NOT_IMPLEMENTED" 
},
+        { GSM48_REJECT_CONDTIONAL_IE_ERROR, "CONDTIONAL_IE_ERROR" },
+        { GSM48_REJECT_MSG_NOT_COMPATIBLE, "MSG_NOT_COMPATIBLE" },
+        { GSM48_REJECT_PROTOCOL_ERROR, "PROTOCOL_ERROR" },
+        { GSM48_REJECT_GPRS_NOT_ALLOWED, "GPRS_NOT_ALLOWED" },
+        { GSM48_REJECT_SERVICES_NOT_ALLOWED, "SERVICES_NOT_ALLOWED" },
+        { GSM48_REJECT_MS_IDENTITY_NOT_DERVIVABLE, 
"MS_IDENTITY_NOT_DERVIVABLE" },
+        { GSM48_REJECT_IMPLICITLY_DETACHED, "IMPLICITLY_DETACHED" },
+        { GSM48_REJECT_GPRS_NOT_ALLOWED_IN_PLMN, "GPRS_NOT_ALLOWED_IN_PLMN" },
+        { GSM48_REJECT_MSC_TMP_NOT_REACHABLE, "MSC_TMP_NOT_REACHABLE" },
+        { 0, NULL }
+};
+
 /*! @} */
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index dd4722e..31717d5 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -287,6 +287,7 @@
 gsm48_mm_msgtype_names;
 gsm48_cc_msgtype_names;
 gsm48_pdisc_msgtype_name;
+gsm48_reject_value_names;
 
 gsm_7bit_decode;
 gsm_7bit_decode_ussd;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6661f139e68a498fb1bef10c266c2f064b72774a
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de>

Reply via email to