[Asterisk-cvs] libpri libpri.h,1.32,1.32.2.1 pri.c,1.24,1.24.2.1

citats at lists.digium.com citats at lists.digium.com
Wed Oct 27 10:41:47 CDT 2004


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

Modified Files:
      Tag: v1-0
	libpri.h pri.c 
Log Message:
Backport libpri part of bug 2703 to 1.0

Index: libpri.h
===================================================================
RCS file: /usr/cvsroot/libpri/libpri.h,v
retrieving revision 1.32
retrieving revision 1.32.2.1
diff -u -d -r1.32 -r1.32.2.1
--- libpri.h	17 Sep 2004 04:02:16 -0000	1.32
+++ libpri.h	27 Oct 2004 14:45:07 -0000	1.32.2.1
@@ -459,8 +459,8 @@
 #define PRI_SET_OVERLAPDIAL
 extern void pri_set_overlapdial(struct pri *pri,int state);
 
-#define PRI_DUMP_INFO
-extern void pri_dump_info(struct pri *pri);
+#define PRI_DUMP_INFO_STR
+extern char *pri_dump_info_str(struct pri *pri);
 
 /* Get file descriptor */
 extern int pri_fd(struct pri *pri);

Index: pri.c
===================================================================
RCS file: /usr/cvsroot/libpri/pri.c,v
retrieving revision 1.24
retrieving revision 1.24.2.1
diff -u -d -r1.24 -r1.24.2.1
--- pri.c	29 Jun 2004 17:57:18 -0000	1.24
+++ pri.c	27 Oct 2004 14:45:07 -0000	1.24.2.1
@@ -432,6 +432,7 @@
 	else
 		fprintf(stderr, tmp);
 }
+
 /* Set overlap mode */
 void pri_set_overlapdial(struct pri *pri,int state)
 {
@@ -443,37 +444,41 @@
 	return pri->fd;
 }
 
-void pri_dump_info(struct pri *pri)
+char *pri_dump_info_str(struct pri *pri)
 {
+	char buf[4096];
+	int len = 0;
 #ifdef LIBPRI_COUNTERS
 	struct q921_frame *f;
 	int q921outstanding = 0;
 #endif
 	if (!pri)
-		return;
+		return NULL;
 
 	/* Might be nice to format these a little better */
-	pri_message("Switchtype: %s\n", pri_switch2str(pri->switchtype));
-	pri_message("Type: %s\n", pri_node2str(pri->localtype));
+	len += sprintf(buf + len, "Switchtype: %s\n", pri_switch2str(pri->switchtype));
+	len += sprintf(buf + len, "Type: %s\n", pri_node2str(pri->localtype));
 #ifdef LIBPRI_COUNTERS
 	/* Remember that Q921 Counters include Q931 packets (and any retransmissions) */
-	pri_message("Q931 RX: %d\n", pri->q931_rxcount);
-	pri_message("Q931 TX: %d\n", pri->q931_txcount);
-	pri_message("Q921 RX: %d\n", pri->q921_rxcount);
-	pri_message("Q921 TX: %d\n", pri->q921_txcount);
+	len += sprintf(buf + len, "Q931 RX: %d\n", pri->q931_rxcount);
+	len += sprintf(buf + len, "Q931 TX: %d\n", pri->q931_txcount);
+	len += sprintf(buf + len, "Q921 RX: %d\n", pri->q921_rxcount);
+	len += sprintf(buf + len, "Q921 TX: %d\n", pri->q921_txcount);
 	f = pri->txqueue;
 	while (f) {
 		q921outstanding++;
 		f = f->next;
 	}
-	pri_message("Q921 Outstanding: %d\n", q921outstanding);
+	len += sprintf(buf + len, "Q921 Outstanding: %d\n", q921outstanding);
 #endif
-	pri_message("Window Length: %d/%d\n", pri->windowlen, pri->window);
-	pri_message("Sentrej: %d\n", pri->sentrej);
-	pri_message("SolicitFbit: %d\n", pri->solicitfbit);
-	pri_message("Retrans: %d\n", pri->retrans);
-	pri_message("Busy: %d\n", pri->busy);
-	pri_message("Overlap Dial: %d\n", pri->overlapdial);
+	len += sprintf(buf + len, "Window Length: %d/%d\n", pri->windowlen, pri->window);
+	len += sprintf(buf + len, "Sentrej: %d\n", pri->sentrej);
+	len += sprintf(buf + len, "SolicitFbit: %d\n", pri->solicitfbit);
+	len += sprintf(buf + len, "Retrans: %d\n", pri->retrans);
+	len += sprintf(buf + len, "Busy: %d\n", pri->busy);
+	len += sprintf(buf + len, "Overlap Dial: %d\n", pri->overlapdial);
+
+	return strdup(buf);
 }
 
 int pri_get_crv(struct pri *pri, q931_call *call, int *callmode)




More information about the svn-commits mailing list