diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-10-27 17:05:55 +0300 |
---|---|---|
committer | fixeria <vyanitskiy@sysmocom.de> | 2021-11-03 21:12:52 +0000 |
commit | c6921e5068ba62cde67707fb3c8103919d1e0c0e (patch) | |
tree | 4f3be4159e914d8211d0859c165396a466a6251d /src | |
parent | e0661105aca655c2edf6bdbd52f2a4490ce877aa (diff) |
mncc: rework passing GCR over the MNCC interface
Using *unpacked* 'struct osmo_gcr_parsed' in the MNCC PDUs makes
the protocol even more complicated than it currently is, and
moreover complicates implementing MNCCv8 in the ttcn3-sip-test.
Replace 'struct osmo_gcr_parsed' in 'struct gsm_mncc' with a
fixed-length buffer, which is supposed to hold the Global Call
Reference encoded as per 3GPP TS 29.205.
Indicate presence of GCR using the MNCC_F_GCR flag.
Change-Id: I259b6d7e4cbe26159b9b496356fc7c1c27d54521
Fixes: I705c860e51637b4537cad65a330ecbaaca96dd5b
Related: OS#5164, OS#5282
Diffstat (limited to 'src')
-rw-r--r-- | src/libmsc/gsm_04_08_cc.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/libmsc/gsm_04_08_cc.c b/src/libmsc/gsm_04_08_cc.c index d6a2864e7..6562daadd 100644 --- a/src/libmsc/gsm_04_08_cc.c +++ b/src/libmsc/gsm_04_08_cc.c @@ -320,12 +320,16 @@ static void cc_paging_cb(struct msc_a *msc_a, struct gsm_trans *trans) trans->paging_request = NULL; /* Get the GCR from the MO call leg (if any). */ - if (!trans->cc.lcls) { + if (!trans->cc.lcls) trans->cc.lcls = trans_lcls_compose(trans, true); - if (trans->cc.lcls) { - trans->cc.lcls->gcr = trans->cc.msg.gcr; + if (trans->cc.lcls && trans->cc.msg.fields & MNCC_F_GCR) { + int rc = osmo_dec_gcr(&trans->cc.lcls->gcr, + &trans->cc.msg.gcr[0], + sizeof(trans->cc.msg.gcr)); + if (rc < 0) + LOG_TRANS(trans, LOGL_ERROR, "Failed to parse GCR\n"); + else trans->cc.lcls->gcr_available = true; - } } osmo_fsm_inst_dispatch(msc_a->c.fi, MSC_A_EV_TRANSACTION_ACCEPTED, trans); @@ -517,8 +521,18 @@ static int gsm48_cc_rx_setup(struct gsm_trans *trans, struct msgb *msg) trans->cc.lcls = trans_lcls_compose(trans, true); /* Pass the LCLS GCR on to the MT call leg via MNCC */ - if (trans->cc.lcls) - setup.gcr = trans->cc.lcls->gcr; + if (trans->cc.lcls) { + struct msgb *gcr_msg = msgb_alloc(sizeof(setup.gcr), "MNCC GCR"); + const struct osmo_gcr_parsed *gcr = &trans->cc.lcls->gcr; + int rc; + + if (gcr_msg != NULL && (rc = osmo_enc_gcr(gcr_msg, gcr)) > 0) { + memcpy(&setup.gcr[0], gcr_msg->data, rc); + setup.fields |= MNCC_F_GCR; + } else + LOG_TRANS(trans, LOGL_ERROR, "Failed to encode GCR\n"); + msgb_free(gcr_msg); + } tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0); /* emergency setup is identified by msg_type */ |