LCLS: add status parameter to Assignment Completed message

* add gsm0808_create_ass_compl2() with additional gsm0808_lcls_status
  parameter and make gsm0808_create_ass_compl() into trivial wrapper
  around it
* update tests accordingly

Change-Id: I547c6b8707123aa8c1ef636db88908df112d90a4
Related: OS#2487
This commit is contained in:
Max 2019-01-08 14:44:24 +01:00 committed by Harald Welte
parent d6ef6f1b91
commit 414c8f565b
4 changed files with 43 additions and 11 deletions

View File

@ -76,6 +76,12 @@ struct msgb *gsm0808_create_ass_compl(uint8_t rr_cause, uint8_t chosen_channel,
const struct gsm0808_speech_codec *sc,
const struct gsm0808_speech_codec_list
*scl);
struct msgb *gsm0808_create_ass_compl2(uint8_t rr_cause, uint8_t chosen_channel,
uint8_t encr_alg_id, uint8_t speech_mode,
const struct sockaddr_storage *ss,
const struct gsm0808_speech_codec *sc,
const struct gsm0808_speech_codec_list *scl,
enum gsm0808_lcls_status lcls_bss_status);
struct msgb *gsm0808_create_assignment_completed(uint8_t rr_cause,
uint8_t chosen_channel,
uint8_t encr_alg_id,

View File

@ -519,7 +519,7 @@ struct msgb *gsm0808_create_ass(const struct gsm0808_channel_type *ct,
return gsm0808_create_ass2(ct, cic, ss, scl, ci, NULL, NULL);
}
/*! Create BSSMAP Assignment Completed message
/*! Create BSSMAP Assignment Completed message as per 3GPP TS 48.008 §3.2.1.2
* \param[in] rr_cause GSM 04.08 RR Cause value
* \param[in] chosen_channel Chosen Channel
* \param[in] encr_alg_id Encryption Algorithm ID
@ -527,13 +527,14 @@ struct msgb *gsm0808_create_ass(const struct gsm0808_channel_type *ct,
* \param[in] ss Socket Address of BSS-side RTP socket
* \param[in] sc Speech Codec (current)
* \param[in] scl Speech Codec List (permitted)
* \param[in] lcls_bss_status §3.2.2.119 LCLS-BSS-Status, optional
* \returns callee-allocated msgb with BSSMAP Assignment Complete message */
struct msgb *gsm0808_create_ass_compl(uint8_t rr_cause, uint8_t chosen_channel,
struct msgb *gsm0808_create_ass_compl2(uint8_t rr_cause, uint8_t chosen_channel,
uint8_t encr_alg_id, uint8_t speech_mode,
const struct sockaddr_storage *ss,
const struct gsm0808_speech_codec *sc,
const struct gsm0808_speech_codec_list
*scl)
const struct gsm0808_speech_codec_list *scl,
enum gsm0808_lcls_status lcls_bss_status)
{
struct msgb *msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM,
"bssmap: ass compl");
@ -570,13 +571,36 @@ struct msgb *gsm0808_create_ass_compl(uint8_t rr_cause, uint8_t chosen_channel,
if (scl)
gsm0808_enc_speech_codec_list(msg, scl);
/* write LSA identifier 3.2.2.15 */
/* FIXME: write LSA identifier 3.2.2.15 - see 3GPP TS 43.073 */
/* LCLS-BSS-Status 3.2.2.119 */
if (lcls_bss_status != GSM0808_LCLS_STS_NA)
msgb_tv_put(msg, GSM0808_IE_LCLS_BSS_STATUS, lcls_bss_status);
msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg));
return msg;
}
/*! Create BSSMAP Assignment Completed message
* \param[in] rr_cause GSM 04.08 RR Cause value
* \param[in] chosen_channel Chosen Channel
* \param[in] encr_alg_id Encryption Algorithm ID
* \param[in] speech_mode Speech Mode
* \param[in] ss Socket Address of BSS-side RTP socket
* \param[in] sc Speech Codec (current)
* \param[in] scl Speech Codec List (permitted)
* \returns callee-allocated msgb with BSSMAP Assignment Complete message */
struct msgb *gsm0808_create_ass_compl(uint8_t rr_cause, uint8_t chosen_channel,
uint8_t encr_alg_id, uint8_t speech_mode,
const struct sockaddr_storage *ss,
const struct gsm0808_speech_codec *sc,
const struct gsm0808_speech_codec_list *scl)
{
return gsm0808_create_ass_compl2(rr_cause, chosen_channel, encr_alg_id, speech_mode,
ss, sc, scl, GSM0808_LCLS_STS_NA);
}
/*! Create BSSMAP Assignment Completed message
* \param[in] rr_cause GSM 04.08 RR Cause value
* \param[in] chosen_channel Chosen Channel
@ -588,8 +612,8 @@ struct msgb *gsm0808_create_assignment_completed(uint8_t rr_cause,
uint8_t encr_alg_id,
uint8_t speech_mode)
{
return gsm0808_create_ass_compl(rr_cause, chosen_channel, encr_alg_id,
speech_mode, NULL, NULL, NULL);
return gsm0808_create_ass_compl2(rr_cause, chosen_channel, encr_alg_id,
speech_mode, NULL, NULL, NULL, GSM0808_LCLS_STS_NA);
}
/*! Create BSSMAP Assignment Failure message

View File

@ -153,6 +153,7 @@ gsm0808_create_ass;
gsm0808_create_ass2;
gsm0808_create_assignment_completed;
gsm0808_create_ass_compl;
gsm0808_create_ass_compl2;
gsm0808_create_assignment_failure;
gsm0808_create_ass_fail;
gsm0808_create_cipher;

View File

@ -510,11 +510,12 @@ static void test_create_ass_compl_aoip()
struct gsm0808_speech_codec sc;
struct gsm0808_speech_codec_list sc_list;
static const uint8_t res[] =
{ 0x00, 0x1d, 0x02, 0x15, 0x23, 0x21, 0x42, 0x2c, 0x11, 0x40, 0x22,
{ 0x00, 0x1f, 0x02, 0x15, 0x23, 0x21, 0x42, 0x2c, 0x11, 0x40, 0x22,
GSM0808_IE_AOIP_TRASP_ADDR, 0x06, 0xc0, 0xa8, 0x64, 0x17, 0x04,
0xd2, GSM0808_IE_SPEECH_CODEC, 0x01, GSM0808_SCT_HR1 | 0x90,
GSM0808_IE_SPEECH_CODEC_LIST, 0x07, GSM0808_SCT_FR3 | 0x50, 0xef,
0xcd, GSM0808_SCT_FR2 | 0xa0, 0x9f, GSM0808_SCT_CSD | 0x90, 0xc0 };
0xcd, GSM0808_SCT_FR2 | 0xa0, 0x9f, GSM0808_SCT_CSD | 0x90, 0xc0,
GSM0808_IE_LCLS_BSS_STATUS, GSM0808_LCLS_STS_LOCALLY_SWITCHED };
struct msgb *msg;
memset(&sin, 0, sizeof(sin));
@ -533,8 +534,8 @@ static void test_create_ass_compl_aoip()
setup_codec_list(&sc_list);
printf("Testing creating Assignment Complete (AoIP)\n");
msg = gsm0808_create_ass_compl(0x23, 0x42, 0x11, 0x22,
&ss, &sc, &sc_list);
msg = gsm0808_create_ass_compl2(0x23, 0x42, 0x11, 0x22,
&ss, &sc, &sc_list, GSM0808_LCLS_STS_LOCALLY_SWITCHED);
VERIFY(msg, res, ARRAY_SIZE(res));
msgb_free(msg);
}