This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Max gerrit-no-reply at lists.osmocom.orgMax has uploaded this change for review. ( https://gerrit.osmocom.org/11826 Change subject: LCLS: add gsm0808_create_ass_ext() ...................................................................... LCLS: add gsm0808_create_ass_ext() It allows setting additional assingment parameters explicitly. Change-Id: Id89765df3f8c12f55f73f1d7a9d90c8883eb3bba Related: OS#2487 --- M include/osmocom/gsm/gsm0808.h M src/gsm/gsm0808.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c M tests/gsm0808/gsm0808_test.ok 5 files changed, 135 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/26/11826/1 diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h index cdbb273..b85908f 100644 --- a/include/osmocom/gsm/gsm0808.h +++ b/include/osmocom/gsm/gsm0808.h @@ -60,6 +60,12 @@ const struct sockaddr_storage *ss, const struct gsm0808_speech_codec_list *scl, const uint32_t *ci); +struct msgb *gsm0808_create_ass_ext(const struct gsm0808_channel_type *ct, + const uint16_t *cic, + const struct sockaddr_storage *ss, + const struct gsm0808_speech_codec_list *scl, + const uint32_t *ci, + const uint8_t *kc, const struct osmo_lcls *lcls); 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, diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index e5c3e30..caf37a9 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -400,18 +400,21 @@ return msg; } -/*! Create BSSMAP Assignment Request message +/*! Create BSSMAP Assignment Request message, 3GPP TS 48.008 §3.2.1.1 * \param[in] ct Channel Type * \param[in] cic Circuit Identity Code (Classic A only) * \param[in] ss Socket Address of MSC-side RTP socket (AoIP only) * \param[in] scl Speech Codec List (AoIP only) - * \param[in] ci Call Identifier (Optional, LCLS) + * \param[in] ci Call Identifier (Optional, LCLS), §3.2.2.105 + * \param[in] kc Kc128 ciphering key (Optional, A5/4), §3.2.2.109 + * \param[in] lcls Optional LCLS parameters * \returns callee-allocated msgb with BSSMAP Assignment Request message */ -struct msgb *gsm0808_create_ass(const struct gsm0808_channel_type *ct, - const uint16_t *cic, - const struct sockaddr_storage *ss, - const struct gsm0808_speech_codec_list *scl, - const uint32_t *ci) +struct msgb *gsm0808_create_ass_ext(const struct gsm0808_channel_type *ct, + const uint16_t *cic, + const struct sockaddr_storage *ss, + const struct gsm0808_speech_codec_list *scl, + const uint32_t *ci, + const uint8_t *kc, const struct osmo_lcls *lcls) { /* See also: 3GPP TS 48.008 3.2.1.1 ASSIGNMENT REQUEST */ struct msgb *msg; @@ -452,8 +455,33 @@ /* AoIP: Call Identifier 3.2.2.105 */ if (ci) { ci_sw = osmo_htonl(*ci); - msgb_tv_fixed_put(msg, GSM0808_IE_CALL_ID, sizeof(ci_sw), - (uint8_t *) & ci_sw); + msgb_tv_fixed_put(msg, GSM0808_IE_CALL_ID, sizeof(ci_sw), (uint8_t *) & ci_sw); + } + + if (kc) { + msgb_tv_fixed_put(msg, GSM0808_IE_KC_128, 16, kc); + } + + if (lcls) { + + /* LCLS: §3.2.2.115 Global Call Reference */ + if (lcls->gcr) { + struct msgb *g = gsm0808_create_gcr(lcls->gcr); + msgb_tlv_put(msg, GSM0808_IE_GLOBAL_CALL_REF, msgb_length(g), msgb_data(g)); + msgb_free(g); + } + + /* LCLS: §3.2.2.116 Configuration */ + if (lcls->config != GSM0808_LCLS_CFG_NA) + msgb_tv_put(msg, GSM0808_IE_LCLS_CONFIG, lcls->config); + + /* LCLS: §3.2.2.117 Connection Status Control */ + if (lcls->control != GSM0808_LCLS_CSC_NA) + msgb_tv_put(msg, GSM0808_IE_LCLS_CONN_STATUS_CTRL, lcls->control); + + /* LCLS: §3.2.2.118 Correlation-Not-Needed */ + if (!lcls->corr_needed) + msgb_v_put(msg, GSM0808_IE_LCLS_CORR_NOT_NEEDED); } /* push the bssmap header */ @@ -463,6 +491,22 @@ return msg; } +/*! Create BSSMAP Assignment Request message + * \param[in] ct Channel Type + * \param[in] cic Circuit Identity Code (Classic A only) + * \param[in] ss Socket Address of MSC-side RTP socket (AoIP only) + * \param[in] scl Speech Codec List (AoIP only) + * \param[in] ci Call Identifier (Optional, LCLS) + * \returns callee-allocated msgb with BSSMAP Assignment Request message */ +struct msgb *gsm0808_create_ass(const struct gsm0808_channel_type *ct, + const uint16_t *cic, + const struct sockaddr_storage *ss, + const struct gsm0808_speech_codec_list *scl, + const uint32_t *ci) +{ + return gsm0808_create_ass_ext(ct, cic, ss, scl, ci, NULL, NULL); +} + /*! Create BSSMAP Assignment Completed message * \param[in] rr_cause GSM 04.08 RR Cause value * \param[in] chosen_channel Chosen Channel diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 4813e13..82ec8d4 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -149,6 +149,7 @@ gsm0808_bssmap_name; gsm0808_cause_name; gsm0808_create_ass; +gsm0808_create_ass_ext; gsm0808_create_assignment_completed; gsm0808_create_ass_compl; gsm0808_create_assignment_failure; diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c index 671b839..869fe97 100644 --- a/tests/gsm0808/gsm0808_test.c +++ b/tests/gsm0808/gsm0808_test.c @@ -344,6 +344,79 @@ msgb_free(msg); } +static void test_create_ass_ext() +{ + static const uint8_t res[] = { 0x00, 0x45, 0x01, 0x0b, 0x04, 0x01, 0x0b, 0x91, 0x15, 0x01, 0x00, 0x04, + GSM0808_IE_AOIP_TRASP_ADDR, + 0x06, + 0xac, 0x0c, 0x65, 0x0d, /* IPv4 */ + 0x02, 0x9a, + GSM0808_IE_SPEECH_CODEC_LIST, + 0x07, + GSM0808_SCT_FR3 | 0x50, + 0xef, 0xcd, + GSM0808_SCT_FR2 | 0xa0, + 0x9f, + GSM0808_SCT_CSD | 0x90, + 0xc0, + GSM0808_IE_CALL_ID, + 0xde, 0xad, 0xfa, 0xce, + 0x83, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, /* Kc */ + GSM0808_IE_GLOBAL_CALL_REF, 0x0d, /*GCR, length */ + 0x03, 0x44, 0x44, 0x44, /* GCR, Net ID */ + 0x02, 0xfe, 0xed, /* GCR, Node ID */ + 0x05, 0x41, 0x41, 0x41, 0x41, 0x41, /* GCR, Call ref. ID */ + GSM0808_IE_LCLS_CONFIG, GSM0808_LCLS_CFG_BOTH_WAY, + GSM0808_IE_LCLS_CONN_STATUS_CTRL, GSM0808_LCLS_CSC_CONNECT, + GSM0808_IE_LCLS_CORR_NOT_NEEDED, + }; + struct msgb *msg; + struct gsm0808_channel_type ct; + uint16_t cic = 4; + struct sockaddr_storage ss; + struct sockaddr_in sin; + struct gsm0808_speech_codec_list sc_list; + uint32_t call_id = 0xDEADFACE; + struct gsm0808_gcr gcr = { .net_len = 3, .node = 0xFEED }; + uint8_t Kc[16], net[gcr.net_len], cr[5]; + struct osmo_lcls lcls = { + .config = GSM0808_LCLS_CFG_BOTH_WAY, + .control = GSM0808_LCLS_CSC_CONNECT, + .gcr = &gcr, + .corr_needed = false + }; + + gcr.net = net; + gcr.cr = cr; + memset(cr, 'A', 5); + memset(net, 'D', gcr.net_len); + memset(Kc, 'E', 16); + + memset(&ct, 0, sizeof(ct)); + ct.ch_indctr = GSM0808_CHAN_SPEECH; + ct.ch_rate_type = GSM0808_SPEECH_HALF_PREF; + ct.perm_spch[0] = GSM0808_PERM_FR2; + ct.perm_spch[1] = GSM0808_PERM_HR2; + ct.perm_spch_len = 2; + + memset(&sin, 0, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_port = htons(666); + inet_aton("172.12.101.13", &sin.sin_addr); + + memset(&ss, 0, sizeof(ss)); + memcpy(&ss, &sin, sizeof(sin)); + + setup_codec_list(&sc_list); + + printf("Testing creating extended Assignment Request\n"); + + msg = gsm0808_create_ass_ext(&ct, &cic, &ss, &sc_list, &call_id, Kc, &lcls); + OSMO_ASSERT(msg); + VERIFY(msg, res, ARRAY_SIZE(res)); + msgb_free(msg); +} + static void test_create_ass_compl() { static const uint8_t res1[] = { @@ -1741,6 +1814,7 @@ test_create_cm_u(); test_create_sapi_reject(); test_create_ass(); + test_create_ass_ext(); test_create_ass_compl(); test_create_ass_compl_aoip(); test_create_ass_fail(); diff --git a/tests/gsm0808/gsm0808_test.ok b/tests/gsm0808/gsm0808_test.ok index 58bc509..89704c9 100644 --- a/tests/gsm0808/gsm0808_test.ok +++ b/tests/gsm0808/gsm0808_test.ok @@ -11,6 +11,7 @@ Testing creating CM U Testing creating SAPI Reject Testing creating Assignment Request +Testing creating extended Assignment Request Testing creating Assignment Complete Testing creating Assignment Complete (AoIP) Testing creating Assignment Failure -- To view, visit https://gerrit.osmocom.org/11826 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Id89765df3f8c12f55f73f1d7a9d90c8883eb3bba Gerrit-Change-Number: 11826 Gerrit-PatchSet: 1 Gerrit-Owner: Max <msuraev at sysmocom.de> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181119/ef86dfb9/attachment.htm>