aboutsummaryrefslogtreecommitdiffstats
path: root/src/gsm/gsm0808_utils.c
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2019-01-15 14:15:11 +0100
committerHarald Welte <laforge@gnumonks.org>2019-01-19 21:06:03 +0000
commit3b90125346e250f4d800e62846d39660a482d3c7 (patch)
treeb56f9000be4b5213ebecda3e0fb33cf7c2e74d09 /src/gsm/gsm0808_utils.c
parent414c8f565b68199fe1d7dd5d179252127a58ecaf (diff)
LCLS: make GCR into static member of osmo_lcls
Most of the time we'll have GCR filled anyway so it make sense to have it as static parameter instead of a pointer to separately allocated structure. Update tests to cover both static and dynamic osmo_lcls allocation variants. Change-Id: I905c36d8455911c68c30bc429379b7313dd46aea
Diffstat (limited to 'src/gsm/gsm0808_utils.c')
-rw-r--r--src/gsm/gsm0808_utils.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c
index 2a458c38..9fcccaec 100644
--- a/src/gsm/gsm0808_utils.c
+++ b/src/gsm/gsm0808_utils.c
@@ -551,8 +551,8 @@ uint8_t gsm0808_enc_lcls(struct msgb *msg, const struct osmo_lcls *lcls)
uint8_t enc = 0;
/* LCLS: §3.2.2.115 Global Call Reference */
- if (lcls->gcr)
- enc = gsm0808_enc_gcr(msg, lcls->gcr);
+ if (lcls->gcr_available)
+ enc = gsm0808_enc_gcr(msg, &lcls->gcr);
/* LCLS: §3.2.2.116 Configuration */
if (lcls->config != GSM0808_LCLS_CFG_NA) {
@@ -581,10 +581,9 @@ uint8_t gsm0808_enc_lcls(struct msgb *msg, const struct osmo_lcls *lcls)
* \returns GCR size or negative on error */
int gsm0808_dec_lcls(struct osmo_lcls *lcls, const struct tlv_parsed *tp)
{
- int ret = gsm0808_dec_gcr(lcls->gcr, tp);
- if (ret < 0)
- return ret;
+ int ret = gsm0808_dec_gcr(&lcls->gcr, tp);
+ lcls->gcr_available = (ret < 0) ? false : true;
lcls->config = tlvp_val8(tp, GSM0808_IE_LCLS_CONFIG, GSM0808_LCLS_CFG_NA);
lcls->control = tlvp_val8(tp, GSM0808_IE_LCLS_CONN_STATUS_CTRL, GSM0808_LCLS_CSC_NA);
lcls->corr_needed = TLVP_PRESENT(tp, GSM0808_IE_LCLS_CORR_NOT_NEEDED) ? false : true;