[libpri-commits] rmudgett: branch rmudgett/libpri_30 r1624 - /team/rmudgett/libpri_30/

SVN commits to the libpri project libpri-commits at lists.digium.com
Mon Apr 19 16:11:04 CDT 2010


Author: rmudgett
Date: Mon Apr 19 16:11:02 2010
New Revision: 1624

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1624
Log:
Add TEI to q931_dump() and fix potential crash.

Modified:
    team/rmudgett/libpri_30/pri_internal.h
    team/rmudgett/libpri_30/pri_q931.h
    team/rmudgett/libpri_30/pridump.c
    team/rmudgett/libpri_30/q921.c
    team/rmudgett/libpri_30/q931.c

Modified: team/rmudgett/libpri_30/pri_internal.h
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/libpri_30/pri_internal.h?view=diff&rev=1624&r1=1623&r2=1624
==============================================================================
--- team/rmudgett/libpri_30/pri_internal.h (original)
+++ team/rmudgett/libpri_30/pri_internal.h Mon Apr 19 16:11:02 2010
@@ -593,8 +593,6 @@
 							   -1 - No reverse charging
 							    1 - Reverse charging
 							0,2-7 - Reserved for future use */
-	/*! \brief TEI associated with call */
-	int tei;
 	int t303_timer;
 	int t303_expirycnt;
 

Modified: team/rmudgett/libpri_30/pri_q931.h
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/libpri_30/pri_q931.h?view=diff&rev=1624&r1=1623&r2=1624
==============================================================================
--- team/rmudgett/libpri_30/pri_q931.h (original)
+++ team/rmudgett/libpri_30/pri_q931.h Mon Apr 19 16:11:02 2010
@@ -498,7 +498,7 @@
 
 int q931_register(struct pri *ctrl, q931_call *call);
 
-extern void q931_dump(struct pri *pri, q931_h *h, int len, int txrx);
+void q931_dump(struct pri *ctrl, int tei, q931_h *h, int len, int txrx);
 
 void q931_destroycall(struct pri *pri, q931_call *c);
 

Modified: team/rmudgett/libpri_30/pridump.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/libpri_30/pridump.c?view=diff&rev=1624&r1=1623&r2=1624
==============================================================================
--- team/rmudgett/libpri_30/pridump.c (original)
+++ team/rmudgett/libpri_30/pridump.c Mon Apr 19 16:11:02 2010
@@ -73,7 +73,7 @@
 	q921_h *h = (q921_h *)buf;
 	q921_dump(pri, h, len, 1, txrx);
 	if (!((h->h.data[0] & Q921_FRAMETYPE_MASK) & 0x3)) {
-		q931_dump(pri, (q931_h *)(h->i.data), len - 4 - 2 /* FCS */, txrx);
+		q931_dump(pri, h->h.tei, (q931_h *)(h->i.data), len - 4 - 2 /* FCS */, txrx);
 	}
 	fflush(stdout);
 	fflush(stderr);

Modified: team/rmudgett/libpri_30/q921.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/libpri_30/q921.c?view=diff&rev=1624&r1=1623&r2=1624
==============================================================================
--- team/rmudgett/libpri_30/q921.c (original)
+++ team/rmudgett/libpri_30/q921.c Mon Apr 19 16:11:02 2010
@@ -857,6 +857,9 @@
 {
 	struct pri *pri = NULL;
 
+	if (!vpri) {
+		return;
+	}
 	if (BRI_NT_PTMP(vpri)) {
 		pri = pri_find_tei(vpri, h->h.sapi, h->h.tei);
 	} else if (BRI_TE_PTMP(vpri)) {

Modified: team/rmudgett/libpri_30/q931.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/libpri_30/q931.c?view=diff&rev=1624&r1=1623&r2=1624
==============================================================================
--- team/rmudgett/libpri_30/q931.c (original)
+++ team/rmudgett/libpri_30/q931.c Mon Apr 19 16:11:02 2010
@@ -4048,7 +4048,7 @@
 	return code2str(disc, discs, sizeof(discs) / sizeof(discs[0]));
 }
 
-void q931_dump(struct pri *ctrl, q931_h *h, int len, int txrx)
+void q931_dump(struct pri *ctrl, int tei, q931_h *h, int len, int txrx)
 {
 	q931_mh *mh;
 	char c;
@@ -4060,9 +4060,9 @@
 	c = txrx ? '>' : '<';
 	pri_message(ctrl, "%c Protocol Discriminator: %s (%d)  len=%d\n", c, disc2str(h->pd), h->pd, len);
 	cref = q931_cr(h);
-	pri_message(ctrl, "%c Call Ref: len=%2d (reference %d/0x%X) (%s)\n",
-		c, h->crlen, cref & ~Q931_CALL_REFERENCE_FLAG, cref & ~Q931_CALL_REFERENCE_FLAG,
-		(cref == Q931_DUMMY_CALL_REFERENCE)
+	pri_message(ctrl, "%c TEI=%d Call Ref: len=%2d (reference %d/0x%X) (%s)\n",
+		c, tei, h->crlen, cref & ~Q931_CALL_REFERENCE_FLAG,
+		cref & ~Q931_CALL_REFERENCE_FLAG, (cref == Q931_DUMMY_CALL_REFERENCE)
 			? "Dummy"
 			: (cref & Q931_CALL_REFERENCE_FLAG)
 				? "Sent to originator" : "Sent from originator");
@@ -4200,7 +4200,7 @@
 	   message body after the transmit puts the sections of the message in the
 	   right order in the log */
 	if (ctrl->debug & PRI_DEBUG_Q931_DUMP)
-		q931_dump(ctrl, h, len, 1);
+		q931_dump(ctrl, tei, h, len, 1);
 #ifdef LIBPRI_COUNTERS
 	ctrl->q931_txcount++;
 #endif
@@ -6186,7 +6186,7 @@
 
 	memset(last_ie, 0, sizeof(last_ie));
 	if (ctrl->debug & PRI_DEBUG_Q931_DUMP)
-		q931_dump(ctrl, h, len, 0);
+		q931_dump(ctrl, tei, h, len, 0);
 #ifdef LIBPRI_COUNTERS
 	ctrl->q931_rxcount++;
 #endif




More information about the libpri-commits mailing list