mirror of https://gerrit.osmocom.org/libosmocore
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
This commit is contained in:
parent
1eb270bda8
commit
60f3153125
|
@ -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);
|
||||
|
||||
|
|
|
@ -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) \
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue