[svn-commits] rmudgett: branch 1.4 r1965 - /branches/1.4/pri.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Sep 8 16:43:18 CDT 2010


Author: rmudgett
Date: Wed Sep  8 16:43:14 2010
New Revision: 1965

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1965
Log:
Added more parameter checks to pri_set_timer() and pri_get_timer().

Made pri_dump_info_str() output a line for each Q.921 TEI Tx queue when
LIBPRI_COUNTERS is defined.

Modified:
    branches/1.4/pri.c

Modified: branches/1.4/pri.c
URL: http://svnview.digium.com/svn/libpri/branches/1.4/pri.c?view=diff&rev=1965&r1=1964&r2=1965
==============================================================================
--- branches/1.4/pri.c (original)
+++ branches/1.4/pri.c Wed Sep  8 16:43:14 2010
@@ -220,20 +220,23 @@
 	}
 }
 
-int pri_set_timer(struct pri *pri, int timer, int value)
-{
-	if (timer < 0 || timer > PRI_MAX_TIMERS || value < 0)
-		return -1;
-
-	pri->timers[timer] = value;
+int pri_set_timer(struct pri *ctrl, int timer, int value)
+{
+	if (!ctrl || timer < 0 || PRI_MAX_TIMERS <= timer || value < 0) {
+		return -1;
+	}
+	ctrl = PRI_MASTER(ctrl);
+	ctrl->timers[timer] = value;
 	return 0;
 }
 
-int pri_get_timer(struct pri *pri, int timer)
-{
-	if (timer < 0 || timer > PRI_MAX_TIMERS)
-		return -1;
-	return pri->timers[timer];
+int pri_get_timer(struct pri *ctrl, int timer)
+{
+	if (!ctrl || timer < 0 || PRI_MAX_TIMERS <= timer) {
+		return -1;
+	}
+	ctrl = PRI_MASTER(ctrl);
+	return ctrl->timers[timer];
 }
 
 int pri_set_service_message_support(struct pri *pri, int supportflag)
@@ -1419,6 +1422,7 @@
 	size_t used;
 #ifdef LIBPRI_COUNTERS
 	struct q921_frame *f;
+	struct pri *link;
 	unsigned q921outstanding;
 #endif
 	unsigned idx;
@@ -1433,6 +1437,8 @@
 	if (!buf) {
 		return NULL;
 	}
+
+	ctrl = PRI_MASTER(ctrl);
 
 	/* Might be nice to format these a little better */
 	used = 0;
@@ -1445,13 +1451,14 @@
 	used = pri_snprintf(buf, used, buf_size, "Q931 TX: %d\n", ctrl->q931_txcount);
 	used = pri_snprintf(buf, used, buf_size, "Q921 RX: %d\n", ctrl->q921_rxcount);
 	used = pri_snprintf(buf, used, buf_size, "Q921 TX: %d\n", ctrl->q921_txcount);
-	q921outstanding = 0;
-	f = ctrl->txqueue;
-	while (f) {
-		q921outstanding++;
-		f = f->next;
-	}
-	used = pri_snprintf(buf, used, buf_size, "Q921 Outstanding: %u\n", q921outstanding);
+	for (link = ctrl; link; link = link->subchannel) {
+		q921outstanding = 0;
+		for (f = link->txqueue; f; f = f->next) {
+			++q921outstanding;
+		}
+		used = pri_snprintf(buf, used, buf_size, "Q921 Outstanding: %u (TEI=%d)\n",
+			q921outstanding, link->tei);
+	}
 #endif
 #if 0
 	used = pri_snprintf(buf, used, buf_size, "Window Length: %d/%d\n",




More information about the svn-commits mailing list