Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
#include "asterisk.h"
#include "asterisk/astobj2.h"
#include "asterisk/conversions.h"
#include "asterisk/module.h"
#include "asterisk/stasis_state.h"
#include "asterisk/test.h"
Go to the source code of this file.
Data Structures | |
struct | foo_data |
struct | publishers |
struct | subscriptions |
Macros | |
#define | MANAGER_TOPIC "foo" |
#define | test_category "/stasis/core/state/" |
#define | TOPIC_COUNT 500 |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
AST_TEST_DEFINE (explicit_publish) | |
AST_TEST_DEFINE (implicit_publish) | |
static struct stasis_message * | create_foo_type_message (const char *id) |
static int | explicit_publish_cb (const char *id, struct stasis_message *msg, void *user_data) |
struct stasis_message_type * | foo_type (void) |
static void | foo_type_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static void | handle_validate (const char *id, struct stasis_state_subscriber *sub) |
static int | implicit_publish_cb (const char *id, struct stasis_message *msg, void *user_data) |
static int | load_module (void) |
static int | publish (struct stasis_state_manager *manager, on_stasis_state cb, void *user_data) |
static int | publishers_create (struct stasis_state_manager *manager, struct publishers *pubs) |
static int | publishers_destroy (struct stasis_state_manager *manager, struct publishers *pubs) |
STASIS_MESSAGE_TYPE_DEFN (foo_type) | |
static int | subscriptions_create (struct stasis_state_manager *manager, struct subscriptions *subs) |
static int | subscriptions_destroy (struct stasis_state_manager *manager, struct subscriptions *subs) |
static int | unload_module (void) |
static int | validate_data (const char *id, struct foo_data *foo) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Stasis state testing" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static int | expect_null |
struct stasis_state_observer | foo_observer |
static size_t | running_total |
static size_t | sum_total |
#define MANAGER_TOPIC "foo" |
Definition at line 36 of file test_stasis_state.c.
#define test_category "/stasis/core/state/" |
Definition at line 32 of file test_stasis_state.c.
#define TOPIC_COUNT 500 |
Definition at line 34 of file test_stasis_state.c.
|
static |
Definition at line 470 of file test_stasis_state.c.
|
static |
Definition at line 470 of file test_stasis_state.c.
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 470 of file test_stasis_state.c.
AST_TEST_DEFINE | ( | explicit_publish | ) |
Definition at line 403 of file test_stasis_state.c.
References ao2_cleanup, ao2_ref, ast_log, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, cleanup(), explicit_publish_cb(), sip_to_pjsip::info(), LOG_ERROR, MANAGER_TOPIC, NULL, publish(), publishers_create(), publishers_destroy(), RAII_VAR, stasis_state_manager_create(), subscriptions_create(), subscriptions_destroy(), test_category, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | implicit_publish | ) |
Definition at line 360 of file test_stasis_state.c.
References ao2_cleanup, ao2_ref, ast_log, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, cleanup(), implicit_publish_cb(), sip_to_pjsip::info(), LOG_ERROR, MANAGER_TOPIC, NULL, publish(), publishers_destroy(), RAII_VAR, stasis_state_manager_create(), subscriptions_create(), subscriptions_destroy(), test_category, TEST_EXECUTE, and TEST_INIT.
|
static |
Definition at line 248 of file test_stasis_state.c.
References ao2_alloc, ao2_ref, ast_log, ast_str_to_umax(), foo_data::bar, foo_type(), LOG_ERROR, NULL, stasis_message_create_full(), and tmp().
Referenced by explicit_publish_cb(), and implicit_publish_cb().
|
static |
Definition at line 297 of file test_stasis_state.c.
References ao2_ref, ast_log, AST_VECTOR_GET, AST_VECTOR_SIZE, CMP_STOP, create_foo_type_message(), LOG_ERROR, NULL, stasis_message_data(), stasis_state_publish(), stasis_state_publisher_id(), and validate_data().
Referenced by AST_TEST_DEFINE().
struct stasis_message_type * foo_type | ( | void | ) |
Referenced by create_foo_type_message(), load_module(), and unload_module().
|
static |
Definition at line 110 of file test_stasis_state.c.
Referenced by subscriptions_create().
|
static |
Definition at line 98 of file test_stasis_state.c.
References ao2_cleanup, stasis_state_subscriber_data(), sub, and validate_data().
|
static |
Definition at line 276 of file test_stasis_state.c.
References ao2_ref, CMP_STOP, create_foo_type_message(), NULL, stasis_message_data(), stasis_state_publish_by_id(), and validate_data().
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 458 of file test_stasis_state.c.
References AST_MODULE_LOAD_SUCCESS, AST_TEST_REGISTER, foo_type(), and STASIS_MESSAGE_TYPE_INIT.
|
static |
Definition at line 332 of file test_stasis_state.c.
References ast_log, expect_null, LOG_ERROR, running_total, stasis_state_callback_all(), and sum_total.
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 207 of file test_stasis_state.c.
References ao2_ref, ast_log, AST_VECTOR_APPEND, AST_VECTOR_INIT, LOG_ERROR, publishers_destroy(), stasis_state_add_publisher(), and TOPIC_COUNT.
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 181 of file test_stasis_state.c.
References ao2_cleanup, ast_log, AST_VECTOR_CALLBACK_VOID, AST_VECTOR_FREE, LOG_ERROR, NULL, stasis_state_remove_publish_by_id(), and TOPIC_COUNT.
Referenced by AST_TEST_DEFINE(), and publishers_create().
STASIS_MESSAGE_TYPE_DEFN | ( | foo_type | ) |
foo stasis message type
|
static |
Definition at line 133 of file test_stasis_state.c.
References ao2_ref, ast_log, AST_VECTOR_APPEND, AST_VECTOR_INIT, expect_null, foo_observer, foo_type_cb(), LOG_ERROR, NULL, running_total, stasis_state_add_observer(), stasis_state_subscribe_pool(), sub, subscriptions_destroy(), sum_total, and TOPIC_COUNT.
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 115 of file test_stasis_state.c.
References ast_log, AST_VECTOR_CALLBACK_VOID, AST_VECTOR_FREE, expect_null, foo_observer, LOG_ERROR, running_total, stasis_state_remove_observer(), stasis_state_unsubscribe_and_join(), and sum_total.
Referenced by AST_TEST_DEFINE(), and subscriptions_create().
|
static |
Definition at line 448 of file test_stasis_state.c.
References AST_TEST_UNREGISTER, foo_type(), and STASIS_MESSAGE_TYPE_CLEANUP.
|
static |
Definition at line 63 of file test_stasis_state.c.
References ast_log, ast_str_to_umax(), foo_data::bar, expect_null, LOG_ERROR, running_total, and tmp().
Referenced by explicit_publish_cb(), handle_validate(), and implicit_publish_cb().
|
static |
Definition at line 470 of file test_stasis_state.c.
|
static |
Definition at line 470 of file test_stasis_state.c.
|
static |
This value is set to check if state data is NULL before publishing
Definition at line 61 of file test_stasis_state.c.
Referenced by publish(), subscriptions_create(), subscriptions_destroy(), and validate_data().
struct stasis_state_observer foo_observer |
Definition at line 105 of file test_stasis_state.c.
Referenced by subscriptions_create(), and subscriptions_destroy().
|
static |
Test variable that tracks the running total of state ids
Definition at line 58 of file test_stasis_state.c.
Referenced by publish(), subscriptions_create(), subscriptions_destroy(), and validate_data().
|
static |
For testing purposes each subscribed state's id is a number. This value is the summation of all id's.
Definition at line 55 of file test_stasis_state.c.
Referenced by publish(), subscriptions_create(), and subscriptions_destroy().