[libss7-commits] mattf: trunk r47 - in /trunk: isup.c isup.h libss7.h ss7linktest.c

libss7-commits at lists.digium.com libss7-commits at lists.digium.com
Mon Sep 18 12:15:01 MST 2006


Author: mattf
Date: Mon Sep 18 14:15:00 2006
New Revision: 47

URL: http://svn.digium.com/view/libss7?rev=47&view=rev
Log:
Updates for parameter debugging

Modified:
    trunk/isup.c
    trunk/isup.h
    trunk/libss7.h
    trunk/ss7linktest.c

Modified: trunk/isup.c
URL: http://svn.digium.com/view/libss7/trunk/isup.c?rev=47&r1=46&r2=47&view=diff
==============================================================================
--- trunk/isup.c (original)
+++ trunk/isup.c Mon Sep 18 14:15:00 2006
@@ -167,7 +167,7 @@
 		case '9':
 			return 9;
 		case '#':
-			return '\0';
+			return 0xf;
 		default:
 			return 0;
 	}
@@ -272,7 +272,6 @@
 	unsigned char con = parm[0];
 	char *continuity;
 	
-	ss7_message(ss7, "PARM: Nature of Connection\n");
 	ss7_message(ss7, "	Satellites in connection: %d\n", con&0x03);
 	con>>=2; 
 	switch (con & 0x03) {
@@ -303,11 +302,15 @@
 {
 	parm[0] = 0x60;
 	parm[1] = 0x01;
-	
 	return 2;
 }
 
 static FUNC_RECV(forward_call_ind_receive)
+{
+	return 2;
+}
+
+static FUNC_DUMP(forward_call_ind_dump)
 {
 	return 2;
 }
@@ -321,6 +324,11 @@
 {
 	/* Default to unknown */
 	parm[0] = 0x0a;
+	return 1;
+}
+
+static FUNC_DUMP(calling_party_cat_dump)
+{
 	return 1;
 }
 
@@ -357,6 +365,11 @@
 	return 1;
 }
 
+static FUNC_DUMP(transmission_medium_reqs_dump)
+{
+	return 1;
+}
+
 /* For variable length parameters we pass in the length of the parameter */
 static FUNC_RECV(called_party_num_receive)
 {
@@ -395,6 +408,11 @@
 {
 	parm[0] = 0x40;
 	parm[1] = 0x14;
+	return 2;
+}
+
+static FUNC_DUMP(backward_call_ind_dump)
+{
 	return 2;
 }
 
@@ -623,9 +641,9 @@
 
 static struct parm_func parms[] = {
 	{ISUP_PARM_NATURE_OF_CONNECTION_IND, "Nature of Connection Indicator", nature_of_connection_ind_dump, nature_of_connection_ind_receive, nature_of_connection_ind_transmit },
-	{ISUP_PARM_FORWARD_CALL_IND, "Forward Call Indicator", NULL, forward_call_ind_receive, forward_call_ind_transmit },
-	{ISUP_PARM_CALLING_PARTY_CAT, "Calling Party Category", NULL, calling_party_cat_receive, calling_party_cat_transmit},
-	{ISUP_PARM_TRANSMISSION_MEDIUM_REQS, "Transmission Medium Requirements", NULL, transmission_medium_reqs_receive, transmission_medium_reqs_transmit},
+	{ISUP_PARM_FORWARD_CALL_IND, "Forward Call Indicator", forward_call_ind_dump, forward_call_ind_receive, forward_call_ind_transmit },
+	{ISUP_PARM_CALLING_PARTY_CAT, "Calling Party Category", calling_party_cat_dump, calling_party_cat_receive, calling_party_cat_transmit},
+	{ISUP_PARM_TRANSMISSION_MEDIUM_REQS, "Transmission Medium Requirements", transmission_medium_reqs_dump, transmission_medium_reqs_receive, transmission_medium_reqs_transmit},
 	{ISUP_PARM_USER_SERVICE_INFO, "User Service Information", NULL, user_service_info_receive, user_service_info_transmit},
 	{ISUP_PARM_CALLED_PARTY_NUM, "Called Party Number", NULL, called_party_num_receive, called_party_num_transmit},
 	{ISUP_PARM_CAUSE, "Cause Indicator", NULL, cause_receive, cause_transmit},
@@ -646,7 +664,8 @@
 	{ISUP_PARM_GENERIC_NAME, "Generic Name"},
 	{ISUP_PARM_GENERIC_NOTIFICATION_IND, "Generic Notification Indication"},
 	{ISUP_PARM_PROPAGATION_DELAY, "Propagation Delay"},
-	{ISUP_PARM_BACKWARD_CALL_IND, "Backward Call Indicator", NULL, backward_call_ind_receive, backward_call_ind_transmit},
+	{ISUP_PARM_HOP_COUNTER, "Hop Counter"},
+	{ISUP_PARM_BACKWARD_CALL_IND, "Backward Call Indicator", backward_call_ind_dump, backward_call_ind_receive, backward_call_ind_transmit},
 	{ISUP_PARM_CIRCUIT_GROUP_SUPERVISION_IND, "Circuit Group Supervision Indicator", circuit_group_supervision_dump, circuit_group_supervision_receive, circuit_group_supervision_transmit},
 	{ISUP_PARM_RANGE_AND_STATUS, "Range and status", range_and_status_dump, range_and_status_receive, range_and_status_transmit},
 	{ISUP_PARM_EVENT_INFO, "Event Information", event_info_dump, event_info_receive, event_info_transmit},
@@ -680,11 +699,15 @@
 	return c;
 }
 
-void isup_init_call(struct isup_call *c, int cic, char *calledpartynum, char *callingpartynum)
+void isup_init_call(struct ss7 *ss7, struct isup_call *c, int cic, char *calledpartynum, char *callingpartynum)
 {
 	c->cic = cic;
-	if (calledpartynum && calledpartynum[0])
-		snprintf(c->called_party_num, sizeof(c->called_party_num), "%s#", calledpartynum);
+	if (calledpartynum && calledpartynum[0]) {
+		if (ss7->switchtype == SS7_ITU)
+			snprintf(c->called_party_num, sizeof(c->called_party_num), "%s#", calledpartynum);
+		else
+			snprintf(c->called_party_num, sizeof(c->called_party_num), "%s", calledpartynum);
+	}
 
 	if (callingpartynum && callingpartynum[0])
 		strncpy(c->calling_party_num, callingpartynum, sizeof(c->calling_party_num));
@@ -782,6 +805,44 @@
 	return -1;
 }
 
+#if 0
+static int dump_parm(struct ss7 *ss7, struct isup_call *c, int message, int parm, unsigned char *parmbuf, int maxlen, int parmtype)
+{
+	struct isup_parm_opt *optparm = NULL;
+	int x;
+	int res = 0;
+	int totalparms = sizeof(parms)/sizeof(struct parm_func);
+
+	for (x = 0; x < totalparms; x++) {
+		if (parms[x].parm == parm) {
+			ss7_message(ss7, "PARM: %s\n", parms[x].name ? parms[x].name : "Unknown");
+			if (parms[x].dump) {
+				switch (parmtype) {
+					case PARM_TYPE_FIXED:
+						return parms[x].dump(ss7, c, message, parmbuf, maxlen);
+					case PARM_TYPE_VARIABLE:
+						return 1 + parms[x].dump(ss7, c, message, parmbuf + 1, parmbuf[0]);
+					case PARM_TYPE_OPTIONAL:
+						optparm = (struct isup_parm_opt *)parmbuf;
+						res = parms[x].dump(ss7, c, message, optparm->data, optparm->len);
+						return res + 2;
+				}
+			} else {
+				optparm = (struct isup_parm_opt *)parmbuf;
+				isup_dump_buffer(ss7, optparm->data, optparm->len);
+				return optparm->len + 2;
+			}
+		}
+	}
+
+	/* This is if we don't find it.... It's going to be either an unknown message or an unknown optional parameter */
+	ss7_message(ss7, "Parm: Unknown");
+	optparm = (struct isup_parm_opt *)parmbuf;
+	isup_dump_buffer(ss7, optparm->data, optparm->len);
+	return optparm->len + 2;
+}
+#endif
+
 static int isup_send_message(struct ss7 *ss7, struct isup_call *c, int messagetype, int parms[])
 {
 	struct ss7_msg *msg;

Modified: trunk/isup.h
URL: http://svn.digium.com/view/libss7/trunk/isup.h?rev=47&r1=46&r2=47&view=diff
==============================================================================
--- trunk/isup.h (original)
+++ trunk/isup.h Mon Sep 18 14:15:00 2006
@@ -98,6 +98,7 @@
 #define ISUP_PARM_RANGE_AND_STATUS 0x16
 #define ISUP_PARM_PROPAGATION_DELAY 0x31
 #define ISUP_PARM_EVENT_INFO 0x24
+#define ISUP_PARM_HOP_COUNTER 0x3d
 
 /* ISUP Parameter Pseudo-type */
 struct isup_parm_opt {

Modified: trunk/libss7.h
URL: http://svn.digium.com/view/libss7/trunk/libss7.h?rev=47&r1=46&r2=47&view=diff
==============================================================================
--- trunk/libss7.h (original)
+++ trunk/libss7.h Mon Sep 18 14:15:00 2006
@@ -227,5 +227,5 @@
 
 int isup_rsc(struct ss7 *ss7, int cic);
 
-void isup_init_call(struct isup_call *c, int cic, char *calledpartynum, char *callingpartynum);
+void isup_init_call(struct ss7 *ss7, struct isup_call *c, int cic, char *calledpartynum, char *callingpartynum);
 #endif /* _LIBSS7_H */

Modified: trunk/ss7linktest.c
URL: http://svn.digium.com/view/libss7/trunk/ss7linktest.c?rev=47&r1=46&r2=47&view=diff
==============================================================================
--- trunk/ss7linktest.c (original)
+++ trunk/ss7linktest.c Mon Sep 18 14:15:00 2006
@@ -32,7 +32,7 @@
 	c = isup_new_call(ss7);
 
 	if (c) {
-		isup_init_call(c, (callcount % 12) + 1, "12345", "7654321");
+		isup_init_call(ss7, c, (callcount % 12) + 1, "12345", "7654321");
 		isup_iam(ss7, c);
 		printf("Callcount = %d\n ", ++callcount);
 	}



More information about the libss7-commits mailing list