[Asterisk-cvs] libpri libpri.h, 1.42, 1.43 pri_facility.c, 1.4, 1.5 q931.c, 1.116, 1.117

mattf at lists.digium.com mattf at lists.digium.com
Wed Mar 2 10:06:02 CST 2005


Update of /usr/cvsroot/libpri
In directory mongoose.digium.com:/tmp/cvs-serv6544

Modified Files:
	libpri.h pri_facility.c q931.c 
Log Message:
Adding debug level for APDUs


Index: libpri.h
===================================================================
RCS file: /usr/cvsroot/libpri/libpri.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- libpri.h	2 Mar 2005 15:56:11 -0000	1.42
+++ libpri.h	2 Mar 2005 16:03:22 -0000	1.43
@@ -37,6 +37,7 @@
 #define PRI_DEBUG_Q931_DUMP		(1 << 5)	/* Show interpreted Q.931 frames */
 #define PRI_DEBUG_Q931_STATE	(1 << 6)	/* Debug Q.931 state machine changes */
 #define	PRI_DEBUG_Q931_ANOMALY 	(1 << 7)	/* Show unexpected events */
+#define PRI_DEBUG_APDU		(1 << 8)	/* Debug of APDU components such as ROSE */
 
 #define PRI_DEBUG_ALL			(0xffff)	/* Everything */
 

Index: pri_facility.c
===================================================================
RCS file: /usr/cvsroot/libpri/pri_facility.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- pri_facility.c	2 Mar 2005 15:56:11 -0000	1.4
+++ pri_facility.c	2 Mar 2005 16:03:22 -0000	1.5
@@ -19,8 +19,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#undef DEBUG
-
 static unsigned char get_invokeid(struct pri *pri)
 {
 	return ++pri->last_invoke;
@@ -359,10 +357,8 @@
 
 		diversion_reason = redirectingreason_for_q931(pri, diversion_reason);
 	
-#ifdef DEBUG
-		if(pri->debug)
+		if(pri->debug & PRI_DEBUG_APDU)
 			pri_message("    Redirection reason: %d, total diversions: %d\n", diversion_reason, diversion_counter);
-#endif
 
 		for(; i < len; NEXT_COMPONENT(comp, i)) {
 			GET_COMPONENT(comp, i, vdata, len);
@@ -370,22 +366,18 @@
 			case 0xA1:		/* divertingnr: presentednumberunscreened */
 				if(rose_presented_number_unscreened_decode(pri, call, comp->data, comp->len, &divertingnr) != 0)
 					return -1;
-#ifdef DEBUG
-				if (pri->debug) {
+				if (pri->debug & PRI_DEBUG_APDU) {
 					pri_message("    Received divertingNr '%s'\n", divertingnr.partyaddress);
 					pri_message("      ton = %d, pres = %d, npi = %d\n", divertingnr.ton, divertingnr.pres, divertingnr.npi);
 				}
-#endif
 				break;
 			case 0xA2:		/* originalCalledNr: PresentedNumberUnscreened */
 				if(rose_presented_number_unscreened_decode(pri, call, comp->data, comp->len, &originalcallednr) != 0)
 					return -1;
-#ifdef DEBUG
-				if (pri->debug) {
+				if (pri->debug & PRI_DEBUG_APDU) {
 					pri_message("    Received originalcallednr '%s'\n", originalcallednr.partyaddress);
 					pri_message("      ton = %d, pres = %d, npi = %d\n", originalcallednr.ton, originalcallednr.pres, originalcallednr.npi);
 				}
-#endif
 				break;
 			default:
 				pri_message("!! Invalid DivertingLegInformation2 component received 0x%X\n", comp->type);
@@ -803,23 +795,18 @@
 		if (!comp->type)
 			return -1;
 
-#ifdef DEBUG
-		pri_message("  [ Handling operation %d ]\n", operation_tag);
-#endif
+		if (pri->debug & PRI_DEBUG_APDU)
+			pri_message("  [ Handling operation %d ]\n", operation_tag);
 		switch (operation_tag) {
 		case SS_CNID_CALLINGNAME:
-#ifdef DEBUG
-			if (pri->debug)
+			if (pri->debug & PRI_DEBUG_APDU)
 				pri_message("  Handle Name display operation\n");
-#endif
-			switch (comp->type) {
+			switch (comp->type & PRI_DEBUG_APDU) {
 			case ROSE_NAME_PRESENTATION_ALLOWED_SIMPLE:
 				memcpy(call->callername, comp->data, comp->len);
 				call->callername[comp->len] = 0;
-#ifdef DEBUG
-				if (pri->debug)
+				if (pri->debug & PRI_DEBUG_APDU)
 				  pri_message("    Received caller name '%s'\n", call->callername);
-#endif
 				return 0;
 			default:
 				pri_message("Do not handle argument of type 0x%X\n", comp->type);
@@ -827,10 +814,8 @@
 			}
 			break;
 		case ROSE_DIVERTING_LEG_INFORMATION2:
-#ifdef DEBUG
-			if (pri->debug)
+			if (pri->debug & PRI_DEBUG_APDU)
 				pri_message("  Handle DivertingLegInformation2\n");
-#endif
 			if (comp->type != 0x30) { /* Sequence */
 				pri_message("Invalid DivertingLegInformation2Type argument\n");
 				return -1;

Index: q931.c
===================================================================
RCS file: /usr/cvsroot/libpri/q931.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -d -r1.116 -r1.117
--- q931.c	2 Mar 2005 15:56:11 -0000	1.116
+++ q931.c	2 Mar 2005 16:03:22 -0000	1.117
@@ -1298,7 +1298,7 @@
 						break; \
 					} \
 					state = my_state; \
-					if (pri->debug) \
+					if (pri->debug & PRI_DEBUG_APDU) \
 						pri_message("Q.932 %s component is not handled\n", name); \
 					break;
 
@@ -1312,7 +1312,7 @@
 	switch(next_protocol = protocol = (ie->data[i] & 0x1f)) {
 	case Q932_PROTOCOL_CMIP:
 	case Q932_PROTOCOL_ACSE:
-		if (pri->debug)
+		if (pri->debug & PRI_DEBUG_APDU)
 			pri_message("!! Don't know how to handle Q.932 Protocol Profile of type 0x%X\n", protocol);
 		return -1;
 	case Q932_PROTOCOL_EXTENSIONS:
@@ -1351,7 +1351,7 @@
 				Q932_HANDLE_NULL(COMP_TYPE_RETURN_ERROR, Q932_STATE_SERVICE, "ROSE return error", NULL);
 				Q932_HANDLE_NULL(COMP_TYPE_REJECT, Q932_STATE_SERVICE, "ROSE reject", NULL);
 				default:
-					if (pri->debug)
+					if (pri->debug & PRI_DEBUG_APDU)
 						pri_message("Don't know how to handle ROSE component of type 0x%X\n", comp->type);
 					break;
 				}
@@ -1359,7 +1359,7 @@
 			case Q932_PROTOCOL_CMIP:
 				switch (comp->type) {
 				default:
-					if (pri->debug)
+					if (pri->debug & PRI_DEBUG_APDU)
 						pri_message("Don't know how to handle CMIP component of type 0x%X\n", comp->type);
 					break;
 				}
@@ -1367,7 +1367,7 @@
 			case Q932_PROTOCOL_ACSE:
 				switch (comp->type) {
 				default:
-					if (pri->debug)
+					if (pri->debug & PRI_DEBUG_APDU)
 						pri_message("Don't know how to handle ACSE component of type 0x%X\n", comp->type);
 					break;
 				}




More information about the svn-commits mailing list