aboutsummaryrefslogtreecommitdiffstats
path: root/src/e1_input_vty.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-08-16 14:17:49 +0200
committerPablo Neira Ayuso <pablo@gnumonks.org>2011-08-16 14:18:53 +0200
commit601a9c7d3266770c4637e909a8578c32c923f21d (patch)
treec80f6f6fcfe27456c801c82d4119d4ead4a97111 /src/e1_input_vty.c
parent31fe5f2ef8391b7f61b7dd1cb2632f27c7843534 (diff)
E1 Input: Add VTY command to specify the name of a Line
So far, there was no way to set the line->name field at all.
Diffstat (limited to 'src/e1_input_vty.c')
-rw-r--r--src/e1_input_vty.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/e1_input_vty.c b/src/e1_input_vty.c
index d832cc5..1b6ea1f 100644
--- a/src/e1_input_vty.c
+++ b/src/e1_input_vty.c
@@ -39,9 +39,11 @@
"IPA TCP/IP input" \
"HSL TCP/IP input"
+#define E1_LINE_HELP "Configure E1/T1/J1 Line\n" "Line Number\n"
+
DEFUN(cfg_e1line_driver, cfg_e1_line_driver_cmd,
"e1_line <0-255> driver " E1_DRIVER_NAMES,
- "Configure E1/T1/J1 Line\n" "Line Number\n" "Set driver for this line\n"
+ E1_LINE_HELP "Set driver for this line\n"
E1_DRIVER_HELP)
{
struct e1inp_line *line;
@@ -61,6 +63,27 @@ DEFUN(cfg_e1line_driver, cfg_e1_line_driver_cmd,
return CMD_SUCCESS;
}
+DEFUN(cfg_e1line_name, cfg_e1_line_name_cmd,
+ "e1_line <0-255> name .LINE",
+ E1_LINE_HELP "Set name for this line\n" "Human readable name\n")
+{
+ struct e1inp_line *line;
+ int e1_nr = atoi(argv[0]);
+
+ line = e1inp_line_find(e1_nr);
+ if (!line) {
+ vty_out(vty, "%% Line %d doesn't exist%s", e1_nr, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ if (line->name) {
+ talloc_free((void *)line->name);
+ line->name = NULL;
+ }
+ line->name = talloc_strdup(line, argv[1]);
+
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_e1inp, cfg_e1inp_cmd,
"e1_input",
"Configure E1/T1/J1 TDM input\n")
@@ -82,6 +105,9 @@ static int e1inp_config_write(struct vty *vty)
llist_for_each_entry(line, &e1inp_line_list, list) {
vty_out(vty, " e1_line %u driver %s%s", line->num,
line->driver->name, VTY_NEWLINE);
+ if (line->name)
+ vty_out(vty, " e1_line %u name %s%s", line->num,
+ line->name, VTY_NEWLINE);
}
return CMD_SUCCESS;
}
@@ -97,6 +123,7 @@ int e1inp_vty_init(void)
install_element(CONFIG_NODE, &cfg_e1inp_cmd);
install_node(&e1inp_node, e1inp_config_write);
install_element(L_E1INP_NODE, &cfg_e1_line_driver_cmd);
+ install_element(L_E1INP_NODE, &cfg_e1_line_name_cmd);
return 0;
}