aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/gsm/gsm0808.h40
-rw-r--r--include/osmocom/gsm/gsm_utils.h2
-rw-r--r--src/gsm/gsm0808.c86
-rw-r--r--src/gsm/libosmogsm.map3
4 files changed, 129 insertions, 2 deletions
diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h
index d704aa91..5ae0af83 100644
--- a/include/osmocom/gsm/gsm0808.h
+++ b/include/osmocom/gsm/gsm0808.h
@@ -103,6 +103,7 @@ struct gsm0808_old_bss_to_new_bss_info {
} current_channel_type_2;
/* more items are defined in the spec and may be added later */
+ bool more_items; /*< always set this to false */
};
/*! 3GPP TS 48.008 ยง3.2.1.9 HANDOVER REQUIRED */
@@ -120,6 +121,7 @@ struct gsm0808_handover_required {
struct gsm0808_old_bss_to_new_bss_info old_bss_to_new_bss_info;
/* more items are defined in the spec and may be added later */
+ bool more_items; /*< always set this to false */
};
struct msgb *gsm0808_create_handover_required(const struct gsm0808_handover_required *params);
@@ -127,6 +129,44 @@ struct msgb *gsm0808_create_handover_request_ack(const uint8_t *l3_info, uint8_t
uint8_t chosen_channel, uint8_t chosen_encr_alg,
uint8_t chosen_speech_version);
+struct msgb *gsm0808_create_handover_detect();
+
+struct gsm0808_handover_complete {
+ bool rr_cause_present;
+ uint8_t rr_cause;
+
+ bool speech_codec_chosen_present;
+ struct gsm0808_speech_codec speech_codec_chosen;
+
+ struct gsm0808_speech_codec_list codec_list_bss_supported; /*< omit when .len == 0 */
+
+ bool chosen_encr_alg_present;
+ uint8_t chosen_encr_alg;
+
+ bool chosen_channel_present;
+ uint8_t chosen_channel;
+
+ bool lcls_bss_status_present;
+ enum gsm0808_lcls_status lcls_bss_status;
+
+ /* more items are defined in the spec and may be added later */
+ bool more_items; /*< always set this to false */
+};
+struct msgb *gsm0808_create_handover_complete(const struct gsm0808_handover_complete *params);
+
+struct gsm0808_handover_failure {
+ uint16_t cause;
+
+ bool rr_cause_present;
+ uint8_t rr_cause;
+
+ struct gsm0808_speech_codec_list codec_list_bss_supported; /*< omit when .len == 0 */
+
+ /* more items are defined in the spec and may be added later */
+ bool more_items; /*< always set this to false */
+};
+struct msgb *gsm0808_create_handover_failure(const struct gsm0808_handover_failure *params);
+
struct msgb *gsm0808_create_dtap(struct msgb *msg, uint8_t link_id);
void gsm0808_prepend_dtap_header(struct msgb *msg, uint8_t link_id);
diff --git a/include/osmocom/gsm/gsm_utils.h b/include/osmocom/gsm/gsm_utils.h
index 83e29cac..6ff44598 100644
--- a/include/osmocom/gsm/gsm_utils.h
+++ b/include/osmocom/gsm/gsm_utils.h
@@ -30,6 +30,8 @@
#include <osmocom/core/defs.h>
#include <osmocom/core/utils.h>
+#include <osmocom/gsm/protocol/gsm_08_08.h>
+#include <osmocom/gsm/protocol/gsm_04_08.h>
#define ADD_MODULO(sum, delta, modulo) do { \
if ((sum += delta) >= modulo) \
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 */
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 3dccb227..96779d22 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -170,6 +170,9 @@ gsm0808_create_reset_ack;
gsm0808_create_sapi_reject;
gsm0808_create_handover_required;
gsm0808_create_handover_request_ack;
+gsm0808_create_handover_detect;
+gsm0808_create_handover_complete;
+gsm0808_create_handover_failure;
gsm0808_prepend_dtap_header;
gsm0808_enc_aoip_trasp_addr;
gsm0808_dec_aoip_trasp_addr;