Max has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/11820 )

Change subject: LCLS: update parameter representation
......................................................................

LCLS: update parameter representation

* use osmo_lcls struct from libosmocore
* use enum values instead of magic numbers

Change-Id: I5e962d4fbb24bf1fb2398dc13e142a4a3304d858
Related: OS#3659
---
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/bsc_subscr_conn_fsm.c
M src/osmo-bsc/osmo_bsc_lcls.c
3 files changed, 15 insertions(+), 21 deletions(-)

Approvals:
  Max: Looks good to me, approved
  Pau Espin Pedrol: Looks good to me, but someone else must approve
  Stefan Sperling: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 738bad3..cf34c6f 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -275,8 +275,8 @@
        struct {
                uint8_t global_call_ref[15];
                uint8_t global_call_ref_len; /* length of global_call_ref */
-               uint8_t config; /* TS 48.008 3.2.2.116 */
-               uint8_t control;/* TS 48.008 3.2.2.117 */
+               enum gsm0808_lcls_config config;        /* TS 48.008 3.2.2.116 
*/
+               enum gsm0808_lcls_control control;      /* TS 48.008 3.2.2.117 
*/
                /* LCLS FSM */
                struct osmo_fsm_inst *fi;
                /* pointer to "other" connection, if Call Leg Relocation was 
successful */
diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c 
b/src/osmo-bsc/bsc_subscr_conn_fsm.c
index fac0bc0..85e754f 100644
--- a/src/osmo-bsc/bsc_subscr_conn_fsm.c
+++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c
@@ -883,9 +883,9 @@
                return NULL;
        }

-       /* initialize to some magic values that indicate "IE not [yet] 
received" */
-       conn->lcls.config = 0xff;
-       conn->lcls.control = 0xff;
+       /* indicate "IE not [yet] received" */
+       conn->lcls.config = GSM0808_LCLS_CFG_NA;
+       conn->lcls.control = GSM0808_LCLS_CSC_NA;
        conn->lcls.fi = osmo_fsm_inst_alloc_child(&lcls_fsm, conn->fi, 
GSCON_EV_LCLS_FAIL);
        if (!conn->lcls.fi) {
                osmo_fsm_inst_term(conn->fi, OSMO_FSM_TERM_ERROR, NULL);
diff --git a/src/osmo-bsc/osmo_bsc_lcls.c b/src/osmo-bsc/osmo_bsc_lcls.c
index cdd6557..622611d 100644
--- a/src/osmo-bsc/osmo_bsc_lcls.c
+++ b/src/osmo-bsc/osmo_bsc_lcls.c
@@ -156,22 +156,16 @@
        return 0;
 }

-
-struct lcls_cfg_csc {
-       enum gsm0808_lcls_config config;
-       enum gsm0808_lcls_control control;
-};
-
 /* Update the connections LCLS configuration and return old/previous 
configuration.
  * \returns (staticallly allocated) old configuration; NULL if new config not 
supported */
-static struct lcls_cfg_csc *update_lcls_cfg_csc(struct 
gsm_subscriber_connection *conn,
-                                               struct lcls_cfg_csc 
*new_cfg_csc)
+static struct osmo_lcls *update_lcls_cfg_csc(struct gsm_subscriber_connection 
*conn,
+                                            struct osmo_lcls *new_cfg_csc)
 {
-       static struct lcls_cfg_csc old_cfg_csc;
+       static struct osmo_lcls old_cfg_csc = { 0 };
        old_cfg_csc.config = conn->lcls.config;
        old_cfg_csc.control = conn->lcls.control;

-       if (new_cfg_csc->config != 0xff) {
+       if (new_cfg_csc->config != GSM0808_LCLS_CFG_NA) {
                if (!lcls_is_supported_config(new_cfg_csc->config))
                        return NULL;
                if (conn->lcls.config != new_cfg_csc->config) {
@@ -179,7 +173,7 @@
                        conn->lcls.config = new_cfg_csc->config;
                }
        }
-       if (new_cfg_csc->control != 0xff) {
+       if (new_cfg_csc->control != GSM0808_LCLS_CSC_NA) {
                if (conn->lcls.control != new_cfg_csc->control) {
                        /* TODO: logging */
                        conn->lcls.control = new_cfg_csc->control;
@@ -193,9 +187,9 @@
  * unsupported, change into LCLS NOT SUPPORTED state and return -EINVAL. */
 static int lcls_handle_cfg_update(struct gsm_subscriber_connection *conn, void 
*data)
 {
-       struct lcls_cfg_csc *new_cfg_csc, *old_cfg_csc;
+       struct osmo_lcls *new_cfg_csc, *old_cfg_csc;

-       new_cfg_csc = (struct lcls_cfg_csc *) data;
+       new_cfg_csc = (struct osmo_lcls *) data;
        old_cfg_csc = update_lcls_cfg_csc(conn, new_cfg_csc);
        if (!old_cfg_csc) {
                osmo_fsm_inst_state_chg(conn->lcls.fi, ST_REQ_LCLS_NOT_SUPP, 0, 
0);
@@ -208,9 +202,9 @@
 void lcls_update_config(struct gsm_subscriber_connection *conn,
                        const uint8_t *config, const uint8_t *control)
 {
-       struct lcls_cfg_csc new_cfg = {
-               .config = 0xff,
-               .control = 0xff,
+       struct osmo_lcls new_cfg = {
+               .config = GSM0808_LCLS_CFG_NA,
+               .control = GSM0808_LCLS_CSC_NA,
        };
        /* nothing to update, skip it */
        if (!config && !control)

--
To view, visit https://gerrit.osmocom.org/11820
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I5e962d4fbb24bf1fb2398dc13e142a4a3304d858
Gerrit-Change-Number: 11820
Gerrit-PatchSet: 4
Gerrit-Owner: Max <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <[email protected]>
Gerrit-Reviewer: Neels Hofmeyr <[email protected]>
Gerrit-Reviewer: Pau Espin Pedrol <[email protected]>
Gerrit-Reviewer: Stefan Sperling <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>

Reply via email to