Make pridump and testprilib compile again.

git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2292 2fbb986a-6c06-0410-b554-c9c1f0a7f128
remotes/origin/1.4
Richard Mudgett 12 years ago
parent 053a38202e
commit 4af121db62

@ -42,7 +42,7 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/select.h> #include <sys/select.h>
#include <sys/types.h> #include <sys/types.h>
#include <zaptel/zaptel.h> #include <dahdi/user.h>
#include "libpri.h" #include "libpri.h"
#include "pri_q921.h" #include "pri_q921.h"
#include "pri_q931.h" #include "pri_q931.h"
@ -50,18 +50,18 @@
static int pri_open(char *dev) static int pri_open(char *dev)
{ {
int dfd; int dfd;
struct zt_params p; struct dahdi_params p;
dfd = open(dev, O_RDWR); dfd = open(dev, O_RDWR);
if (dfd < 0) { if (dfd < 0) {
fprintf(stderr, "Failed to open dchannel '%s': %s\n", dev, strerror(errno)); fprintf(stderr, "Failed to open dchannel '%s': %s\n", dev, strerror(errno));
return -1; 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)); fprintf(stderr, "Unable to get parameters on '%s': %s\n", dev, strerror(errno));
return -1; 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); fprintf(stderr, "%s is in %d signalling, not FCS HDLC or RAW HDLC mode\n", dev, p.sigtype);
return -1; return -1;
} }
@ -94,8 +94,8 @@ static int pri_bridge(int d1, int d2)
max = d1; max = d1;
if (max < d2) if (max < d2)
max = d2; max = d2;
ioctl(d1, ZT_GETEVENT, &e); ioctl(d1, DAHDI_GETEVENT, &e);
ioctl(d2, ZT_GETEVENT, &e); ioctl(d2, DAHDI_GETEVENT, &e);
res = select(max + 1, &fds, NULL, NULL, NULL); res = select(max + 1, &fds, NULL, NULL, NULL);
if (res < 0) { if (res < 0) {
fprintf(stderr, "Select returned %d: %s\n", res, strerror(errno)); fprintf(stderr, "Select returned %d: %s\n", res, strerror(errno));

@ -48,13 +48,10 @@
#include <sys/time.h> #include <sys/time.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <zaptel/zaptel.h>
#ifndef SOLARIS
#include <zap.h>
#endif
#include <pthread.h> #include <pthread.h>
#include <sys/select.h> #include <sys/select.h>
#include "libpri.h" #include "libpri.h"
#include "pri_q921.h"
#include "pri_q931.h" #include "pri_q931.h"
#ifndef AF_LOCAL #ifndef AF_LOCAL
@ -66,7 +63,7 @@
#define PRI_DEF_NODETYPE PRI_CPE #define PRI_DEF_NODETYPE PRI_CPE
#define PRI_DEF_SWITCHTYPE PRI_SWITCH_NI2 #define PRI_DEF_SWITCHTYPE PRI_SWITCH_NI2
static struct pri *first, *cur; static struct pri *first;
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
@ -159,9 +156,9 @@ static void testmsg(struct pri *pri, char *s)
*c = '\0'; *c = '\0';
c++; c++;
} }
if (keeplast) if (keeplast || !pri)
printf("%s", s); printf("%s", s);
else if (cur == first) else if (pri == first)
printf("-1 %s", s); printf("-1 %s", s);
else else
printf("-2 %s", s); printf("-2 %s", s);
@ -185,9 +182,9 @@ static void testerr(struct pri *pri, char *s)
*c = '\0'; *c = '\0';
c++; c++;
} }
if (keeplast) if (keeplast || !pri)
printf("%s", s); printf("%s", s);
else if (cur == first) else if (pri == first)
printf("=1 %s", s); printf("=1 %s", s);
else else
printf("=2 %s", s); printf("=2 %s", s);
@ -207,7 +204,7 @@ static void *dchan(void *data)
/* Joint D-channel */ /* Joint D-channel */
struct pri *pri = data; struct pri *pri = data;
struct timeval *next, tv; struct timeval *next, tv;
pri_event *e; pri_event *e = NULL;
fd_set fds; fd_set fds;
int res; int res;
for(;;) { for(;;) {
@ -228,7 +225,6 @@ static void *dchan(void *data)
FD_SET(pri_fd(pri), &fds); FD_SET(pri_fd(pri), &fds);
res = select(pri_fd(pri) + 1, &fds, NULL, NULL, next ? &tv : NULL); res = select(pri_fd(pri) + 1, &fds, NULL, NULL, next ? &tv : NULL);
pthread_mutex_lock(&lock); pthread_mutex_lock(&lock);
cur = pri;
if (res < 0) { if (res < 0) {
perror("select"); perror("select");
} else if (!res) { } else if (!res) {
@ -238,9 +234,9 @@ static void *dchan(void *data)
} }
if (e) { if (e) {
if (first == pri) { if (first == pri) {
event1(e->gen.pri, e); event1(pri, e);
} else { } else {
event2(e->gen.pri, e); event2(pri, e);
} }
} }
pthread_mutex_unlock(&lock); pthread_mutex_unlock(&lock);

Loading…
Cancel
Save