aboutsummaryrefslogtreecommitdiffstats
path: root/src/gsm/gsm0808.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-04-16 22:42:09 +0200
committerHarald Welte <laforge@gnumonks.org>2018-06-18 17:32:58 +0000
commit60f3153125fc07d406df90cde58ea658c929f5f8 (patch)
treebe054546ea996b149362b661ec7cc99b38e6f452 /src/gsm/gsm0808.c
parent1eb270bda845586e6c8d54f01c49b493d248a9d6 (diff)
add and tweak inter-BSC HO API
Add: gsm0808_create_handover_detect() gsm0808_create_handover_complete() gsm0808_create_handover_failure() To existing structs gsm0808_old_bss_to_new_bss_info and gsm0808_handover_required, add a final 'more_items' flag that makes future extensions API and ABI compatible. Fix the msgb string for Handover Request Ack. Extend some API doc comments. Related: OS#2283 (inter-BSC Handover, BSC side, MT) Change-Id: I03ee7ce840ecfa0b6a33358e7385528aabd4873f
Diffstat (limited to 'src/gsm/gsm0808.c')
-rw-r--r--src/gsm/gsm0808.c86
1 files changed, 84 insertions, 2 deletions
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c
index 3a631372..625de81f 100644
--- a/src/gsm/gsm0808.c
+++ b/src/gsm/gsm0808.c
@@ -739,14 +739,16 @@ struct msgb *gsm0808_create_handover_required(const struct gsm0808_handover_requ
return msg;
}
-/*! Create BSSMAP HANDOVER REQUEST ACKNOWLEDGE message, 3GPP TS 48.008 3.2.1.10. */
+/*! Create BSSMAP HANDOVER REQUEST ACKNOWLEDGE message, 3GPP TS 48.008 3.2.1.10.
+ * Sent from the MT BSC back to the MSC when it has allocated an lchan to handover to.
+ * l3_info is the RR Handover Command that the MO BSC sends to the MS to move over. */
struct msgb *gsm0808_create_handover_request_ack(const uint8_t *l3_info, uint8_t l3_info_len,
uint8_t chosen_channel, uint8_t chosen_encr_alg,
uint8_t chosen_speech_version)
{
struct msgb *msg;
- msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-HANDOVER-ACCEPT-ACK");
+ msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-HANDOVER-REQUEST-ACK");
if (!msg)
return NULL;
@@ -764,6 +766,86 @@ struct msgb *gsm0808_create_handover_request_ack(const uint8_t *l3_info, uint8_t
return msg;
}
+/*! Create BSSMAP HANDOVER DETECT message, 3GPP TS 48.008 3.2.1.40.
+ * Sent from the MT BSC back to the MSC when the MS has sent a handover RACH request and the MT BSC has
+ * received the Handover Detect message. */
+struct msgb *gsm0808_create_handover_detect()
+{
+ struct msgb *msg;
+
+ msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-HANDOVER-DETECT");
+ if (!msg)
+ return NULL;
+
+ /* Message Type, 3.2.2.1 */
+ msgb_v_put(msg, BSS_MAP_MSG_HANDOVER_DETECT);
+
+ return msg;
+}
+
+/*! Create BSSMAP HANDOVER COMPLETE message, 3GPP TS 48.008 3.2.1.12.
+ * Sent from the MT BSC back to the MSC when the MS has fully settled into the new lchan. */
+struct msgb *gsm0808_create_handover_complete(const struct gsm0808_handover_complete *params)
+{
+ struct msgb *msg;
+
+ msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-HANDOVER-COMPLETE");
+ if (!msg)
+ return NULL;
+
+ /* Message Type, 3.2.2.1 */
+ msgb_v_put(msg, BSS_MAP_MSG_HANDOVER_COMPLETE);
+
+ /* RR Cause, 3.2.2.22 */
+ if (params->rr_cause_present)
+ msgb_tlv_put(msg, GSM0808_IE_RR_CAUSE, 1, &params->rr_cause);
+
+ /* AoIP: Speech Codec (Chosen) 3.2.2.104 */
+ if (params->speech_codec_chosen_present)
+ gsm0808_enc_speech_codec(msg, &params->speech_codec_chosen);
+
+ /* AoIP: add Codec List (BSS Supported) 3.2.2.103 */
+ if (params->codec_list_bss_supported.len)
+ gsm0808_enc_speech_codec_list(msg, &params->codec_list_bss_supported);
+
+ /* Chosen Encryption Algorithm 3.2.2.44 */
+ if (params->chosen_encr_alg_present)
+ msgb_tv_put(msg, GSM0808_IE_CHOSEN_ENCR_ALG, params->chosen_encr_alg);
+
+ /* LCLS-BSS-Status 3.2.2.119 */
+ if (params->lcls_bss_status_present)
+ msgb_tv_put(msg, GSM0808_IE_LCLS_BSS_STATUS, params->lcls_bss_status);
+
+ return msg;
+}
+
+/*! Create BSSMAP HANDOVER FAILURE message, 3GPP TS 48.008 3.2.1.16.
+ * Sent from the MT BSC back to the MSC when the handover has failed. */
+struct msgb *gsm0808_create_handover_failure(const struct gsm0808_handover_failure *params)
+{
+ struct msgb *msg;
+
+ msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-HANDOVER-FAILURE");
+ if (!msg)
+ return NULL;
+
+ /* Message Type, 3.2.2.1 */
+ msgb_v_put(msg, BSS_MAP_MSG_HANDOVER_FAILURE);
+
+ /* Cause, 3.2.2.5 */
+ msgb_tlv_put(msg, GSM0808_IE_CAUSE, params->cause & 0x80? 2 : 1, (const uint8_t*)&params->cause);
+
+ /* RR Cause, 3.2.2.22 */
+ if (params->rr_cause_present)
+ msgb_tlv_put(msg, GSM0808_IE_RR_CAUSE, 1, &params->rr_cause);
+
+ /* AoIP: add Codec List (BSS Supported) 3.2.2.103 */
+ if (params->codec_list_bss_supported.len)
+ gsm0808_enc_speech_codec_list(msg, &params->codec_list_bss_supported);
+
+ return msg;
+}
+
/*! Prepend a DTAP header to given Message Buffer
* \param[in] msgb Message Buffer
* \param[in] link_id Link Identifier */