summaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs/sgsn_vty.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-05-06 17:46:08 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-05-06 17:46:08 +0200
commitc15c61c401e6f934fbf35c0c87d0777ff857f7c6 (patch)
treee65e29b5e7832bae4fefaefe3212c4104dfbd3b4 /openbsc/src/gprs/sgsn_vty.c
parent4f5b8237ec2182861fbe075f4cce56a9c7caf904 (diff)
sgsn: Add VTY configuration for the CDR module
Make it possible to set a filename to use for the CDR. By default no CDR will be generated. Forbid to set the interval of 0 seconds as this will cause a lot of work. Add a very basic VTY test.
Diffstat (limited to 'openbsc/src/gprs/sgsn_vty.c')
-rw-r--r--openbsc/src/gprs/sgsn_vty.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/openbsc/src/gprs/sgsn_vty.c b/openbsc/src/gprs/sgsn_vty.c
index be575d337..8b6e3ec29 100644
--- a/openbsc/src/gprs/sgsn_vty.c
+++ b/openbsc/src/gprs/sgsn_vty.c
@@ -1,6 +1,7 @@
/*
* (C) 2010-2013 by Harald Welte <laforge@gnumonks.org>
* (C) 2010 by On-Waves
+ * (C) 2015 by Holger Hans Peter Freyther
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@@ -164,6 +165,12 @@ static int config_write_sgsn(struct vty *vty)
actx->ggsn->id, VTY_NEWLINE);
}
+ if (g_cfg->cdr.filename)
+ vty_out(vty, " cdr filename %s%s", g_cfg->cdr.filename, VTY_NEWLINE);
+ else
+ vty_out(vty, " no cdr filename%s", VTY_NEWLINE);
+ vty_out(vty, " cdr interval %d%s", g_cfg->cdr.interval, VTY_NEWLINE);
+
return CMD_SUCCESS;
}
@@ -811,6 +818,32 @@ DEFUN(cfg_no_apn_name, cfg_no_apn_name_cmd,
return CMD_SUCCESS;
}
+DEFUN(cfg_cdr_filename, cfg_cdr_filename_cmd,
+ "cdr filename NAME",
+ "CDR\nSet filename\nname\n")
+{
+ talloc_free(g_cfg->cdr.filename);
+ g_cfg->cdr.filename = talloc_strdup(tall_vty_ctx, argv[0]);
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_no_cdr_filename, cfg_no_cdr_filename_cmd,
+ "no cdr filename",
+ NO_STR "CDR\nDisable CDR generation\n")
+{
+ talloc_free(g_cfg->cdr.filename);
+ g_cfg->cdr.filename = NULL;
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_cdr_interval, cfg_cdr_interval_cmd,
+ "cdr interval <1-2147483647>",
+ "CDR\nPDP periodic log interval\nSeconds\n")
+{
+ g_cfg->cdr.interval = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
+
int sgsn_vty_init(void)
{
install_element_ve(&show_sgsn_cmd);
@@ -842,6 +875,9 @@ int sgsn_vty_init(void)
install_element(SGSN_NODE, &cfg_apn_imsi_ggsn_cmd);
install_element(SGSN_NODE, &cfg_apn_name_cmd);
install_element(SGSN_NODE, &cfg_no_apn_name_cmd);
+ install_element(SGSN_NODE, &cfg_cdr_filename_cmd);
+ install_element(SGSN_NODE, &cfg_no_cdr_filename_cmd);
+ install_element(SGSN_NODE, &cfg_cdr_interval_cmd);
return 0;
}