[libss7-commits] mattf: trunk r184 - in /trunk: ss7.c ss7linktest.c ss7test.c

SVN commits to the libss7 project libss7-commits at lists.digium.com
Sat Jun 28 20:56:07 CDT 2008


Author: mattf
Date: Sat Jun 28 20:56:06 2008
New Revision: 184

URL: http://svn.digium.com/view/libss7?view=rev&rev=184
Log:
Make libss7 compatible with DAHDI.  No more Zaptel (get 0.9.1 branch if you need Zaptel support, although it is not going to be maintained)

Modified:
    trunk/ss7.c
    trunk/ss7linktest.c
    trunk/ss7test.c

Modified: trunk/ss7.c
URL: http://svn.digium.com/view/libss7/trunk/ss7.c?view=diff&rev=184&r1=183&r2=184
==============================================================================
--- trunk/ss7.c (original)
+++ trunk/ss7.c Sat Jun 28 20:56:06 2008
@@ -17,6 +17,7 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <stdarg.h>
+#include <dahdi/user.h>
 #include <sys/ioctl.h>
 #include <sys/poll.h>
 #include "libss7.h"
@@ -175,22 +176,22 @@
 	if (transport == SS7_TRANSPORT_TCP) {
 	}
 
-	if (transport == SS7_TRANSPORT_ZAP) {
+	if (transport == SS7_TRANSPORT_DAHDI) {
 		int zapmtp2 = 0;
-#ifdef ZT_SIG_MTP2
-		struct zt_params z;
+#ifdef DAHDI_SIG_MTP2
+		struct dahdi_params z;
 		int res;
 
-		res = ioctl(fd, ZT_GET_PARAMS, &z);
+		res = ioctl(fd, DAHDI_GET_PARAMS, &z);
 		if (res)
 			return res;
 
-		if (z.sigtype == ZT_SIG_MTP2) {
+		if (z.sigtype == DAHDI_SIG_MTP2) {
 			printf("Found zapmtp2\n");
 			zapmtp2 = 1;
 		}
 
-#endif /* ZT_SIG_MTP2 */
+#endif /* DAHDI_SIG_MTP2 */
 		m = mtp2_new(fd, ss7->switchtype);
 		
 		if (!m)

Modified: trunk/ss7linktest.c
URL: http://svn.digium.com/view/libss7/trunk/ss7linktest.c?view=diff&rev=184&r1=183&r2=184
==============================================================================
--- trunk/ss7linktest.c (original)
+++ trunk/ss7linktest.c Sat Jun 28 20:56:06 2008
@@ -10,7 +10,7 @@
 #include <pthread.h>
 #include <errno.h>
 #include <time.h>
-#include <zaptel/zaptel.h>
+#include <dahdi/user.h>
 #include "libss7.h"
 
 struct linkset {
@@ -92,17 +92,17 @@
 		}
 
 		if (poller.revents & POLLPRI) {
-			if (ioctl(linkset->fd, ZT_GETEVENT, &x)) {
+			if (ioctl(linkset->fd, DAHDI_GETEVENT, &x)) {
 				perror("Error in exception retrieval!\n");
 			}
 			switch (x) {
-				case ZT_EVENT_OVERRUN:
+				case DAHDI_EVENT_OVERRUN:
 					printf("Overrun detected!\n");
 					break;
-				case ZT_EVENT_BADFCS:
+				case DAHDI_EVENT_BADFCS:
 					printf("Bad FCS!\n");
 					break;
-				case ZT_EVENT_ABORT:
+				case DAHDI_EVENT_ABORT:
 					printf("HDLC Abort!\n");
 					break;
 				default:
@@ -197,17 +197,17 @@
 int zap_open(int devnum)
 {
 	int fd;
-	ZT_BUFFERINFO bi;
-	fd = open("/dev/zap/channel", O_RDWR|O_NONBLOCK, 0600);
-	if ((fd < 0) || (ioctl(fd, ZT_SPECIFY, &devnum) == -1)) {
+	DAHDI_BUFFERINFO bi;
+	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));
 		return -1;
 	}
-	bi.txbufpolicy = ZT_POLICY_IMMEDIATE;
-	bi.rxbufpolicy = ZT_POLICY_IMMEDIATE;
+	bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
+	bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
 	bi.numbufs = NUM_BUFS;
 	bi.bufsize = 512;
-	if (ioctl(fd, ZT_SET_BUFINFO, &bi)) {
+	if (ioctl(fd, DAHDI_SET_BUFINFO, &bi)) {
 		close(fd);
 		return -1;
 	}

Modified: trunk/ss7test.c
URL: http://svn.digium.com/view/libss7/trunk/ss7test.c?view=diff&rev=184&r1=183&r2=184
==============================================================================
--- trunk/ss7test.c (original)
+++ trunk/ss7test.c Sat Jun 28 20:56:06 2008
@@ -9,7 +9,7 @@
 #include <errno.h>
 #include <time.h>
 #ifdef LINUX
-#include <zaptel/zaptel.h>
+#include <dahdi/user.h>
 #endif
 #include "libss7.h"
 
@@ -73,7 +73,7 @@
 #if LINUX
 		if (FD_ISSET(linkset->fd, &efds)) {
 			int x;
-			if (ioctl(linkset->fd, ZT_GETEVENT, &x)) {
+			if (ioctl(linkset->fd, DAHDI_GETEVENT, &x)) {
 				perror("Error in exception retrieval!\n");
 				exit(-1);
 			}
@@ -132,17 +132,17 @@
 int zap_open(int devnum)
 {
 	int fd;
-	ZT_BUFFERINFO bi;
-	fd = open("/dev/zap/channel", O_RDWR|O_NONBLOCK, 0600);
-	if ((fd < 0) || (ioctl(fd, ZT_SPECIFY, &devnum) == -1)) {
+	DAHDI_BUFFERINFO bi;
+	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", strerror(errno));
 		return -1;
 	}
-	bi.txbufpolicy = ZT_POLICY_IMMEDIATE;
-	bi.rxbufpolicy = ZT_POLICY_IMMEDIATE;
+	bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
+	bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
 	bi.numbufs = NUM_BUFS;
 	bi.bufsize = 512;
-	if (ioctl(fd, ZT_SET_BUFINFO, &bi)) {
+	if (ioctl(fd, DAHDI_SET_BUFINFO, &bi)) {
 		close(fd);
 		return -1;
 	}




More information about the libss7-commits mailing list