[Asterisk-cvs] libpri libpri.h,1.33,1.34 pri.c,1.25,1.26
citats at lists.digium.com
citats at lists.digium.com
Tue Oct 26 00:24:00 CDT 2004
Update of /usr/cvsroot/libpri
In directory mongoose.digium.com:/tmp/cvs-serv30944
Modified Files:
libpri.h pri.c
Log Message:
Change pri_dump_info to generate string instead of using pri_message (bug 2703)
Index: libpri.h
===================================================================
RCS file: /usr/cvsroot/libpri/libpri.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- libpri.h 2 Oct 2004 14:55:20 -0000 1.33
+++ libpri.h 26 Oct 2004 04:27:29 -0000 1.34
@@ -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.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- pri.c 2 Oct 2004 14:55:20 -0000 1.25
+++ pri.c 26 Oct 2004 04:27:29 -0000 1.26
@@ -520,6 +520,7 @@
else
fprintf(stderr, tmp);
}
+
/* Set overlap mode */
void pri_set_overlapdial(struct pri *pri,int state)
{
@@ -531,43 +532,47 @@
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);
- pri_message("T200 Timer: %d\n", pri->timers[PRI_TIMER_T200]);
- pri_message("T203 Timer: %d\n", pri->timers[PRI_TIMER_T203]);
- pri_message("T305 Timer: %d\n", pri->timers[PRI_TIMER_T305]);
- pri_message("T308 Timer: %d\n", pri->timers[PRI_TIMER_T308]);
- pri_message("T313 Timer: %d\n", pri->timers[PRI_TIMER_T313]);
- pri_message("N200 Counter: %d\n", pri->timers[PRI_TIMER_N200]);
+ 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);
+ len += sprintf(buf + len, "T200 Timer: %d\n", pri->timers[PRI_TIMER_T200]);
+ len += sprintf(buf + len, "T203 Timer: %d\n", pri->timers[PRI_TIMER_T203]);
+ len += sprintf(buf + len, "T305 Timer: %d\n", pri->timers[PRI_TIMER_T305]);
+ len += sprintf(buf + len, "T308 Timer: %d\n", pri->timers[PRI_TIMER_T308]);
+ len += sprintf(buf + len, "T313 Timer: %d\n", pri->timers[PRI_TIMER_T313]);
+ len += sprintf(buf + len, "N200 Counter: %d\n", pri->timers[PRI_TIMER_N200]);
+
+ return strdup(buf);
}
int pri_get_crv(struct pri *pri, q931_call *call, int *callmode)
More information about the svn-commits
mailing list