diff options
author | Philipp Maier <pmaier@sysmocom.de> | 2018-10-30 14:56:59 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-12-03 13:54:31 +0000 |
commit | 225bdf4779a0070648fced5b00cad9c1bfdc9908 (patch) | |
tree | 7474e3a12d9cccac44e66ade0587aa126c642eb3 /src | |
parent | a2f696fa5c735bb66f67b1bb9f0ad5a2a36cafb3 (diff) |
gsm0808: add message generator for BSSMAP HANDOVER PERFORMED
We currently have no generator function that can generate BSSMAP
HANDOVER PERFORMED messages. Lets add function for this.
Change-Id: I825106858bd89afc9837811b8fed2e8accc82441
Related: OS#3645
Diffstat (limited to 'src')
-rw-r--r-- | src/gsm/gsm0808.c | 46 | ||||
-rw-r--r-- | src/gsm/libosmogsm.map | 1 |
2 files changed, 47 insertions, 0 deletions
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index 2566ad5a..c0d5f39d 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -892,6 +892,52 @@ struct msgb *gsm0808_create_handover_failure(const struct gsm0808_handover_failu return msg; } +/*! Create BSSMAP HANDOVER PERFORMED message, 3GPP TS 48.008 3.2.1.25. + * \param[in] params All information to be encoded. + * \returns callee-allocated msgb with BSSMAP HANDOVER PERFORMED message */ +struct msgb *gsm0808_create_handover_performed(const struct gsm0808_handover_performed *params) +{ + struct msgb *msg; + + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "BSSMAP-HANDOVER-PERFORMED"); + if (!msg) + return NULL; + + /* Message Type, 3.2.2.1 */ + msgb_v_put(msg, BSS_MAP_MSG_HANDOVER_PERFORMED); + + /* Cause, 3.2.2.5 */ + msgb_tlv_put(msg, GSM0808_IE_CAUSE, gsm0808_cause_ext(params->cause) ? 2 : 1, (const uint8_t *)¶ms->cause); + + /* Cell Identifier, 3.2.2.17 */ + gsm0808_enc_cell_id(msg, ¶ms->cell_id); + + /* Chosen Channel 3.2.2.33 */ + if (params->chosen_channel_present) + msgb_tv_put(msg, GSM0808_IE_CHOSEN_CHANNEL, params->chosen_channel); + + /* 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); + + /* Speech Version (chosen) 3.2.2.51 */ + if (params->speech_version_chosen_present) + msgb_tv_put(msg, GSM0808_IE_SPEECH_VERSION, params->speech_version_chosen); + + /* AoIP: Speech Codec (chosen) 3.2.2.104 */ + if (params->speech_codec_chosen_present) + gsm0808_enc_speech_codec(msg, ¶ms->speech_codec_chosen); + + /* 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); + + /* prepend header with final length */ + msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); + + 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 3fe9dfcf..04a98267 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -181,6 +181,7 @@ gsm0808_create_handover_request_ack; gsm0808_create_handover_detect; gsm0808_create_handover_complete; gsm0808_create_handover_failure; +gsm0808_create_handover_performed; gsm0808_prepend_dtap_header; gsm0808_enc_aoip_trasp_addr; gsm0808_dec_aoip_trasp_addr; |