aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-02-28 17:00:20 +0100
committerIvan Kluchnikov <kluchnikovi@gmail.com>2014-01-13 16:05:39 +0400
commit560156395f31bdb0c6818d83b090c19a6220ebf2 (patch)
tree8fdbdcef85ce6ce99454eade4e6f95d221b74819
parent39bb62cd6f0ed2b77d51a48b8030f4d36c3bdddd (diff)
nitb: Add ctrl command for setting the global timers
-rw-r--r--openbsc/include/openbsc/control_cmd.h16
-rw-r--r--openbsc/src/osmo-nitb/ctrl_commands.c32
2 files changed, 41 insertions, 7 deletions
diff --git a/openbsc/include/openbsc/control_cmd.h b/openbsc/include/openbsc/control_cmd.h
index cd7b7b6d3..480727934 100644
--- a/openbsc/include/openbsc/control_cmd.h
+++ b/openbsc/include/openbsc/control_cmd.h
@@ -158,18 +158,20 @@ static struct ctrl_cmd_element cmd_##cmdname = { \
.verify = NULL, \
}
-#define CTRL_CMD_DEFINE(cmdname, cmdstr) \
-static int get_##cmdname(struct ctrl_cmd *cmd, void *data); \
-static int set_##cmdname(struct ctrl_cmd *cmd, void *data); \
-static int verify_##cmdname(struct ctrl_cmd *cmd, const char *value, void *data); \
+#define CTRL_CMD_RAW(cmdname, cmdstr, cmdget, cmdset, cmdverify) \
static struct ctrl_cmd_element cmd_##cmdname = { \
.name = cmdstr, \
.param = NULL, \
- .get = &get_##cmdname, \
- .set = &set_##cmdname, \
- .verify = &verify_##cmdname, \
+ .get = cmdget, \
+ .set = cmdset, \
+ .verify = cmdverify, \
}
+#define CTRL_CMD_DEFINE(cmdname, cmdstr) \
+static int get_##cmdname(struct ctrl_cmd *cmd, void *data); \
+static int set_##cmdname(struct ctrl_cmd *cmd, void *data); \
+static int verify_##cmdname(struct ctrl_cmd *cmd, const char *value, void *data); \
+ CTRL_CMD_RAW(cmdname, cmdstr, get_##cmdname, set_##cmdname, verify_##cmdname)
struct gsm_network;
#endif /* _CONTROL_CMD_H */
diff --git a/openbsc/src/osmo-nitb/ctrl_commands.c b/openbsc/src/osmo-nitb/ctrl_commands.c
index aeac6840b..6ba9bee0e 100644
--- a/openbsc/src/osmo-nitb/ctrl_commands.c
+++ b/openbsc/src/osmo-nitb/ctrl_commands.c
@@ -36,6 +36,14 @@ static struct ctrl_cmd_element cmd_##cmdname = { \
.verify = verify_vty_description_string, \
}
+CTRL_HELPER_VERIFY_RANGE(net_timer, 0, 65535);
+#define CTRL_CMD_TIMER(timer) \
+ CTRL_HELPER_GET_INT(net_timer_t##timer, struct gsm_network, T##timer); \
+ CTRL_HELPER_SET_INT(net_timer_t##timer, struct gsm_network, T##timer); \
+ CTRL_CMD_RAW(net_timer_t##timer, "t"#timer, \
+ get_net_timer_t##timer, set_net_timer_t##timer, \
+ verify_net_timer);
+
/**
* Check that there are no newlines or comments or other things
* that could make the VTY configuration unparsable.
@@ -65,6 +73,18 @@ CTRL_CMD_DEFINE_RANGE(net_mnc, "mnc", struct gsm_network, network_code, 0, 999);
CTRL_CMD_DEFINE_RANGE(net_mcc, "mcc", struct gsm_network, country_code, 1, 999);
CTRL_CMD_VTY_STRING(net_short_name, "short-name", struct gsm_network, name_short);
CTRL_CMD_VTY_STRING(net_long_name, "long-name", struct gsm_network, name_long);
+CTRL_CMD_TIMER(3101);
+CTRL_CMD_TIMER(3103);
+CTRL_CMD_TIMER(3105);
+CTRL_CMD_TIMER(3107);
+CTRL_CMD_TIMER(3109);
+CTRL_CMD_TIMER(3111);
+CTRL_CMD_TIMER(3113);
+CTRL_CMD_TIMER(3115);
+CTRL_CMD_TIMER(3117);
+CTRL_CMD_TIMER(3119);
+CTRL_CMD_TIMER(3122);
+CTRL_CMD_TIMER(3141);
static int verify_net_save_config(struct ctrl_cmd *cmd, const char *v, void *d)
{
@@ -129,6 +149,18 @@ int bsc_ctrl_cmds_install(void)
rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_long_name);
rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_apply_config);
rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_save_config);
+ rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_timer_t3101);
+ rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_timer_t3103);
+ rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_timer_t3105);
+ rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_timer_t3107);
+ rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_timer_t3109);
+ rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_timer_t3111);
+ rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_timer_t3113);
+ rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_timer_t3115);
+ rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_timer_t3117);
+ rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_timer_t3119);
+ rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_timer_t3122);
+ rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_timer_t3141);
return rc;
}