[Asterisk-cvs] libpri Makefile,1.6,1.7 libpri.h,1.18,1.19 pri.c,1.10,1.11 pri_internal.h,1.5,1.6 q921.c,1.6,1.7 q931.c,1.46,1.47
citats at lists.digium.com
citats at lists.digium.com
Mon Mar 15 00:59:21 CST 2004
Update of /usr/cvsroot/libpri
In directory mongoose.digium.com:/tmp/cvs-serv9829
Modified Files:
Makefile libpri.h pri.c pri_internal.h q921.c q931.c
Log Message:
Add pri_dump_info and q921/q931 counters to libpri
Index: Makefile
===================================================================
RCS file: /usr/cvsroot/libpri/Makefile,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Makefile 2 Feb 2004 05:55:03 -0000 1.6
+++ Makefile 15 Mar 2004 05:53:25 -0000 1.7
@@ -24,12 +24,15 @@
# Uncomment if you want libpri not send PROGRESS_INDICATOR w/ALERTING
#ALERTING=-DALERTING_NO_PROGRESS
+# Uncomment if you want libpri to count number of Q921/Q931 sent/received
+#LIBPRI_COUNTERS=-DLIBPRI_COUNTERS
+
TOBJS=testpri.o
STATIC_LIBRARY=libpri.a
DYNAMIC_LIBRARY=libpri.so.1.0
STATIC_OBJS=pri.o q921.o prisched.o q931.o
DYNAMIC_OBJS=pri.lo q921.lo prisched.lo q931.lo
-CFLAGS=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g $(ALERTING)
+CFLAGS=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g $(ALERTING) $(LIBPRI_COUNTERS)
INSTALL_PREFIX=
all: $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
Index: libpri.h
===================================================================
RCS file: /usr/cvsroot/libpri/libpri.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- libpri.h 12 Aug 2003 20:16:55 -0000 1.18
+++ libpri.h 15 Mar 2004 05:53:25 -0000 1.19
@@ -386,4 +386,8 @@
/* Set overlap mode */
#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);
+
#endif
Index: pri.c
===================================================================
RCS file: /usr/cvsroot/libpri/pri.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- pri.c 25 Sep 2003 06:13:14 -0000 1.10
+++ pri.c 15 Mar 2004 05:53:25 -0000 1.11
@@ -66,6 +66,12 @@
p->localtype = node;
p->switchtype = switchtype;
p->cref = 1;
+#ifdef LIBPRI_COUNTERS
+ p->q921_rxcount = 0;
+ p->q921_txcount = 0;
+ p->q931_rxcount = 0;
+ p->q931_txcount = 0;
+#endif
/* Start Q.921 layer */
q921_start(p, 1);
}
@@ -330,5 +336,37 @@
void pri_set_overlapdial(struct pri *pri,int state)
{
pri->overlapdial = state;
+}
+
+void pri_dump_info(struct pri *pri)
+{
+#ifdef LIBPRI_COUNTERS
+ struct q921_frame *f;
+ int q921outstanding = 0;
+#endif
+ if (!pri)
+ return;
+
+ /* 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));
+#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);
+ f = pri->txqueue;
+ while (f) {
+ q921outstanding++;
+ f = f->next;
+ }
+ pri_message("Q921 Outstanding: %d\n", q921outstanding);
+#endif
+ 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);
}
Index: pri_internal.h
===================================================================
RCS file: /usr/cvsroot/libpri/pri_internal.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- pri_internal.h 25 Sep 2003 06:13:14 -0000 1.5
+++ pri_internal.h 15 Mar 2004 05:53:25 -0000 1.6
@@ -82,6 +82,14 @@
/* do we do overlap dialing */
int overlapdial;
+
+#ifdef LIBPRI_COUNTERS
+ /* q921/q931 packet counters */
+ unsigned int q921_txcount;
+ unsigned int q921_rxcount;
+ unsigned int q931_txcount;
+ unsigned int q931_rxcount;
+#endif
};
extern int pri_schedule_event(struct pri *pri, int ms, void (*function)(void *data), void *data);
Index: q921.c
===================================================================
RCS file: /usr/cvsroot/libpri/q921.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- q921.c 25 Sep 2003 06:13:14 -0000 1.6
+++ q921.c 15 Mar 2004 05:53:25 -0000 1.7
@@ -73,7 +73,9 @@
return 0;
}
#endif
-
+#ifdef LIBPRI_COUNTERS
+ pri->q921_txcount++;
+#endif
/* Just send it raw */
if (pri->debug & PRI_DEBUG_Q921_DUMP)
q921_dump(h, len, pri->debug & PRI_DEBUG_Q921_RAW, 1);
@@ -858,6 +860,9 @@
pri_event *e;
e = __q921_receive(pri, h, len);
reschedule_t203(pri);
+#ifdef LIBPRI_COUNTERS
+ pri->q921_rxcount++;
+#endif
return e;
}
Index: q931.c
===================================================================
RCS file: /usr/cvsroot/libpri/q931.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- q931.c 25 Feb 2004 20:02:04 -0000 1.46
+++ q931.c 15 Mar 2004 05:53:25 -0000 1.47
@@ -1476,6 +1476,9 @@
right order in the log */
if (pri->debug & PRI_DEBUG_Q931_DUMP)
q931_dump(h, len, 1);
+#ifdef LIBPRI_COUNTERS
+ pri->q931_txcount++;
+#endif
return 0;
}
@@ -1935,6 +1938,9 @@
int missingmand;
if (pri->debug & PRI_DEBUG_Q931_DUMP)
q931_dump(h, len, 0);
+#ifdef LIBPRI_COUNTERS
+ pri->q931_rxcount++;
+#endif
mh = (q931_mh *)(h->contents + h->crlen);
if (h->pd == 0x3) {
/* This is the weird maintenance stuff. We majorly
More information about the svn-commits
mailing list