[asterisk-commits] mvanbaak: branch group/cli_cleanup r145012 - /team/group/cli_cleanup/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Sep 27 17:26:45 CDT 2008


Author: mvanbaak
Date: Sat Sep 27 17:26:44 2008
New Revision: 145012

URL: http://svn.digium.com/view/asterisk?view=rev&rev=145012
Log:
and now the ss7 CLI commands are cleanedup as well

Modified:
    team/group/cli_cleanup/channels/chan_dahdi.c

Modified: team/group/cli_cleanup/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/group/cli_cleanup/channels/chan_dahdi.c?view=diff&rev=145012&r1=145011&r2=145012
==============================================================================
--- team/group/cli_cleanup/channels/chan_dahdi.c (original)
+++ team/group/cli_cleanup/channels/chan_dahdi.c Sat Sep 27 17:26:44 2008
@@ -13071,65 +13071,40 @@
 	return 0;
 }
 
-static char *handle_ss7_no_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+static char *handle_ss7_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	int span;
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "ss7 no debug linkset";
+		e->command = "ss7 set debug {on|off} linkset";
 		e->usage = 
-			"Usage: ss7 no debug linkset <span>\n"
-			"       Disables debugging on a given SS7 linkset\n";
-		return NULL;
-	case CLI_GENERATE:
-		return NULL;
-	}
-	if (a->argc < 5)
-		return CLI_SHOWUSAGE;
-	span = atoi(a->argv[4]);
-	if ((span < 1) || (span > NUM_SPANS)) {
-		ast_cli(a->fd, "Invalid linkset %s.  Should be a number from %d to %d\n", a->argv[4], 1, NUM_SPANS);
-		return CLI_SUCCESS;
-	}
-	if (!linksets[span-1].ss7) {
-		ast_cli(a->fd, "No SS7 running on linkset %d\n", span);
-		return CLI_SUCCESS;
-	}
-	if (linksets[span-1].ss7)
-		ss7_set_debug(linksets[span-1].ss7, 0);
-
-	ast_cli(a->fd, "Disabled debugging on linkset %d\n", span);
-	return CLI_SUCCESS;
-}
-
-static char *handle_ss7_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
-	int span;
-	switch (cmd) {
-	case CLI_INIT:
-		e->command = "ss7 debug linkset";
-		e->usage = 
-			"Usage: ss7 debug linkset <linkset>\n"
+			"Usage: ss7 set debug {on|off} linkset <linkset>\n"
 			"       Enables debugging on a given SS7 linkset\n";
 		return NULL;
 	case CLI_GENERATE:
 		return NULL;
 	}
-	if (a->argc < 4)
+	if (a->argc < 6)
 		return CLI_SHOWUSAGE;
-	span = atoi(a->argv[3]);
+	span = atoi(a->argv[5]);
 	if ((span < 1) || (span > NUM_SPANS)) {
-		ast_cli(a->fd, "Invalid linkset %s.  Should be a number from %d to %d\n", a->argv[3], 1, NUM_SPANS);
+		ast_cli(a->fd, "Invalid linkset %s.  Should be a number from %d to %d\n", a->argv[5], 1, NUM_SPANS);
 		return CLI_SUCCESS;
 	}
 	if (!linksets[span-1].ss7) {
 		ast_cli(a->fd, "No SS7 running on linkset %d\n", span);
 		return CLI_SUCCESS;
 	}
-	if (linksets[span-1].ss7)
-		ss7_set_debug(linksets[span-1].ss7, SS7_DEBUG_MTP2 | SS7_DEBUG_MTP3 | SS7_DEBUG_ISUP);
-
-	ast_cli(a->fd, "Enabled debugging on linkset %d\n", span);
+	if (linksets[span-1].ss7) {
+		if (strcasecmp(a->argv[4], "on")) {
+			ss7_set_debug(linksets[span-1].ss7, SS7_DEBUG_MTP2 | SS7_DEBUG_MTP3 | SS7_DEBUG_ISUP);
+			ast_cli(a->fd, "Enabled debugging on linkset %d\n", span);
+		} else {
+			ss7_set_debug(linksets[span-1].ss7, 0);
+			ast_cli(a->fd, "Disabled debugging on linkset %d\n", span);
+		}
+	}
+
 	return CLI_SUCCESS;
 }
 
@@ -13390,7 +13365,6 @@
 
 static struct ast_cli_entry dahdi_ss7_cli[] = {
 	AST_CLI_DEFINE(handle_ss7_debug, "Enables SS7 debugging on a linkset"), 
-	AST_CLI_DEFINE(handle_ss7_no_debug, "Disables SS7 debugging on a linkset"), 
 	AST_CLI_DEFINE(handle_ss7_block_cic, "Blocks the given CIC"),
 	AST_CLI_DEFINE(handle_ss7_unblock_cic, "Unblocks the given CIC"),
 	AST_CLI_DEFINE(handle_ss7_block_linkset, "Blocks all CICs on a linkset"),




More information about the asterisk-commits mailing list