diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-02-28 12:32:18 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-02-28 19:40:53 +0100 |
commit | 6ea7e777f5edec004da8e82f0f415abb1aee2d48 (patch) | |
tree | d3bc4e7b825b97c283e0d019f10439696dbcbb59 /openbsc/src/mgcp/mgcp_vty.c | |
parent | cdba04978d0bb4e54b7e9c33717e30c5f864b4e2 (diff) |
mgcp: Implement find_trunk to find the E1 trunks as well.
Diffstat (limited to 'openbsc/src/mgcp/mgcp_vty.c')
-rw-r--r-- | openbsc/src/mgcp/mgcp_vty.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/openbsc/src/mgcp/mgcp_vty.c b/openbsc/src/mgcp/mgcp_vty.c index 88c097d9c..81cc68b26 100644 --- a/openbsc/src/mgcp/mgcp_vty.c +++ b/openbsc/src/mgcp/mgcp_vty.c @@ -37,12 +37,16 @@ static struct mgcp_config *g_cfg = NULL; -static struct mgcp_trunk_config *find_trunk(struct mgcp_config *cfg, int trunk) +static struct mgcp_trunk_config *find_trunk(struct mgcp_config *cfg, int nr) { - if (trunk != 0) - return NULL; + struct mgcp_trunk_config *trunk; + + if (nr == 0) + trunk = &cfg->trunk; + else + trunk = mgcp_trunk_num(cfg, nr); - return &cfg->trunk; + return trunk; } /* @@ -466,6 +470,12 @@ DEFUN(loop_endp, return CMD_WARNING; } + if (!trunk->endpoints) { + vty_out(vty, "%%Trunk %d has no endpoints allocated.%s", + trunk->trunk_nr, VTY_NEWLINE); + return CMD_WARNING; + } + int endp_no = strtoul(argv[1], NULL, 16); if (endp_no < 1 || endp_no >= trunk->number_endpoints) { vty_out(vty, "Loopback number %s/%d is invalid.%s", @@ -509,6 +519,12 @@ DEFUN(tap_call, return CMD_WARNING; } + if (!trunk->endpoints) { + vty_out(vty, "%%Trunk %d has no endpoints allocated.%s", + trunk->trunk_nr, VTY_NEWLINE); + return CMD_WARNING; + } + int endp_no = strtoul(argv[1], NULL, 16); if (endp_no < 1 || endp_no >= trunk->number_endpoints) { vty_out(vty, "Endpoint number %s/%d is invalid.%s", @@ -554,6 +570,12 @@ DEFUN(free_endp, free_endp_cmd, return CMD_WARNING; } + if (!trunk->endpoints) { + vty_out(vty, "%%Trunk %d has no endpoints allocated.%s", + trunk->trunk_nr, VTY_NEWLINE); + return CMD_WARNING; + } + int endp_no = strtoul(argv[1], NULL, 16); if (endp_no < 1 || endp_no >= trunk->number_endpoints) { vty_out(vty, "Endpoint number %s/%d is invalid.%s", |