diff options
Diffstat (limited to 'src/gsm')
-rw-r--r-- | src/gsm/gsm0808.c | 86 | ||||
-rw-r--r-- | src/gsm/libosmogsm.map | 3 |
2 files changed, 87 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, ¶ms->rr_cause); + + /* AoIP: Speech Codec (Chosen) 3.2.2.104 */ + if (params->speech_codec_chosen_present) + gsm0808_enc_speech_codec(msg, ¶ms->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, ¶ms->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*)¶ms->cause); + + /* RR Cause, 3.2.2.22 */ + if (params->rr_cause_present) + msgb_tlv_put(msg, GSM0808_IE_RR_CAUSE, 1, ¶ms->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, ¶ms->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; |