[svn-commits] mattf: branch mattf/bug13495 r232 - /team/mattf/bug13495/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sat Dec 6 11:03:41 CST 2008


Author: mattf
Date: Sat Dec  6 11:03:39 2008
New Revision: 232

URL: http://svn.digium.com/view/libss7?view=rev&rev=232
Log:
Add a new point code to string function and fix a bug in finding a link where two links have the same point code

Modified:
    team/mattf/bug13495/libss7.h
    team/mattf/bug13495/mtp2.c
    team/mattf/bug13495/mtp3.c
    team/mattf/bug13495/ss7.c

Modified: team/mattf/bug13495/libss7.h
URL: http://svn.digium.com/view/libss7/team/mattf/bug13495/libss7.h?view=diff&rev=232&r1=231&r2=232
==============================================================================
--- team/mattf/bug13495/libss7.h (original)
+++ team/mattf/bug13495/libss7.h Sat Dec  6 11:03:39 2008
@@ -608,4 +608,6 @@
 void mtp3_init_restart(struct ss7 *ss7, int slc);
 
 int ss7_set_mtp3_timer(struct ss7 *ss7, char *name, int ms);
+
+void ss7_pc_to_str(int ss7type, unsigned int pc, char *str);
 #endif /* _LIBSS7_H */

Modified: team/mattf/bug13495/mtp2.c
URL: http://svn.digium.com/view/libss7/team/mattf/bug13495/mtp2.c?view=diff&rev=232&r1=231&r2=232
==============================================================================
--- team/mattf/bug13495/mtp2.c (original)
+++ team/mattf/bug13495/mtp2.c Sat Dec  6 11:03:39 2008
@@ -514,6 +514,7 @@
 int mtp2_setstate(struct mtp2 *link, int newstate)
 {
 	ss7_event *e;
+	int i;
 
 	if (link->master->debug & SS7_DEBUG_MTP2)
 		mtp_message(link->master, "Link state change: %s -> %s\n", linkstate2str(link->state), linkstate2str(newstate));
@@ -619,7 +620,12 @@
 						return -1;
 					}
 					e->gen.e = MTP2_LINK_UP;
-					e->gen.data = link->slc;
+					for (i = 0; i < link->master->numlinks; i++) {
+						if (link->master->links[i] == link) {
+							e->gen.data = i;
+							break;
+						}
+					}
 					break;
 				default:
 					mtp_error(link->master, "Don't know how to handle state change from %d to %d\n", link->state, newstate);
@@ -635,7 +641,12 @@
 					return -1;
 				}
 				e->gen.e = MTP2_LINK_DOWN;
-				e->gen.data = link->slc;
+				for (i = 0; i < link->master->numlinks; i++) {
+					if (link->master->links[i] == link) {
+						e->gen.data = i;
+						break;
+					}
+				}
 				return to_idle(link);
 			}
 			break;
@@ -819,6 +830,7 @@
 	struct mtp_su_head *h = (struct mtp_su_head *)buf;
 	unsigned char mtype;
 	char *mtypech = NULL;
+	char pc_str[64];
 
 	if (!(link->master->debug & SS7_DEBUG_MTP2))
 		return;
@@ -849,7 +861,9 @@
 			ss7_message(link->master, "FSN: %d FIB %d\n", h->fsn, h->fib);
 			ss7_message(link->master, "BSN: %d BIB %d\n", h->bsn, h->bib);
 
-			ss7_message(link->master, "%c[%d] FISU\n", prefix, link->slc);
+			ss7_pc_to_str(link->master->switchtype, link->adj_sp->adjpc, pc_str);
+
+			ss7_message(link->master, "%c[%s:%d] FISU\n", prefix, pc_str, link->slc);
 			break; 
 		case 1:
 			if (prefix == '<' && link->lastsurxd == h->data[0])

Modified: team/mattf/bug13495/mtp3.c
URL: http://svn.digium.com/view/libss7/team/mattf/bug13495/mtp3.c?view=diff&rev=232&r1=231&r2=232
==============================================================================
--- team/mattf/bug13495/mtp3.c (original)
+++ team/mattf/bug13495/mtp3.c Sat Dec  6 11:03:39 2008
@@ -1811,6 +1811,18 @@
 	return link;
 }
 
+static struct mtp2 * mtp2_event_to_mtp2(struct ss7 *ss7, unsigned int link_index)
+{
+	struct mtp2 *link = NULL;
+
+	link = ss7->links[link_index];
+	if (!link) {
+		ss7_error(ss7, "Badness! could not find MTP2 link from MTP2 event\n");
+	}
+
+	return link;
+}
+
 ss7_event * mtp3_process_event(struct ss7 *ss7, ss7_event *e)
 {
 	struct mtp2 *link;
@@ -1821,11 +1833,11 @@
 
 	switch (e->e) {
 		case MTP2_LINK_UP:
-			link = slc_to_mtp2(ss7, e->gen.data);
+			link = mtp2_event_to_mtp2(ss7, e->gen.data);
 			mtp3_event_link_up(link);
 			return e;
 		case MTP2_LINK_DOWN:
-			link = slc_to_mtp2(ss7, e->gen.data);
+			link = mtp2_event_to_mtp2(ss7, e->gen.data);
 			mtp3_event_link_down(link);
 			return e;
 		default:

Modified: team/mattf/bug13495/ss7.c
URL: http://svn.digium.com/view/libss7/team/mattf/bug13495/ss7.c?view=diff&rev=232&r1=231&r2=232
==============================================================================
--- team/mattf/bug13495/ss7.c (original)
+++ team/mattf/bug13495/ss7.c Sat Dec  6 11:03:39 2008
@@ -549,6 +549,15 @@
 	}
 }
 
+void ss7_pc_to_str(int ss7type, unsigned int pc, char *str)
+{
+	if (ss7type == SS7_ITU) {
+		sprintf(str, "%d", pc);
+	} else {
+		sprintf(str, "%d-%d-%d", (pc >> 16) & 0xff, (pc >> 8) & 0xff, pc & 0xff);
+	}
+}
+
 void ss7_show_linkset(struct ss7 *ss7, void (* cust_printf)(int fd, const char *format, ...), int fd)
 {
 	int j, i, x;
@@ -610,3 +619,4 @@
 		} /* links */
 	} /* sps */
 }
+




More information about the svn-commits mailing list