[libss7-commits] mattf: trunk r186 - in /trunk: parser_debug.c ss7linktest.c

SVN commits to the libss7 project libss7-commits at lists.digium.com
Fri Jul 11 16:30:34 CDT 2008


Author: mattf
Date: Fri Jul 11 16:30:34 2008
New Revision: 186

URL: http://svn.digium.com/view/libss7?view=rev&rev=186
Log:
Make linktest program work with new transport definitions

Modified:
    trunk/parser_debug.c
    trunk/ss7linktest.c

Modified: trunk/parser_debug.c
URL: http://svn.digium.com/view/libss7/trunk/parser_debug.c?view=diff&rev=186&r1=185&r2=186
==============================================================================
--- trunk/parser_debug.c (original)
+++ trunk/parser_debug.c Fri Jul 11 16:30:34 2008
@@ -43,7 +43,7 @@
 
 	printf("\n");
 
-	ss7_add_link(ss7, SS7_TRANSPORT_ZAP, 10);
+	ss7_add_link(ss7, SS7_TRANSPORT_DAHDIDCHAN, 10);
 
 	ss7->debug = SS7_DEBUG_MTP2 | SS7_DEBUG_MTP3 | SS7_DEBUG_ISUP;
 	ss7->links[0]->state = MTP_INSERVICE;

Modified: trunk/ss7linktest.c
URL: http://svn.digium.com/view/libss7/trunk/ss7linktest.c?view=diff&rev=186&r1=185&r2=186
==============================================================================
--- trunk/ss7linktest.c (original)
+++ trunk/ss7linktest.c Fri Jul 11 16:30:34 2008
@@ -194,10 +194,11 @@
 	printf("%s", fmt);
 }
 
-int zap_open(int devnum)
+int zap_open(int devnum, int *ismtp2)
 {
 	int fd;
 	DAHDI_BUFFERINFO bi;
+	struct dahdi_params z;
 	fd = open("/dev/dahdi/channel", O_RDWR|O_NONBLOCK, 0600);
 	if ((fd < 0) || (ioctl(fd, DAHDI_SPECIFY, &devnum) == -1)) {
 		printf("Could not open device %d: %s\n", devnum, strerror(errno));
@@ -211,6 +212,16 @@
 		close(fd);
 		return -1;
 	}
+
+	if (ioctl(fd, DAHDI_GET_PARAMS, &z)) {
+		close(fd);
+		return -1;
+	}
+
+	if (z.sigtype == DAHDI_SIG_MTP2)
+		*ismtp2 = 1;
+	else
+		*ismtp2 = 0;
 	return fd;
 }
 
@@ -229,6 +240,7 @@
 	struct ss7 *ss7;
 	pthread_t tmp;
 	int channum;
+	int ismtp2;
 	unsigned int type;
 
 	if (argc < 5) {
@@ -249,7 +261,7 @@
 	opc = atoi(argv[3]);
 	dpc = atoi(argv[4]);
 
-	fd = zap_open(channum);
+	fd = zap_open(channum, &ismtp2);
 
 	if (fd == -1)
 		return -1;
@@ -267,7 +279,7 @@
 	ss7_set_network_ind(ss7, SS7_NI_NAT);
 
 	ss7_set_debug(ss7, 0xfffffff);
-	if ((ss7_add_link(ss7, SS7_TRANSPORT_ZAP, fd))) {
+	if ((ss7_add_link(ss7, ismtp2 ? SS7_TRANSPORT_DAHDIMTP2 : SS7_TRANSPORT_DAHDIDCHAN, fd))) {
 		perror("ss7_add_link");
 		exit(1);
 	}




More information about the libss7-commits mailing list