[libpri-commits] mattf: trunk r532 - in /trunk: pri.c pri_internal.h q921.c q931.c

SVN commits to the libpri project libpri-commits at lists.digium.com
Sat Mar 1 13:46:09 CST 2008


Author: mattf
Date: Sat Mar  1 13:46:08 2008
New Revision: 532

URL: http://svn.digium.com/view/libpri?view=rev&rev=532
Log:
Initial checkin of code to pass Q.921 PC25 and PC26

Modified:
    trunk/pri.c
    trunk/pri_internal.h
    trunk/q921.c
    trunk/q931.c

Modified: trunk/pri.c
URL: http://svn.digium.com/view/libpri/trunk/pri.c?view=diff&rev=532&r1=531&r2=532
==============================================================================
--- trunk/pri.c (original)
+++ trunk/pri.c Sat Mar  1 13:46:08 2008
@@ -187,6 +187,15 @@
 	return res;
 }
 
+/* Pass in the master for this function */
+void __pri_free_tei(struct pri * p, int tei)
+{
+	if (p->subchannel && (tei == p->subchannel->tei)) {
+		free(p->subchannel);
+		p->subchannel = NULL;
+	}
+}
+
 struct pri *__pri_new_tei(int fd, int node, int switchtype, struct pri *master, pri_io_cb rd, pri_io_cb wr, void *userdata, int tei, int bri)
 {
 	struct pri *p;

Modified: trunk/pri_internal.h
URL: http://svn.digium.com/view/libpri/trunk/pri_internal.h?view=diff&rev=532&r1=531&r2=532
==============================================================================
--- trunk/pri_internal.h (original)
+++ trunk/pri_internal.h Sat Mar  1 13:46:08 2008
@@ -272,4 +272,6 @@
 
 struct pri *__pri_new_tei(int fd, int node, int switchtype, struct pri *master, pri_io_cb rd, pri_io_cb wr, void *userdata, int tei, int bri);
 
+void __pri_free_tei(struct pri *p, int tei);
+
 #endif

Modified: trunk/q921.c
URL: http://svn.digium.com/view/libpri/trunk/q921.c?view=diff&rev=532&r1=531&r2=532
==============================================================================
--- trunk/q921.c (original)
+++ trunk/q921.c Sat Mar  1 13:46:08 2008
@@ -70,7 +70,7 @@
 {
 	int res;
 
-	while (pri->master)
+	if (pri->master)
 		pri = pri->master;
 
 #ifdef RANDOM_DROPS
@@ -771,6 +771,7 @@
 	int ri;
 	struct pri *sub;
 	int tei;
+	pri_event *ev;
 	pri_message(pri, "Received MDL message\n");
 	if (h->data[0] != 0x0f) {
 		pri_error(pri, "Received MDL with unsupported management entity %02x\n", h->data[0]);
@@ -834,6 +835,13 @@
 			q921_send_tei(pri, Q921_TEI_IDENTITY_CHECK_RESPONSE, random() % 65535, pri->subchannel->tei, 0);
 
 		break;
+	case Q921_TEI_IDENTITY_REMOVE:
+		/* XXX: Assuming multiframe mode has been disconnected already */
+		if (tei == pri->subchannel->tei) {
+			ev = q921_dchannel_down(pri->subchannel);
+			__pri_free_tei(pri, tei);
+			q921_tei_request(pri);
+		}
 	}
 	return NULL;	/* Do we need to return something??? */
 }

Modified: trunk/q931.c
URL: http://svn.digium.com/view/libpri/trunk/q931.c?view=diff&rev=532&r1=531&r2=532
==============================================================================
--- trunk/q931.c (original)
+++ trunk/q931.c Sat Mar  1 13:46:08 2008
@@ -2326,7 +2326,10 @@
 	struct pri *master;
 
 	/* Find the master  - He has the call pool */
-	for (master = pri; master->master; master = master->master);
+	if (pri->master)
+		master = pri->master;
+	else
+		master = pri;
 	
 	cur = *master->callpool;
 	prev = NULL;




More information about the libpri-commits mailing list