[asterisk-commits] dlee: branch dlee/stasis-core r382660 - in /team/dlee/stasis-core: include/as...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 7 17:14:14 CST 2013


Author: dlee
Date: Thu Mar  7 17:14:11 2013
New Revision: 382660

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382660
Log:
Naming improvements

Modified:
    team/dlee/stasis-core/include/asterisk/channel.h
    team/dlee/stasis-core/include/asterisk/channel_internal.h
    team/dlee/stasis-core/main/channel.c
    team/dlee/stasis-core/main/channel_internal_api.c
    team/dlee/stasis-core/main/manager.c
    team/dlee/stasis-core/main/pbx.c

Modified: team/dlee/stasis-core/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-core/include/asterisk/channel.h?view=diff&rev=382660&r1=382659&r2=382660
==============================================================================
--- team/dlee/stasis-core/include/asterisk/channel.h (original)
+++ team/dlee/stasis-core/include/asterisk/channel.h Thu Mar  7 17:14:11 2013
@@ -4167,14 +4167,14 @@
  * \retval Topic for channel's events.
  * \retval \c NULL if \a chan is \c NULL.
  */
-struct stasis_topic *ast_channel_events(struct ast_channel *chan);
+struct stasis_topic *ast_channel_topic(struct ast_channel *chan);
 
 /*!
  * \since 12
  * \brief A topic which publishes the events for all channels.
  * \retval Topic for all channel events.
  */
-struct stasis_topic *ast_channel_events_all(void);
+struct stasis_topic *ast_channel_topic_all(void);
 
 /*!
  * \since 12
@@ -4183,13 +4183,13 @@
  *
  * \retval Topic for all channel events.
  */
-struct stasis_caching_topic *ast_channel_events_all_cached(void);
+struct stasis_caching_topic *ast_channel_topic_all_cached(void);
 
 /*!
  * \since 12
  * \brief Variable set event.
  */
-struct ast_channel_varset_event {
+struct ast_channel_varset {
 	/*! Channel variable was set on (or NULL for global variable) */
 	struct ast_channel_snapshot *snapshot;
 	/*! Variable name */
@@ -4200,21 +4200,21 @@
 
 /*!
  * \since 12
- * \brief Message type for \ref ast_channel_varset_event messages.
- *
- * \retval Message type for \ref ast_channel_varset_event messages.
- */
-struct stasis_message_type *ast_channel_varset_event(void);
+ * \brief Message type for \ref ast_channel_varset messages.
+ *
+ * \retval Message type for \ref ast_channel_varset messages.
+ */
+struct stasis_message_type *ast_channel_varset(void);
 
 /*!
  * \since 12
- * \brief Publish a \ref ast_channel_varset_event for a channel.
+ * \brief Publish a \ref ast_channel_varset for a channel.
  *
  * \param chan Channel to pulish the event for, or \c NULL for 'none'.
  * \param variable Name of the variable being set
  * \param value Value.
  */
-void ast_channel_send_varset_event(struct ast_channel *chan,
-				   const char *variable, const char *value);
+void ast_channel_publish_varset(struct ast_channel *chan,
+				const char *variable, const char *value);
 
 #endif /* _ASTERISK_CHANNEL_H */

Modified: team/dlee/stasis-core/include/asterisk/channel_internal.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-core/include/asterisk/channel_internal.h?view=diff&rev=382660&r1=382659&r2=382660
==============================================================================
--- team/dlee/stasis-core/include/asterisk/channel_internal.h (original)
+++ team/dlee/stasis-core/include/asterisk/channel_internal.h Thu Mar  7 17:14:11 2013
@@ -23,5 +23,5 @@
 void ast_channel_internal_finalize(struct ast_channel *chan);
 int ast_channel_internal_is_finalized(struct ast_channel *chan);
 void ast_channel_internal_cleanup(struct ast_channel *chan);
-void ast_channel_internal_setup_events(struct ast_channel *chan);
+void ast_channel_internal_setup_topics(struct ast_channel *chan);
 

Modified: team/dlee/stasis-core/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-core/main/channel.c?view=diff&rev=382660&r1=382659&r2=382660
==============================================================================
--- team/dlee/stasis-core/main/channel.c (original)
+++ team/dlee/stasis-core/main/channel.c Thu Mar  7 17:14:11 2013
@@ -155,11 +155,11 @@
 /*! \brief Message type for channel snapshot events */
 static struct stasis_message_type *__channel_snapshot;
 
-static struct stasis_message_type *__channel_varset_event;
-
-struct stasis_topic *__channel_events_all;
-
-struct stasis_caching_topic *__channel_events_all_cached;
+static struct stasis_message_type *__channel_varset;
+
+struct stasis_topic *__channel_topic_all;
+
+struct stasis_caching_topic *__channel_topic_all_cached;
 
 /*! \brief map AST_CAUSE's to readable string representations
  *
@@ -239,24 +239,24 @@
 		return;
 	}
 
-	ast_assert(ast_channel_events(chan) != NULL);
-	stasis_publish(ast_channel_events(chan), message);
-}
-
-static void channel_varset_event_dtor(void *obj)
-{
-	struct ast_channel_varset_event *event = obj;
+	ast_assert(ast_channel_topic(chan) != NULL);
+	stasis_publish(ast_channel_topic(chan), message);
+}
+
+static void channel_varset_dtor(void *obj)
+{
+	struct ast_channel_varset *event = obj;
 	ao2_cleanup(event->snapshot);
 	ast_free(event->variable);
 	ast_free(event->value);
 }
 
-void ast_channel_send_varset_event(struct ast_channel *chan, const char *name, const char *value)
-{
-	RAII_VAR(struct ast_channel_varset_event *, event, NULL, ao2_cleanup);
+void ast_channel_publish_varset(struct ast_channel *chan, const char *name, const char *value)
+{
+	RAII_VAR(struct ast_channel_varset *, event, NULL, ao2_cleanup);
 	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
 
-	event = ao2_alloc(sizeof(*event), channel_varset_event_dtor);
+	event = ao2_alloc(sizeof(*event), channel_varset_dtor);
 	if (!event) {
 		return;
 	}
@@ -273,15 +273,15 @@
 		return;
 	}
 
-	msg = stasis_message_create(ast_channel_varset_event(), event);
+	msg = stasis_message_create(ast_channel_varset(), event);
 	if (!msg) {
 		return;
 	}
 
 	if (chan) {
-		stasis_publish(ast_channel_events(chan), msg);
+		stasis_publish(ast_channel_topic(chan), msg);
 	} else {
-		stasis_publish(ast_channel_events_all(), msg);
+		stasis_publish(ast_channel_topic_all(), msg);
 	}
 }
 
@@ -291,7 +291,7 @@
 	RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
 
 	message = stasis_cache_clear_create(ast_channel_snapshot(), ast_channel_uniqueid(chan));
-	stasis_publish(ast_channel_events(chan), message);
+	stasis_publish(ast_channel_topic(chan), message);
 }
 
 struct ast_variable *ast_channeltype_list(void)
@@ -1153,7 +1153,7 @@
 		ast_channel_linkedid_set(tmp, ast_channel_uniqueid(tmp));
 	}
 
-	ast_channel_internal_setup_events(tmp);
+	ast_channel_internal_setup_topics(tmp);
 
 	if (!ast_strlen_zero(name_fmt)) {
 		char *slash, *slash2;
@@ -8631,12 +8631,12 @@
 {
 	ao2_cleanup(__channel_snapshot);
 	__channel_snapshot = NULL;
-	ao2_cleanup(__channel_varset_event);
-	__channel_varset_event = NULL;
-	ao2_cleanup(__channel_events_all);
-	__channel_events_all = NULL;
-	stasis_caching_unsubscribe(__channel_events_all_cached);
-	__channel_events_all_cached = NULL;
+	ao2_cleanup(__channel_varset);
+	__channel_varset = NULL;
+	ao2_cleanup(__channel_topic_all);
+	__channel_topic_all = NULL;
+	stasis_caching_unsubscribe(__channel_topic_all_cached);
+	__channel_topic_all_cached = NULL;
 	ast_data_unregister(NULL);
 	ast_cli_unregister_multiple(cli_channel, ARRAY_LEN(cli_channel));
 	if (channels) {
@@ -8665,10 +8665,10 @@
 	}
 
 	__channel_snapshot = stasis_message_type_create("ast_channel_snapshot");
-	__channel_varset_event = stasis_message_type_create("ast_channel_varset_event");
-
-	__channel_events_all = stasis_topic_create("ast_channel_events_all");
-	__channel_events_all_cached = stasis_caching_topic_create(__channel_events_all, channel_snapshot_get_id);
+	__channel_varset = stasis_message_type_create("ast_channel_varset");
+
+	__channel_topic_all = stasis_topic_create("ast_channel_topic_all");
+	__channel_topic_all_cached = stasis_caching_topic_create(__channel_topic_all, channel_snapshot_get_id);
 
 	ast_cli_register_multiple(cli_channel, ARRAY_LEN(cli_channel));
 
@@ -11304,9 +11304,9 @@
 	return snapshot;
 }
 
-struct stasis_message_type *ast_channel_varset_event(void)
-{
-	return __channel_varset_event;
+struct stasis_message_type *ast_channel_varset(void)
+{
+	return __channel_varset;
 }
 
 struct stasis_message_type *ast_channel_snapshot(void)
@@ -11314,14 +11314,14 @@
 	return __channel_snapshot;
 }
 
-struct stasis_topic *ast_channel_events_all(void)
-{
-	return __channel_events_all;
-}
-
-struct stasis_caching_topic *ast_channel_events_all_cached(void)
-{
-	return __channel_events_all_cached;
+struct stasis_topic *ast_channel_topic_all(void)
+{
+	return __channel_topic_all;
+}
+
+struct stasis_caching_topic *ast_channel_topic_all_cached(void)
+{
+	return __channel_topic_all_cached;
 }
 
 /* DO NOT PUT ADDITIONAL FUNCTIONS BELOW THIS BOUNDARY

Modified: team/dlee/stasis-core/main/channel_internal_api.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-core/main/channel_internal_api.c?view=diff&rev=382660&r1=382659&r2=382660
==============================================================================
--- team/dlee/stasis-core/main/channel_internal_api.c (original)
+++ team/dlee/stasis-core/main/channel_internal_api.c Thu Mar  7 17:14:11 2013
@@ -1384,15 +1384,15 @@
 	return chan->finalized;
 }
 
-struct stasis_topic *ast_channel_events(struct ast_channel *chan)
+struct stasis_topic *ast_channel_topic(struct ast_channel *chan)
 {
 	return chan->topic;
 }
 
-void ast_channel_internal_setup_events(struct ast_channel *chan)
+void ast_channel_internal_setup_topics(struct ast_channel *chan)
 {
 	ast_assert(chan->topic == NULL);
 	ast_assert(chan->forwarder == NULL);
 	chan->topic = stasis_topic_create(chan->uniqueid);
-	chan->forwarder = stasis_forward_all(chan->topic, ast_channel_events_all());
-}
+	chan->forwarder = stasis_forward_all(chan->topic, ast_channel_topic_all());
+}

Modified: team/dlee/stasis-core/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-core/main/manager.c?view=diff&rev=382660&r1=382659&r2=382660
==============================================================================
--- team/dlee/stasis-core/main/manager.c (original)
+++ team/dlee/stasis-core/main/manager.c Thu Mar  7 17:14:11 2013
@@ -7559,11 +7559,11 @@
 				stasis_message_data(update->new_snapshot);
 			channel_snapshot_update(old_snapshot, new_snapshot);
 		}
-	} else if (stasis_message_type(message) == ast_channel_varset_event()) {
-		struct ast_channel_varset_event *event = stasis_message_data(message);
-		const char *name = event->snapshot ?event->snapshot->name : "none";
-		const char *uniqueid = event->snapshot ?event->snapshot->uniqueid : "none";
-		channel_varset(name, uniqueid, event->variable, event->value);
+	} else if (stasis_message_type(message) == ast_channel_varset()) {
+		struct ast_channel_varset *varset = stasis_message_data(message);
+		const char *name = varset->snapshot ? varset->snapshot->name : "none";
+		const char *uniqueid = varset->snapshot ? varset->snapshot->uniqueid : "none";
+		channel_varset(name, uniqueid, varset->variable, varset->value);
 	}
 }
 
@@ -7686,7 +7686,7 @@
 
 	if (!channel_state_sub) {
 		channel_state_sub = stasis_subscribe(
-			stasis_caching_get_topic(ast_channel_events_all_cached()),
+			stasis_caching_get_topic(ast_channel_topic_all_cached()),
 			channel_event_cb, NULL);
 	}
 

Modified: team/dlee/stasis-core/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-core/main/pbx.c?view=diff&rev=382660&r1=382659&r2=382660
==============================================================================
--- team/dlee/stasis-core/main/pbx.c (original)
+++ team/dlee/stasis-core/main/pbx.c Thu Mar  7 17:14:11 2013
@@ -11453,7 +11453,7 @@
 			ast_verb(2, "Setting global variable '%s' to '%s'\n", name, value);
 		newvariable = ast_var_assign(name, value);
 		AST_LIST_INSERT_HEAD(headp, newvariable, entries);
-		ast_channel_send_varset_event(chan, name, value);
+		ast_channel_publish_varset(chan, name, value);
 	}
 
 	if (chan)




More information about the asterisk-commits mailing list