diff --git a/pridump.c b/pridump.c index 45978d1..e199570 100644 --- a/pridump.c +++ b/pridump.c @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include "libpri.h" #include "pri_q921.h" #include "pri_q931.h" @@ -50,18 +50,18 @@ static int pri_open(char *dev) { int dfd; - struct zt_params p; + struct dahdi_params p; dfd = open(dev, O_RDWR); if (dfd < 0) { fprintf(stderr, "Failed to open dchannel '%s': %s\n", dev, strerror(errno)); return -1; } - if (ioctl(dfd, ZT_GET_PARAMS, &p)) { + if (ioctl(dfd, DAHDI_GET_PARAMS, &p)) { fprintf(stderr, "Unable to get parameters on '%s': %s\n", dev, strerror(errno)); return -1; } - if ((p.sigtype != ZT_SIG_HDLCRAW) && (p.sigtype != ZT_SIG_HDLCFCS)) { + if ((p.sigtype != DAHDI_SIG_HDLCRAW) && (p.sigtype != DAHDI_SIG_HDLCFCS)) { fprintf(stderr, "%s is in %d signalling, not FCS HDLC or RAW HDLC mode\n", dev, p.sigtype); return -1; } @@ -94,8 +94,8 @@ static int pri_bridge(int d1, int d2) max = d1; if (max < d2) max = d2; - ioctl(d1, ZT_GETEVENT, &e); - ioctl(d2, ZT_GETEVENT, &e); + ioctl(d1, DAHDI_GETEVENT, &e); + ioctl(d2, DAHDI_GETEVENT, &e); res = select(max + 1, &fds, NULL, NULL, NULL); if (res < 0) { fprintf(stderr, "Select returned %d: %s\n", res, strerror(errno)); diff --git a/testprilib.c b/testprilib.c index 264c9a3..3173a02 100644 --- a/testprilib.c +++ b/testprilib.c @@ -48,13 +48,10 @@ #include #include #include -#include -#ifndef SOLARIS -#include -#endif #include #include #include "libpri.h" +#include "pri_q921.h" #include "pri_q931.h" #ifndef AF_LOCAL @@ -66,7 +63,7 @@ #define PRI_DEF_NODETYPE PRI_CPE #define PRI_DEF_SWITCHTYPE PRI_SWITCH_NI2 -static struct pri *first, *cur; +static struct pri *first; static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; @@ -159,9 +156,9 @@ static void testmsg(struct pri *pri, char *s) *c = '\0'; c++; } - if (keeplast) + if (keeplast || !pri) printf("%s", s); - else if (cur == first) + else if (pri == first) printf("-1 %s", s); else printf("-2 %s", s); @@ -185,9 +182,9 @@ static void testerr(struct pri *pri, char *s) *c = '\0'; c++; } - if (keeplast) + if (keeplast || !pri) printf("%s", s); - else if (cur == first) + else if (pri == first) printf("=1 %s", s); else printf("=2 %s", s); @@ -207,7 +204,7 @@ static void *dchan(void *data) /* Joint D-channel */ struct pri *pri = data; struct timeval *next, tv; - pri_event *e; + pri_event *e = NULL; fd_set fds; int res; for(;;) { @@ -228,7 +225,6 @@ static void *dchan(void *data) FD_SET(pri_fd(pri), &fds); res = select(pri_fd(pri) + 1, &fds, NULL, NULL, next ? &tv : NULL); pthread_mutex_lock(&lock); - cur = pri; if (res < 0) { perror("select"); } else if (!res) { @@ -238,9 +234,9 @@ static void *dchan(void *data) } if (e) { if (first == pri) { - event1(e->gen.pri, e); + event1(pri, e); } else { - event2(e->gen.pri, e); + event2(pri, e); } } pthread_mutex_unlock(&lock);