diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-05-19 16:13:52 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-05-22 16:12:09 +0200 |
commit | c2402244c1aa437fe7eadb21013aace446047ac5 (patch) | |
tree | 92f6596a635cbb2f9e64bc0c037ed4a8e5f3fdb0 | |
parent | e1bef2d89c29600eeb655e00fcf496a2b2de3cb1 (diff) |
layer23: Define imsi_attached field as bool
Change-Id: I47e234dcef4c5af09023318dda45d40c8c92b312
-rw-r--r-- | src/host/layer23/include/osmocom/bb/common/settings.h | 2 | ||||
-rw-r--r-- | src/host/layer23/include/osmocom/bb/common/subscriber.h | 2 | ||||
-rw-r--r-- | src/host/layer23/src/common/vty.c | 12 | ||||
-rw-r--r-- | src/host/layer23/src/mobile/gsm48_mm.c | 4 |
4 files changed, 8 insertions, 12 deletions
diff --git a/src/host/layer23/include/osmocom/bb/common/settings.h b/src/host/layer23/include/osmocom/bb/common/settings.h index f66874c1..f480aadb 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 @@ struct test_sim_settings { 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 e2a8dab4..f44401d9 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 @@ struct gsm_subscriber { 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 c315689a..ef2de248 100644 --- a/src/host/layer23/src/common/vty.c +++ b/src/host/layer23/src/common/vty.c @@ -1053,8 +1053,7 @@ DEFUN(cfg_testsim_no_rplmn, cfg_testsim_no_rplmn_cmd, "no rplmn", 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 @@ static int _testsim_rplmn_cmd(struct vty *vty, int argc, const char *argv[], 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 @@ DEFUN(cfg_testsim_rplmn, cfg_testsim_rplmn_cmd, "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 @@ DEFUN(cfg_testsim_rplmn_att, cfg_testsim_rplmn_att_cmd, "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 95808ee5..2bba0e13 100644 --- a/src/host/layer23/src/mobile/gsm48_mm.c +++ b/src/host/layer23/src/mobile/gsm48_mm.c @@ -2234,7 +2234,7 @@ static int gsm48_mm_loc_upd_normal(struct osmocom_ms *ms, struct msgb *msg) && (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 @@ static int gsm48_mm_rx_loc_upd_acc(struct osmocom_ms *ms, struct msgb *msg) 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); |