[dahdi-commits] mspiceland: branch linux/rmeyerriecks/dahdi-tools-maintmodes r7452 - /linux/t...

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Fri Oct 30 13:28:33 CDT 2009


Author: mspiceland
Date: Fri Oct 30 13:28:30 2009
New Revision: 7452

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7452
Log:
Modifictions to dahdi_maint to support initiating all 3 loopback modes.

Modified:
    linux/team/rmeyerriecks/dahdi-tools-maintmodes/Makefile
    linux/team/rmeyerriecks/dahdi-tools-maintmodes/dahdi_maint.c

Modified: linux/team/rmeyerriecks/dahdi-tools-maintmodes/Makefile
URL: http://svnview.digium.com/svn/dahdi/linux/team/rmeyerriecks/dahdi-tools-maintmodes/Makefile?view=diff&rev=7452&r1=7451&r2=7452
==============================================================================
--- linux/team/rmeyerriecks/dahdi-tools-maintmodes/Makefile (original)
+++ linux/team/rmeyerriecks/dahdi-tools-maintmodes/Makefile Fri Oct 30 13:28:30 2009
@@ -105,13 +105,13 @@
 
 # Utilities we build with a standard build procedure:
 UTILS		= dahdi_tool dahdi_test dahdi_monitor dahdi_speed sethdlc dahdi_cfg \
-		  fxstest fxotune dahdi_diag dahdi_scan
+		  fxstest fxotune dahdi_diag dahdi_scan dahdi_maint
 
 # some tests:
 UTILS		+= patgen pattest patlooptest hdlcstress hdlctest hdlcgen \
 		   hdlcverify timertest
 
-BINS:=fxotune fxstest sethdlc dahdi_cfg dahdi_diag dahdi_monitor dahdi_speed dahdi_test dahdi_scan dahdi_tool
+BINS:=fxotune fxstest sethdlc dahdi_cfg dahdi_diag dahdi_monitor dahdi_speed dahdi_test dahdi_scan dahdi_tool dahdi_maint
 BINS:=$(filter-out $(MENUSELECT_UTILS),$(BINS))
 MAN_PAGES:=$(wildcard $(BINS:%=doc/%.8))
 

Modified: linux/team/rmeyerriecks/dahdi-tools-maintmodes/dahdi_maint.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/rmeyerriecks/dahdi-tools-maintmodes/dahdi_maint.c?view=diff&rev=7452&r1=7451&r2=7452
==============================================================================
--- linux/team/rmeyerriecks/dahdi-tools-maintmodes/dahdi_maint.c (original)
+++ linux/team/rmeyerriecks/dahdi-tools-maintmodes/dahdi_maint.c Fri Oct 30 13:28:30 2009
@@ -14,44 +14,50 @@
 extern char *optarg;
 extern int optind;
 
-main(int argc, char *argv[]) {
+int main(int argc, char *argv[]) {
 	static int ctl = -1;
 	int res;
 
-	int lflag = 0;
+	int localhostloopback = 0;
+	char *harg = NULL;
+	int networklineloopback= 0;
 	char *larg = NULL;
-	int rflag = 0;
-	char *rarg = NULL;
+	int networkpayloadloopback= 0;
+	char *parg = NULL;
 	int sflag = 0;
 	int span = 0;
 	int dflag = 0;
 	char *darg = NULL;
-	int pflag = 0;
+	int gflag = 0;
 	int c;
 
 	struct dahdi_maintinfo m;
 	struct dahdi_spaninfo s;
 
-	while((c = getopt(argc, argv, "l:r:s:d:p")) != -1) {
+	while((c = getopt(argc, argv, "h:l:p:s:d:g")) != -1) {
 			switch(c) {
-			case 'l':
+			case 'h': /* local host loopback */
+				harg = optarg;
+				localhostloopback = 1;
+				break;
+			case 'l': /* network line loopback */
 				larg = optarg;
-				lflag = 1;
+				networklineloopback = 1;
 				break;
-			case 'r':
-				rarg = optarg;
-				rflag = 1;
+			case 'p': /* network payload loopback */
+				parg = optarg;
+				networkpayloadloopback = 1;
 				break;
-			case 's':
+			case 's': /* specify a span */
 				span = atoi(optarg);
 				sflag = 1;
 				break;
-			case 'd':
+			case 'd': /* insert an error */
 				darg = optarg;
 				dflag = 1;
 				break;
-			case 'p':
-				pflag = 1;
+			case 'g': /* generate psuedo random sequence */
+				gflag = 1;
 				break;
 			}
 	}
@@ -81,12 +87,12 @@
 
 	m.spanno = span;
 
-	if(lflag) {
-		if(!strcasecmp(larg, "on")) {
-			printf("Turning on local loopback for span: %d\n", span);
+	if(localhostloopback) {
+		if(!strcasecmp(harg, "on")) {
+			printf("Turning on Host Loopback for span: %d\n", span);
 			m.command = DAHDI_MAINT_LOCALLOOP;
-		} else if (!strcasecmp(larg, "off")) {
-			printf("Turning off local loopback for span: %d\n", span);
+		} else if (!strcasecmp(harg, "off")) {
+			printf("Turning off Host Loopback for span: %d\n", span);
 			m.command = DAHDI_MAINT_NONE;
 		} else {
 			printf("Usage: maint -l <on|off>\n");
@@ -95,14 +101,30 @@
 		res = ioctl(ctl, DAHDI_MAINT, &m);
 	}
 
-	if(rflag) {
-		if(!strcasecmp(rarg, "on")) {
-			printf("Turning remote loopback on\n");
-		} else if (!strcasecmp(rarg, "off")) {
-			printf("Turning remote loopback off\n");
+	if(networklineloopback) {
+		if(!strcasecmp(larg, "on")) {
+			printf("Turning network line loopback on\n");
+			m.command = DAHDI_MAINT_NETWORKLINELOOP;
+		} else if (!strcasecmp(larg, "off")) {
+			printf("Turning network line loopback off\n");
+			m.command = DAHDI_MAINT_NONE;
 		} else {
 			printf("Usage: maint -r <on|off>\n");
 		}
+		res = ioctl(ctl, DAHDI_MAINT, &m);
+	}
+
+	if(networkpayloadloopback) {
+		if(!strcasecmp(parg, "on")) {
+			printf("Turning network payload loopback on\n");
+			m.command = DAHDI_MAINT_NETWORKPAYLOADLOOP;
+		} else if (!strcasecmp(parg, "off")) {
+			printf("Turning network payload loopback off\n");
+			m.command = DAHDI_MAINT_NONE;
+		} else {
+			printf("Usage: dahdi_maint -r <on|off>\n");
+		}
+		res = ioctl(ctl, DAHDI_MAINT, &m);
 	}
 
 	if(dflag) {
@@ -130,7 +152,7 @@
 		res = ioctl(ctl, DAHDI_MAINT, &m);
 	}
 
-	if(pflag) {
+	if(gflag) {
 		printf("Enabled the Pseudo-Random Binary Sequence Generation and Monitor\n");
 		m.command = DAHDI_MAINT_PRBS;
 		res = ioctl(ctl, DAHDI_MAINT, &m);




More information about the dahdi-commits mailing list