summaryrefslogtreecommitdiffstats
path: root/src/gsm/gsm0808.c
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2018-11-30 10:44:07 +0100
committerMax <msuraev@sysmocom.de>2018-12-14 13:15:39 +0000
commit520743278064c81e7fbe06ba42de6eefa807235a (patch)
tree4ec650c43447422296922b3907ab55d598626e2b /src/gsm/gsm0808.c
parent969fb2ed841d34577d985af4baf67d20c6f35c8a (diff)
LCLS: add gsm0808_create_ass2()
It allows setting additional assignment parameters explicitly. Change-Id: Id89765df3f8c12f55f73f1d7a9d90c8883eb3bba Related: OS#2487
Diffstat (limited to 'src/gsm/gsm0808.c')
-rw-r--r--src/gsm/gsm0808.c53
1 files changed, 47 insertions, 6 deletions
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c
index e951ab1f..69da57da 100644
--- a/src/gsm/gsm0808.c
+++ b/src/gsm/gsm0808.c
@@ -425,18 +425,22 @@ struct msgb *gsm0808_create_sapi_reject(uint8_t link_id)
return msg;
}
-/*! Create BSSMAP Assignment Request message, 3GPP TS 48.008 §3.2.1.1
+/*! Create BSSMAP Assignment Request message, 3GPP TS 48.008 §3.2.1.1.
+ * This is identical to gsm0808_create_ass(), but adds KC and LCLS IEs.
* \param[in] ct Channel Type
* \param[in] cic Circuit Identity Code (Classic A only)
* \param[in] ss Socket Address of MSC-side RTP socket (AoIP only)
* \param[in] scl Speech Codec List (AoIP only)
* \param[in] ci Call Identifier (Optional), §3.2.2.105
+ * \param[in] kc Kc128 ciphering key (Optional, A5/4), §3.2.2.109
+ * \param[in] lcls Optional LCLS parameters
* \returns callee-allocated msgb with BSSMAP Assignment Request message */
-struct msgb *gsm0808_create_ass(const struct gsm0808_channel_type *ct,
- const uint16_t *cic,
- const struct sockaddr_storage *ss,
- const struct gsm0808_speech_codec_list *scl,
- const uint32_t *ci)
+struct msgb *gsm0808_create_ass2(const struct gsm0808_channel_type *ct,
+ const uint16_t *cic,
+ const struct sockaddr_storage *ss,
+ const struct gsm0808_speech_codec_list *scl,
+ const uint32_t *ci,
+ const uint8_t *kc, const struct osmo_lcls *lcls)
{
/* See also: 3GPP TS 48.008 3.2.1.1 ASSIGNMENT REQUEST */
struct msgb *msg;
@@ -481,6 +485,27 @@ struct msgb *gsm0808_create_ass(const struct gsm0808_channel_type *ct,
(uint8_t *) & ci_sw);
}
+ if (kc)
+ msgb_tv_fixed_put(msg, GSM0808_IE_KC_128, 16, kc);
+
+ if (lcls) {
+ /* LCLS: §3.2.2.115 Global Call Reference */
+ if (lcls->gcr)
+ gsm0808_enc_gcr(msg, lcls->gcr);
+
+ /* LCLS: §3.2.2.116 Configuration */
+ if (lcls->config != GSM0808_LCLS_CFG_NA)
+ msgb_tv_put(msg, GSM0808_IE_LCLS_CONFIG, lcls->config);
+
+ /* LCLS: §3.2.2.117 Connection Status Control */
+ if (lcls->control != GSM0808_LCLS_CSC_NA)
+ msgb_tv_put(msg, GSM0808_IE_LCLS_CONN_STATUS_CTRL, lcls->control);
+
+ /* LCLS: §3.2.2.118 Correlation-Not-Needed */
+ if (!lcls->corr_needed)
+ msgb_v_put(msg, GSM0808_IE_LCLS_CORR_NOT_NEEDED);
+ }
+
/* push the bssmap header */
msg->l3h =
msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg));
@@ -488,6 +513,22 @@ struct msgb *gsm0808_create_ass(const struct gsm0808_channel_type *ct,
return msg;
}
+/*! Create BSSMAP Assignment Request message, 3GPP TS 48.008 §3.2.1.1.
+ * \param[in] ct Channel Type
+ * \param[in] cic Circuit Identity Code (Classic A only)
+ * \param[in] ss Socket Address of MSC-side RTP socket (AoIP only)
+ * \param[in] scl Speech Codec List (AoIP only)
+ * \param[in] ci Call Identifier (Optional), §3.2.2.105
+ * \returns callee-allocated msgb with BSSMAP Assignment Request message */
+struct msgb *gsm0808_create_ass(const struct gsm0808_channel_type *ct,
+ const uint16_t *cic,
+ const struct sockaddr_storage *ss,
+ const struct gsm0808_speech_codec_list *scl,
+ const uint32_t *ci)
+{
+ return gsm0808_create_ass2(ct, cic, ss, scl, ci, NULL, NULL);
+}
+
/*! Create BSSMAP Assignment Completed message
* \param[in] rr_cause GSM 04.08 RR Cause value
* \param[in] chosen_channel Chosen Channel