aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-07-24 13:06:45 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2017-08-27 03:52:46 +0200
commitf704a6e5af7f8bc80f9b91eb5402ddf9ea62e5b2 (patch)
tree8badac53ad46b4118b0bdde5117d04fda712248e
parent5ca0a8132f542c846c8dc25b50d6ebc1724538b5 (diff)
vty: add 'default' keyword to timer config
-rw-r--r--src/libbsc/bsc_vty.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c
index da406e0a6..9991e583f 100644
--- a/src/libbsc/bsc_vty.c
+++ b/src/libbsc/bsc_vty.c
@@ -1540,15 +1540,26 @@ DEFUN(cfg_net_pag_any_tch,
return CMD_SUCCESS;
}
+#define DEFAULT_TIMER(number) GSM_T##number##_DEFAULT
+/* Add another expansion so that DEFAULT_TIMER() becomes its value */
+#define EXPAND_AND_STRINGIFY(x) OSMO_STRINGIFY(x)
+
#define DECLARE_TIMER(number, doc) \
DEFUN(cfg_net_T##number, \
cfg_net_T##number##_cmd, \
- "timer t" #number " <1-65535>", \
+ "timer t" #number " (default|<1-65535>)", \
"Configure GSM Timers\n" \
- doc "Timer Value in seconds\n") \
+ doc \
+ "Set to default timer value" \
+ " (" EXPAND_AND_STRINGIFY(DEFAULT_TIMER(number)) " seconds)\n" \
+ "Timer Value in seconds\n") \
{ \
struct gsm_network *gsmnet = gsmnet_from_vty(vty); \
- int value = atoi(argv[0]); \
+ int value; \
+ if (strcmp(argv[0], "default") == 0) \
+ value = DEFAULT_TIMER(number); \
+ else \
+ value = atoi(argv[0]); \
\
gsmnet->T##number = value; \
return CMD_SUCCESS; \