[asterisk-commits] junky: branch junky/cli-tls r204655 - in /team/junky/cli-tls: include/asteris...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jul 1 15:02:25 CDT 2009


Author: junky
Date: Wed Jul  1 15:02:22 2009
New Revision: 204655

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=204655
Log:
for you mark


Modified:
    team/junky/cli-tls/include/asterisk/logger.h
    team/junky/cli-tls/main/logger.c
    team/junky/cli-tls/main/pbx.c

Modified: team/junky/cli-tls/include/asterisk/logger.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/junky/cli-tls/include/asterisk/logger.h?view=diff&rev=204655&r1=204654&r2=204655
==============================================================================
--- team/junky/cli-tls/include/asterisk/logger.h (original)
+++ team/junky/cli-tls/include/asterisk/logger.h Wed Jul  1 15:02:22 2009
@@ -210,6 +210,9 @@
  * \since 1.6.3
  */
 void ast_logger_unregister_level(const char *name);
+
+/* To add a channel to a TLS object */
+int tls_add_channel(struct ast_channel *chan);
 
 /*!
  * \brief Send a log message to a dynamically registered log level

Modified: team/junky/cli-tls/main/logger.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/junky/cli-tls/main/logger.c?view=diff&rev=204655&r1=204654&r2=204655
==============================================================================
--- team/junky/cli-tls/main/logger.c (original)
+++ team/junky/cli-tls/main/logger.c Wed Jul  1 15:02:22 2009
@@ -205,6 +205,20 @@
 
 AST_THREADSTORAGE(log_buf);
 #define LOG_BUF_INIT_SIZE       256
+
+struct ast_channels *channels;
+static void filter_channel_cleanup(void *data);
+
+AST_THREADSTORAGE_CUSTOM(filter_channels, NULL, filter_channel_cleanup);
+
+/* List of channels used for filtering */
+AST_LIST_HEAD_NOLOCK(ast_channels, logger_filter_list_item);
+
+struct logger_filter_list_item {
+        struct ast_channels list;
+        struct ast_channel *chan;
+        AST_LIST_ENTRY(logger_filter_list_item) next;
+};
 
 static unsigned int make_components(const char *s, int lineno)
 {
@@ -1366,3 +1380,68 @@
 	}
 }
 
+//http://pastebin.ca/1474652
+int tls_add_channel(struct ast_channel *chan){
+        struct logger_filter_list_item *filter;
+        int res = 0;
+
+        if ((channels = ast_threadstorage_get(&filter_channels, sizeof(*channels)))) {
+                ast_log(LOG_WARNING, "Adding channel(%s) to channels_list\n", chan->name);
+                filter = ast_calloc(1, sizeof(*filter));
+                if ( !filter ) {
+                        ast_log(LOG_WARNING, "Out of memory\n");
+                        return -1;
+                }
+                filter->chan = chan;
+                ast_log(LOG_WARNING, "TLS channel name is:%s\n", filter->chan->name);
+                AST_RWLIST_INSERT_HEAD(channels, filter, next);
+        } else {
+                ast_log(LOG_WARNING, "Out of memory\n");
+                res = -1;
+        }
+        return res;
+}
+
+static void filter_channel_cleanup(void *data)
+{
+        struct logger_filter_list_item *filter = data;
+
+        ast_log(LOG_WARNING, "%s is called. data=%p\n", __PRETTY_FUNCTION__, data );
+        if (filter ) {
+                ast_log(LOG_WARNING, "filter is there\n");
+                if ( filter->chan) {
+                        ast_log(LOG_WARNING, "chan is there \n");
+                }
+        }
+        //filter = ast_malloc(sizeof(*filter));
+
+        /*
+        if ((filter = ast_threadstorage_get(&filter_channels, sizeof(*filter)))) {
+                ast_log(LOG_WARNING, "ive to remove \n");
+        }
+
+
+        if ((channels = ast_threadstorage_get(&filter_channels, sizeof(*filter)))) {
+                ast_log(LOG_WARNING, "filter is there\n");
+                //AST_LIST_TRAVERSE_SAFE_BEGIN(&filter->list, chan, chan_list) {
+                AST_LIST_TRAVERSE_SAFE_BEGIN(channels, fi, next) {
+                        ast_log(LOG_WARNING, "filter!!!\n");
+                        if (fi->chan) {
+                                ast_log(LOG_WARNING, "chan is %s\n", fi->chan->name);
+                        }
+                }
+                AST_LIST_TRAVERSE_SAFE_END;
+        }
+
+
+        */
+
+        while ((filter = AST_LIST_REMOVE_HEAD(channels, next))) {
+                ast_log(LOG_WARNING, "filter has been removed.\n");
+                if ( filter->chan) {
+                        ast_log(LOG_WARNING, "chan is there(%s) \n", filter->chan->name);
+                }
+                ast_free(filter);
+        }
+}
+

Modified: team/junky/cli-tls/main/pbx.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/junky/cli-tls/main/pbx.c?view=diff&rev=204655&r1=204654&r2=204655
==============================================================================
--- team/junky/cli-tls/main/pbx.c (original)
+++ team/junky/cli-tls/main/pbx.c Wed Jul  1 15:02:22 2009
@@ -776,35 +776,9 @@
 struct ast_app;
 
 static struct ast_taskprocessor *device_state_tps;
-static void filter_channel_cleanup(void *data);
 
 AST_THREADSTORAGE(switch_data);
 AST_THREADSTORAGE(extensionstate_buf);
-
-AST_THREADSTORAGE_CUSTOM(filter_channels, NULL, filter_channel_cleanup);
-
-
-/* List of channels used for filtering */
-AST_LIST_HEAD_NOLOCK(ast_channels, logger_filter_list_item);
-//AST_LIST_HEAD_NOLOCK(ast_channels, ast_channel);
-//AST_LIST_HEAD_NOLOCK(ast_channels, filter_channel);
-
-struct logger_filter_list_item {
-        struct ast_channels list;
-        struct ast_channel *chan;
-        AST_LIST_ENTRY(logger_filter_list_item) next;
-};
-
-
-/*
-struct filter_channel {
-	struct ast_frames list;
-	struct ast_channel *chan;
-};
-*/
-
-static void filter_channel_cleanup(void *data);
-
 
 /* Structure for the cli filter */
 struct ast_cli_filter {
@@ -3165,9 +3139,7 @@
 /* Temporary debug function */
 static char *handle_ts_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
-        struct logger_filter_list_item *filter;
-	struct logger_filter_list_item *fi;
-	//struct ast_channel *chan;
+        //struct logger_filter_list_item *filter;
 
         switch (cmd) {
         case CLI_INIT:
@@ -3184,16 +3156,28 @@
                 return CLI_SHOWUSAGE;
         }
 
-
-        if ((filter = ast_threadstorage_get(&filter_channels, sizeof(*filter)))) {
-		//ast_log(LOG_WARNING, "filter is there\n");
+	/*
+                AST_LIST_TRAVERSE_SAFE_BEGIN(channels, filter, next) {
+                        ast_log(LOG_WARNING, "filter!!!\n");
+                        if (filter->chan) {
+                                ast_log(LOG_WARNING, "chan is %s\n", filter->chan->name);
+                        }
+                }
+                AST_LIST_TRAVERSE_SAFE_END;
+	return CLI_SUCCESS;
+	*/
+	/*
+        if ((channels = ast_threadstorage_get(&filter_channels, sizeof(*channels)))) {
+		ast_log(LOG_WARNING, "filter is there\n");
 		//AST_LIST_TRAVERSE_SAFE_BEGIN(&filter->list, chan, chan_list) {
-		AST_LIST_TRAVERSE_SAFE_BEGIN(&filter->list, fi, next) {
+		AST_LIST_TRAVERSE_SAFE_BEGIN(channels, filter, next) {
 			ast_log(LOG_WARNING, "filter!!!\n");
+			if (filter->chan) {
+				ast_log(LOG_WARNING, "chan is %s\n", filter->chan->name);
+			}
 		}
 		AST_LIST_TRAVERSE_SAFE_END;
 	}
-	/*
         AST_LIST_TRAVERSE(&ast_channels, filter, next) {
                 ast_cli(a->fd, "TLS channel name=%s\n", filter->chan->name);
         }
@@ -10097,52 +10081,3 @@
 	return ret;
 }
 
-static void filter_channel_cleanup(void *data)
-{
-	struct logger_filter_list_item *filter = data;
-
-	ast_log(LOG_WARNING, "%s is called. data=%p\n", __PRETTY_FUNCTION__, data );
-	if (filter ) {
-		ast_log(LOG_WARNING, "filter is there\n");
-		if ( filter->chan) {
-			ast_log(LOG_WARNING, "chan is there\n");
-		}
-	}
-        //filter = ast_malloc(sizeof(*filter));
-
-	/*
-        if ((filter = ast_threadstorage_get(&filter_channels, sizeof(*filter)))) {
-		ast_log(LOG_WARNING, "ive to remove \n");
-	}
-
-        while ((filter = AST_LIST_REMOVE_HEAD(&filter->list, next))) {
-		ast_log(LOG_WARNING, "filter has been removed.\n");
-                ast_free(filter);
-	}
-	*/
-}
-
-
-//http://pastebin.ca/1474652
-int tls_add_channel(struct ast_channel *chan){
-	struct logger_filter_list_item *filter;
-	struct logger_filter_list_item *fi;
-	int res = 0;
-	
-        if ((filter = ast_threadstorage_get(&filter_channels, sizeof(*filter)))) {
-                ast_log(LOG_WARNING, "Adding channel(%s) to channels_list\n", chan->name);
-		fi = ast_calloc(1, sizeof(*fi));
-                fi->chan = chan;
-                ast_log(LOG_WARNING, "TLS channel name is:%s\n", fi->chan->name);
-		//AST_LIST_INSERT_HEAD(&filter->list, chan, chan_list);
-		AST_LIST_INSERT_HEAD(&filter->list, fi, next);
-		//AST_RWLIST_INSERT_HEAD(&ast_channels, filter, next);
-		//AST_RWLIST_INSERT_HEAD(&filter->list, chan, chan_list);
-		//AST_RWLIST_INSERT_HEAD(&ast_channels, filter, next);
-        } else {
-                ast_log(LOG_WARNING, "Out of memory\n");
-		res = -1;
-        }
-	return res;
-}
-




More information about the asterisk-commits mailing list