aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2018-11-09 13:36:11 +0100
committerMax <msuraev@sysmocom.de>2018-12-18 17:48:46 +0000
commitfe65ece24cb25f44b587c16d102bf57da1acbb42 (patch)
tree128723608135491e97cccc61635ff50cb8e284e9 /src
parent1cf21de48fe354d364f8b930448ec788553275c7 (diff)
LCLS: update parameter representation
* use osmo_lcls struct from libosmocore * use enum values instead of magic numbers Change-Id: I5e962d4fbb24bf1fb2398dc13e142a4a3304d858 Related: OS#3659
Diffstat (limited to 'src')
-rw-r--r--src/osmo-bsc/bsc_subscr_conn_fsm.c6
-rw-r--r--src/osmo-bsc/osmo_bsc_lcls.c26
2 files changed, 13 insertions, 19 deletions
diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c
index fac0bc0b7..85e754fa4 100644
--- a/src/osmo-bsc/bsc_subscr_conn_fsm.c
+++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c
@@ -883,9 +883,9 @@ struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_network *ne
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 cdd655798..622611d06 100644
--- a/src/osmo-bsc/osmo_bsc_lcls.c
+++ b/src/osmo-bsc/osmo_bsc_lcls.c
@@ -156,22 +156,16 @@ static int lcls_perform_correlation(struct gsm_subscriber_connection *conn_local
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 @@ static struct lcls_cfg_csc *update_lcls_cfg_csc(struct gsm_subscriber_connection
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 @@ static struct lcls_cfg_csc *update_lcls_cfg_csc(struct gsm_subscriber_connection
* 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 @@ static int lcls_handle_cfg_update(struct gsm_subscriber_connection *conn, void *
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)