summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gsm/gsm0808.c24
-rw-r--r--src/gsm/gsm0808_utils.c16
-rw-r--r--src/gsm/libosmogsm.map2
3 files changed, 42 insertions, 0 deletions
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c
index c413688c..a84e717d 100644
--- a/src/gsm/gsm0808.c
+++ b/src/gsm/gsm0808.c
@@ -283,6 +283,30 @@ struct msgb *gsm0808_create_cipher_reject(enum gsm0808_cause cause)
return msg;
}
+/*! Create BSSMAP Cipher Mode Reject message
+ * \param[in] class 3GPP TS 08.08 §3.2.2.5 cause's class
+ * \param[in] ext 3GPP TS 08.08 §3.2.2.5 cause value (national application extension)
+ * \returns callee-allocated msgb with BSSMAP Cipher Mode Reject message */
+struct msgb *gsm0808_create_cipher_reject_ext(enum gsm0808_cause_class class, uint8_t ext)
+{
+ uint8_t c[2];
+ struct msgb *msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM,
+ "bssmap: cipher mode reject");
+ if (!msg)
+ return NULL;
+
+ c[0] = 0x80 | (class << 4); /* set the high bit to indicate extended cause */
+ c[1] = ext;
+
+ msgb_v_put(msg, BSS_MAP_MSG_CIPHER_MODE_REJECT);
+
+ msgb_tlv_put(msg, GSM0808_IE_CAUSE, 2, c);
+
+ msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg));
+
+ return msg;
+}
+
/*! Create BSSMAP LCLS CONNECT CONTROL message (TS 48.008 3.2.1.91).
* \param[in] config LCLS Configuration
* \param[in] control LCLS Connection Status Control
diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c
index 2348105d..c58d8284 100644
--- a/src/gsm/gsm0808_utils.c
+++ b/src/gsm/gsm0808_utils.c
@@ -1235,6 +1235,22 @@ void gsm48_mr_cfg_from_gsm0808_sc_cfg(struct gsm48_multi_rate_conf *cfg,
cfg->icmi = 1;
}
+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 32e4ce95..217dcc39 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -157,6 +157,8 @@ gsm0808_create_ass_fail;
gsm0808_create_cipher;
gsm0808_create_cipher_complete;
gsm0808_create_cipher_reject;
+gsm0808_create_cipher_reject_ext;
+gsm0808_get_cipher_reject_cause;
gsm0808_create_classmark_request;
gsm0808_create_classmark_update;
gsm0808_create_clear_command;