Change in osmo-bsc[master]: LCLS: update parameter representation

Max gerrit-no-reply at lists.osmocom.org
Sun Nov 18 23:48:55 UTC 2018


Max has uploaded this change for review. ( 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, 12 insertions(+), 18 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/20/11820/1

diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 7897fea..6be8b7b 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 bca9e1f..cc32d8a 100644
--- a/src/osmo-bsc/bsc_subscr_conn_fsm.c
+++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c
@@ -857,8 +857,8 @@
 	}
 
 	/* initialize to some magic values that indicate "IE not [yet] received" */
-	conn->lcls.config = 0xff;
-	conn->lcls.control = 0xff;
+	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 a406643..f457617 100644
--- a/src/osmo-bsc/osmo_bsc_lcls.c
+++ b/src/osmo-bsc/osmo_bsc_lcls.c
@@ -155,18 +155,12 @@
 	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;
 	old_cfg_csc.config = conn->lcls.config;
 	old_cfg_csc.control = conn->lcls.control;
 
@@ -192,9 +186,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);
@@ -207,9 +201,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: newchange
Gerrit-Change-Id: I5e962d4fbb24bf1fb2398dc13e142a4a3304d858
Gerrit-Change-Number: 11820
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/20181118/9d28a64d/attachment.html>


More information about the gerrit-log mailing list