pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32795 )
Change subject: layer23: Define imsi_attached field as bool ......................................................................
layer23: Define imsi_attached field as bool
Change-Id: I47e234dcef4c5af09023318dda45d40c8c92b312 --- M src/host/layer23/include/osmocom/bb/common/settings.h M src/host/layer23/include/osmocom/bb/common/subscriber.h M src/host/layer23/src/common/vty.c M src/host/layer23/src/mobile/gsm48_mm.c 4 files changed, 17 insertions(+), 12 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/95/32795/1
diff --git a/src/host/layer23/include/osmocom/bb/common/settings.h b/src/host/layer23/include/osmocom/bb/common/settings.h index f66874c..f480aad 100644 --- a/src/host/layer23/include/osmocom/bb/common/settings.h +++ b/src/host/layer23/include/osmocom/bb/common/settings.h @@ -67,7 +67,7 @@ uint8_t rplmn_valid; struct osmo_plmn_id rplmn; uint16_t lac; - uint8_t imsi_attached; + bool imsi_attached; uint8_t always; /* ...search hplmn... */ };
diff --git a/src/host/layer23/include/osmocom/bb/common/subscriber.h b/src/host/layer23/include/osmocom/bb/common/subscriber.h index e2a8dab..f44401d 100644 --- a/src/host/layer23/include/osmocom/bb/common/subscriber.h +++ b/src/host/layer23/include/osmocom/bb/common/subscriber.h @@ -49,7 +49,7 @@ enum gsm_subscriber_sim_type sim_type; /* type of sim */ bool sim_valid; /* sim inserted and valid */ enum gsm_sub_sim_ustate ustate; /* update status */ - uint8_t imsi_attached; /* attached state */ + bool imsi_attached; /* attached state */
/* IMSI & co */ char imsi[OSMO_IMSI_BUF_SIZE]; diff --git a/src/host/layer23/src/common/vty.c b/src/host/layer23/src/common/vty.c index c315689..ef2de24 100644 --- a/src/host/layer23/src/common/vty.c +++ b/src/host/layer23/src/common/vty.c @@ -1053,8 +1053,7 @@ return CMD_SUCCESS; }
-static int _testsim_rplmn_cmd(struct vty *vty, int argc, const char *argv[], - int attached) +static int _testsim_rplmn_cmd(struct vty *vty, int argc, const char *argv[], bool attached) { struct osmocom_ms *ms = vty->index; struct gsm_settings *set = &ms->settings; @@ -1081,10 +1080,7 @@ else set->test_sim.tmsi = GSM_RESERVED_TMSI;
- if (attached) - set->test_sim.imsi_attached = 1; - else - set->test_sim.imsi_attached = 0; + set->test_sim.imsi_attached = attached;
l23_vty_restart_required_warn(vty, ms);
@@ -1097,7 +1093,7 @@ "Optionally set location area code\n" "Optionally set current assigned TMSI") { - return _testsim_rplmn_cmd(vty, argc, argv, 0); + return _testsim_rplmn_cmd(vty, argc, argv, false); }
DEFUN(cfg_testsim_rplmn_att, cfg_testsim_rplmn_att_cmd, @@ -1106,7 +1102,7 @@ "Set location area code\nSet current assigned TMSI\n" "Indicate to MM that card is already attached") { - return _testsim_rplmn_cmd(vty, argc, argv, 1); + return _testsim_rplmn_cmd(vty, argc, argv, true); }
DEFUN(cfg_testsim_hplmn, cfg_testsim_hplmn_cmd, "hplmn-search (everywhere|foreign-country)", diff --git a/src/host/layer23/src/mobile/gsm48_mm.c b/src/host/layer23/src/mobile/gsm48_mm.c index 95808ee..2bba0e1 100644 --- a/src/host/layer23/src/mobile/gsm48_mm.c +++ b/src/host/layer23/src/mobile/gsm48_mm.c @@ -2234,7 +2234,7 @@ && (subscr->imsi_attached || !s->att_allowed)) { LOGP(DMM, LOGL_INFO, "Loc. upd. not required.\n"); - subscr->imsi_attached = 1; + subscr->imsi_attached = true;
/* go straight to normal service state */ new_mm_state(mm, GSM48_MM_ST_MM_IDLE, @@ -2413,7 +2413,7 @@ mm->lupd_attempt = 0;
/* mark SIM as attached */ - subscr->imsi_attached = 1; + subscr->imsi_attached = true;
/* set the status in the sim to updated */ new_sim_ustate(subscr, GSM_SIM_U1_UPDATED);