Update of /usr/cvsroot/libpri
In directory mongoose.digium.com:/tmp/cvs-serv28951

Modified Files:
        Makefile pridump.c 
Log Message:
Fix pridump so that  it works again (bug 4803) Thanks PCadach


Index: Makefile
===================================================================
RCS file: /usr/cvsroot/libpri/Makefile,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- Makefile    21 Jun 2005 22:47:39 -0000      1.17
+++ Makefile    27 Jul 2005 13:14:05 -0000      1.18
@@ -104,7 +104,7 @@
        $(CC) -o testprilib testprilib.o -L. -lpri -lpthread $(CFLAGS)
 
 pridump: pridump.o
-       $(CC) -o pridump pridump.o -L. -lpri -lzap $(CFLAGS)
+       $(CC) -o pridump pridump.o -L. -lpri $(CFLAGS)
 
 ifneq ($(wildcard .depend),)
 include .depend

Index: pridump.c
===================================================================
RCS file: /usr/cvsroot/libpri/pridump.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- pridump.c   21 Jun 2005 22:47:39 -0000      1.4
+++ pridump.c   27 Jul 2005 13:14:05 -0000      1.5
@@ -67,12 +67,12 @@
        return dfd;
 }
 
-static void dump_packet(char *buf, int len, int txrx)
+static void dump_packet(struct pri *pri, char *buf, int len, int txrx)
 {
        q921_h *h = (q921_h *)buf;
-       q921_dump(h, len, 1, txrx);
+       q921_dump(pri, h, len, 1, txrx);
        if (!((h->h.data[0] & Q921_FRAMETYPE_MASK) & 0x3)) {
-               q931_dump((q931_h *)(h->i.data), len - 4 - 2 /* FCS */, txrx);
+               q931_dump(pri, (q931_h *)(h->i.data), len - 4 - 2 /* FCS */, 
txrx);
        }
        fflush(stdout);
        fflush(stderr);
@@ -103,18 +103,28 @@
                if (FD_ISSET(d1, &fds)) {
                        /* Copy from d1 to d2 */
                        res = read(d1, buf, sizeof(buf));
-                       dump_packet(buf, res, 1);
+                       dump_packet((struct pri *)NULL, buf, res, 1);
                        res = write(d2, buf, res);
                }
                if (FD_ISSET(d2, &fds)) {
                        /* Copy from d2 to d1 */
                        res = read(d2, buf, sizeof(buf));
-                       dump_packet(buf, res, 0);
+                       dump_packet((struct pri *)NULL, buf, res, 0);
                        res = write(d1, buf, res);
                }
        }
 }
 
+static void my_pri_message(struct pri *pri, char *stuff)
+{
+       fprintf(stdout, "%s", stuff);
+}
+
+static void my_pri_error(struct pri *pri, char *stuff)
+{
+       fprintf(stderr, "%s", stuff);
+}
+
 int main(int argc, char *argv[])
 {
        int d1, d2;
@@ -124,6 +134,9 @@
                exit(1);
        }
        
+       pri_set_message(my_pri_message);
+       pri_set_error(my_pri_error);
+       
        d1 = pri_open(argv[1]);
        if (d1 < 0)
                exit(1);

_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs

Reply via email to