diff options
author | Harald Welte <laforge@gnumonks.org> | 2011-08-16 14:30:10 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@gnumonks.org> | 2011-08-16 14:35:34 +0200 |
commit | f2737fcd64b4d5441c8ee3296ac7a706d87c587a (patch) | |
tree | 20ee796b84ae72b0feaf1aac7df668c0759e3974 /src/e1_input_vty.c | |
parent | 6e37c591f980b41eac2468a1e3e0690e71dbc536 (diff) |
E1 Input: Add rate counters for events related to E1 lines
Diffstat (limited to 'src/e1_input_vty.c')
-rw-r--r-- | src/e1_input_vty.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/e1_input_vty.c b/src/e1_input_vty.c index fe14799..a8ccabb 100644 --- a/src/e1_input_vty.c +++ b/src/e1_input_vty.c @@ -21,17 +21,21 @@ #include <stdlib.h> #include <unistd.h> +#include <osmocom/core/linuxlist.h> +#include <osmocom/core/talloc.h> +#include <osmocom/core/utils.h> +#include <osmocom/gsm/gsm_utils.h> + #include <osmocom/vty/command.h> #include <osmocom/vty/buffer.h> #include <osmocom/vty/vty.h> #include <osmocom/vty/logging.h> +#include <osmocom/vty/misc.h> #include <osmocom/vty/telnet_interface.h> -#include <osmocom/core/linuxlist.h> #include <osmocom/abis/e1_input.h> -#include <osmocom/core/utils.h> -#include <osmocom/gsm/gsm_utils.h> -#include <osmocom/core/talloc.h> + +/* CONFIG */ #define E1_DRIVER_NAMES "(misdn|dahdi|ipa|hsl)" #define E1_DRIVER_HELP "mISDN supported E1 Card\n" \ @@ -112,6 +116,8 @@ static int e1inp_config_write(struct vty *vty) return CMD_SUCCESS; } +/* SHOW */ + static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv) { vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE); @@ -130,34 +136,43 @@ DEFUN(show_e1drv, return CMD_SUCCESS; } -static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line) +static void e1line_dump_vty(struct vty *vty, struct e1inp_line *line, + int stats) { vty_out(vty, "E1 Line Number %u, Name %s, Driver %s%s", line->num, line->name ? line->name : "", line->driver->name, VTY_NEWLINE); + if (stats) + vty_out_rate_ctr_group(vty, " ", line->rate_ctr); } DEFUN(show_e1line, show_e1line_cmd, - "show e1_line [line_nr]", + "show e1_line [line_nr] [stats]", SHOW_STR "Display information about a E1 line\n" "E1 Line Number\n") { struct e1inp_line *line; + int stats = 0; - if (argc >= 1) { + if (argc >= 1 && strcmp(argv[0], "stats")) { int num = atoi(argv[0]); + if (argc >= 2) + stats = 1; llist_for_each_entry(line, &e1inp_line_list, list) { if (line->num == num) { - e1line_dump_vty(vty, line); + e1line_dump_vty(vty, line, stats); return CMD_SUCCESS; } } return CMD_WARNING; } + if (argc >= 1 && !strcmp(argv[0], "stats")) + stats = 1; + llist_for_each_entry(line, &e1inp_line_list, list) - e1line_dump_vty(vty, line); + e1line_dump_vty(vty, line, stats); return CMD_SUCCESS; } |