aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/gsm/gsm0808.h4
-rw-r--r--include/osmocom/gsm/gsm0808_utils.h2
-rw-r--r--src/gsm/gsm0808.c16
-rw-r--r--src/gsm/gsm0808_utils.c16
-rw-r--r--src/gsm/libosmogsm.map1
-rw-r--r--tests/gsm0808/gsm0808_test.c2
6 files changed, 22 insertions, 19 deletions
diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h
index 373b4341..5a33f605 100644
--- a/include/osmocom/gsm/gsm0808.h
+++ b/include/osmocom/gsm/gsm0808.h
@@ -315,6 +315,10 @@ const char *gsm0808_bssap_name(uint8_t msg_type);
const char *gsm0808_cause_name(enum gsm0808_cause cause);
const char *gsm0808_cause_class_name(enum gsm0808_cause_class class);
+/*! Parse Cause TLV 3GPP TS 08.08 ยง3.2.2.5
+ * \returns Cause value */
+enum gsm0808_cause gsm0808_get_cause(const struct tlv_parsed *tp);
+
extern const struct value_string gsm0808_lcls_config_names[];
extern const struct value_string gsm0808_lcls_control_names[];
extern const struct value_string gsm0808_lcls_status_names[];
diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h
index ccdf5ed9..1cdca8c6 100644
--- a/include/osmocom/gsm/gsm0808_utils.h
+++ b/include/osmocom/gsm/gsm0808_utils.h
@@ -155,8 +155,6 @@ static inline bool gsm0808_cause_ext(enum gsm0808_cause cause)
return (cause & 0x80) && !(cause & 0x0F);
}
-int gsm0808_get_cipher_reject_cause(const struct tlv_parsed *tp);
-
/*! \returns 3GPP TS 48.008 3.2.2.49 Current Channel Type 1 from enum gsm_chan_t. */
static inline uint8_t gsm0808_current_channel_type_1(enum gsm_chan_t type)
{
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,
diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c
index 7416d8f5..6f3c07a4 100644
--- a/src/gsm/gsm0808_utils.c
+++ b/src/gsm/gsm0808_utils.c
@@ -1563,22 +1563,6 @@ int gsm48_mr_cfg_from_gsm0808_sc_cfg(struct gsm48_multi_rate_conf *cfg,
return 0;
}
-int gsm0808_get_cipher_reject_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];
-}
-
/*! Print a human readable name of the cell identifier to the char buffer.
* This is useful both for struct gsm0808_cell_id and struct gsm0808_cell_id_list2.
* See also gsm0808_cell_id_name() and gsm0808_cell_id_list_name().
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index a518b289..1ff1286c 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -157,6 +157,7 @@ gsm0808_bssap_name;
gsm0808_bssmap_name;
gsm0808_cause_name;
gsm0808_cause_class_name;
+gsm0808_get_cause;
gsm0808_create_ass;
gsm0808_create_ass2;
gsm0808_create_assignment_completed;
diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c
index ec249148..ce733901 100644
--- a/tests/gsm0808/gsm0808_test.c
+++ b/tests/gsm0808/gsm0808_test.c
@@ -306,7 +306,7 @@ static inline void parse_cipher_reject(struct msgb *msg, uint8_t exp)
if (rc < 0)
printf("FIXME: failed (%d) to parse created message %s\n", rc, msgb_hexdump(msg));
- rc = gsm0808_get_cipher_reject_cause(&tp);
+ rc = gsm0808_get_cause(&tp);
if (rc < 0)
printf("FIXME: failed (%s) to extract Cause from created message %s\n",
strerror(-rc), msgb_hexdump(msg));