[svn-commits] russell: branch russell/ais r78352 - /team/russell/ais/res/res_ais.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Aug 7 11:42:49 CDT 2007


Author: russell
Date: Tue Aug  7 11:42:49 2007
New Revision: 78352

URL: http://svn.digium.com/view/asterisk?view=rev&rev=78352
Log:
Add a CLI command to show the configured event channels

Modified:
    team/russell/ais/res/res_ais.c

Modified: team/russell/ais/res/res_ais.c
URL: http://svn.digium.com/view/asterisk/team/russell/ais/res/res_ais.c?view=diff&rev=78352&r1=78351&r2=78352
==============================================================================
--- team/russell/ais/res/res_ais.c (original)
+++ team/russell/ais/res/res_ais.c Tue Aug  7 11:42:49 2007
@@ -349,7 +349,61 @@
 	return NULL;
 }
 
-static char *ais_clm_list(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+static char *ais_evt_show_event_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	struct event_channel *event_channel;
+
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "ais evt show event channels";
+		e->usage =
+			"Usage: ais evt show event channels\n"
+			"       List configured event channels for the (EVT) Eventing service.\n";
+		return NULL;
+
+	case CLI_GENERATE:
+		return NULL;	/* no completion */
+	}
+
+	if (a->argc != e->args)
+		return CLI_SHOWUSAGE;
+
+	ast_cli(a->fd, "\n"
+	            "=============================================================\n"
+	            "=== Event Channels ==========================================\n"
+	            "=============================================================\n"
+	            "===\n");
+
+	AST_RWLIST_RDLOCK(&event_channels);
+	AST_RWLIST_TRAVERSE(&event_channels, event_channel, entry) {
+		struct publish_event *publish_event;
+		struct subscribe_event *subscribe_event;
+
+		ast_cli(a->fd, "=== ---------------------------------------------------------\n"
+		               "=== Event Channel Name: %s\n", event_channel->name);
+
+		AST_LIST_TRAVERSE(&event_channel->publish_events, publish_event, entry) {
+			ast_cli(a->fd, "=== ==> Publishing Event Type: %s\n", 
+				type_to_filter_str(publish_event->type));
+		}
+		
+		AST_LIST_TRAVERSE(&event_channel->subscribe_events, subscribe_event, entry) {
+			ast_cli(a->fd, "=== ==> Subscribing to Event Type: %s\n", 
+				type_to_filter_str(subscribe_event->type));
+		}
+
+		ast_cli(a->fd, "=== ---------------------------------------------------------\n"
+		               "===\n");
+	}
+	AST_RWLIST_UNLOCK(&event_channels);
+
+	ast_cli(a->fd, "=============================================================\n"
+	               "\n");
+
+	return CLI_SUCCESS;
+}
+
+static char *ais_clm_show_members(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	int i, res;
 	SaClmClusterNotificationBufferT buf;
@@ -357,9 +411,9 @@
 
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "ais clm list";
+		e->command = "ais clm show members";
 		e->usage =
-			"Usage: ais clm list\n"
+			"Usage: ais clm show members\n"
 			"       List members of the cluster using the CLM (Cluster Membership) service.\n";
 		return NULL;
 
@@ -408,7 +462,8 @@
 }
 
 static struct ast_cli_entry ais_cli[] = {
-	NEW_CLI(ais_clm_list, "List current members of the cluster"),
+	NEW_CLI(ais_evt_show_event_channels, "Show configured event channels"),
+	NEW_CLI(ais_clm_show_members, "List current members of the cluster"),
 };
 
 static void add_publish_event(struct event_channel *event_channel, const char *event_type)




More information about the svn-commits mailing list