aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2019-01-28 03:52:14 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2019-04-23 21:57:44 +0200
commita6078fe1d8701d15262e7eb5b3d50d13d1702bbc (patch)
treef59a29deaff503daf3b7354685148a1cbc6eaf5f
parent62f3b302b09ec183b601776e4a3d2b5658a5abe2 (diff)
use libosmocore osmo_tdef
Move the T_defs API to libosmocore as osmo_tdefs: remove the local T_defs API and use libosmocore's osmo_tdef* API instead. The root reason is moving the mgw_endpoint_fsm to libosmo-mgcp-client to be able to use it in osmo-msc for inter-MSC handover. When adding osmo_tdef, the new concept of timer groups was added to the API. It would make sense to apply group names here as well, but do not modify the VTY configuration for timers. The future might bring separate groups (or not). Depends: Ibd6b1ed7f1bd6e1f2e0fde53352055a4468f23e5 (libosmocore) Change-Id: I66674a5d8403d820038762888c846bae10ceac58
-rw-r--r--include/osmocom/bsc/Makefile.am1
-rw-r--r--include/osmocom/bsc/gsm_data.h4
-rw-r--r--include/osmocom/bsc/gsm_timers.h56
-rw-r--r--include/osmocom/bsc/mgw_endpoint_fsm.h4
-rw-r--r--src/ipaccess/Makefile.am2
-rw-r--r--src/osmo-bsc/Makefile.am2
-rw-r--r--src/osmo-bsc/abis_om2000.c7
-rw-r--r--src/osmo-bsc/abis_rsl.c4
-rw-r--r--src/osmo-bsc/assignment_fsm.c12
-rw-r--r--src/osmo-bsc/bsc_subscr_conn_fsm.c12
-rw-r--r--src/osmo-bsc/bsc_vty.c51
-rw-r--r--src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c3
-rw-r--r--src/osmo-bsc/bts_siemens_bs11.c5
-rw-r--r--src/osmo-bsc/gsm_data.c3
-rw-r--r--src/osmo-bsc/gsm_timers.c207
-rw-r--r--src/osmo-bsc/gsm_timers_vty.c118
-rw-r--r--src/osmo-bsc/handover_fsm.c10
-rw-r--r--src/osmo-bsc/lchan_fsm.c10
-rw-r--r--src/osmo-bsc/lchan_rtp_fsm.c11
-rw-r--r--src/osmo-bsc/mgw_endpoint_fsm.c9
-rw-r--r--src/osmo-bsc/net_init.c11
-rw-r--r--src/osmo-bsc/paging.c6
-rw-r--r--src/utils/Makefile.am2
-rw-r--r--tests/abis/Makefile.am1
-rw-r--r--tests/bsc/Makefile.am1
-rw-r--r--tests/gsm0408/Makefile.am1
-rw-r--r--tests/handover/Makefile.am1
-rw-r--r--tests/nanobts_omlattr/Makefile.am1
-rw-r--r--tests/nanobts_omlattr/nanobts_omlattr_test.c7
29 files changed, 94 insertions, 468 deletions
diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am
index 044fdc9d0..21e53d702 100644
--- a/include/osmocom/bsc/Makefile.am
+++ b/include/osmocom/bsc/Makefile.am
@@ -20,7 +20,6 @@ noinst_HEADERS = \
gsm_04_08_rr.h \
gsm_04_80.h \
gsm_data.h \
- gsm_timers.h \
handover.h \
handover_cfg.h \
handover_decision.h \
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index dc133e137..7b813a621 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -17,6 +17,7 @@
#include <osmocom/gsm/gsm0808.h>
#include <osmocom/gsm/gsm48.h>
#include <osmocom/core/fsm.h>
+#include <osmocom/core/tdef.h>
#include <osmocom/crypt/auth.h>
@@ -31,7 +32,6 @@
#include <osmocom/bsc/meas_rep.h>
#include <osmocom/bsc/bsc_msg_filter.h>
#include <osmocom/bsc/acc_ramp.h>
-#include <osmocom/bsc/gsm_timers.h>
#include <osmocom/bsc/neighbor_ident.h>
#define GSM_T3122_DEFAULT 10
@@ -1495,7 +1495,7 @@ struct gsm_network {
struct llist_head bts_rejected;
/* shall reference gsm_network_T[] */
- struct T_def *T_defs;
+ struct osmo_tdef *T_defs;
enum gsm_chan_t ctype_by_chreq[_NUM_CHREQ_T];
diff --git a/include/osmocom/bsc/gsm_timers.h b/include/osmocom/bsc/gsm_timers.h
deleted file mode 100644
index 699c461ad..000000000
--- a/include/osmocom/bsc/gsm_timers.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* API to define Tnnn timers globally, configure in VTY and use for FSM state changes. */
-#pragma once
-
-#include <stdint.h>
-#include <osmocom/core/utils.h>
-
-struct osmo_fsm_inst;
-struct vty;
-
-enum T_unit {
- T_S = 0, /*< most T are in seconds, keep 0 as default. */
- T_MS, /*< milliseconds */
- T_M, /*< minutes */
- T_CUSTOM,
-};
-
-extern const struct value_string T_unit_names[];
-static inline const char *T_unit_name(enum T_unit val)
-{ return get_value_string(T_unit_names, val); }
-
-/* Define a GSM timer of the form Tnnn, with unit, default value and doc string. */
-struct T_def {
- const int T; /*< T1234 number */
- const int default_val; /*< timeout duration (according to unit), default value. */
- const enum T_unit unit;
- const char *desc;
- int val; /*< currently active value, e.g. set by user config. */
-};
-
-/* Iterate an array of struct T_def, the last item should be fully zero, i.e. "{}" */
-#define for_each_T_def(d, T_defs) \
- for (d = T_defs; d && (d->T || d->default_val || d->desc); d++)
-
-int T_def_get(const struct T_def *T_defs, int T, enum T_unit as_unit, int val_if_not_present);
-void T_defs_reset(struct T_def *T_defs);
-struct T_def *T_def_get_entry(struct T_def *T_defs, int T);
-
-void T_defs_vty_init(struct T_def *T_defs, int cfg_parent_node);
-void T_defs_vty_write(struct vty *vty, const char *indent);
-struct T_def *parse_T_arg(struct vty *vty, const char *T_str);
-
-struct state_timeout {
- int T;
- bool keep_timer;
-};
-
-const struct state_timeout *get_state_timeout(uint32_t state,
- const struct state_timeout *timeouts_array);
-
-#define fsm_inst_state_chg_T(fi, state, timeouts_array, T_defs, default_timeout) \
- _fsm_inst_state_chg_T(fi, state, timeouts_array, T_defs, default_timeout, \
- __FILE__, __LINE__)
-int _fsm_inst_state_chg_T(struct osmo_fsm_inst *fi, uint32_t state,
- const struct state_timeout *timeouts_array,
- const struct T_def *T_defs, int default_timeout,
- const char *file, int line);
diff --git a/include/osmocom/bsc/mgw_endpoint_fsm.h b/include/osmocom/bsc/mgw_endpoint_fsm.h
index e264a3c8b..f86a7cd10 100644
--- a/include/osmocom/bsc/mgw_endpoint_fsm.h
+++ b/include/osmocom/bsc/mgw_endpoint_fsm.h
@@ -24,9 +24,9 @@ enum mgwep_fsm_event {
struct mgw_endpoint;
struct mgwep_ci;
-struct T_def;
+struct osmo_tdef;
-void mgw_endpoint_fsm_init(struct T_def *T_defs);
+void mgw_endpoint_fsm_init(struct osmo_tdef *T_defs);
struct mgw_endpoint *mgw_endpoint_alloc(struct osmo_fsm_inst *parent, uint32_t parent_term_event,
struct mgcp_client *mgcp_client,
diff --git a/src/ipaccess/Makefile.am b/src/ipaccess/Makefile.am
index 3578a40ff..145ea3989 100644
--- a/src/ipaccess/Makefile.am
+++ b/src/ipaccess/Makefile.am
@@ -50,7 +50,6 @@ ipaccess_config_LDADD = \
$(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts.o \
$(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.o \
$(top_builddir)/src/osmo-bsc/gsm_data.o \
- $(top_builddir)/src/osmo-bsc/gsm_timers.o \
$(top_builddir)/src/osmo-bsc/net_init.o \
$(OSMO_LIBS) \
$(NULL)
@@ -62,6 +61,5 @@ ipaccess_proxy_SOURCES = \
$(NULL)
ipaccess_proxy_LDADD = \
- $(top_builddir)/src/osmo-bsc/gsm_timers.o \
$(OSMO_LIBS) \
$(NULL)
diff --git a/src/osmo-bsc/Makefile.am b/src/osmo-bsc/Makefile.am
index 364228d8c..11803da4b 100644
--- a/src/osmo-bsc/Makefile.am
+++ b/src/osmo-bsc/Makefile.am
@@ -57,8 +57,6 @@ osmo_bsc_SOURCES = \
gsm_04_08_rr.c \
gsm_04_80_utils.c \
gsm_data.c \
- gsm_timers.c \
- gsm_timers_vty.c \
handover_cfg.c \
handover_decision.c \
handover_decision_2.c \
diff --git a/src/osmo-bsc/abis_om2000.c b/src/osmo-bsc/abis_om2000.c
index 9715dfc17..fda273de9 100644
--- a/src/osmo-bsc/abis_om2000.c
+++ b/src/osmo-bsc/abis_om2000.c
@@ -42,7 +42,6 @@
#include <osmocom/bsc/abis_rsl.h>
#include <osmocom/bsc/abis_om2000.h>
#include <osmocom/bsc/signal.h>
-#include <osmocom/bsc/gsm_timers.h>
#include <osmocom/bsc/timeslot_fsm.h>
#include <osmocom/abis/e1_input.h>
@@ -1381,7 +1380,7 @@ int abis_om2k_tx_ts_conf_req(struct gsm_bts_trx_ts *ts)
break;
case GSM_PCHAN_CCCH_SDCCH4:
msgb_tv_put(msg, OM2K_DEI_T3105,
- T_def_get(ts->trx->bts->network->T_defs, 3105, T_MS, -1) / 10);
+ osmo_tdef_get(ts->trx->bts->network->T_defs, 3105, OSMO_TDEF_MS, -1) / 10);
msgb_tv_put(msg, OM2K_DEI_NY1, 35);
msgb_tv_put(msg, OM2K_DEI_BA_PA_MFRMS, 0x06);
msgb_tv_put(msg, OM2K_DEI_CBCH_INDICATOR, 0);
@@ -1396,7 +1395,7 @@ int abis_om2k_tx_ts_conf_req(struct gsm_bts_trx_ts *ts)
break;
case GSM_PCHAN_SDCCH8_SACCH8C:
msgb_tv_put(msg, OM2K_DEI_T3105,
- T_def_get(ts->trx->bts->network->T_defs, 3105, T_MS, -1) / 10);
+ osmo_tdef_get(ts->trx->bts->network->T_defs, 3105, OSMO_TDEF_MS, -1) / 10);
msgb_tv_put(msg, OM2K_DEI_NY1, 35);
msgb_tv_put(msg, OM2K_DEI_CBCH_INDICATOR, 0);
msgb_tv_put(msg, OM2K_DEI_TSC, gsm_ts_tsc(ts));
@@ -1407,7 +1406,7 @@ int abis_om2k_tx_ts_conf_req(struct gsm_bts_trx_ts *ts)
break;
default:
msgb_tv_put(msg, OM2K_DEI_T3105,
- T_def_get(ts->trx->bts->network->T_defs, 3105, T_MS, -1) / 10);
+ osmo_tdef_get(ts->trx->bts->network->T_defs, 3105, OSMO_TDEF_MS, -1) / 10);
msgb_tv_put(msg, OM2K_DEI_NY1, 35);
msgb_tv_put(msg, OM2K_DEI_TSC, gsm_ts_tsc(ts));
/* Disable RF RESOURCE INDICATION on idle channels */
diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c
index fd6dbdb78..0117435b6 100644
--- a/src/osmo-bsc/abis_rsl.c
+++ b/src/osmo-bsc/abis_rsl.c
@@ -45,7 +45,7 @@
#include <osmocom/bsc/pcu_if.h>
#include <osmocom/bsc/gsm_08_08.h>
#include <osmocom/netif/rtp.h>
-#include <osmocom/bsc/gsm_timers.h>
+#include <osmocom/core/tdef.h>
#include <osmocom/bsc/bsc_subscr_conn_fsm.h>
#include <osmocom/bsc/timeslot_fsm.h>
#include <osmocom/bsc/lchan_select.h>
@@ -1291,7 +1291,7 @@ int rsl_tx_imm_ass_rej(struct gsm_bts *bts, struct gsm48_req_ref *rqd_ref)
uint8_t wait_ind;
wait_ind = bts->T3122;
if (!wait_ind)
- wait_ind = T_def_get(bts->network->T_defs, 3122, T_S, -1);
+ wait_ind = osmo_tdef_get(bts->network->T_defs, 3122, OSMO_TDEF_S, -1);
if (!wait_ind)
wait_ind = GSM_T3122_DEFAULT;
/* The BTS will gather multiple CHAN RQD and reject up to 4 MS at the same time. */
diff --git a/src/osmo-bsc/assignment_fsm.c b/src/osmo-bsc/assignment_fsm.c
index 9c0c40028..520498fe3 100644
--- a/src/osmo-bsc/assignment_fsm.c
+++ b/src/osmo-bsc/assignment_fsm.c
@@ -20,13 +20,13 @@
*
*/
+#include <osmocom/core/tdef.h>
#include <osmocom/gsm/gsm0808.h>
#include <osmocom/mgcp_client/mgcp_client_fsm.h>
#include <osmocom/bsc/debug.h>
#include <osmocom/bsc/gsm_data.h>
-#include <osmocom/bsc/gsm_timers.h>
#include <osmocom/bsc/lchan_fsm.h>
#include <osmocom/bsc/mgw_endpoint_fsm.h>
#include <osmocom/bsc/bsc_subscr_conn_fsm.h>
@@ -48,7 +48,7 @@ struct gsm_subscriber_connection *assignment_fi_conn(struct osmo_fsm_inst *fi)
return fi->priv;
}
-static const struct state_timeout assignment_fsm_timeouts[32] = {
+static const struct osmo_tdef_state_timeout assignment_fsm_timeouts[32] = {
[ASSIGNMENT_ST_WAIT_LCHAN_ACTIVE] = { .T=10 },
[ASSIGNMENT_ST_WAIT_RR_ASS_COMPLETE] = { .keep_timer=true },
[ASSIGNMENT_ST_WAIT_LCHAN_ESTABLISHED] = { .keep_timer=true },
@@ -59,10 +59,10 @@ static const struct state_timeout assignment_fsm_timeouts[32] = {
* The actual timeout value is in turn obtained from network->T_defs.
* Assumes local variable fi exists. */
#define assignment_fsm_state_chg(state) \
- fsm_inst_state_chg_T(fi, state, \
- assignment_fsm_timeouts, \
- ((struct gsm_subscriber_connection*)(fi->priv))->network->T_defs, \
- 5)
+ osmo_tdef_fsm_inst_state_chg(fi, state, \
+ assignment_fsm_timeouts, \
+ ((struct gsm_subscriber_connection*)(fi->priv))->network->T_defs, \
+ 5)
/* Log failure and transition to ASSIGNMENT_ST_FAILURE, which triggers the appropriate actions. */
#define assignment_fail(cause, fmt, args...) do { \
diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c
index 1cc0c78b4..4466404f3 100644
--- a/src/osmo-bsc/bsc_subscr_conn_fsm.c
+++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c
@@ -37,7 +37,7 @@
#include <osmocom/bsc/penalty_timers.h>
#include <osmocom/bsc/bsc_rll.h>
#include <osmocom/bsc/abis_rsl.h>
-#include <osmocom/bsc/gsm_timers.h>
+#include <osmocom/core/tdef.h>
#include <osmocom/bsc/gsm_04_08_rr.h>
#include <osmocom/bsc/mgw_endpoint_fsm.h>
#include <osmocom/bsc/assignment_fsm.h>
@@ -85,7 +85,7 @@ static const struct value_string gscon_fsm_event_names[] = {
{}
};
-struct state_timeout conn_fsm_timeouts[32] = {
+struct osmo_tdef_state_timeout conn_fsm_timeouts[32] = {
[ST_WAIT_CC] = { .T = 993210 },
[ST_CLEARING] = { .T = 999 },
};
@@ -94,10 +94,10 @@ struct state_timeout conn_fsm_timeouts[32] = {
* The actual timeout value is in turn obtained from network->T_defs.
* Assumes local variable 'conn' exists. */
#define conn_fsm_state_chg(state) \
- fsm_inst_state_chg_T(conn->fi, state, \
- conn_fsm_timeouts, \
- conn->network->T_defs, \
- -1)
+ osmo_tdef_fsm_inst_state_chg(conn->fi, state, \
+ conn_fsm_timeouts, \
+ conn->network->T_defs, \
+ -1)
/* forward MT DTAP from BSSAP side to RSL side */
static inline void submit_dtap(struct gsm_subscriber_connection *conn, struct msgb *msg)
diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index 767d56596..3a6ddd42b 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -29,6 +29,7 @@
#include <osmocom/vty/stats.h>
#include <osmocom/vty/telnet_interface.h>
#include <osmocom/vty/misc.h>
+#include <osmocom/vty/tdef_vty.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
#include <osmocom/gsm/gsm0502.h>
#include <osmocom/ctrl/control_if.h>
@@ -66,11 +67,9 @@
#include <osmocom/bsc/meas_feed.h>
#include <osmocom/bsc/neighbor_ident.h>
#include <osmocom/bsc/handover.h>
-#include <osmocom/bsc/gsm_timers.h>
#include <osmocom/bsc/timeslot_fsm.h>
#include <osmocom/bsc/lchan_fsm.h>
#include <osmocom/bsc/lchan_select.h>
-#include <osmocom/bsc/gsm_timers.h>
#include <osmocom/bsc/mgw_endpoint_fsm.h>
#include <inttypes.h>
@@ -1046,7 +1045,7 @@ static int config_write_net(struct vty *vty)
ho_vty_write_net(vty, gsmnet);
- T_defs_vty_write(vty, " ");
+ osmo_tdef_vty_write(vty, gsmnet->T_defs, " ");
if (!gsmnet->dyn_ts_allow_tch_f)
vty_out(vty, " dyn_ts_allow_tch_f 0%s", VTY_NEWLINE);
@@ -1060,7 +1059,7 @@ static int config_write_net(struct vty *vty)
gsmnet->tz.hr, gsmnet->tz.mn, VTY_NEWLINE);
}
- /* writing T3212 from the common T_defs_vty_write() instead. */
+ osmo_tdef_vty_write(vty, gsmnet->T_defs, " timer ");
{
uint16_t meas_port;
@@ -4005,10 +4004,11 @@ DEFUN(cfg_bts_t3113_dynamic, cfg_bts_t3113_dynamic_cmd,
"Calculate T3113 dynamically based on channel config and load\n"
TNUM_STR)
{
- struct T_def *d;
+ struct osmo_tdef *d;
struct gsm_bts *bts = vty->index;
+ struct gsm_network *gsmnet = gsmnet_from_vty(vty);
- d = parse_T_arg(vty, argv[0]);
+ d = osmo_tdef_vty_parse_T_arg(vty, gsmnet->T_defs, argv[0]);
if (!d)
return CMD_WARNING;
@@ -4030,10 +4030,11 @@ DEFUN(cfg_bts_no_t3113_dynamic, cfg_bts_no_t3113_dynamic_cmd,
"Set given timer to non-dynamic and use the default or user provided fixed value\n"
TNUM_STR)
{
- struct T_def *d;
+ struct osmo_tdef *d;
struct gsm_bts *bts = vty->index;
+ struct gsm_network *gsmnet = gsmnet_from_vty(vty);
- d = parse_T_arg(vty, argv[0]);
+ d = osmo_tdef_vty_parse_T_arg(vty, gsmnet->T_defs, argv[0]);
if (!d)
return CMD_WARNING;
@@ -5042,11 +5043,11 @@ DEFUN(cfg_net_per_loc_upd, cfg_net_per_loc_upd_cmd,
"Periodic Location Updating Interval in Minutes\n")
{
struct gsm_network *net = vty->index;
- struct T_def *d = T_def_get_entry(net->T_defs, 3212);
+ struct osmo_tdef *d = osmo_tdef_get_entry(net->T_defs, 3212);
OSMO_ASSERT(d);
d->val = atoi(argv[0]) / 6;
- vty_out(vty, "T%d = %u %s (%s)%s", d->T, d->val, "* 6min", d->desc, VTY_NEWLINE);
+ vty_out(vty, "T%d = %lu %s (%s)%s", d->T, d->val, "* 6min", d->desc, VTY_NEWLINE);
return CMD_SUCCESS;
}
@@ -5058,11 +5059,11 @@ DEFUN(cfg_net_no_per_loc_upd, cfg_net_no_per_loc_upd_cmd,
"Periodic Location Updating Interval\n")
{
struct gsm_network *net = vty->index;
- struct T_def *d = T_def_get_entry(net->T_defs, 3212);
+ struct osmo_tdef *d = osmo_tdef_get_entry(net->T_defs, 3212);
OSMO_ASSERT(d);
d->val = 0;
- vty_out(vty, "T%d = %u %s (%s)%s", d->T, d->val, "* 6min", d->desc, VTY_NEWLINE);
+ vty_out(vty, "T%d = %lu %s (%s)%s", d->T, d->val, "* 6min", d->desc, VTY_NEWLINE);
return CMD_SUCCESS;
}
@@ -5092,6 +5093,28 @@ DEFUN(cfg_net_meas_feed_scenario, cfg_net_meas_feed_scenario_cmd,
return CMD_SUCCESS;
}
+DEFUN(show_timer, show_timer_cmd,
+ "show timer " OSMO_TDEF_VTY_ARG_T_OPTIONAL,
+ SHOW_STR "Show timers\n"
+ OSMO_TDEF_VTY_DOC_T)
+{
+ struct gsm_network *net = gsmnet_from_vty(vty);
+ const char *T_arg = argc > 0 ? argv[0] : NULL;
+ return osmo_tdef_vty_show_cmd(vty, net->T_defs, T_arg, NULL);
+}
+
+DEFUN(cfg_net_timer, cfg_net_timer_cmd,
+ "timer " OSMO_TDEF_VTY_ARG_SET_OPTIONAL,
+ "Configure or show timers\n"
+ OSMO_TDEF_VTY_DOC_SET)
+{
+ struct gsm_network *net = gsmnet_from_vty(vty);
+ /* If any arguments are missing, redirect to 'show' */
+ if (argc < 2)
+ return show_timer(self, vty, argc, argv);
+ return osmo_tdef_vty_set_cmd(vty, net->T_defs, argv);
+}
+
extern int bsc_vty_init_extra(void);
int bsc_vty_init(struct gsm_network *network)
@@ -5136,6 +5159,7 @@ int bsc_vty_init(struct gsm_network *network)
install_element(GSMNET_NODE, &cfg_net_dyn_ts_allow_tch_f_cmd);
install_element(GSMNET_NODE, &cfg_net_meas_feed_dest_cmd);
install_element(GSMNET_NODE, &cfg_net_meas_feed_scenario_cmd);
+ install_element(GSMNET_NODE, &cfg_net_timer_cmd);
install_element_ve(&bsc_show_net_cmd);
install_element_ve(&show_bts_cmd);
@@ -5146,6 +5170,7 @@ int bsc_vty_init(struct gsm_network *network)
install_element_ve(&show_lchan_cmd);
install_element_ve(&show_lchan_summary_cmd);
install_element_ve(&show_lchan_summary_all_cmd);
+ install_element_ve(&show_timer_cmd);
install_element_ve(&show_subscr_conn_cmd);
@@ -5159,8 +5184,6 @@ int bsc_vty_init(struct gsm_network *network)
logging_vty_add_cmds(NULL);
osmo_talloc_vty_add_cmds();
- T_defs_vty_init(network->T_defs, GSMNET_NODE);
-
install_element(GSMNET_NODE, &cfg_net_neci_cmd);
install_element(GSMNET_NODE, &cfg_net_dtx_cmd);
install_element(GSMNET_NODE, &cfg_net_pag_any_tch_cmd);
diff --git a/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c b/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c
index be4041067..8a370dafc 100644
--- a/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c
+++ b/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c
@@ -23,7 +23,6 @@
#include <osmocom/core/msgb.h>
#include <osmocom/bsc/gsm_data.h>
#include <osmocom/bsc/abis_nm.h>
-#include <osmocom/bsc/gsm_timers.h>
struct msgb *nanobts_attr_bts_get(struct gsm_bts *bts)
@@ -82,7 +81,7 @@ struct msgb *nanobts_attr_bts_get(struct gsm_bts *bts)
msgb_tv_fixed_put(msgb, NM_ATT_LDAVG_SLOTS, 2, buf);
/* 10 milliseconds */
- msgb_tv_put(msgb, NM_ATT_BTS_AIR_TIMER, T_def_get(bts->network->T_defs, 3105, T_MS, -1));
+ msgb_tv_put(msgb, NM_ATT_BTS_AIR_TIMER, osmo_tdef_get(bts->network->T_defs, 3105, OSMO_TDEF_MS, -1));
/* 10 retransmissions of physical config */
msgb_tv_put(msgb, NM_ATT_NY1, 10);
diff --git a/src/osmo-bsc/bts_siemens_bs11.c b/src/osmo-bsc/bts_siemens_bs11.c
index 2cb676c93..b1688f3d5 100644
--- a/src/osmo-bsc/bts_siemens_bs11.c
+++ b/src/osmo-bsc/bts_siemens_bs11.c
@@ -20,6 +20,8 @@
*/
+#include <osmocom/core/tdef.h>
+
#include <osmocom/gsm/tlv.h>
#include <osmocom/bsc/debug.h>
@@ -27,7 +29,6 @@
#include <osmocom/bsc/abis_nm.h>
#include <osmocom/abis/e1_input.h>
#include <osmocom/bsc/signal.h>
-#include <osmocom/bsc/gsm_timers.h>
#include <osmocom/bsc/timeslot_fsm.h>
static int bts_model_bs11_start(struct gsm_network *net);
@@ -360,7 +361,7 @@ static void patch_nm_tables(struct gsm_bts *bts)
uint8_t arfcn_high = (bts->c0->arfcn >> 8) & 0x0f;
/* T3105 attribute in units of 10ms */
- bs11_attr_bts[2] = T_def_get(bts->network->T_defs, 3105, T_MS, -1) / 10;
+ bs11_attr_bts[2] = osmo_tdef_get(bts->network->T_defs, 3105, OSMO_TDEF_MS, -1) / 10;
/* patch ARFCN into BTS Attributes */
bs11_attr_bts[69] &= 0xf0;
diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c
index 45c433ced..88690a749 100644
--- a/src/osmo-bsc/gsm_data.c
+++ b/src/osmo-bsc/gsm_data.c
@@ -40,7 +40,6 @@
#include <osmocom/bsc/osmo_bsc_lcls.h>
#include <osmocom/bsc/abis_nm.h>
#include <osmocom/bsc/handover_cfg.h>
-#include <osmocom/bsc/gsm_timers.h>
#include <osmocom/bsc/timeslot_fsm.h>
#include <osmocom/bsc/lchan_fsm.h>
@@ -872,7 +871,7 @@ struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, uint8_t bts_num)
bts->si_common.chan_desc.att = 1; /* attachment required */
bts->si_common.chan_desc.bs_pa_mfrms = RSL_BS_PA_MFRMS_5; /* paging frames */
bts->si_common.chan_desc.bs_ag_blks_res = 1; /* reserved AGCH blocks */
- bts->si_common.chan_desc.t3212 = T_def_get(net->T_defs, 3212, T_CUSTOM, -1);
+ bts->si_common.chan_desc.t3212 = osmo_tdef_get(net->T_defs, 3212, OSMO_TDEF_CUSTOM, -1);
gsm_bts_set_radio_link_timeout(bts, 32); /* Use RADIO LINK TIMEOUT of 32 */
INIT_LLIST_HEAD(&bts->abis_queue);
diff --git a/src/osmo-bsc/gsm_timers.c b/src/osmo-bsc/gsm_timers.c
deleted file mode 100644
index fc3ec246e..000000000
--- a/src/osmo-bsc/gsm_timers.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/* Implementation to define Tnnn timers globally and use for FSM state changes. */
-/* (C) 2018 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
- *
- * Author: Neels Hofmeyr <neels@hofmeyr.de>
- *
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include <osmocom/core/fsm.h>
-
-#include <osmocom/bsc/gsm_timers.h>
-
-/* a = return_val * b. Return 0 if factor is below 1. */
-static int T_factor(enum T_unit a, enum T_unit b)
-{
- if (b == a
- || b == T_CUSTOM || a == T_CUSTOM)
- return 1;
-
- switch (b) {
- case T_MS:
- switch (a) {
- case T_S:
- return 1000;
- case T_M:
- return 60*1000;
- default:
- return 0;
- }
- case T_S:
- switch (a) {
- case T_M:
- return 60;
- default:
- return 0;
- }
- default:
- return 0;
- }
-}
-
-static int T_round(int val, enum T_unit from_unit, enum T_unit to_unit)
-{
- int f;
- if (!val)
- return 0;
-
- f = T_factor(from_unit, to_unit);
- if (f < 1) {
- f = T_factor(to_unit, from_unit);
- return (val / f) + (val % f? 1 : 0);
- }
- return val * f;
-}
-
-/* Return the value of a T timer from a list of T_defs.
- * Any value is rounded up to match as_unit: 1100 ms as T_S becomes 2 seconds, as T_M becomes one minute.
- * If no such timer is defined, return the default value passed, or abort the program if default < 0.
- *
- * Usage examples:
- *
- * - Initialization:
- *
- * struct T_def global_T_defs[] = {
- * { .T=7, .default_val=50, .desc="Water Boiling Timeout" }, // default is .unit=T_S == 0
- * { .T=8, .default_val=300, .desc="Tea brewing" },
- * { .T=9, .default_val=5, .unit=T_M, .desc="Let tea cool down before drinking" },
- * { .T=10, .default_val=20, .unit=T_M, .desc="Forgot to drink tea while it's warm" },
- * {} // <-- important! last entry shall be zero
- * };
- * T_defs_reset(global_T_defs); // make all values the default
- * T_defs_vty_init(global_T_defs, CONFIG_NODE);
- *
- * val = T_def_get(global_T_defs, 7, T_S, -1); // -> 50
- * sleep(val);
- *
- * val = T_def_get(global_T_defs, 7, T_M, -1); // 50 seconds becomes 1 minute -> 1
- * sleep_minutes(val);
- *
- * val = T_def_get(global_T_defs, 99, T_S, -1); // not defined, program aborts!
- *
- * val = T_def_get(global_T_defs, 99, T_S, 3); // not defined, returns 3
- */
-int T_def_get(const struct T_def *T_defs, int T, enum T_unit as_unit, int val_if_not_present)
-{
- const struct T_def *d = T_def_get_entry((struct T_def*)T_defs, T);
- if (!d) {
- OSMO_ASSERT(val_if_not_present >= 0);
- return val_if_not_present;
- }
- return T_round(d->val, d->unit, as_unit);
-}
-
-/* Set all T_def values to the default_val. */
-void T_defs_reset(struct T_def *T_defs)
-{
- struct T_def *d;
- for_each_T_def(d, T_defs)
- d->val = d->default_val;
-}
-
-/* Return a pointer to a T_def from an array, or NULL. */
-struct T_def *T_def_get_entry(struct T_def *T_defs, int T)
-{
- struct T_def *d;
- for_each_T_def(d, T_defs) {
- if (d->T == T)
- return d;
- }
- return NULL;
-}
-
-/* Return a state_timeout entry from an array, or return NULL if the entry is zero.
- *
- * The timeouts_array shall contain exactly 32 elements, which corresponds to the number of states
- * allowed by osmo_fsm_*. Lookup is by array index.
- *
- * For example:
- * struct state_timeout my_fsm_timeouts[32] = {
- * [MY_FSM_STATE_3] = { .T = 423 },
- * [MY_FSM_STATE_7] = { .T = 235 },
- * [MY_FSM_STATE_8] = { .keep_timer = true },
- * // any state that is omitted will remain zero == no timeout
- * };
- * get_state_timeout(MY_FSM_STATE_0, &my_fsm_timeouts) -> NULL,
- * get_state_timeout(MY_FSM_STATE_7, &my_fsm_timeouts) -> { .T = 235 }
- *
- * The intention is then to obtain the timer like T_def_get(global_T_defs, T=235); see also
- * fsm_inst_state_chg_T() below.
- */
-const struct state_timeout *get_state_timeout(uint32_t state,
- const struct state_timeout *timeouts_array)
-{
- const struct state_timeout *t;
- OSMO_ASSERT(state < 32);
- t = &timeouts_array[state];
- if (!t->keep_timer && !t->T)
- return NULL;
- return t;
-}
-
-/* Call osmo_fsm_inst_state_chg() or osmo_fsm_inst_state_chg_keep_timer(), depending on the T value
- * defined for this state in the timeouts_array, and obtaining the actual timeout value from T_defs.
- * A T timer configured in sub-second precision is rounded up to the next full second.
- *
- * See get_state_timeout() and T_def_get().
- *
- * Should a T number be defined in timeouts_array that is not defined in T_defs, use default_timeout.
- * This is best used by wrapping this function call in a macro suitable for a specific FSM
- * implementation, which can become as short as: my_fsm_state_chg(fi, NEXT_STATE):
- *
- * #define my_fsm_state_chg(fi, NEXT_STATE) \
- * fsm_inst_state_chg_T(fi, NEXT_STATE, my_fsm_timeouts, global_T_defs, 5)
- *
- * my_fsm_state_chg(fi, MY_FSM_STATE_1);
- * // -> No timeout configured, will enter state without timeout.
- *
- * my_fsm_state_chg(fi, MY_FSM_STATE_3);
- * // T423 configured for this state, will look up T423 in T_defs, or use 5 seconds if unset.
- *
- * my_fsm_state_chg(fi, MY_FSM_STATE_8);
- * // keep_timer configured for this state, will invoke osmo_fsm_inst_state_chg_keep_timer().
- *
- */
-int _fsm_inst_state_chg_T(struct osmo_fsm_inst *fi, uint32_t state,
- const struct state_timeout *timeouts_array,
- const struct T_def *T_defs, int default_timeout,
- const char *file, int line)
-{
- const struct state_timeout *t = get_state_timeout(state, timeouts_array);
- int val;
-
- /* No timeout defined for this state? */
- if (!t)
- return _osmo_fsm_inst_state_chg(fi, state, 0, 0, file, line);
-
- if (t->keep_timer) {
- int rc = _osmo_fsm_inst_state_chg_keep_timer(fi, state, file, line);
- if (t->T && !rc)
- fi->T = t->T;
- return rc;
- }
-
- val = T_def_get(T_defs, t->T, T_S, default_timeout);
- return _osmo_fsm_inst_state_chg(fi, state, val, t->T, file, line);
-}
-
-const struct value_string T_unit_names[] = {
- { T_S, "s" },
- { T_MS, "ms" },
- { T_CUSTOM, "(custom)" },
- { 0, NULL }
-};
diff --git a/src/osmo-bsc/gsm_timers_vty.c b/src/osmo-bsc/gsm_timers_vty.c
deleted file mode 100644
index e744dfac5..000000000
--- a/src/osmo-bsc/gsm_timers_vty.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Implementation to configure Tnnn timers in VTY */
-/* (C) 2018 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
- *
- * Author: Neels Hofmeyr <neels@hofmeyr.de>
- *
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include <string.h>
-
-#include <osmocom/vty/vty.h>
-#include <osmocom/vty/command.h>
-
-#include <osmocom/bsc/gsm_timers.h>
-
-/* Global singleton list used for the VTY configuration. See T_defs_vty_init(). */
-static struct T_def *g_vty_T_defs = NULL;
-
-/* Parse an argument like "T1234", "t1234" or "1234" and return the corresponding T_def entry from
- * g_vty_T_defs, if any. */
-struct T_def *parse_T_arg(struct vty *vty, const char *T_str)
-{
- int T;
- struct T_def *d;
-
- if (T_str[0] == 't' || T_str[0] == 'T')
- T_str++;
- T = atoi(T_str);
-
- d = T_def_get_entry(g_vty_T_defs, T);
- if (!d)
- vty_out(vty, "No such timer: T%d%s", T, VTY_NEWLINE);
- return d;
-}
-
-/* Installed in the VTY on T_defs_vty_init(). */
-DEFUN(cfg_timer, cfg_timer_cmd,
- "timer TNNNN (default|<1-65535>)",
- "Configure GSM Timers\n"
- "T-number, optionally preceded by 't' or 'T'."
- "See also 'show timer' for a list of available timers.\n"
- "Set to default timer value\n" "Timer value\n")
-{
- const char *val_str = argv[1];
- struct T_def *d;
-
- d = parse_T_arg(vty, argv[0]);
- if (!d)
- return CMD_WARNING;
-
- if (!strcmp(val_str, "default"))
- d->val = d->default_val;
- else
- d->val = atoi(val_str);
- vty_out(vty, "T%d = %u %s (%s)%s", d->T, d->val, T_unit_name(d->unit), d->desc, VTY_NEWLINE);
- return CMD_SUCCESS;
-}
-
-/* Print a T_def to the VTY. */
-static void show_one_timer(struct vty *vty, struct T_def *d)
-{
- vty_out(vty, "T%d = %u %s (default = %u %s) \t%s%s",
- d->T, d->val, T_unit_name(d->unit),
- d->default_val, T_unit_name(d->unit), d->desc, VTY_NEWLINE);
-}
-
-/* Installed in the VTY on T_defs_vty_init(). */
-DEFUN(show_timer, show_timer_cmd,
- "show timer [TNNNN]",
- SHOW_STR "GSM Timers\n"
- "Specific timer to show, or all timers if omitted.\n")
-{
- struct T_def *d;
-
- if (argc) {
- d = parse_T_arg(vty, argv[0]);
- if (!d)
- return CMD_WARNING;
- show_one_timer(vty, d);
- return CMD_SUCCESS;
- }
-
- for_each_T_def(d, g_vty_T_defs)
- show_one_timer(vty, d);
- return CMD_SUCCESS;
-}
-
-/* Install GSM timer configuration commands in the VTY. */
-void T_defs_vty_init(struct T_def *T_defs, int cfg_parent_node)
-{
- g_vty_T_defs = T_defs;
- install_element_ve(&show_timer_cmd);
- install_element(cfg_parent_node, &cfg_timer_cmd);
-}
-
-/* Write GSM timer configuration to the vty. */
-void T_defs_vty_write(struct vty *vty, const char *indent)
-{
- struct T_def *d;
- for_each_T_def(d, g_vty_T_defs) {
- if (d->val != d->default_val)
- vty_out(vty, "%stimer t%d %u%s", indent, d->T, d->val, VTY_NEWLINE);
- }
-}
diff --git a/src/osmo-bsc/handover_fsm.c b/src/osmo-bsc/handover_fsm.c
index 421c32efb..fe3b8b2db 100644
--- a/src/osmo-bsc/handover_fsm.c
+++ b/src/osmo-bsc/handover_fsm.c
@@ -159,7 +159,7 @@ struct gsm_subscriber_connection *ho_fi_conn(struct osmo_fsm_inst *fi)
return fi->priv;
}
-static const struct state_timeout ho_fsm_timeouts[32] = {
+static const struct osmo_tdef_state_timeout ho_fsm_timeouts[32] = {
[HO_ST_WAIT_LCHAN_ACTIVE] = { .T = 23042 },
[HO_ST_WAIT_RR_HO_DETECT] = { .T = 23042 },
[HO_ST_WAIT_RR_HO_COMPLETE] = { .T = 23042 },
@@ -173,10 +173,10 @@ static const struct state_timeout ho_fsm_timeouts[32] = {
* The actual timeout value is in turn obtained from network->T_defs.
* Assumes local variable fi exists. */
#define ho_fsm_state_chg(state) \
- fsm_inst_state_chg_T(fi, state, \
- ho_fsm_timeouts, \
- ((struct gsm_subscriber_connection*)(fi->priv))->network->T_defs, \
- 5)
+ osmo_tdef_fsm_inst_state_chg(fi, state, \
+ ho_fsm_timeouts, \
+ ((struct gsm_subscriber_connection*)(fi->priv))->network->T_defs, \
+ 5)
/* Log failure and transition to HO_ST_FAILURE, which triggers the appropriate actions. */
#define ho_fail(result, fmt, args...) do { \
diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index 7af2ea01c..33abb1fe5 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -207,7 +207,7 @@ static void lchan_on_fully_established(struct gsm_lchan *lchan)
}
}
-struct state_timeout lchan_fsm_timeouts[32] = {
+struct osmo_tdef_state_timeout lchan_fsm_timeouts[32] = {
[LCHAN_ST_WAIT_TS_READY] = { .T=23001 },
[LCHAN_ST_WAIT_ACTIV_ACK] = { .T=23002 },
[LCHAN_ST_WAIT_RLL_RTP_ESTABLISH] = { .T=3101 },
@@ -221,10 +221,10 @@ struct state_timeout lchan_fsm_timeouts[32] = {
* The actual timeout value is in turn obtained from network->T_defs.
* Assumes local variable fi exists. */
#define lchan_fsm_state_chg(state) \
- fsm_inst_state_chg_T(fi, state, \
- lchan_fsm_timeouts, \
- ((struct gsm_lchan*)(fi->priv))->ts->trx->bts->network->T_defs, \
- 5)
+ osmo_tdef_fsm_inst_state_chg(fi, state, \
+ lchan_fsm_timeouts, \
+ ((struct gsm_lchan*)(fi->priv))->ts->trx->bts->network->T_defs, \
+ 5)
/* Set a failure message, trigger the common actions to take on failure, transition to a state to
* continue with (using state timeouts from lchan_fsm_timeouts[]). Assumes local variable fi exists. */
diff --git a/src/osmo-bsc/lchan_rtp_fsm.c b/src/osmo-bsc/lchan_rtp_fsm.c
index 2d15bf29b..5e2d75891 100644
--- a/src/osmo-bsc/lchan_rtp_fsm.c
+++ b/src/osmo-bsc/lchan_rtp_fsm.c
@@ -23,7 +23,6 @@
#include <osmocom/core/fsm.h>
#include <osmocom/bsc/gsm_data.h>
-#include <osmocom/bsc/gsm_timers.h>
#include <osmocom/bsc/lchan_fsm.h>
#include <osmocom/bsc/lchan_rtp_fsm.h>
#include <osmocom/bsc/mgw_endpoint_fsm.h>
@@ -41,7 +40,7 @@ struct gsm_lchan *lchan_rtp_fi_lchan(struct osmo_fsm_inst *fi)
return fi->priv;
}
-struct state_timeout lchan_rtp_fsm_timeouts[32] = {
+struct osmo_tdef_state_timeout lchan_rtp_fsm_timeouts[32] = {
[LCHAN_RTP_ST_WAIT_MGW_ENDPOINT_AVAILABLE] = { .T=23004 },
[LCHAN_RTP_ST_WAIT_IPACC_CRCX_ACK] = { .T=23005 },
[LCHAN_RTP_ST_WAIT_IPACC_MDCX_ACK] = { .T=23006 },
@@ -52,10 +51,10 @@ struct state_timeout lchan_rtp_fsm_timeouts[32] = {
* The actual timeout value is in turn obtained from network->T_defs.
* Assumes local variable fi exists. */
#define lchan_rtp_fsm_state_chg(state) \
- fsm_inst_state_chg_T(fi, state, \
- lchan_rtp_fsm_timeouts, \
- ((struct gsm_lchan*)(fi->priv))->ts->trx->bts->network->T_defs, \
- 5)
+ osmo_tdef_fsm_inst_state_chg(fi, state, \
+ lchan_rtp_fsm_timeouts, \
+ ((struct gsm_lchan*)(fi->priv))->ts->trx->bts->network->T_defs, \
+ 5)
/* Set a failure message, trigger the common actions to take on failure, transition to a state to
* continue with (using state timeouts from lchan_rtp_fsm_timeouts[]). Assumes local variable fi exists. */
diff --git a/src/osmo-bsc/mgw_endpoint_fsm.c b/src/osmo-bsc/mgw_endpoint_fsm.c
index 5462914fb..fa65166b7 100644
--- a/src/osmo-bsc/mgw_endpoint_fsm.c
+++ b/src/osmo-bsc/mgw_endpoint_fsm.c
@@ -29,7 +29,6 @@
#include <osmocom/netif/rtp.h>
#include <osmocom/bsc/debug.h>
-#include <osmocom/bsc/gsm_timers.h>
#include <osmocom/bsc/mgw_endpoint_fsm.h>
#include <osmocom/bsc/lchan_fsm.h>
@@ -196,9 +195,9 @@ static void fill_event_names()
}
}
-static struct T_def *g_T_defs = NULL;
+static struct osmo_tdef *g_T_defs = NULL;
-void mgw_endpoint_fsm_init(struct T_def *T_defs)
+void mgw_endpoint_fsm_init(struct osmo_tdef *T_defs)
{
g_T_defs = T_defs;
OSMO_ASSERT(osmo_fsm_register(&mgwep_fsm) == 0);
@@ -380,7 +379,7 @@ bool mgwep_ci_get_crcx_info_to_sockaddr(const struct mgwep_ci *ci, struct sockad
}
-static const struct state_timeout mgwep_fsm_timeouts[32] = {
+static const struct osmo_tdef_state_timeout mgwep_fsm_timeouts[32] = {
[MGWEP_ST_WAIT_MGW_RESPONSE] = { .T=23042 },
};
@@ -388,7 +387,7 @@ static const struct state_timeout mgwep_fsm_timeouts[32] = {
* The actual timeout value is in turn obtained from g_T_defs.
* Assumes local variable fi exists. */
#define mgwep_fsm_state_chg(state) \
- fsm_inst_state_chg_T(fi, state, mgwep_fsm_timeouts, g_T_defs, 5)
+ osmo_tdef_fsm_inst_state_chg(fi, state, mgwep_fsm_timeouts, g_T_defs, 5)
void mgw_endpoint_ci_request(struct mgwep_ci *ci,
enum mgcp_verb verb, const struct mgcp_conn_peer *verb_info,
diff --git a/src/osmo-bsc/net_init.c b/src/osmo-bsc/net_init.c
index b4ff48936..c2a38bcf1 100644
--- a/src/osmo-bsc/net_init.c
+++ b/src/osmo-bsc/net_init.c
@@ -17,21 +17,22 @@
*
*/
+#include <osmocom/core/tdef.h>
+
#include <osmocom/bsc/osmo_bsc.h>
#include <osmocom/bsc/gsm_04_08_rr.h>
#include <osmocom/bsc/handover_cfg.h>
#include <osmocom/bsc/chan_alloc.h>
#include <osmocom/bsc/neighbor_ident.h>
-#include <osmocom/bsc/gsm_timers.h>
-static struct T_def gsm_network_T_defs[] = {
+static struct osmo_tdef gsm_network_T_defs[] = {
{ .T=7, .default_val=10, .desc="inter-BSC Handover MO, HO Required to HO Command" },
{ .T=8, .default_val=10, .desc="inter-BSC Handover MO, HO Command to final Clear" },
{ .T=10, .default_val=6, .desc="RR Assignment" },
{ .T=101, .default_val=10, .desc="inter-BSC Handover MT, HO Request to HO Accept" },
{ .T=3101, .default_val=3, .desc="RR Immediate Assignment" },
{ .T=3103, .default_val=5, .desc="Handover" },
- { .T=3105, .default_val=100, .unit=T_MS, .desc="Physical Information" },
+ { .T=3105, .default_val=100, .unit=OSMO_TDEF_MS, .desc="Physical Information" },
{ .T=3107, .default_val=5, .desc="(unused)" },
{ .T=3109, .default_val=5, .desc="RSL SACCH deactivation" },
{ .T=3111, .default_val=2, .desc="Wait time before RSL RF Channel Release" },
@@ -42,7 +43,7 @@ static struct T_def gsm_network_T_defs[] = {
{ .T=3119, .default_val=10, .desc="(unused)" },
{ .T=3122, .default_val=GSM_T3122_DEFAULT, .desc="Wait time after RR Immediate Assignment Reject" },
{ .T=3141, .default_val=10, .desc="(unused)" },
- { .T=3212, .default_val=5, .unit=T_CUSTOM,
+ { .T=3212, .default_val=5, .unit=OSMO_TDEF_CUSTOM,
.desc="Periodic Location Update timer, sent to MS (1 = 6 minutes)" },
{ .T=993210, .default_val=20, .desc="After L3 Complete, wait for MSC to confirm" },
{ .T=999, .default_val=60, .desc="After Clear Request, wait for MSC to Clear Command (sanity)" },
@@ -78,7 +79,7 @@ struct gsm_network *gsm_network_init(void *ctx)
net->num_bts = 0;
net->T_defs = gsm_network_T_defs;
- T_defs_reset(net->T_defs);
+ osmo_tdefs_reset(net->T_defs);
return net;
}
diff --git a/src/osmo-bsc/paging.c b/src/osmo-bsc/paging.c
index 066db1c62..f1fd2ad61 100644
--- a/src/osmo-bsc/paging.c
+++ b/src/osmo-bsc/paging.c
@@ -39,6 +39,7 @@
#include <assert.h>
#include <osmocom/core/talloc.h>
+#include <osmocom/core/tdef.h>
#include <osmocom/gsm/gsm48.h>
#include <osmocom/gsm/gsm0502.h>
@@ -51,7 +52,6 @@
#include <osmocom/bsc/chan_alloc.h>
#include <osmocom/bsc/gsm_08_08.h>
#include <osmocom/bsc/gsm_04_08_rr.h>
-#include <osmocom/bsc/gsm_timers.h>
#include <osmocom/bsc/bsc_subscr_conn_fsm.h>
void *tall_paging_ctx = NULL;
@@ -294,11 +294,11 @@ static void paging_T3113_expired(void *data)
static unsigned int calculate_timer_3113(struct gsm_bts *bts)
{
unsigned int to_us, to;
- struct T_def *d = T_def_get_entry(bts->network->T_defs, 3113);
+ struct osmo_tdef *d = osmo_tdef_get_entry(bts->network->T_defs, 3113);
/* Note: d should always contain a valid pointer since all timers,
* including 3113 are statically pre-defined in
- * struct T_def gsm_network_T_defs. */
+ * struct osmo_tdef gsm_network_T_defs. */
OSMO_ASSERT(d);
if (!bts->T3113_dynamic)
diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am
index 24cd23085..e585e0df8 100644
--- a/src/utils/Makefile.am
+++ b/src/utils/Makefile.am
@@ -51,7 +51,6 @@ bs11_config_LDADD = \
$(top_builddir)/src/osmo-bsc/bts_siemens_bs11.o \
$(top_builddir)/src/osmo-bsc/e1_config.o \
$(top_builddir)/src/osmo-bsc/gsm_data.o \
- $(top_builddir)/src/osmo-bsc/gsm_timers.o \
$(top_builddir)/src/osmo-bsc/net_init.o \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
@@ -119,7 +118,6 @@ meas_json_SOURCES = \
meas_json_LDADD = \
$(top_builddir)/src/osmo-bsc/gsm_data.o \
- $(top_builddir)/src/osmo-bsc/gsm_timers.o \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOABIS_LIBS) \
diff --git a/tests/abis/Makefile.am b/tests/abis/Makefile.am
index 4fc3605c0..60054d94d 100644
--- a/tests/abis/Makefile.am
+++ b/tests/abis/Makefile.am
@@ -27,7 +27,6 @@ abis_test_SOURCES = \
abis_test_LDADD = \
$(top_builddir)/src/osmo-bsc/abis_nm.o \
$(top_builddir)/src/osmo-bsc/gsm_data.o \
- $(top_builddir)/src/osmo-bsc/gsm_timers.o \
$(top_builddir)/src/osmo-bsc/net_init.o \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOABIS_LIBS) \
diff --git a/tests/bsc/Makefile.am b/tests/bsc/Makefile.am
index c8ad0e40a..b301f9e9c 100644
--- a/tests/bsc/Makefile.am
+++ b/tests/bsc/Makefile.am
@@ -38,7 +38,6 @@ bsc_test_LDADD = \
$(top_builddir)/src/osmo-bsc/osmo_bsc_filter.o \
$(top_builddir)/src/osmo-bsc/bsc_subscriber.o \
$(top_builddir)/src/osmo-bsc/gsm_data.o \
- $(top_builddir)/src/osmo-bsc/gsm_timers.o \
$(top_builddir)/src/osmo-bsc/handover_cfg.o \
$(top_builddir)/src/osmo-bsc/handover_logic.o \
$(top_builddir)/src/osmo-bsc/neighbor_ident.o \
diff --git a/tests/gsm0408/Makefile.am b/tests/gsm0408/Makefile.am
index b207f8b09..aff7c7dd4 100644
--- a/tests/gsm0408/Makefile.am
+++ b/tests/gsm0408/Makefile.am
@@ -26,7 +26,6 @@ gsm0408_test_LDADD = \
$(top_builddir)/src/osmo-bsc/gsm_04_08_rr.o \
$(top_builddir)/src/osmo-bsc/arfcn_range_encode.o \
$(top_builddir)/src/osmo-bsc/gsm_data.o \
- $(top_builddir)/src/osmo-bsc/gsm_timers.o \
$(top_builddir)/src/osmo-bsc/net_init.o \
$(top_builddir)/src/osmo-bsc/rest_octets.o \
$(top_builddir)/src/osmo-bsc/system_information.o \
diff --git a/tests/handover/Makefile.am b/tests/handover/Makefile.am
index 5e4440c7b..40ecf54ea 100644
--- a/tests/handover/Makefile.am
+++ b/tests/handover/Makefile.am
@@ -55,7 +55,6 @@ handover_test_LDADD = \
$(top_builddir)/src/osmo-bsc/gsm_04_08_rr.o \
$(top_builddir)/src/osmo-bsc/gsm_04_80_utils.o \
$(top_builddir)/src/osmo-bsc/gsm_data.o \
- $(top_builddir)/src/osmo-bsc/gsm_timers.o \
$(top_builddir)/src/osmo-bsc/handover_cfg.o \
$(top_builddir)/src/osmo-bsc/handover_decision.o \
$(top_builddir)/src/osmo-bsc/handover_decision_2.o \
diff --git a/tests/nanobts_omlattr/Makefile.am b/tests/nanobts_omlattr/Makefile.am
index 312cf7d93..aa7045e49 100644
--- a/tests/nanobts_omlattr/Makefile.am
+++ b/tests/nanobts_omlattr/Makefile.am
@@ -26,7 +26,6 @@ nanobts_omlattr_test_LDADD = \
$(top_builddir)/src/osmo-bsc/abis_nm.o \
$(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.o \
$(top_builddir)/src/osmo-bsc/gsm_data.o \
- $(top_builddir)/src/osmo-bsc/gsm_timers.o \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOABIS_LIBS) \
diff --git a/tests/nanobts_omlattr/nanobts_omlattr_test.c b/tests/nanobts_omlattr/nanobts_omlattr_test.c
index 38729ac35..65eb05563 100644
--- a/tests/nanobts_omlattr/nanobts_omlattr_test.c
+++ b/tests/nanobts_omlattr/nanobts_omlattr_test.c
@@ -21,7 +21,6 @@
#include <osmocom/bsc/debug.h>
#include <osmocom/bsc/gsm_data.h>
-#include <osmocom/bsc/gsm_timers.h>
#include <osmocom/bsc/bts_ipaccess_nanobts_omlattr.h>
#include <osmocom/core/talloc.h>
@@ -192,9 +191,9 @@ static const struct log_info log_info = {
.num_cat = ARRAY_SIZE(log_categories),
};
-static struct T_def gsm_network_T_defs[] = {
- { .T=3105, .default_val=100, .val=13, .unit=T_MS, .desc="Physical Information" },
- { .T=3212, .default_val=5, .unit=T_CUSTOM,
+static struct osmo_tdef gsm_network_T_defs[] = {
+ { .T=3105, .default_val=100, .val=13, .unit=OSMO_TDEF_MS, .desc="Physical Information" },
+ { .T=3212, .default_val=5, .unit=OSMO_TDEF_CUSTOM,
.desc="Periodic Location Update timer, sent to MS (1 = 6 minutes)" },
{}
};