aboutsummaryrefslogtreecommitdiffstats
path: root/src/gsm/gsm0808.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gsm/gsm0808.c')
-rw-r--r--src/gsm/gsm0808.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c
index 02288e6c..788f6c3c 100644
--- a/src/gsm/gsm0808.c
+++ b/src/gsm/gsm0808.c
@@ -1654,6 +1654,22 @@ const char *gsm0808_cause_name(enum gsm0808_cause cause)
return get_value_string(gsm0808_cause_names, cause);
}
+enum gsm0808_cause gsm0808_get_cause(const struct tlv_parsed *tp)
+{
+ const uint8_t *buf = TLVP_VAL_MINLEN(tp, GSM0808_IE_CAUSE, 1);
+
+ if (!buf)
+ return -EBADMSG;
+
+ if (TLVP_LEN(tp, GSM0808_IE_CAUSE) > 1) {
+ if (!gsm0808_cause_ext(buf[0]))
+ return -EINVAL;
+ return buf[1];
+ }
+
+ return buf[0];
+}
+
const struct value_string gsm0808_lcls_config_names[] = {
{ GSM0808_LCLS_CFG_BOTH_WAY, "Connect both-way" },
{ GSM0808_LCLS_CFG_BOTH_WAY_AND_BICAST_UL,