[asterisk-commits] kmoore: trunk r354165 - in /trunk/channels: chan_dahdi.c sig_pri.h
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Feb 6 14:18:20 CST 2012
Author: kmoore
Date: Mon Feb 6 14:18:16 2012
New Revision: 354165
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=354165
Log:
Allow more control over the output of pri debug
This changes the debuglevel of 'pri set debug' to a bit mask allowing the user
to independently select bits of output:
1 libpri internals including state machine
2 Decoded Q.931 messages
4 Decoded Q.921 headers
8 raw hex dump of the full frames
Additionally, this ensures that the meaning of "on" does not change and
intrudces intense and hex to simplify usage.
(closes issue ASTERISK-17159)
Original-patch-by: wimpy
Modified:
trunk/channels/chan_dahdi.c
trunk/channels/sig_pri.h
Modified: trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=354165&r1=354164&r2=354165
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Mon Feb 6 14:18:16 2012
@@ -14319,13 +14319,22 @@
{
int span;
int x;
+ int debugmask = 0;
int level = 0;
switch (cmd) {
case CLI_INIT:
- e->command = "pri set debug {on|off|0|1|2} span";
+ e->command = "pri set debug {on|off|hex|intense|0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15} span";
e->usage =
- "Usage: pri set debug {<level>|on|off} span <span>\n"
- " Enables debugging on a given PRI span\n";
+ "Usage: pri set debug {<level>|on|off|hex|intense} span <span>\n"
+ " Enables debugging on a given PRI span\n"
+ " Level is a bitmap of the following values:\n"
+ " 1 General debugging incl. state changes\n"
+ " 2 Decoded Q.931 messages\n"
+ " 4 Decoded Q.921 messages\n"
+ " 8 Raw hex dumps of Q.921 frames\n"
+ " on - equivalent to 3\n"
+ " hex - equivalent to 8\n"
+ " intense - equivalent to 15\n";
return NULL;
case CLI_GENERATE:
return complete_span_4(a->line, a->word, a->pos, a->n);
@@ -14335,9 +14344,13 @@
}
if (!strcasecmp(a->argv[3], "on")) {
- level = 1;
+ level = 3;
} else if (!strcasecmp(a->argv[3], "off")) {
level = 0;
+ } else if (!strcasecmp(a->argv[3], "intense")) {
+ level = 15;
+ } else if (!strcasecmp(a->argv[3], "hex")) {
+ level = 8;
} else {
level = atoi(a->argv[3]);
}
@@ -14351,20 +14364,15 @@
return CLI_SUCCESS;
}
+ if (level & 1) debugmask |= SIG_PRI_DEBUG_NORMAL;
+ if (level & 2) debugmask |= PRI_DEBUG_Q931_DUMP;
+ if (level & 4) debugmask |= PRI_DEBUG_Q921_DUMP;
+ if (level & 8) debugmask |= PRI_DEBUG_Q921_RAW;
+
/* Set debug level in libpri */
for (x = 0; x < SIG_PRI_NUM_DCHANS; x++) {
if (pris[span - 1].pri.dchans[x]) {
- switch (level) {
- case 0:
- pri_set_debug(pris[span - 1].pri.dchans[x], 0);
- break;
- case 1:
- pri_set_debug(pris[span - 1].pri.dchans[x], SIG_PRI_DEBUG_NORMAL);
- break;
- default:
- pri_set_debug(pris[span - 1].pri.dchans[x], SIG_PRI_DEBUG_INTENSE);
- break;
- }
+ pri_set_debug(pris[span - 1].pri.dchans[x], debugmask);
}
}
if (level == 0) {
Modified: trunk/channels/sig_pri.h
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_pri.h?view=diff&rev=354165&r1=354164&r2=354165
==============================================================================
--- trunk/channels/sig_pri.h (original)
+++ trunk/channels/sig_pri.h Mon Feb 6 14:18:16 2012
@@ -35,24 +35,12 @@
#if defined(HAVE_PRI_CCSS)
/*! PRI debug message flags when normal PRI debugging is turned on at the command line. */
#define SIG_PRI_DEBUG_NORMAL \
- (PRI_DEBUG_APDU | PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q921_STATE \
- | PRI_DEBUG_CC)
-
-/*! PRI debug message flags when intense PRI debugging is turned on at the command line. */
-#define SIG_PRI_DEBUG_INTENSE \
- (PRI_DEBUG_APDU | PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q921_STATE \
- | PRI_DEBUG_CC | PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_DUMP)
-
+ (PRI_DEBUG_APDU | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q921_STATE | PRI_DEBUG_CC)
#else
/*! PRI debug message flags when normal PRI debugging is turned on at the command line. */
#define SIG_PRI_DEBUG_NORMAL \
- (PRI_DEBUG_APDU | PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q921_STATE)
-
-/*! PRI debug message flags when intense PRI debugging is turned on at the command line. */
-#define SIG_PRI_DEBUG_INTENSE \
- (PRI_DEBUG_APDU | PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q921_STATE \
- | PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_DUMP)
+ (PRI_DEBUG_APDU | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q921_STATE)
#endif /* !defined(HAVE_PRI_CCSS) */
#if 0
More information about the asterisk-commits
mailing list