summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-02-28 17:00:20 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-03-06 23:01:40 +0100
commit253bf2fdb73218aef1e86436146146049ce63d55 (patch)
treee317a280074f43582ab9d4f3ff124004b48367e1
parent448117963d0794013a24dc6d051aacd6088c9826 (diff)
nitb: Add ctrl command for setting the global timers
-rw-r--r--openbsc/include/openbsc/control_cmd.h16
-rw-r--r--openbsc/src/libbsc/bsc_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/libbsc/bsc_ctrl_commands.c b/openbsc/src/libbsc/bsc_ctrl_commands.c
index 63212542a..53693300f 100644
--- a/openbsc/src/libbsc/bsc_ctrl_commands.c
+++ b/openbsc/src/libbsc/bsc_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)
{
@@ -188,6 +208,18 @@ int bsc_base_ctrl_cmds_install(void)
rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_save_config);
rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_apply_config);
rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_mcc_mnc_apply);
+ 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;
}