[svn-commits] junky: branch group/ast_log-channelize r57205 - in /team/group/ast_log-channe...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Wed Feb 28 15:59:12 MST 2007


Author: junky
Date: Wed Feb 28 16:59:11 2007
New Revision: 57205

URL: http://svn.digium.com/view/asterisk?view=rev&rev=57205
Log:
add the CLI command core filter channel foo

Modified:
    team/group/ast_log-channelize/include/asterisk/logger.h
    team/group/ast_log-channelize/main/cli.c
    team/group/ast_log-channelize/main/logger.c

Modified: team/group/ast_log-channelize/include/asterisk/logger.h
URL: http://svn.digium.com/view/asterisk/team/group/ast_log-channelize/include/asterisk/logger.h?view=diff&rev=57205&r1=57204&r2=57205
==============================================================================
--- team/group/ast_log-channelize/include/asterisk/logger.h (original)
+++ team/group/ast_log-channelize/include/asterisk/logger.h Wed Feb 28 16:59:11 2007
@@ -85,6 +85,9 @@
 void ast_console_puts_mutable(const char *string);
 void ast_console_toggle_mute(int fd);
 
+/*! Channel to restrict the filter to */
+int ast_cli_add_filter_chan(const char *channel);
+
 #define _A_ __FILE__, __LINE__, __PRETTY_FUNCTION__
 
 #ifdef LOG_DEBUG

Modified: team/group/ast_log-channelize/main/cli.c
URL: http://svn.digium.com/view/asterisk/team/group/ast_log-channelize/main/cli.c?view=diff&rev=57205&r1=57204&r2=57205
==============================================================================
--- team/group/ast_log-channelize/main/cli.c (original)
+++ team/group/ast_log-channelize/main/cli.c Wed Feb 28 16:59:11 2007
@@ -82,6 +82,11 @@
 "Usage: soft hangup <channel>\n"
 "       Request that a channel be hung up. The hangup takes effect\n"
 "       the next time the driver reads or writes from the channel\n";
+
+
+static const char corefilterchannel_help[] =
+"Usage: core filter channel <chan>\n"
+"	Limit the CLI output to that channel\n";
 
 static const char group_show_channels_help[] = 
 "Usage: group show channels [pattern]\n"
@@ -558,6 +563,25 @@
 #undef VERBOSE_FORMAT_STRING
 #undef VERBOSE_FORMAT_STRING2
 }
+
+static int handle_core_filter_channel(int fd, int argc, char *argv[]) 
+{
+	struct ast_channel *chan = NULL;
+	char *chartmp = "(null)";
+	if ( argc < 3 || argc > 4  )
+		return RESULT_SHOWUSAGE;
+	if ( argc == 4 ) { /* if 4, use the specified channel */
+		chan = ast_get_channel_by_name_locked(argv[3]);
+		chartmp = argv[3];
+	}
+	/* if 3, use the NULL from chan initialization */
+
+	ast_cli_add_filter_chan(chartmp); /* Passing the string, cause many the channel doesnt exists yet */
+
+	ast_cli(fd, "Filter set for chan: %s\n", chartmp);
+	return CLI_SUCCESS;
+}
+
 
 static const char showchan_help[] = 
 "Usage: core show channel <channel>\n"
@@ -1006,6 +1030,10 @@
 	{ { "soft", "hangup", NULL },
 	handle_softhangup, "Request a hangup on a given channel",
 	softhangup_help, complete_ch_3 },
+
+	{ { "core", "filter", "channel"}, 
+	handle_core_filter_channel, "Filter the CLI output to certain(s) channel(s)",
+	corefilterchannel_help, complete_ch_3 },
 };
 
 /*!

Modified: team/group/ast_log-channelize/main/logger.c
URL: http://svn.digium.com/view/asterisk/team/group/ast_log-channelize/main/logger.c?view=diff&rev=57205&r1=57204&r2=57205
==============================================================================
--- team/group/ast_log-channelize/main/logger.c (original)
+++ team/group/ast_log-channelize/main/logger.c Wed Feb 28 16:59:11 2007
@@ -115,6 +115,13 @@
 
 static AST_LIST_HEAD_STATIC(logchannels, logchannel);
 
+struct clifilter {
+	int type;	
+	AST_LIST_ENTRY(clifilter) list;
+};
+
+static AST_LIST_HEAD_STATIC(clifilters, clifilter);
+
 enum logmsgtypes {
 	LOGMSG_NORMAL = 0,
 	LOGMSG_VERBOSE,
@@ -138,6 +145,11 @@
 
 static FILE *eventlog;
 static FILE *qlog;
+
+static int clifiltertypes[] = {
+	0,	/* filter channel */
+	1	/* filter pattern */
+};
 
 static char *levels[] = {
 	"DEBUG",
@@ -1070,3 +1082,16 @@
 	
 	return cur ? 0 : -1;
 }
+
+
+/*! that function add a new chan filter to the list of filters */
+int ast_cli_add_filter_chan(const char *chan) {
+	struct clifilter *cf = NULL;
+	//cf->type =0;
+	ast_log(NULL, LOG_NOTICE, "Channel filter is restricted to: %s\n",chan);
+
+
+	return 0;
+}
+
+



More information about the svn-commits mailing list