diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-05-14 01:14:15 +0800 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-05-14 01:45:45 +0800 |
commit | 39cb9f2a3c9ad4b8793c3c99675ccc6123527128 (patch) | |
tree | bd79b941f1d0f170ae935a6759e5e5fbc6493713 | |
parent | 0558a5a0dd0dccafbac2a2ea7a6af2211577c55e (diff) |
[vty] Move "show lchan" into a parameterized method
I want to have a shorter lchan summary but with the same
config parameters. Change the current code to be a method
that takes a dump routine as parameter.
-rw-r--r-- | openbsc/src/vty_interface.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/openbsc/src/vty_interface.c b/openbsc/src/vty_interface.c index c1466ea6d..421dd72cc 100644 --- a/openbsc/src/vty_interface.c +++ b/openbsc/src/vty_interface.c @@ -681,7 +681,7 @@ static void meas_rep_dump_vty(struct vty *vty, struct gsm_meas_rep *mr, meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul"); } -static void lchan_dump_vty(struct vty *vty, struct gsm_lchan *lchan) +static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan) { int idx; @@ -716,10 +716,8 @@ static void lchan_dump_vty(struct vty *vty, struct gsm_lchan *lchan) meas_rep_dump_vty(vty, &lchan->meas_rep[idx], " "); } -DEFUN(show_lchan, - show_lchan_cmd, - "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]", - SHOW_STR "Display information about a logical channel\n") +static int lchan_summary(struct vty *vty, int argc, const char **argv, + void (*dump_cb)(struct vty *, struct gsm_lchan *)) { struct gsm_network *net = gsmnet; struct gsm_bts *bts; @@ -764,7 +762,7 @@ DEFUN(show_lchan, return CMD_WARNING; } lchan = &ts->lchan[lchan_nr]; - lchan_dump_vty(vty, lchan); + dump_cb(vty, lchan); return CMD_SUCCESS; } for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { @@ -778,7 +776,7 @@ DEFUN(show_lchan, lchan = &ts->lchan[lchan_nr]; if (lchan->type == GSM_LCHAN_NONE) continue; - lchan_dump_vty(vty, lchan); + dump_cb(vty, lchan); } } } @@ -787,6 +785,15 @@ DEFUN(show_lchan, return CMD_SUCCESS; } + +DEFUN(show_lchan, + show_lchan_cmd, + "show lchan [bts_nr] [trx_nr] [ts_nr] [lchan_nr]", + SHOW_STR "Display information about a logical channel\n") +{ + return lchan_summary(vty, argc, argv, lchan_dump_full_vty); +} + static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv) { vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE); |