lynxis lazus has submitted this change. (
https://gerrit.osmocom.org/c/osmo-msc/+/38356?usp=email )
Change subject: vlr: refactor and rename vlr_timer into vlr_timer_val
......................................................................
vlr: refactor and rename vlr_timer into vlr_timer_val
Use correct types for vlr_timer. A timer T is always a signed integer.
Also osmo_tdef_get returns an unsigned long. Match the types from osmo_tdef.
Rename the vlr_timer() into vlr_timer_val() to make it more understandable.
Change-Id: Ic46ddb578962619fc08bd63645c76852e676fcc9
---
M include/osmocom/vlr/vlr.h
M src/libmsc/msc_vty.c
M src/libvlr/vlr.c
M src/libvlr/vlr_access_req_fsm.c
M src/libvlr/vlr_auth_fsm.c
M src/libvlr/vlr_lu_fsm.c
M tests/msc_vlr/msc_vlr_test_no_authen.c
7 files changed, 18 insertions(+), 18 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
diff --git a/include/osmocom/vlr/vlr.h b/include/osmocom/vlr/vlr.h
index 27b40c2..5d01397 100644
--- a/include/osmocom/vlr/vlr.h
+++ b/include/osmocom/vlr/vlr.h
@@ -424,7 +424,7 @@
bool vlr_subscr_matches_msisdn(struct vlr_subscr *vsub, const char *msisdn);
bool vlr_subscr_matches_imei(struct vlr_subscr *vsub, const char *imei);
-uint32_t vlr_timer(struct vlr_instance *vlr, uint32_t timer);
+unsigned long vlr_timer_secs(struct vlr_instance *vlr, int timer);
int vlr_subscr_changed(struct vlr_subscr *vsub);
int vlr_subscr_purge(struct vlr_subscr *vsub) __attribute__((warn_unused_result));
diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c
index 92b166f..d9eec51 100644
--- a/src/libmsc/msc_vty.c
+++ b/src/libmsc/msc_vty.c
@@ -1048,7 +1048,7 @@
VTY_NEWLINE);
}
- if (!vlr_timer(vsub->vlr, 3212)) {
+ if (!vlr_timer_secs(vsub->vlr, 3212)) {
MSC_VTY_DUMP(vty, offset, "Expires: never (T3212 is disabled)%s",
VTY_NEWLINE);
} else if (vsub->expire_lu == VLR_SUBSCRIBER_NO_EXPIRATION) {
diff --git a/src/libvlr/vlr.c b/src/libvlr/vlr.c
index f160578..97f2484 100644
--- a/src/libvlr/vlr.c
+++ b/src/libvlr/vlr.c
@@ -203,7 +203,7 @@
/* This is just a wrapper around the osmo_tdef API.
* TODO: we should start using osmo_tdef_fsm_inst_state_chg() */
-uint32_t vlr_timer(struct vlr_instance *vlr, uint32_t timer)
+unsigned long vlr_timer_secs(struct vlr_instance *vlr, int timer)
{
/* NOTE: since we usually do not need more than one instance of the VLR,
* and since libosmocore's osmo_tdef API does not (yet) support dynamic
@@ -731,7 +731,7 @@
/* Mark the subscriber as inactive if it stopped to do periodical location updates. */
if (osmo_clock_gettime(CLOCK_MONOTONIC, &now) == 0) {
- vsub->expire_lu = now.tv_sec + vlr_timer(vsub->vlr, 3212);
+ vsub->expire_lu = now.tv_sec + vlr_timer_secs(vsub->vlr, 3212);
} else {
LOGP(DVLR, LOGL_ERROR,
"%s: Could not enable Location Update expiry: unable to read current
time\n", vlr_subscr_name(vsub));
@@ -748,7 +748,7 @@
/* Periodic location update might be disabled from the VTY,
* so we shall not expire subscribers until explicit IMSI Detach. */
- if (!vlr_timer(vlr, 3212))
+ if (!vlr_timer_secs(vlr, 3212))
goto done;
if (llist_empty(&vlr->subscribers))
diff --git a/src/libvlr/vlr_access_req_fsm.c b/src/libvlr/vlr_access_req_fsm.c
index c2e185b..08adfbb 100644
--- a/src/libvlr/vlr_access_req_fsm.c
+++ b/src/libvlr/vlr_access_req_fsm.c
@@ -203,7 +203,7 @@
/* Chck_IMEI_VLR */
vlr->ops.tx_id_req(par->msc_conn_ref, GSM_MI_TYPE_IMEI);
osmo_fsm_inst_state_chg(fi, PR_ARQ_S_WAIT_CHECK_IMEI,
- vlr_timer(vlr, 3270), 3270);
+ vlr_timer_secs(vlr, 3270), 3270);
} else
_proc_arq_vlr_post_imei(fi);
}
@@ -406,7 +406,7 @@
if (vlr->cfg.parq_retrieve_imsi) {
/* Obtain_IMSI_VLR */
osmo_fsm_inst_state_chg(fi, PR_ARQ_S_WAIT_OBTAIN_IMSI,
- vlr_timer(vlr, 3270), 3270);
+ vlr_timer_secs(vlr, 3270), 3270);
return;
} else {
/* Set User Error: Unidentified Subscriber */
diff --git a/src/libvlr/vlr_auth_fsm.c b/src/libvlr/vlr_auth_fsm.c
index 5c16946..964c4d7 100644
--- a/src/libvlr/vlr_auth_fsm.c
+++ b/src/libvlr/vlr_auth_fsm.c
@@ -346,7 +346,7 @@
} else {
/* go straight ahead with sending auth request */
osmo_fsm_inst_state_chg(fi, VLR_SUB_AS_WAIT_RESP,
- vlr_timer(vsub->vlr, 3260), 3260);
+ vlr_timer_secs(vsub->vlr, 3260), 3260);
_vlr_subscr_authenticate(fi);
}
}
@@ -400,7 +400,7 @@
return;
pass:
osmo_fsm_inst_state_chg(fi, VLR_SUB_AS_WAIT_RESP,
- vlr_timer(vsub->vlr, 3260), 3260);
+ vlr_timer_secs(vsub->vlr, 3260), 3260);
_vlr_subscr_authenticate(fi);
}
@@ -424,7 +424,7 @@
GSM_MI_TYPE_IMSI);
osmo_fsm_inst_state_chg(fi,
VLR_SUB_AS_WAIT_ID_IMSI,
- vlr_timer(vlr, 3270), 3270);
+ vlr_timer_secs(vlr, 3270), 3270);
} else {
auth_fsm_term(fi, AUTH_FSM_FAILURE, GSM48_REJECT_ILLEGAL_MS);
}
@@ -467,7 +467,7 @@
case VLR_AUTH_E_HLR_SAI_ACK:
vlr_subscr_update_tuples(vsub, gsup);
osmo_fsm_inst_state_chg(fi, VLR_SUB_AS_WAIT_RESP_RESYNC,
- vlr_timer(vsub->vlr, 3260), 3260);
+ vlr_timer_secs(vsub->vlr, 3260), 3260);
_vlr_subscr_authenticate(fi);
break;
case VLR_AUTH_E_HLR_SAI_NACK:
@@ -500,7 +500,7 @@
GSM_MI_TYPE_IMSI);
osmo_fsm_inst_state_chg(fi,
VLR_SUB_AS_WAIT_ID_IMSI,
- vlr_timer(vlr, 3270), 3270);
+ vlr_timer_secs(vlr, 3270), 3270);
} else {
/* Result = Aborted */
auth_fsm_term(fi, AUTH_FSM_FAILURE, GSM48_REJECT_SYNCH_FAILURE);
diff --git a/src/libvlr/vlr_lu_fsm.c b/src/libvlr/vlr_lu_fsm.c
index d622baa..7101240 100644
--- a/src/libvlr/vlr_lu_fsm.c
+++ b/src/libvlr/vlr_lu_fsm.c
@@ -432,7 +432,7 @@
}
osmo_fsm_inst_state_chg(fi, LU_COMPL_VLR_S_WAIT_TMSI_CNF,
- vlr_timer(vlr, 3250), 3250);
+ vlr_timer_secs(vlr, 3250), 3250);
vlr->ops.tx_lu_acc(lcvp->msc_conn_ref, vsub->tmsi_new);
}
@@ -459,7 +459,7 @@
lcvp->assign_tmsi ?
LU_COMPL_VLR_S_WAIT_IMEI_TMSI
: LU_COMPL_VLR_S_WAIT_IMEI,
- vlr_timer(vlr, 3270), 3270);
+ vlr_timer_secs(vlr, 3270), 3270);
vlr->ops.tx_id_req(lcvp->msc_conn_ref, GSM_MI_TYPE_IMEI);
return;
}
@@ -939,7 +939,7 @@
LOGPFSM(fi, "%s()\n", __func__);
if (vlr->cfg.check_imei_rqd && vlr->cfg.retrieve_imeisv_early) {
- osmo_fsm_inst_state_chg(fi, VLR_ULA_S_WAIT_HLR_CHECK_IMEI_EARLY, vlr_timer(lfp->vlr,
3270), 3270);
+ osmo_fsm_inst_state_chg(fi, VLR_ULA_S_WAIT_HLR_CHECK_IMEI_EARLY,
vlr_timer_secs(lfp->vlr, 3270), 3270);
vlr_subscr_tx_req_check_imei(lfp->vsub);
} else {
vlr_loc_upd_node1(fi);
@@ -975,7 +975,7 @@
/* Obtain_IMSI_VLR */
osmo_fsm_inst_state_chg(fi, VLR_ULA_S_WAIT_IMSI,
- vlr_timer(vlr, 3270), 3270);
+ vlr_timer_secs(vlr, 3270), 3270);
vlr->ops.tx_id_req(lfp->msc_conn_ref, GSM_MI_TYPE_IMSI);
/* will continue at vlr_loc_upd_node1_pre() once IMSI arrives */
}
@@ -1112,7 +1112,7 @@
} else {
vlr->ops.tx_id_req(lfp->msc_conn_ref, GSM_MI_TYPE_IMEISV);
osmo_fsm_inst_state_chg(fi, VLR_ULA_S_WAIT_IMEISV,
- vlr_timer(vlr, 3270), 3270);
+ vlr_timer_secs(vlr, 3270), 3270);
}
}
diff --git a/tests/msc_vlr/msc_vlr_test_no_authen.c
b/tests/msc_vlr/msc_vlr_test_no_authen.c
index 5d3db69..384a069 100644
--- a/tests/msc_vlr/msc_vlr_test_no_authen.c
+++ b/tests/msc_vlr/msc_vlr_test_no_authen.c
@@ -941,7 +941,7 @@
vlr_subscr_put(vsub, __func__);
/* Let T3212 (periodic Location update timer) expire */
- fake_time_passes(vlr_timer(net->vlr, 3212) + 60 * 4, 0);
+ fake_time_passes(vlr_timer_secs(net->vlr, 3212) + 60 * 4, 0);
/* The subscriber should now be gone. */
vsub = vlr_subscr_find_by_imsi(net->vlr, imsi, __func__);
--
To view, visit
https://gerrit.osmocom.org/c/osmo-msc/+/38356?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Ic46ddb578962619fc08bd63645c76852e676fcc9
Gerrit-Change-Number: 38356
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>