[libss7-commits] mattf: trunk r265 - in /trunk: mtp3.c mtp3.h ss7.c

SVN commits to the libss7 project libss7-commits at lists.digium.com
Wed Apr 29 11:19:43 CDT 2009


Author: mattf
Date: Wed Apr 29 11:19:38 2009
New Revision: 265

URL: http://svn.digium.com/svn-view/libss7?view=rev&rev=265
Log:
Merge in MTP3 T21 support patch (#13495)

Modified:
    trunk/mtp3.c
    trunk/mtp3.h
    trunk/ss7.c

Modified: trunk/mtp3.c
URL: http://svn.digium.com/svn-view/libss7/trunk/mtp3.c?view=diff&rev=265&r1=264&r2=265
==============================================================================
--- trunk/mtp3.c (original)
+++ trunk/mtp3.c Wed Apr 29 11:19:38 2009
@@ -667,10 +667,17 @@
 	if (!count && adj_sp->state != MTP3_DOWN) {
 		adj_sp->state = MTP3_DOWN;
 		adj_sp->tra = 0;
+
 		if (adj_sp->timer_t19 > -1) {
 			ss7_schedule_del(ss7, &adj_sp->timer_t19);
 			ss7_message(ss7, "MTP3 T19 timer stopped PC: %i\n", adj_sp->adjpc);
 		}
+
+		if (adj_sp->timer_t21 > -1) {
+			ss7_schedule_del(ss7, &adj_sp->timer_t21);
+			ss7_message(ss7, "MTP3 T21 timer stopped PC: %i\n", adj_sp->adjpc);
+		}
+
 		for (i = 0; i < adj_sp->numlinks; i++) {
 			adj_sp->links[i]->got_sent_netmsg = 0;
 			mtp3_stop_all_timers_except_cocb(adj_sp->links[i]);
@@ -745,6 +752,9 @@
 	
 	if (adj_sp->timer_t19 > -1)
 		ss7_schedule_del(ss7, &adj_sp->timer_t19);
+
+	if (adj_sp->timer_t21 > -1)
+		ss7_schedule_del(ss7, &adj_sp->timer_t21);
 	
 	//AUTORL(rl, link);
 	//net_mng_send(link, NET_MNG_TRA, rl, 0);
@@ -866,6 +876,15 @@
 	ss7_message(adj_sp->master, "MTP3 T19 timer expired PC:%i\n", adj_sp->adjpc);
 }
 
+static void mtp3_t21_expiry(void * data)
+{
+	struct adjacent_sp *adj_sp = data;
+	adj_sp->timer_t21 = -1;
+	adj_sp->tra |= GOT;
+	ss7_message(adj_sp->master, "MTP3 T21 timer expired and accepting traffic from PC:%i\n", adj_sp->adjpc);
+	mtp3_check(adj_sp);
+}
+
 static void mtp3_t22_expired(void *data)
 {
 	struct mtp2 *link = data;
@@ -1086,6 +1105,12 @@
 					mtp2->adj_sp->timer_t19 = ss7_schedule_event(ss7, ss7->mtp3_timers[MTP3_TIMER_T19], mtp3_t19_expiry, mtp2->adj_sp);
 					ss7_message(ss7, "MTP3 T19 timer started PC: %i\n", mtp2->adj_sp->adjpc);
 			}
+
+			if (mtp2->adj_sp->timer_t21 > -1) {
+				ss7_schedule_del(ss7, &mtp2->adj_sp->timer_t21);
+				ss7_message(ss7, "MTP3 T21 timer stopped PC: %i\n", mtp2->adj_sp->adjpc);
+			}
+
 			mtp2->adj_sp->tra |= GOT;
 			mtp3_check(mtp2->adj_sp);
 			return 0;
@@ -1437,6 +1462,12 @@
 			}
 			break;
 		case NET_MNG_TRA:
+			/* we are not an stp, so we can start the T21 now */
+			if (ss7->mtp3_timers[MTP3_TIMER_T21] > 0 && link->adj_sp->timer_t21 == -1) {
+				link->adj_sp->timer_t21 = ss7_schedule_event(ss7, ss7->mtp3_timers[MTP3_TIMER_T21],
+					&mtp3_t21_expiry, link->adj_sp);
+			}
+
 			link->adj_sp->tra |= SENT;
 			ss7_msg_userpart_len(m, rllen + 1); /* no more params */
 			break;
@@ -2037,6 +2068,8 @@
 		ss7->mtp3_timers[MTP3_TIMER_T14] = ms;
 	else if (!strcasecmp(name, "t19"))
 		ss7->mtp3_timers[MTP3_TIMER_T19] = ms;
+	else if (!strcasecmp(name, "t21"))
+		ss7->mtp3_timers[MTP3_TIMER_T21] = ms;
 	else if (!strcasecmp(name, "t22"))
 		ss7->mtp3_timers[MTP3_TIMER_T22] = ms;
 	else if (!strcasecmp(name, "t23"))
@@ -2078,6 +2111,8 @@
 			return "T14";
 		case MTP3_TIMER_T19:
 			return "T19";
+		case MTP3_TIMER_T21:
+			return "T21";
 		case MTP3_TIMER_T22:
 			return "T22";
 		case MTP3_TIMER_T23:
@@ -2125,6 +2160,7 @@
 	ss7->adj_sps[ss7->numsps] = new;
 	
 	new->timer_t19 = -1;
+	new->timer_t21 = -1;
 	new->master = ss7;
 	new->links[0] = link;
 	new->numlinks = 1;

Modified: trunk/mtp3.h
URL: http://svn.digium.com/svn-view/libss7/trunk/mtp3.h?view=diff&rev=265&r1=264&r2=265
==============================================================================
--- trunk/mtp3.h (original)
+++ trunk/mtp3.h Wed Apr 29 11:19:38 2009
@@ -124,6 +124,7 @@
 #define MTP3_TIMER_T13 10
 #define MTP3_TIMER_T14 11
 #define MTP3_TIMER_T19 12
+#define MTP3_TIMER_T21 13
 
 #define MTP3_TIMER_T22 14
 #define MTP3_TIMER_T23 15
@@ -177,6 +178,7 @@
 	struct mtp2 *links[SS7_MAX_LINKS];
 	unsigned int numlinks;
 	int timer_t19;
+	int timer_t21;
 	unsigned int tra;
 	struct ss7 *master;
 	struct mtp3_route *routes;

Modified: trunk/ss7.c
URL: http://svn.digium.com/svn-view/libss7/trunk/ss7.c?view=diff&rev=265&r1=264&r2=265
==============================================================================
--- trunk/ss7.c (original)
+++ trunk/ss7.c Wed Apr 29 11:19:38 2009
@@ -667,8 +667,8 @@
 		adj_sp = ss7->adj_sps[j];
 		ss7_pc_to_str(ss7->switchtype, adj_sp->adjpc, pc_str);
 		cust_printf(fd, "  ---------------------------------\n  Adjacent SP PC: %s STATE: %s\n", pc_str, mtp3_state(adj_sp->state));
-		cust_printf(fd, "  TRA:  %s%s    T19: %s\n", (adj_sp->tra & GOT) ? "GOT " : "", (adj_sp->tra & SENT) ? "SENT" : "",
-				(adj_sp->timer_t19 > -1) ? "running" : "not running");
+		cust_printf(fd, "  TRA:  %s%s    T19: %s T21: %s\n", (adj_sp->tra & GOT) ? "GOT " : "", (adj_sp->tra & SENT) ? "SENT" : "",
+				(adj_sp->timer_t19 > -1) ? "running" : "not running", (adj_sp->timer_t21 > -1) ? "running" : "not running");
 
 		cust_printf(fd, "  Routes:\n");
 		cust_printf(fd, "    DPC       State        T6       T10\n");




More information about the libss7-commits mailing list