[libss7-commits] mattf: branch mattf/bug13495 r236 - /team/mattf/bug13495/

SVN commits to the libss7 project libss7-commits at lists.digium.com
Sat Dec 6 12:45:02 CST 2008


Author: mattf
Date: Sat Dec  6 12:45:01 2008
New Revision: 236

URL: http://svn.digium.com/view/libss7?view=rev&rev=236
Log:
Change ss7_add_link API to include the Adjacent Point Code as well

Modified:
    team/mattf/bug13495/libss7.h
    team/mattf/bug13495/parser_debug.c
    team/mattf/bug13495/ss7.c
    team/mattf/bug13495/ss7linktest.c
    team/mattf/bug13495/ss7test.c

Modified: team/mattf/bug13495/libss7.h
URL: http://svn.digium.com/view/libss7/team/mattf/bug13495/libss7.h?view=diff&rev=236&r1=235&r2=236
==============================================================================
--- team/mattf/bug13495/libss7.h (original)
+++ team/mattf/bug13495/libss7.h Sat Dec  6 12:45:01 2008
@@ -422,9 +422,7 @@
 
 struct timeval *ss7_schedule_next(struct ss7 *ss7);
 
-int ss7_add_link(struct ss7 *ss7, int transport, int fd, int slc);
-
-int ss7_set_adjpc(struct ss7 *ss7, int fd, unsigned int pc);
+int ss7_add_link(struct ss7 *ss7, int transport, int fd, int slc, unsigned int adjpc);
 
 int ss7_set_network_ind(struct ss7 *ss7, int ni);
 

Modified: team/mattf/bug13495/parser_debug.c
URL: http://svn.digium.com/view/libss7/team/mattf/bug13495/parser_debug.c?view=diff&rev=236&r1=235&r2=236
==============================================================================
--- team/mattf/bug13495/parser_debug.c (original)
+++ team/mattf/bug13495/parser_debug.c Sat Dec  6 12:45:01 2008
@@ -74,7 +74,7 @@
 
 	printf("\n");
 
-	ss7_add_link(ss7, SS7_TRANSPORT_DAHDIDCHAN, 10, -1);
+	ss7_add_link(ss7, SS7_TRANSPORT_DAHDIDCHAN, 10, -1, 0);
 
 	ss7->debug = SS7_DEBUG_MTP2 | SS7_DEBUG_MTP3 | SS7_DEBUG_ISUP;
 	ss7->links[0]->state = MTP_INSERVICE;

Modified: team/mattf/bug13495/ss7.c
URL: http://svn.digium.com/view/libss7/team/mattf/bug13495/ss7.c?view=diff&rev=236&r1=235&r2=236
==============================================================================
--- team/mattf/bug13495/ss7.c (original)
+++ team/mattf/bug13495/ss7.c Sat Dec  6 12:45:01 2008
@@ -199,7 +199,26 @@
 	mtp3_noalarm(ss7, fd);
 }
 
-int ss7_add_link(struct ss7 *ss7, int transport, int fd, int slc)
+/* TODO: Add entry to routing table instead */
+static int ss7_set_adjpc(struct ss7 *ss7, int fd, unsigned int pc)
+{
+	int i;
+	int winner = -1;
+
+	for (i = 0; i < ss7->numlinks; i++) {
+		if (ss7->links[i]->fd == fd)
+			winner = i;
+	}
+	if (winner > -1) {
+		ss7->links[winner]->dpc = pc;
+		mtp3_add_adj_sp(ss7->links[winner]);
+	} else
+		return -1;
+
+	return 0;
+}
+
+int ss7_add_link(struct ss7 *ss7, int transport, int fd, int slc, unsigned int adjpc)
 {
 	struct mtp2 *m;
 
@@ -232,6 +251,8 @@
 		ss7->links[ss7->numlinks - 1] = m;
 	}
 
+	ss7_set_adjpc(ss7, fd, adjpc);
+
 	return 0;
 }
 
@@ -258,25 +279,6 @@
 		flags |= POLLOUT;
 
 	return flags;
-}
-
-/* TODO: Add entry to routing table instead */
-int ss7_set_adjpc(struct ss7 *ss7, int fd, unsigned int pc)
-{
-	int i;
-	int winner = -1;
-
-	for (i = 0; i < ss7->numlinks; i++) {
-		if (ss7->links[i]->fd == fd)
-			winner = i;
-	}
-	if (winner > -1) {
-		ss7->links[winner]->dpc = pc;
-		mtp3_add_adj_sp(ss7->links[winner]);
-	} else
-		return -1;
-
-	return 0;
 }
 
 int ss7_set_pc(struct ss7 *ss7, unsigned int pc)

Modified: team/mattf/bug13495/ss7linktest.c
URL: http://svn.digium.com/view/libss7/team/mattf/bug13495/ss7linktest.c?view=diff&rev=236&r1=235&r2=236
==============================================================================
--- team/mattf/bug13495/ss7linktest.c (original)
+++ team/mattf/bug13495/ss7linktest.c Sat Dec  6 12:45:01 2008
@@ -319,13 +319,12 @@
 	ss7_set_network_ind(ss7, SS7_NI_NAT);
 
 	ss7_set_debug(ss7, 0xfffffff);
-	if ((ss7_add_link(ss7, ismtp2 ? SS7_TRANSPORT_DAHDIMTP2 : SS7_TRANSPORT_DAHDIDCHAN, fd, -1))) {
+	if ((ss7_add_link(ss7, ismtp2 ? SS7_TRANSPORT_DAHDIMTP2 : SS7_TRANSPORT_DAHDIDCHAN, fd, -1, dpc))) {
 		perror("ss7_add_link");
 		exit(1);
 	}
 
 	ss7_set_pc(ss7, opc);
-	ss7_set_adjpc(ss7, fd, dpc);
 
 	if (pthread_create(&tmp, NULL, ss7_run, &linkset[0])) {
 		perror("thread(0)");

Modified: team/mattf/bug13495/ss7test.c
URL: http://svn.digium.com/view/libss7/team/mattf/bug13495/ss7test.c?view=diff&rev=236&r1=235&r2=236
==============================================================================
--- team/mattf/bug13495/ss7test.c (original)
+++ team/mattf/bug13495/ss7test.c Sat Dec  6 12:45:01 2008
@@ -218,7 +218,7 @@
 	ss7_set_error(myprintf);
 
 	ss7_set_debug(ss7, 0xffffffff);
-	if ((ss7_add_link(ss7, SS7_TRANSPORT_DAHDIDCHAN, fds[0], -1))) {
+	if ((ss7_add_link(ss7, SS7_TRANSPORT_DAHDIDCHAN, fds[0], -1, 0))) {
 		perror("ss7_add_link");
 		exit(1);
 	}
@@ -235,7 +235,7 @@
 	ss7_set_debug(ss7, 0xffffffff);
 	linkset[1].linkno = 1;
 
-	if ((ss7_add_link(ss7, SS7_TRANSPORT_DAHDIDCHAN, fds[1], -1))) {
+	if ((ss7_add_link(ss7, SS7_TRANSPORT_DAHDIDCHAN, fds[1], -1, 1))) {
 		perror("ss7_add_link");
 		exit(1);
 	}




More information about the libss7-commits mailing list