Break the world. Stasis message type accessors should now all be named correctly.
authorKinsey Moore <kmoore@digium.com>
Thu, 28 Mar 2013 15:45:18 +0000 (15:45 +0000)
committerKinsey Moore <kmoore@digium.com>
Thu, 28 Mar 2013 15:45:18 +0000 (15:45 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384261 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_voicemail.c
include/asterisk/channel.h
include/asterisk/stasis.h
main/app.c
main/channel.c
main/manager_channels.c
main/pbx.c
main/stasis.c
main/stasis_cache.c
pbx/pbx_realtime.c
tests/test_stasis.c

index f177869..a05c34c 100644 (file)
@@ -12627,7 +12627,7 @@ static void mwi_event_cb(void *userdata, struct stasis_subscription *sub, struct
 {
        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 @@ static void start_poll_thread(void)
        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);
                }
index 30a05a1..91d2f80 100644 (file)
@@ -4186,7 +4186,7 @@ struct ast_channel_snapshot *ast_channel_snapshot_create(struct ast_channel *cha
  *
  * \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 @@ struct ast_channel_blob {
  *
  * \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 @@ struct stasis_message_type *ast_channel_blob(void);
  * \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
index 936a75d..07c3c5c 100644 (file)
@@ -377,7 +377,7 @@ struct stasis_subscription_change {
  * \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 @@ struct stasis_topic *stasis_topic_pool_get_topic(struct stasis_topic_pool *pool,
  * \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
index 307a9d6..bf36c5a 100644 (file)
@@ -2719,7 +2719,7 @@ static const char *mwi_state_get_id(struct stasis_message *message)
        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;
        }
index 56752f8..fd5ac67 100644 (file)
@@ -153,13 +153,13 @@ static AST_RWLIST_HEAD_STATIC(backends, chanlist);
 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_snapshot_type;
 
-static struct stasis_message_type *__channel_blob;
+static struct stasis_message_type *channel_blob_type;
 
-struct stasis_topic *__channel_topic_all;
+struct stasis_topic *channel_topic_all;
 
-struct stasis_caching_topic *__channel_topic_all_cached;
+struct stasis_caching_topic *channel_topic_all_cached;
 
 /*! \brief map AST_CAUSE's to readable string representations
  *
@@ -234,7 +234,7 @@ static void publish_channel_state(struct ast_channel *chan)
                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 @@ struct stasis_message *ast_channel_blob_create(struct ast_channel *chan,
 
        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 @@ struct stasis_message *ast_channel_blob_create(struct ast_channel *chan,
        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 @@ static void publish_cache_clear(struct ast_channel *chan)
 {
        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 @@ struct varshead *ast_channel_get_manager_vars(struct ast_channel *chan)
 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 void channels_shutdown(void)
 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 @@ void ast_channels_init(void)
                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_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);
+       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 @@ struct ast_channel_snapshot *ast_channel_snapshot_create(struct ast_channel *cha
        return snapshot;
 }
 
-struct stasis_message_type *ast_channel_blob(void)
+struct stasis_message_type *ast_channel_blob_type(void)
 {
-       return __channel_blob;
+       return channel_blob_type;
 }
 
-struct stasis_message_type *ast_channel_snapshot(void)
+struct stasis_message_type *ast_channel_snapshot_type(void)
 {
-       return __channel_snapshot;
+       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
index abeffe3..ce8e087 100644 (file)
@@ -441,7 +441,7 @@ static void channel_snapshot_update(void *data, struct stasis_subscription *sub,
 
        update = stasis_message_data(message);
 
-       if (ast_channel_snapshot() != update->type) {
+       if (ast_channel_snapshot_type() != update->type) {
                return;
        }
 
@@ -593,11 +593,11 @@ static void channel_blob_cb(void *data, struct stasis_subscription *sub,
 {
        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 @@ int manager_channels_init(void)
        }
 
        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);
 
index 5d5ef95..bc79cff 100644 (file)
@@ -4708,7 +4708,7 @@ static int pbx_extension_helper(struct ast_channel *c, struct ast_context *con,
                                 */
                                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);
                                }
index f513dcd..d1baa44 100644 (file)
@@ -217,7 +217,7 @@ const char *stasis_subscription_uniqueid(const struct stasis_subscription *sub)
 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 @@ static struct stasis_subscription_change *subscription_change_alloc(struct stasi
        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 @@ static void send_subscription_change_message(struct stasis_topic *topic, char *u
                return;
        }
 
-       msg = stasis_message_create(stasis_subscription_change(), change);
+       msg = stasis_message_create(stasis_subscription_change_type(), change);
 
        if (!msg) {
                return;
index 85c8239..7b6dc82 100644 (file)
@@ -250,7 +250,7 @@ static struct stasis_message_type *cache_clear_data(void)
 
 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 @@ static struct stasis_message *update_create(struct stasis_topic *topic, struct s
                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;
        }
index d1cb5ed..65685e0 100644 (file)
@@ -363,7 +363,7 @@ static int realtime_exec(struct ast_channel *chan, const char *context, const ch
                                         */
                                        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);
                                        }
index 4c50723..52d510f 100644 (file)
@@ -161,7 +161,7 @@ static void consumer_exec(void *data, struct stasis_subscription *sub, struct st
        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_DEFINE(subscription_messages)
        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 @@ AST_TEST_DEFINE(cache)
        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 @@ AST_TEST_DEFINE(cache)
        /* 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 @@ AST_TEST_DEFINE(cache)
        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;