aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2022-04-10 15:43:45 +0200
committerHarald Welte <laforge@osmocom.org>2022-04-10 17:35:15 +0200
commit97b15ae3970701d20bb35eca771d6ddc87c703af (patch)
tree92415ea430e67418022cc7c820525ae29db7544a /src
parent9f3498681a411f898152c3e29129afef95348385 (diff)
vty: Print only applicable information during 'show line'
If the line is in channelized mode, only print per-TS information. If the line is in superchannel mode, only print SC information. This avoids printing information that is not applicable to the line mode. Change-Id: I7b55ae8a5e1d352f90e14342d7f7e82e4848118a
Diffstat (limited to 'src')
-rw-r--r--src/vty.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/vty.c b/src/vty.c
index ba6b1ac..65eb334 100644
--- a/src/vty.c
+++ b/src/vty.c
@@ -170,15 +170,24 @@ static void vty_dump_line(struct vty *vty, const struct e1_line *line)
line->ts0.cur_errmask & E1L_TS0_RX_CRC4_ERR ? " [REMOTE-CRC-ERROR]" : "",
VTY_NEWLINE);
- for (tn = 0; tn < ARRAY_SIZE(line->ts); tn++) {
- const struct e1_ts *ts = &line->ts[tn];
- vty_out(vty, " TS%02u: Mode %s, FD %d, Peer PID %d%s",
- ts->id, get_value_string(e1_ts_mode_names, ts->mode),
- ts->fd, get_remote_pid(ts->fd), VTY_NEWLINE);
+ switch (line->mode) {
+ case E1_LINE_MODE_CHANNELIZED:
+ for (tn = 0; tn < ARRAY_SIZE(line->ts); tn++) {
+ const struct e1_ts *ts = &line->ts[tn];
+ vty_out(vty, " TS%02u: Mode %s, FD %d, Peer PID %d%s",
+ ts->id, get_value_string(e1_ts_mode_names, ts->mode),
+ ts->fd, get_remote_pid(ts->fd), VTY_NEWLINE);
+ }
+ break;
+ case E1_LINE_MODE_SUPERCHANNEL:
+ vty_out(vty, " SC: Mode %s, FD %d, Peer PID %d%s",
+ get_value_string(e1_ts_mode_names, line->superchan.mode),
+ line->superchan.fd, get_remote_pid(line->superchan.fd), VTY_NEWLINE);
+ break;
+ case E1_LINE_MODE_E1OIP:
+ /* TODO: dump some information about E1oIP */
+ break;
}
- vty_out(vty, " SC: Mode %s, FD %d, Peer PID %d%s",
- get_value_string(e1_ts_mode_names, line->superchan.mode),
- line->superchan.fd, get_remote_pid(line->superchan.fd), VTY_NEWLINE);
vty_out_rate_ctr_group(vty, " ", line->ctrs);
}