aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2017-05-08 20:57:52 +0200
committerPablo Neira Ayuso <pablo@gnumonks.org>2017-05-10 11:21:24 +0200
commit5121576b0c6c323ae5f92d8d987b8c0899d99db0 (patch)
treec0157908247ea2f068fa942575753be416e43402
parent7b62d54b52457ecae649ead12e67369b3e09c235 (diff)
src: use osmo_timer_setup()
Use new function available in libosmocore to set up timers. Compile tested only. Change-Id: Ibcfd915688e97d370a888888a83a7c95cbe16819
-rw-r--r--openbsc/src/gprs/gprs_gmm.c8
-rw-r--r--openbsc/src/gprs/gprs_sgsn.c4
-rw-r--r--openbsc/src/gprs/gtphub.c4
-rw-r--r--openbsc/src/gprs/sgsn_ares.c4
-rw-r--r--openbsc/src/gprs/sgsn_cdr.c4
-rw-r--r--openbsc/src/gprs/sgsn_libgtp.c3
-rw-r--r--openbsc/src/ipaccess/abisip-find.c4
-rw-r--r--openbsc/src/ipaccess/ipaccess-proxy.c3
-rw-r--r--openbsc/src/libbsc/abis_rsl.c24
-rw-r--r--openbsc/src/libbsc/bsc_api.c3
-rw-r--r--openbsc/src/libbsc/bsc_msc.c6
-rw-r--r--openbsc/src/libbsc/bsc_rf_ctrl.c12
-rw-r--r--openbsc/src/libbsc/bsc_rll.c4
-rw-r--r--openbsc/src/libbsc/bts_nokia_site.c4
-rw-r--r--openbsc/src/libbsc/handover_logic.c3
-rw-r--r--openbsc/src/libbsc/paging.c11
-rw-r--r--openbsc/src/libcommon/gsup_client.c6
-rw-r--r--openbsc/src/libcommon/gsup_test_client.c3
-rw-r--r--openbsc/src/libmgcp/mgcp_protocol.c3
-rw-r--r--openbsc/src/libmsc/gsm_04_08.c10
-rw-r--r--openbsc/src/libmsc/smpp_openbsc.c3
-rw-r--r--openbsc/src/libmsc/sms_queue.c6
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_msc.c6
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_sccp.c6
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat.c12
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c4
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_ussd.c3
-rw-r--r--openbsc/src/osmo-nitb/bsc_hack.c7
-rw-r--r--openbsc/src/utils/bs11_config.c2
29 files changed, 60 insertions, 112 deletions
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index aa0389130..e6751db7c 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -227,9 +227,7 @@ static void mmctx_timer_start(struct sgsn_mm_ctx *mm, unsigned int T,
mm->num_T_exp = 0;
/* FIXME: we should do this only once ? */
- mm->timer.data = mm;
- mm->timer.cb = &mmctx_timer_cb;
-
+ osmo_timer_setup(&mm->timer, mmctx_timer_cb, mm);
osmo_timer_schedule(&mm->timer, seconds, 0);
}
@@ -2167,9 +2165,7 @@ static void pdpctx_timer_start(struct sgsn_pdp_ctx *pdp, unsigned int T,
pdp->num_T_exp = 0;
/* FIXME: we should do this only once ? */
- pdp->timer.data = pdp;
- pdp->timer.cb = &pdpctx_timer_cb;
-
+ osmo_timer_setup(&pdp->timer, pdpctx_timer_cb, pdp);
osmo_timer_schedule(&pdp->timer, seconds, 0);
}
diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c
index 5d9af7807..071dd97c8 100644
--- a/openbsc/src/gprs/gprs_sgsn.c
+++ b/openbsc/src/gprs/gprs_sgsn.c
@@ -889,9 +889,7 @@ static void sgsn_llme_check_cb(void *data_)
void sgsn_inst_init()
{
- sgsn->llme_timer.cb = sgsn_llme_check_cb;
- sgsn->llme_timer.data = NULL;
-
+ osmo_timer_setup(&sgsn->llme_timer, sgsn_llme_check_cb, NULL);
osmo_timer_schedule(&sgsn->llme_timer, GPRS_LLME_CHECK_TICK, 0);
}
diff --git a/openbsc/src/gprs/gtphub.c b/openbsc/src/gprs/gtphub.c
index a1aaed213..211018b53 100644
--- a/openbsc/src/gprs/gtphub.c
+++ b/openbsc/src/gprs/gtphub.c
@@ -2438,9 +2438,7 @@ static void gtphub_gc_cb(void *data)
static void gtphub_gc_start(struct gtphub *hub)
{
- hub->gc_timer.cb = gtphub_gc_cb;
- hub->gc_timer.data = hub;
-
+ osmo_timer_setup(&hub->gc_timer, gtphub_gc_cb, hub);
osmo_timer_schedule(&hub->gc_timer, GTPH_GC_TICK_SECONDS, 0);
}
diff --git a/openbsc/src/gprs/sgsn_ares.c b/openbsc/src/gprs/sgsn_ares.c
index dd1bdb57b..d94d184a3 100644
--- a/openbsc/src/gprs/sgsn_ares.c
+++ b/openbsc/src/gprs/sgsn_ares.c
@@ -71,12 +71,10 @@ static void osmo_ares_reschedule(struct sgsn_instance *sgsn)
osmo_timer_del(&sgsn->ares_timer);
timeout = ares_timeout(sgsn->ares_channel, NULL, &tv);
if (timeout) {
- sgsn->ares_timer.cb = ares_timeout_cb;
- sgsn->ares_timer.data = sgsn;
-
LOGP(DGPRS, LOGL_DEBUG, "C-ares scheduling timeout %llu.%llu\n",
(unsigned long long) tv.tv_sec,
(unsigned long long) tv.tv_usec);
+ osmo_timer_setup(&sgsn->ares_timer, ares_timeout_cb, sgsn);
osmo_timer_schedule(&sgsn->ares_timer, tv.tv_sec, tv.tv_usec);
}
}
diff --git a/openbsc/src/gprs/sgsn_cdr.c b/openbsc/src/gprs/sgsn_cdr.c
index bf0d6f704..091089610 100644
--- a/openbsc/src/gprs/sgsn_cdr.c
+++ b/openbsc/src/gprs/sgsn_cdr.c
@@ -227,8 +227,8 @@ static int handle_sgsn_sig(unsigned int subsys, unsigned int signal,
clock_gettime(CLOCK_MONOTONIC, &signal_data->pdp->cdr_start);
signal_data->pdp->cdr_charging_id = signal_data->pdp->lib->cid;
cdr_log_pdp(inst, "pdp-act", signal_data->pdp);
- signal_data->pdp->cdr_timer.cb = cdr_pdp_timeout;
- signal_data->pdp->cdr_timer.data = signal_data->pdp;
+ osmo_timer_setup(&signal_data->pdp->cdr_timer, cdr_pdp_timeout,
+ signal_data->pdp);
osmo_timer_schedule(&signal_data->pdp->cdr_timer, inst->cfg.cdr.interval, 0);
break;
case S_SGSN_PDP_DEACT:
diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c
index c26abc992..001e61146 100644
--- a/openbsc/src/gprs/sgsn_libgtp.c
+++ b/openbsc/src/gprs/sgsn_libgtp.c
@@ -845,8 +845,7 @@ int sgsn_gtp_init(struct sgsn_instance *sgi)
}
/* Start GTP re-transmission timer */
- sgi->gtp_timer.cb = sgsn_gtp_tmr_cb;
- sgi->gtp_timer.data = sgi;
+ osmo_timer_setup(&sgi->gtp_timer, sgsn_gtp_tmr_cb, sgi);
sgsn_gtp_tmr_start(sgi);
/* Register callbackcs with libgtp */
diff --git a/openbsc/src/ipaccess/abisip-find.c b/openbsc/src/ipaccess/abisip-find.c
index 5b36272e8..21d9f2290 100644
--- a/openbsc/src/ipaccess/abisip-find.c
+++ b/openbsc/src/ipaccess/abisip-find.c
@@ -200,9 +200,7 @@ int main(int argc, char **argv)
exit(1);
}
- timer.cb = timer_cb;
- timer.data = &bfd;
-
+ osmo_timer_setup(&timer, timer_cb, &bfd);
osmo_timer_schedule(&timer, 5, 0);
printf("Trying to find ip.access BTS by broadcast UDP...\n");
diff --git a/openbsc/src/ipaccess/ipaccess-proxy.c b/openbsc/src/ipaccess/ipaccess-proxy.c
index 9e8ec88e3..d3674426c 100644
--- a/openbsc/src/ipaccess/ipaccess-proxy.c
+++ b/openbsc/src/ipaccess/ipaccess-proxy.c
@@ -1059,8 +1059,7 @@ static int ipaccess_proxy_setup(void)
if (!ipp)
return -ENOMEM;
INIT_LLIST_HEAD(&ipp->bts_list);
- ipp->reconn_timer.cb = reconn_tmr_cb;
- ipp->reconn_timer.data = ipp;
+ osmo_timer_setup(&ipp->reconn_timer, reconn_tmr_cb, ipp);
/* Listen for OML connections */
ret = make_sock(&ipp->oml_listen_fd, IPPROTO_TCP, INADDR_ANY,
diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c
index be687ebaa..20dd2b5ca 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -73,8 +73,7 @@ static void do_lchan_free(struct gsm_lchan *lchan)
{
/* We start the error timer to make the channel available again */
if (lchan->state == LCHAN_S_REL_ERR) {
- lchan->error_timer.data = lchan;
- lchan->error_timer.cb = error_timeout_cb;
+ osmo_timer_setup(&lchan->error_timer, error_timeout_cb, lchan);
osmo_timer_schedule(&lchan->error_timer,
lchan->ts->trx->bts->network->T3111 + 2, 0);
} else {
@@ -890,8 +889,7 @@ static int rsl_rf_chan_release(struct gsm_lchan *lchan, int error,
}
/* Start another timer or assume the BTS sends a ACK/NACK? */
- lchan->act_timer.cb = lchan_deact_tmr_cb;
- lchan->act_timer.data = lchan;
+ osmo_timer_setup(&lchan->act_timer, lchan_deact_tmr_cb, lchan);
osmo_timer_schedule(&lchan->act_timer, 4, 0);
rc = abis_rsl_sendmsg(msg);
@@ -1200,8 +1198,7 @@ int rsl_release_request(struct gsm_lchan *lchan, uint8_t link_id,
&& release_mode == RSL_REL_LOCAL_END) {
DEBUGP(DRLL, "Scheduling release, becasuse Nokia InSite BTS does not send a RELease CONFirm.\n");
lchan->sapis[link_id & 0x7] = LCHAN_SAPI_REL;
- lchan->rel_work.cb = lchan_rel_work_cb;
- lchan->rel_work.data = lchan;
+ osmo_timer_setup(&lchan->rel_work, lchan_rel_work_cb, lchan);
osmo_timer_schedule(&lchan->rel_work, 0, 0);
}
@@ -1857,8 +1854,7 @@ static int rsl_rx_chan_rqd(struct msgb *msg)
lchan->tch_mode = GSM48_CMODE_SIGN;
/* Start another timer or assume the BTS sends a ACK/NACK? */
- lchan->act_timer.cb = lchan_act_tmr_cb;
- lchan->act_timer.data = lchan;
+ osmo_timer_setup(&lchan->act_timer, lchan_act_tmr_cb, lchan);
osmo_timer_schedule(&lchan->act_timer, 4, 0);
DEBUGP(DRSL, "%s Activating ARFCN(%u) SS(%u) lctype %s "
@@ -1898,8 +1894,7 @@ static int rsl_send_imm_assignment(struct gsm_lchan *lchan)
ia->l2_plen = GSM48_LEN2PLEN((sizeof(*ia)-1) + ia->mob_alloc_len);
/* Start timer T3101 to wait for GSM48_MT_RR_PAG_RESP */
- lchan->T3101.cb = t3101_expired;
- lchan->T3101.data = lchan;
+ osmo_timer_setup(&lchan->T3101, t3101_expired, lchan);
osmo_timer_schedule(&lchan->T3101, bts->network->T3101, 0);
/* send IMMEDIATE ASSIGN CMD on RSL to BTS (to send on CCCH to MS) */
@@ -2031,8 +2026,7 @@ static void rsl_handle_release(struct gsm_lchan *lchan)
/* Stop T3109 and wait for T3111 before re-using the channel */
osmo_timer_del(&lchan->T3109);
- lchan->T3111.cb = t3111_expired;
- lchan->T3111.data = lchan;
+ osmo_timer_setup(&lchan->T3111, t3111_expired, lchan);
bts = lchan->ts->trx->bts;
osmo_timer_schedule(&lchan->T3111, bts->network->T3111, 0);
}
@@ -2631,8 +2625,7 @@ static int dyn_ts_switchover_continue(struct gsm_bts_trx_ts *ts)
/* During switchover, we have received a release ack, which means that
* the act_timer has been stopped. Start the timer again so we mark
* this channel broken if the activation ack comes too late. */
- lchan->act_timer.cb = lchan_act_tmr_cb;
- lchan->act_timer.data = lchan;
+ osmo_timer_setup(&lchan->act_timer, lchan_act_tmr_cb, lchan);
osmo_timer_schedule(&lchan->act_timer, 4, 0);
rc = rsl_chan_activate_lchan(lchan, act_type, ho_ref);
@@ -2836,8 +2829,7 @@ int rsl_start_t3109(struct gsm_lchan *lchan)
if (bts->network->T3109 == 0)
return -1;
- lchan->T3109.cb = t3109_expired;
- lchan->T3109.data = lchan;
+ osmo_timer_setup(&lchan->T3109, t3109_expired, lchan);
osmo_timer_schedule(&lchan->T3109, bts->network->T3109, 0);
return 0;
}
diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c
index 253326f71..4dba3e95f 100644
--- a/openbsc/src/libbsc/bsc_api.c
+++ b/openbsc/src/libbsc/bsc_api.c
@@ -406,8 +406,7 @@ int gsm0808_assign_req(struct gsm_subscriber_connection *conn, int chan_mode, in
}
/* we will now start the timer to complete the assignment */
- conn->T10.cb = assignment_t10_timeout;
- conn->T10.data = conn;
+ osmo_timer_setup(&conn->T10, assignment_t10_timeout, conn);
osmo_timer_schedule(&conn->T10, GSM0808_T10_VALUE);
return 0;
diff --git a/openbsc/src/libbsc/bsc_msc.c b/openbsc/src/libbsc/bsc_msc.c
index e373679c1..82a572dbe 100644
--- a/openbsc/src/libbsc/bsc_msc.c
+++ b/openbsc/src/libbsc/bsc_msc.c
@@ -211,8 +211,7 @@ int bsc_msc_connect(struct bsc_msc_connection *con)
"MSC(%s) Connection in progress\n", con->name);
fd->when = BSC_FD_WRITE;
fd->cb = msc_connection_connect;
- con->timeout_timer.cb = msc_con_timeout;
- con->timeout_timer.data = con;
+ osmo_timer_setup(&con->timeout_timer, msc_con_timeout, con);
osmo_timer_schedule(&con->timeout_timer, 20, 0);
} else if (ret < 0) {
perror("Connection failed");
@@ -277,8 +276,7 @@ void bsc_msc_schedule_connect(struct bsc_msc_connection *con)
{
LOGP(DMSC, LOGL_NOTICE,
"Attempting to reconnect to the MSC(%s)\n", con->name);
- con->reconnect_timer.cb = reconnect_msc;
- con->reconnect_timer.data = con;
+ osmo_timer_setup(&con->reconnect_timer, reconnect_msc, con);
osmo_timer_schedule(&con->reconnect_timer, 5, 0);
}
diff --git a/openbsc/src/libbsc/bsc_rf_ctrl.c b/openbsc/src/libbsc/bsc_rf_ctrl.c
index d13c68546..b7b6fc819 100644
--- a/openbsc/src/libbsc/bsc_rf_ctrl.c
+++ b/openbsc/src/libbsc/bsc_rf_ctrl.c
@@ -266,8 +266,7 @@ static int enter_grace(struct osmo_bsc_rf *rf)
return 0;
}
- rf->grace_timeout.cb = grace_timeout;
- rf->grace_timeout.data = rf;
+ osmo_timer_setup(&rf->grace_timeout, grace_timeout, rf);
osmo_timer_schedule(&rf->grace_timeout, rf->gsm_network->bsc_data->mid_call_timeout, 0);
LOGP(DLINP, LOGL_NOTICE, "Going to switch RF off in %d seconds.\n",
rf->gsm_network->bsc_data->mid_call_timeout);
@@ -514,15 +513,12 @@ struct osmo_bsc_rf *osmo_bsc_rf_create(const char *path, struct gsm_network *net
rf->last_rf_lock_ctrl_command = talloc_strdup(rf, "");
/* check the rf state */
- rf->rf_check.data = rf;
- rf->rf_check.cb = rf_check_cb;
+ osmo_timer_setup(&rf->rf_check, rf_check_cb, rf);
/* delay cmd handling */
- rf->delay_cmd.data = rf;
- rf->delay_cmd.cb = rf_delay_cmd_cb;
+ osmo_timer_setup(&rf->delay_cmd, rf_delay_cmd_cb, rf);
- rf->auto_off_timer.data = rf;
- rf->auto_off_timer.cb = rf_auto_off_cb;
+ osmo_timer_setup(&rf->auto_off_timer, rf_auto_off_cb, rf);
/* listen to RF signals */
osmo_signal_register_handler(SS_MSC, msc_signal_handler, net);
diff --git a/openbsc/src/libbsc/bsc_rll.c b/openbsc/src/libbsc/bsc_rll.c
index f2b65ca7a..bb488da15 100644
--- a/openbsc/src/libbsc/bsc_rll.c
+++ b/openbsc/src/libbsc/bsc_rll.c
@@ -89,9 +89,7 @@ int rll_establish(struct gsm_lchan *lchan, uint8_t sapi,
llist_add(&rllr->list, &bsc_rll_reqs);
- rllr->timer.cb = &timer_cb;
- rllr->timer.data = rllr;
-
+ osmo_timer_setup(&rllr->timer, timer_cb, rllr);
osmo_timer_schedule(&rllr->timer, 7, 0);
/* send the RSL RLL ESTablish REQuest */
diff --git a/openbsc/src/libbsc/bts_nokia_site.c b/openbsc/src/libbsc/bts_nokia_site.c
index 32a885c0c..3ca76c017 100644
--- a/openbsc/src/libbsc/bts_nokia_site.c
+++ b/openbsc/src/libbsc/bts_nokia_site.c
@@ -1560,8 +1560,8 @@ static int abis_nm_rcvmsg_fom(struct msgb *mb)
*/
bts->nokia.wait_reset = 1;
- bts->nokia.reset_timer.cb = &reset_timer_cb;
- bts->nokia.reset_timer.data = bts;
+ osmo_timer_setup(&bts->nokia.reset_timer,
+ reset_timer_cb, bts);
osmo_timer_schedule(&bts->nokia.reset_timer, bts->nokia.bts_reset_timer_cnf, 0);
struct gsm_e1_subslot *e1_link = &bts->oml_e1_link;
diff --git a/openbsc/src/libbsc/handover_logic.c b/openbsc/src/libbsc/handover_logic.c
index ffcca6647..4dd913b15 100644
--- a/openbsc/src/libbsc/handover_logic.c
+++ b/openbsc/src/libbsc/handover_logic.c
@@ -216,8 +216,7 @@ static int ho_chan_activ_ack(struct gsm_lchan *new_lchan)
/* start T3103. We can continue either with T3103 expiration,
* 04.08 HANDOVER COMPLETE or 04.08 HANDOVER FAIL */
- ho->T3103.cb = ho_T3103_cb;
- ho->T3103.data = ho;
+ osmo_timer_setup(&ho->T3103, ho_T3103_cb, ho);
osmo_timer_schedule(&ho->T3103, 10, 0);
/* create a RTP connection */
diff --git a/openbsc/src/libbsc/paging.c b/openbsc/src/libbsc/paging.c
index bd23d89de..78e39c558 100644
--- a/openbsc/src/libbsc/paging.c
+++ b/openbsc/src/libbsc/paging.c
@@ -188,8 +188,8 @@ static void paging_handle_pending_requests(struct gsm_bts_paging_state *paging_b
* to zero and we do not get any messages.
*/
if (paging_bts->available_slots == 0) {
- paging_bts->credit_timer.cb = paging_give_credit;
- paging_bts->credit_timer.data = paging_bts;
+ osmo_timer_setup(&paging_bts->credit_timer, paging_give_credit,
+ paging_bts);
osmo_timer_schedule(&paging_bts->credit_timer, 5, 0);
return;
}
@@ -230,8 +230,8 @@ static void paging_init_if_needed(struct gsm_bts *bts)
bts->paging.bts = bts;
INIT_LLIST_HEAD(&bts->paging.pending_requests);
- bts->paging.work_timer.cb = paging_worker;
- bts->paging.work_timer.data = &bts->paging;
+ osmo_timer_setup(&bts->paging.work_timer, paging_worker,
+ &bts->paging);
/* Large number, until we get a proper message */
bts->paging.available_slots = 20;
@@ -299,8 +299,7 @@ static int _paging_request(struct gsm_bts *bts, struct bsc_subscr *bsub,
req->chan_type = type;
req->cbfn = cbfn;
req->cbfn_param = data;
- req->T3113.cb = paging_T3113_expired;
- req->T3113.data = req;
+ osmo_timer_setup(&req->T3113, paging_T3113_expired, req);
osmo_timer_schedule(&req->T3113, bts->network->T3113, 0);
llist_add_tail(&req->entry, &bts_entry->pending_requests);
paging_schedule_if_needed(bts_entry);
diff --git a/openbsc/src/libcommon/gsup_client.c b/openbsc/src/libcommon/gsup_client.c
index 2e920a6b6..de00d8d4f 100644
--- a/openbsc/src/libcommon/gsup_client.c
+++ b/openbsc/src/libcommon/gsup_client.c
@@ -254,8 +254,7 @@ static void ping_timer_cb(void *gsupc_)
static void start_test_procedure(struct gsup_client *gsupc)
{
- gsupc->ping_timer.data = gsupc;
- gsupc->ping_timer.cb = &ping_timer_cb;
+ osmo_timer_setup(&gsupc->ping_timer, ping_timer_cb, gsupc);
gsupc->got_ipa_pong = 0;
osmo_timer_schedule(&gsupc->ping_timer, GSUP_CLIENT_PING_INTERVAL, 0);
@@ -290,8 +289,7 @@ struct gsup_client *gsup_client_create(const char *ip_addr,
if (!gsupc->link)
goto failed;
- gsupc->connect_timer.data = gsupc;
- gsupc->connect_timer.cb = &connect_timer_cb;
+ osmo_timer_setup(&gsupc->connect_timer, connect_timer_cb, gsupc);
rc = gsup_client_connect(gsupc);
diff --git a/openbsc/src/libcommon/gsup_test_client.c b/openbsc/src/libcommon/gsup_test_client.c
index 8be4e7aea..8fc38d60d 100644
--- a/openbsc/src/libcommon/gsup_test_client.c
+++ b/openbsc/src/libcommon/gsup_test_client.c
@@ -77,8 +77,7 @@ static struct imsi_op *imsi_op_alloc(void *ctx, const char *imsi,
io = talloc_zero(ctx, struct imsi_op);
osmo_strlcpy(io->imsi, imsi, sizeof(io->imsi));
io->type = type;
- io->timer.cb = imsi_op_timer_cb;
- io->timer.data = io;
+ osmo_timer_setup(&io->timer, imsi_op_timer_cb, io);
llist_add(&io->list, &g_imsi_ops);
imsi_op_stats[type].num_alloc++;
diff --git a/openbsc/src/libmgcp/mgcp_protocol.c b/openbsc/src/libmgcp/mgcp_protocol.c
index 18398fc59..4fcadd949 100644
--- a/openbsc/src/libmgcp/mgcp_protocol.c
+++ b/openbsc/src/libmgcp/mgcp_protocol.c
@@ -1172,8 +1172,7 @@ static void mgcp_keepalive_timer_cb(void *_tcfg)
void mgcp_trunk_set_keepalive(struct mgcp_trunk_config *tcfg, int interval)
{
tcfg->keepalive_interval = interval;
- tcfg->keepalive_timer.data = tcfg;
- tcfg->keepalive_timer.cb = mgcp_keepalive_timer_cb;
+ osmo_timer_setup(&tcfg->keepalive_timer, mgcp_keepalive_timer_cb, tcfg);
if (interval <= 0)
osmo_timer_del(&tcfg->keepalive_timer);
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c
index 376106f5f..89108e466 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -618,8 +618,8 @@ static void loc_upd_rej_cb(void *data)
static void schedule_reject(struct gsm_subscriber_connection *conn)
{
- conn->loc_operation->updating_timer.cb = loc_upd_rej_cb;
- conn->loc_operation->updating_timer.data = conn;
+ osmo_timer_setup(&conn->loc_operation->updating_timer, loc_upd_rej_cb,
+ conn);
osmo_timer_schedule(&conn->loc_operation->updating_timer, 5, 0);
}
@@ -2224,8 +2224,7 @@ static void gsm48_start_cc_timer(struct gsm_trans *trans, int current,
int sec, int micro)
{
DEBUGP(DCC, "starting timer T%x with %d seconds\n", current, sec);
- trans->cc.timer.cb = gsm48_cc_timeout;
- trans->cc.timer.data = trans;
+ osmo_timer_setup(&trans->cc.timer, gsm48_cc_timeout, trans);
osmo_timer_schedule(&trans->cc.timer, sec, micro);
trans->cc.Tcurrent = current;
}
@@ -3955,8 +3954,7 @@ int gsm0408_new_conn(struct gsm_subscriber_connection *conn)
if (!conn->anch_operation)
return -1;
- conn->anch_operation->timeout.data = conn;
- conn->anch_operation->timeout.cb = anchor_timeout;
+ osmo_timer_setup(&conn->anch_operation->timeout, anchor_timeout, conn);
osmo_timer_schedule(&conn->anch_operation->timeout, 5, 0);
return 0;
}
diff --git a/openbsc/src/libmsc/smpp_openbsc.c b/openbsc/src/libmsc/smpp_openbsc.c
index 8f1a96c5c..8111d92b1 100644
--- a/openbsc/src/libmsc/smpp_openbsc.c
+++ b/openbsc/src/libmsc/smpp_openbsc.c
@@ -549,8 +549,7 @@ static int smpp_cmd_enqueue(struct osmo_esme *esme,
* lchan keeps busy until we get a reply to this SMPP command. Too high
* value may exhaust resources.
*/
- cmd->response_timer.cb = smpp_deliver_sm_cb;
- cmd->response_timer.data = cmd;
+ osmo_timer_setup(&cmd->response_timer, smpp_deliver_sm_cb, cmd);
osmo_timer_schedule(&cmd->response_timer, 5, 0);
llist_add_tail(&cmd->list, &esme->smpp_cmd_list);
*deferred = true;
diff --git a/openbsc/src/libmsc/sms_queue.c b/openbsc/src/libmsc/sms_queue.c
index ebc53c239..dc7f6e8c6 100644
--- a/openbsc/src/libmsc/sms_queue.c
+++ b/openbsc/src/libmsc/sms_queue.c
@@ -354,10 +354,8 @@ int sms_queue_start(struct gsm_network *network, int max_pending)
sms->max_fail = 1;
sms->network = network;
sms->max_pending = max_pending;
- sms->push_queue.data = sms;
- sms->push_queue.cb = sms_submit_pending;
- sms->resend_pending.data = sms;
- sms->resend_pending.cb = sms_resend_pending;
+ osmo_timer_setup(&sms->push_queue, sms_submit_pending, sms);
+ osmo_timer_setup(&sms->resend_pending, sms_resend_pending, sms);
sms_submit_pending(sms);
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_msc.c b/openbsc/src/osmo-bsc/osmo_bsc_msc.c
index 42e805515..8d02624b4 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_msc.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_msc.c
@@ -526,10 +526,8 @@ int osmo_bsc_msc_init(struct bsc_msc_data *data)
return -1;
}
- data->ping_timer.cb = msc_ping_timeout_cb;
- data->ping_timer.data = data;
- data->pong_timer.cb = msc_pong_timeout_cb;
- data->pong_timer.data = data;
+ osmo_timer_setup(&data->ping_timer, msc_ping_timeout_cb, data);
+ osmo_timer_setup(&data->pong_timer, msc_pong_timeout_cb, data);
data->msc_con->write_queue.bfd.data = data;
data->msc_con->connection_loss = msc_connection_was_lost;
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_sccp.c b/openbsc/src/osmo-bsc/osmo_bsc_sccp.c
index 970d70e82..e242390ef 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_sccp.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_sccp.c
@@ -232,10 +232,8 @@ enum bsc_con bsc_create_new_connection(struct gsm_subscriber_connection *conn,
bsc_con->send_ping = send_ping;
/* prepare the timers */
- bsc_con->sccp_it_timeout.cb = sccp_it_timeout;
- bsc_con->sccp_it_timeout.data = bsc_con;
- bsc_con->sccp_cc_timeout.cb = sccp_cc_timeout;
- bsc_con->sccp_cc_timeout.data = bsc_con;
+ osmo_timer_setup(&bsc_con->sccp_it_timeout, sccp_it_timeout, bsc_con);
+ osmo_timer_setup(&bsc_con->sccp_cc_timeout, sccp_cc_timeout, bsc_con);
INIT_LLIST_HEAD(&bsc_con->sccp_queue);
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c
index 80e89fd53..daa066d05 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c
@@ -180,10 +180,8 @@ static void bsc_ping_timeout(void *_bsc)
static void start_ping_pong(struct bsc_connection *bsc)
{
- bsc->pong_timeout.data = bsc;
- bsc->pong_timeout.cb = bsc_pong_timeout;
- bsc->ping_timeout.data = bsc;
- bsc->ping_timeout.cb = bsc_ping_timeout;
+ osmo_timer_setup(&bsc->pong_timeout, bsc_pong_timeout, bsc);
+ osmo_timer_setup(&bsc->ping_timeout, bsc_ping_timeout, bsc);
bsc_ping_timeout(bsc);
}
@@ -1446,8 +1444,7 @@ static int ipaccess_listen_bsc_cb(struct osmo_fd *bfd, unsigned int what)
/*
* start the hangup timer
*/
- bsc->id_timeout.data = bsc;
- bsc->id_timeout.cb = ipaccess_close_bsc;
+ osmo_timer_setup(&bsc->id_timeout, ipaccess_close_bsc, bsc);
osmo_timer_schedule(&bsc->id_timeout, nat->auth_timeout, 0);
return 0;
}
@@ -1711,8 +1708,7 @@ int main(int argc, char **argv)
/* recycle timer */
sccp_set_log_area(DSCCP);
- sccp_close.cb = sccp_close_unconfirmed;
- sccp_close.data = NULL;
+ osmo_timer_setup(&sccp_close, sccp_close_unconfirmed, NULL);
osmo_timer_schedule(&sccp_close, SCCP_CLOSE_TIME, 0);
while (1) {
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c b/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c
index 057a58310..345375897 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c
@@ -279,8 +279,8 @@ static int forward_to_bsc(struct ctrl_cmd *cmd)
pending->cmd = cmd;
/* Setup the timeout */
- pending->timeout.data = pending;
- pending->timeout.cb = pending_timeout_cb;
+ osmo_timer_setup(&pending->timeout, pending_timeout_cb,
+ pending);
/* TODO: Make timeout configurable */
osmo_timer_schedule(&pending->timeout, 10, 0);
llist_add_tail(&pending->list_entry, &bsc->cmd_pending);
diff --git a/openbsc/src/osmo-bsc_nat/bsc_ussd.c b/openbsc/src/osmo-bsc_nat/bsc_ussd.c
index 2f68381ac..0ba63270d 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_ussd.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_ussd.c
@@ -216,8 +216,7 @@ static void ussd_start_auth(struct bsc_nat_ussd_con *conn)
{
struct msgb *msg;
- conn->auth_timeout.data = conn;
- conn->auth_timeout.cb = ussd_auth_cb;
+ osmo_timer_setup(&conn->auth_timeout, ussd_auth_cb, conn);
osmo_timer_schedule(&conn->auth_timeout, conn->nat->auth_timeout, 0);
msg = msgb_alloc_headroom(4096, 128, "auth message");
diff --git a/openbsc/src/osmo-nitb/bsc_hack.c b/openbsc/src/osmo-nitb/bsc_hack.c
index d8029cd56..17b23b2b9 100644
--- a/openbsc/src/osmo-nitb/bsc_hack.c
+++ b/openbsc/src/osmo-nitb/bsc_hack.c
@@ -369,13 +369,12 @@ int main(int argc, char **argv)
printf("DB: Database prepared.\n");
/* setup the timer */
- db_sync_timer.cb = db_sync_timer_cb;
- db_sync_timer.data = NULL;
+ osmo_timer_setup(&db_sync_timer, db_sync_timer_cb, NULL);
if (use_db_counter)
osmo_timer_schedule(&db_sync_timer, DB_SYNC_INTERVAL);
- bsc_gsmnet->subscr_expire_timer.cb = subscr_expire_cb;
- bsc_gsmnet->subscr_expire_timer.data = NULL;
+ osmo_timer_setup(&bsc_gsmnet->subscr_expire_timer, subscr_expire_cb,
+ NULL);
osmo_timer_schedule(&bsc_gsmnet->subscr_expire_timer, EXPIRE_INTERVAL);
signal(SIGINT, &signal_handler);
diff --git a/openbsc/src/utils/bs11_config.c b/openbsc/src/utils/bs11_config.c
index 8b056375d..a0f3cb757 100644
--- a/openbsc/src/utils/bs11_config.c
+++ b/openbsc/src/utils/bs11_config.c
@@ -940,7 +940,7 @@ int main(int argc, char **argv)
abis_nm_bs11_factory_logon(g_bts, 1);
//abis_nm_bs11_get_serno(g_bts);
- status_timer.cb = status_timer_cb;
+ osmo_timer_setup(&status_timer, status_timer_cb, NULL);
while (1) {
if (osmo_select_main(0) < 0)