From fcb999c01c22548f582f167e1b1e86f0c3a5a2fd Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Mon, 18 Sep 2006 19:54:18 +0000 Subject: merge qwell's CLI verbification work git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43212 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/udptl.c | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) (limited to 'main/udptl.c') diff --git a/main/udptl.c b/main/udptl.c index 1264c23fc..d21cfe981 100644 --- a/main/udptl.c +++ b/main/udptl.c @@ -1135,7 +1135,7 @@ static int udptl_do_debug(int fd, int argc, char *argv[]) return RESULT_SUCCESS; } -static int udptl_no_debug(int fd, int argc, char *argv[]) +static int udptl_nodebug_deprecated(int fd, int argc, char *argv[]) { if (argc !=3) return RESULT_SHOWUSAGE; @@ -1144,22 +1144,41 @@ static int udptl_no_debug(int fd, int argc, char *argv[]) return RESULT_SUCCESS; } +static int udptl_nodebug(int fd, int argc, char *argv[]) +{ + if (argc != 2) + return RESULT_SHOWUSAGE; + udptldebug = 0; + ast_cli(fd,"UDPTL Debugging Disabled\n"); + return RESULT_SUCCESS; +} + static char debug_usage[] = "Usage: udptl debug [ip host[:port]]\n" " Enable dumping of all UDPTL packets to and from host.\n"; -static char no_debug_usage[] = - "Usage: udptl no debug\n" +static char nodebug_usage[] = + "Usage: udptl nodebug\n" " Disable all UDPTL debugging\n"; -static struct ast_cli_entry cli_debug_ip = -{{ "udptl", "debug", "ip", NULL } , udptl_do_debug, "Enable UDPTL debugging on IP", debug_usage }; +static struct ast_cli_entry cli_udptl_no_debug = { + { "udptl", "no", "debug", NULL }, + udptl_nodebug_deprecated, NULL, + NULL }; -static struct ast_cli_entry cli_debug = -{{ "udptl", "debug", NULL } , udptl_do_debug, "Enable UDPTL debugging", debug_usage }; +static struct ast_cli_entry cli_udptl[] = { + { { "udptl", "debug", NULL }, + udptl_do_debug, "Enable UDPTL debugging", + debug_usage }, -static struct ast_cli_entry cli_no_debug = -{{ "udptl", "no", "debug", NULL } , udptl_no_debug, "Disable UDPTL debugging", no_debug_usage }; + { { "udptl", "debug", "ip", NULL }, + udptl_do_debug, "Enable UDPTL debugging on IP", + debug_usage }, + + { { "udptl", "nodebug", NULL }, + udptl_nodebug, "Disable UDPTL debugging", + nodebug_usage, NULL, &cli_udptl_no_debug }, +}; void ast_udptl_reload(void) { @@ -1239,8 +1258,6 @@ void ast_udptl_reload(void) void ast_udptl_init(void) { - ast_cli_register(&cli_debug); - ast_cli_register(&cli_debug_ip); - ast_cli_register(&cli_no_debug); + ast_cli_register_multiple(cli_udptl, sizeof(cli_udptl) / sizeof(struct ast_cli_entry)); ast_udptl_reload(); } -- cgit v1.2.3