[asterisk-commits] dlee: branch dlee/stasis-app r384292 - in /team/dlee/stasis-app: ./ apps/ inc...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 28 13:30:13 CDT 2013


Author: dlee
Date: Thu Mar 28 13:30:09 2013
New Revision: 384292

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=384292
Log:
Break the world. Stasis message type accessors should now all be named correctly.
........

Merged revisions 384261 from http://svn.asterisk.org/svn/asterisk/trunk

Modified:
    team/dlee/stasis-app/   (props changed)
    team/dlee/stasis-app/apps/app_stasis.c
    team/dlee/stasis-app/apps/app_voicemail.c
    team/dlee/stasis-app/include/asterisk/channel.h
    team/dlee/stasis-app/include/asterisk/stasis.h
    team/dlee/stasis-app/main/app.c
    team/dlee/stasis-app/main/channel.c
    team/dlee/stasis-app/main/manager_channels.c
    team/dlee/stasis-app/main/pbx.c
    team/dlee/stasis-app/main/stasis.c
    team/dlee/stasis-app/main/stasis_cache.c
    team/dlee/stasis-app/pbx/pbx_realtime.c
    team/dlee/stasis-app/tests/test_stasis.c

Propchange: team/dlee/stasis-app/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Mar 28 13:30:09 2013
@@ -1,1 +1,1 @@
-/trunk:1-384234
+/trunk:1-384291

Modified: team/dlee/stasis-app/apps/app_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/apps/app_stasis.c?view=diff&rev=384292&r1=384291&r2=384292
==============================================================================
--- team/dlee/stasis-app/apps/app_stasis.c (original)
+++ team/dlee/stasis-app/apps/app_stasis.c Thu Mar 28 13:30:09 2013
@@ -323,7 +323,7 @@
 static void sub_handler(void *data, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *message)
 {
 	struct app *app = data;
-	if (ast_channel_snapshot() == stasis_message_type(message)) {
+	if (ast_channel_snapshot_type() == stasis_message_type(message)) {
 		RAII_VAR(struct ast_json *, msg, NULL, ast_json_unref);
 		struct ast_channel_snapshot *snapshot = stasis_message_data(message);
 

Modified: team/dlee/stasis-app/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/apps/app_voicemail.c?view=diff&rev=384292&r1=384291&r2=384292
==============================================================================
--- team/dlee/stasis-app/apps/app_voicemail.c (original)
+++ team/dlee/stasis-app/apps/app_voicemail.c Thu Mar 28 13:30:09 2013
@@ -12627,7 +12627,7 @@
 {
 	struct stasis_subscription_change *change;
 	/* Only looking for subscription change notices here */
-	if (stasis_message_type(msg) != stasis_subscription_change()) {
+	if (stasis_message_type(msg) != stasis_subscription_change_type()) {
 		return;
 	}
 
@@ -12656,7 +12656,7 @@
 	mwi_sub_sub = stasis_subscribe(stasis_mwi_topic_all(), mwi_event_cb, NULL);
 
 	if (mwi_sub_sub) {
-		struct ao2_container *cached = stasis_cache_dump(stasis_mwi_topic_cached(), stasis_subscription_change());
+		struct ao2_container *cached = stasis_cache_dump(stasis_mwi_topic_cached(), stasis_subscription_change_type());
 		if (cached) {
 			ao2_callback(cached, OBJ_MULTIPLE | OBJ_NODATA, dump_cache, NULL);
 		}

Modified: team/dlee/stasis-app/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/include/asterisk/channel.h?view=diff&rev=384292&r1=384291&r2=384292
==============================================================================
--- team/dlee/stasis-app/include/asterisk/channel.h (original)
+++ team/dlee/stasis-app/include/asterisk/channel.h Thu Mar 28 13:30:09 2013
@@ -4186,7 +4186,7 @@
  *
  * \retval Message type for \ref ast_channel_snapshot.
  */
-struct stasis_message_type *ast_channel_snapshot(void);
+struct stasis_message_type *ast_channel_snapshot_type(void);
 
 /*!
  * \since 12
@@ -4237,7 +4237,7 @@
  *
  * \retval Message type for \ref ast_channel_blob messages.
  */
-struct stasis_message_type *ast_channel_blob(void);
+struct stasis_message_type *ast_channel_blob_type(void);
 
 /*!
  * \since 12
@@ -4247,7 +4247,7 @@
  * \return Type field value from the blob.
  * \return \c NULL on error.
  */
-const char *ast_channel_blob_type(struct ast_channel_blob *obj);
+const char *ast_channel_blob_json_type(struct ast_channel_blob *obj);
 
 /*!
  * \since 12

Modified: team/dlee/stasis-app/include/asterisk/stasis.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/include/asterisk/stasis.h?view=diff&rev=384292&r1=384291&r2=384292
==============================================================================
--- team/dlee/stasis-app/include/asterisk/stasis.h (original)
+++ team/dlee/stasis-app/include/asterisk/stasis.h Thu Mar 28 13:30:09 2013
@@ -377,7 +377,7 @@
  * \return The stasis_message_type for subscription change notices
  * \since 12
  */
-struct stasis_message_type *stasis_subscription_change(void);
+struct stasis_message_type *stasis_subscription_change_type(void);
 
 /*! @} */
 
@@ -413,7 +413,7 @@
  * \return Message type for cache update messages.
  * \since 12
  */
-struct stasis_message_type *stasis_cache_update(void);
+struct stasis_message_type *stasis_cache_update_type(void);
 
 /*!
  * \brief Cache update message

Modified: team/dlee/stasis-app/main/app.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/main/app.c?view=diff&rev=384292&r1=384291&r2=384292
==============================================================================
--- team/dlee/stasis-app/main/app.c (original)
+++ team/dlee/stasis-app/main/app.c Thu Mar 28 13:30:09 2013
@@ -2719,7 +2719,7 @@
 	if (stasis_mwi_state_type() == stasis_message_type(message)) {
 		struct stasis_mwi_state *mwi_state = stasis_message_data(message);
 		return mwi_state->uniqueid;
-	} else if (stasis_subscription_change() == stasis_message_type(message)) {
+	} else if (stasis_subscription_change_type() == stasis_message_type(message)) {
 		struct stasis_subscription_change *change = stasis_message_data(message);
 		return change->uniqueid;
 	}

Modified: team/dlee/stasis-app/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/main/channel.c?view=diff&rev=384292&r1=384291&r2=384292
==============================================================================
--- team/dlee/stasis-app/main/channel.c (original)
+++ team/dlee/stasis-app/main/channel.c Thu Mar 28 13:30:09 2013
@@ -153,13 +153,13 @@
 static struct ao2_container *channels;
 
 /*! \brief Message type for channel snapshot events */
-static struct stasis_message_type *__channel_snapshot;
-
-static struct stasis_message_type *__channel_blob;
-
-struct stasis_topic *__channel_topic_all;
-
-struct stasis_caching_topic *__channel_topic_all_cached;
+static struct stasis_message_type *channel_snapshot_type;
+
+static struct stasis_message_type *channel_blob_type;
+
+struct stasis_topic *channel_topic_all;
+
+struct stasis_caching_topic *channel_topic_all_cached;
 
 /*! \brief map AST_CAUSE's to readable string representations
  *
@@ -234,7 +234,7 @@
 		return;
 	}
 
-	message = stasis_message_create(ast_channel_snapshot(), snapshot);
+	message = stasis_message_create(ast_channel_snapshot_type(), snapshot);
 	if (!message) {
 		return;
 	}
@@ -291,7 +291,7 @@
 
 	obj->blob = ast_json_ref(blob);
 
-	msg = stasis_message_create(ast_channel_blob(), obj);
+	msg = stasis_message_create(ast_channel_blob_type(), obj);
 	if (!msg) {
 		return NULL;
 	}
@@ -300,7 +300,7 @@
 	return msg;
 }
 
-const char *ast_channel_blob_type(struct ast_channel_blob *obj)
+const char *ast_channel_blob_json_type(struct ast_channel_blob *obj)
 {
 	if (obj == NULL) {
 		return NULL;
@@ -329,7 +329,7 @@
 {
 	RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
 
-	message = stasis_cache_clear_create(ast_channel_snapshot(), ast_channel_uniqueid(chan));
+	message = stasis_cache_clear_create(ast_channel_snapshot_type(), ast_channel_uniqueid(chan));
 	stasis_publish(ast_channel_topic(chan), message);
 }
 
@@ -8701,13 +8701,13 @@
 static void channels_shutdown(void)
 {
 	free_channelvars();
-	ao2_cleanup(__channel_snapshot);
-	__channel_snapshot = NULL;
-	ao2_cleanup(__channel_blob);
-	__channel_blob = NULL;
-	ao2_cleanup(__channel_topic_all);
-	__channel_topic_all = NULL;
-	__channel_topic_all_cached = stasis_caching_unsubscribe(__channel_topic_all_cached);
+	ao2_cleanup(channel_snapshot_type);
+	channel_snapshot_type = NULL;
+	ao2_cleanup(channel_blob_type);
+	channel_blob_type = NULL;
+	ao2_cleanup(channel_topic_all);
+	channel_topic_all = NULL;
+	channel_topic_all_cached = stasis_caching_unsubscribe(channel_topic_all_cached);
 	ast_data_unregister(NULL);
 	ast_cli_unregister_multiple(cli_channel, ARRAY_LEN(cli_channel));
 	if (channels) {
@@ -8720,7 +8720,7 @@
 static const char *channel_snapshot_get_id(struct stasis_message *message)
 {
 	struct ast_channel_snapshot *snapshot;
-	if (ast_channel_snapshot() != stasis_message_type(message)) {
+	if (ast_channel_snapshot_type() != stasis_message_type(message)) {
 		return NULL;
 	}
 	snapshot = stasis_message_data(message);
@@ -8735,11 +8735,11 @@
 		ao2_container_register("channels", channels, prnt_channel_key);
 	}
 
-	__channel_snapshot = stasis_message_type_create("ast_channel_snapshot");
-	__channel_blob = stasis_message_type_create("ast_channel_blob");
-
-	__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);
+	channel_snapshot_type = stasis_message_type_create("ast_channel_snapshot");
+	channel_blob_type = stasis_message_type_create("ast_channel_blob");
+
+	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));
 
@@ -11379,24 +11379,24 @@
 	return snapshot;
 }
 
-struct stasis_message_type *ast_channel_blob(void)
-{
-	return __channel_blob;
-}
-
-struct stasis_message_type *ast_channel_snapshot(void)
-{
-	return __channel_snapshot;
+struct stasis_message_type *ast_channel_blob_type(void)
+{
+	return channel_blob_type;
+}
+
+struct stasis_message_type *ast_channel_snapshot_type(void)
+{
+	return channel_snapshot_type;
 }
 
 struct stasis_topic *ast_channel_topic_all(void)
 {
-	return __channel_topic_all;
+	return channel_topic_all;
 }
 
 struct stasis_caching_topic *ast_channel_topic_all_cached(void)
 {
-	return __channel_topic_all_cached;
+	return channel_topic_all_cached;
 }
 
 /* DO NOT PUT ADDITIONAL FUNCTIONS BELOW THIS BOUNDARY

Modified: team/dlee/stasis-app/main/manager_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/main/manager_channels.c?view=diff&rev=384292&r1=384291&r2=384292
==============================================================================
--- team/dlee/stasis-app/main/manager_channels.c (original)
+++ team/dlee/stasis-app/main/manager_channels.c Thu Mar 28 13:30:09 2013
@@ -441,7 +441,7 @@
 
 	update = stasis_message_data(message);
 
-	if (ast_channel_snapshot() != update->type) {
+	if (ast_channel_snapshot_type() != update->type) {
 		return;
 	}
 
@@ -593,11 +593,11 @@
 {
 	struct ast_channel_blob *obj = stasis_message_data(message);
 
-	if (strcmp("varset", ast_channel_blob_type(obj)) == 0) {
+	if (strcmp("varset", ast_channel_blob_json_type(obj)) == 0) {
 		channel_varset(obj);
-	} else if (strcmp("userevent", ast_channel_blob_type(obj)) == 0) {
+	} else if (strcmp("userevent", ast_channel_blob_json_type(obj)) == 0) {
 		channel_userevent(obj);
-	} else if (strcmp("hangup_request", ast_channel_blob_type(obj)) == 0) {
+	} else if (strcmp("hangup_request", ast_channel_blob_json_type(obj)) == 0) {
 		channel_hangup_request(obj);
 	}
 }
@@ -627,12 +627,12 @@
 	}
 
 	ret |= stasis_message_router_add(channel_state_router,
-					 stasis_cache_update(),
+					 stasis_cache_update_type(),
 					 channel_snapshot_update,
 					 NULL);
 
 	ret |= stasis_message_router_add(channel_state_router,
-					 ast_channel_blob(),
+					 ast_channel_blob_type(),
 					 channel_blob_cb,
 					 NULL);
 

Modified: team/dlee/stasis-app/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/main/pbx.c?view=diff&rev=384292&r1=384291&r2=384292
==============================================================================
--- team/dlee/stasis-app/main/pbx.c (original)
+++ team/dlee/stasis-app/main/pbx.c Thu Mar 28 13:30:09 2013
@@ -4708,7 +4708,7 @@
 				 */
 				ast_string_field_set(snapshot, appl, app->name);
 				ast_string_field_set(snapshot, data, passdata);
-				msg = stasis_message_create(ast_channel_snapshot(), snapshot);
+				msg = stasis_message_create(ast_channel_snapshot_type(), snapshot);
 				if (msg) {
 					stasis_publish(ast_channel_topic(c), msg);
 				}

Modified: team/dlee/stasis-app/main/stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/main/stasis.c?view=diff&rev=384292&r1=384291&r2=384292
==============================================================================
--- team/dlee/stasis-app/main/stasis.c (original)
+++ team/dlee/stasis-app/main/stasis.c Thu Mar 28 13:30:09 2013
@@ -217,7 +217,7 @@
 int stasis_subscription_final_message(struct stasis_subscription *sub, struct stasis_message *msg)
 {
 	struct stasis_subscription_change *change;
-	if (stasis_message_type(msg) != stasis_subscription_change()) {
+	if (stasis_message_type(msg) != stasis_subscription_change_type()) {
 		return 0;
 	}
 
@@ -413,7 +413,7 @@
 	return change;
 }
 
-struct stasis_message_type *stasis_subscription_change(void)
+struct stasis_message_type *stasis_subscription_change_type(void)
 {
 	return __subscription_change_message_type;
 }
@@ -429,7 +429,7 @@
 		return;
 	}
 
-	msg = stasis_message_create(stasis_subscription_change(), change);
+	msg = stasis_message_create(stasis_subscription_change_type(), change);
 
 	if (!msg) {
 		return;

Modified: team/dlee/stasis-app/main/stasis_cache.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/main/stasis_cache.c?view=diff&rev=384292&r1=384291&r2=384292
==============================================================================
--- team/dlee/stasis-app/main/stasis_cache.c (original)
+++ team/dlee/stasis-app/main/stasis_cache.c Thu Mar 28 13:30:09 2013
@@ -250,7 +250,7 @@
 
 static struct stasis_message_type *__cache_update;
 
-struct stasis_message_type *stasis_cache_update(void)
+struct stasis_message_type *stasis_cache_update_type(void)
 {
 	ast_assert(__cache_update != NULL);
 	return __cache_update;
@@ -340,7 +340,7 @@
 		update->type = stasis_message_type(new_snapshot);
 	}
 
-	msg = stasis_message_create(stasis_cache_update(), update);
+	msg = stasis_message_create(stasis_cache_update_type(), update);
 	if (!msg) {
 		return NULL;
 	}

Modified: team/dlee/stasis-app/pbx/pbx_realtime.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/pbx/pbx_realtime.c?view=diff&rev=384292&r1=384291&r2=384292
==============================================================================
--- team/dlee/stasis-app/pbx/pbx_realtime.c (original)
+++ team/dlee/stasis-app/pbx/pbx_realtime.c Thu Mar 28 13:30:09 2013
@@ -363,7 +363,7 @@
 					 */
 					ast_string_field_set(snapshot, appl, app);
 					ast_string_field_set(snapshot, data, !ast_strlen_zero(appdata) ? appdata : "(NULL)");
-					msg = stasis_message_create(ast_channel_snapshot(), snapshot);
+					msg = stasis_message_create(ast_channel_snapshot_type(), snapshot);
 					if (msg) {
 						stasis_publish(ast_channel_topic(chan), msg);
 					}

Modified: team/dlee/stasis-app/tests/test_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/tests/test_stasis.c?view=diff&rev=384292&r1=384291&r2=384292
==============================================================================
--- team/dlee/stasis-app/tests/test_stasis.c (original)
+++ team/dlee/stasis-app/tests/test_stasis.c Thu Mar 28 13:30:09 2013
@@ -161,7 +161,7 @@
 	RAII_VAR(struct consumer *, consumer_needs_cleanup, NULL, ao2_cleanup);
 	SCOPED_MUTEX(lock, &consumer->lock);
 
-	if (!consumer->ignore_subscriptions || stasis_message_type(message) != stasis_subscription_change()) {
+	if (!consumer->ignore_subscriptions || stasis_message_type(message) != stasis_subscription_change_type()) {
 
 		++consumer->messages_rxed_len;
 		consumer->messages_rxed = ast_realloc(consumer->messages_rxed, sizeof(*consumer->messages_rxed) * consumer->messages_rxed_len);
@@ -282,8 +282,8 @@
 	ast_test_validate(test, 1 == complete);
 
 	ast_test_validate(test, 2 == consumer->messages_rxed_len);
-	ast_test_validate(test, stasis_subscription_change() == stasis_message_type(consumer->messages_rxed[0]));
-	ast_test_validate(test, stasis_subscription_change() == stasis_message_type(consumer->messages_rxed[1]));
+	ast_test_validate(test, stasis_subscription_change_type() == stasis_message_type(consumer->messages_rxed[0]));
+	ast_test_validate(test, stasis_subscription_change_type() == stasis_message_type(consumer->messages_rxed[1]));
 
 	change = stasis_message_data(consumer->messages_rxed[0]);
 	ast_test_validate(test, topic == change->topic);
@@ -606,7 +606,7 @@
 	cache_dump = NULL;
 
 	/* Check for new snapshot messages */
-	ast_test_validate(test, stasis_cache_update() == stasis_message_type(consumer->messages_rxed[0]));
+	ast_test_validate(test, stasis_cache_update_type() == stasis_message_type(consumer->messages_rxed[0]));
 	actual_update = stasis_message_data(consumer->messages_rxed[0]);
 	ast_test_validate(test, topic == actual_update->topic);
 	ast_test_validate(test, NULL == actual_update->old_snapshot);
@@ -615,7 +615,7 @@
 	/* stasis_cache_get returned a ref, so unref test_message1_1 */
 	ao2_ref(test_message1_1, -1);
 
-	ast_test_validate(test, stasis_cache_update() == stasis_message_type(consumer->messages_rxed[1]));
+	ast_test_validate(test, stasis_cache_update_type() == stasis_message_type(consumer->messages_rxed[1]));
 	actual_update = stasis_message_data(consumer->messages_rxed[1]);
 	ast_test_validate(test, topic == actual_update->topic);
 	ast_test_validate(test, NULL == actual_update->old_snapshot);
@@ -667,7 +667,7 @@
 	cache_dump = NULL;
 
 	/* Dump the cache to ensure that it has no subscription change items in it since those aren't cached */
-	cache_dump = stasis_cache_dump(caching_topic, stasis_subscription_change());
+	cache_dump = stasis_cache_dump(caching_topic, stasis_subscription_change_type());
 	ast_test_validate(test, 0 == ao2_container_count(cache_dump));
 	ao2_ref(cache_dump, -1);
 	cache_dump = NULL;




More information about the asterisk-commits mailing list