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/mwi.h"
#include "asterisk/stasis.h"
#include "asterisk/test.h"
Go to the source code of this file.
Data Structures | |
struct | publishers |
struct | subscriptions |
Macros | |
#define | MAILBOX_COUNT 500 |
#define | MAILBOX_PREFIX "test~" /* Hopefully sufficiently unlikely */ |
#define | MAILBOX_SIZE 32 |
#define | test_category "/mwi/" |
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 int | explicit_publish_cb (struct ast_mwi_state *mwi_state, void *data) |
static void | handle_validate (const char *mailbox, struct ast_mwi_subscriber *sub) |
static int | implicit_publish_cb (struct ast_mwi_state *mwi_state, void *data) |
static int | load_module (void) |
static int | mailbox_to_num (const char *mailbox, size_t *num) |
static void | mwi_type_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static int | num_to_mailbox (char *mailbox, size_t size, size_t num) |
static int | publish (on_mwi_state cb, void *user_data) |
static int | publishers_create (struct publishers *pubs) |
static int | publishers_destroy (struct publishers *pubs) |
static int | subscriptions_create (struct subscriptions *subs) |
static int | subscriptions_destroy (struct subscriptions *subs) |
static int | unload_module (void) |
static int | validate_data (struct ast_mwi_state *mwi_state) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "MWI 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_zero |
struct ast_mwi_observer | mwi_observer |
static size_t | running_total |
static size_t | sum_total |
#define MAILBOX_COUNT 500 |
Definition at line 36 of file test_mwi.c.
#define MAILBOX_PREFIX "test~" /* Hopefully sufficiently unlikely */ |
Definition at line 35 of file test_mwi.c.
#define MAILBOX_SIZE 32 |
Definition at line 37 of file test_mwi.c.
#define test_category "/mwi/" |
Definition at line 33 of file test_mwi.c.
|
static |
Definition at line 409 of file test_mwi.c.
|
static |
Definition at line 409 of file test_mwi.c.
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 409 of file test_mwi.c.
AST_TEST_DEFINE | ( | explicit_publish | ) |
Definition at line 362 of file test_mwi.c.
References AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, cleanup(), explicit_publish_cb(), sip_to_pjsip::info(), publish(), publishers_create(), publishers_destroy(), subscriptions_create(), subscriptions_destroy(), test_category, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | implicit_publish | ) |
Definition at line 333 of file test_mwi.c.
References AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, cleanup(), implicit_publish_cb(), sip_to_pjsip::info(), NULL, publish(), publishers_destroy(), subscriptions_create(), subscriptions_destroy(), test_category, TEST_EXECUTE, and TEST_INIT.
|
static |
Definition at line 273 of file test_mwi.c.
References ast_begins_with(), ast_log, ast_mwi_publish(), AST_VECTOR_GET, CMP_STOP, LOG_ERROR, MAILBOX_PREFIX, mailbox_to_num(), NULL, ast_mwi_state::uniqueid, and validate_data().
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 106 of file test_mwi.c.
References ao2_cleanup, ast_begins_with(), ast_mwi_subscriber_data(), MAILBOX_PREFIX, sub, ast_mwi_state::uniqueid, and validate_data().
|
static |
Definition at line 254 of file test_mwi.c.
References ast_begins_with(), ast_mwi_publish_by_mailbox(), CMP_STOP, MAILBOX_PREFIX, NULL, ast_mwi_state::uniqueid, and validate_data().
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 401 of file test_mwi.c.
References AST_MODULE_LOAD_SUCCESS, and AST_TEST_REGISTER.
|
static |
Definition at line 64 of file test_mwi.c.
References ast_log, ast_str_to_umax(), LOG_ERROR, voicemailpwcheck::mailbox, and tmp().
Referenced by explicit_publish_cb(), and validate_data().
|
static |
Definition at line 122 of file test_mwi.c.
Referenced by subscriptions_create().
|
static |
Definition at line 54 of file test_mwi.c.
References ast_log, LOG_ERROR, voicemailpwcheck::mailbox, and MAILBOX_PREFIX.
Referenced by publishers_create(), publishers_destroy(), and subscriptions_create().
|
static |
Definition at line 306 of file test_mwi.c.
References ast_log, ast_mwi_state_callback_all(), expect_zero, LOG_ERROR, running_total, and sum_total.
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 215 of file test_mwi.c.
References ao2_ref, ast_log, ast_mwi_add_publisher(), AST_VECTOR_APPEND, AST_VECTOR_INIT, LOG_ERROR, voicemailpwcheck::mailbox, MAILBOX_COUNT, MAILBOX_SIZE, num_to_mailbox(), and publishers_destroy().
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 190 of file test_mwi.c.
References ao2_cleanup, ast_delete_mwi_state, AST_VECTOR_CALLBACK_VOID, AST_VECTOR_FREE, voicemailpwcheck::mailbox, MAILBOX_COUNT, MAILBOX_SIZE, NULL, and num_to_mailbox().
Referenced by AST_TEST_DEFINE(), and publishers_create().
|
static |
Definition at line 145 of file test_mwi.c.
References ao2_ref, ast_log, ast_mwi_add_observer(), ast_mwi_subscribe_pool(), AST_VECTOR_APPEND, AST_VECTOR_INIT, expect_zero, LOG_ERROR, voicemailpwcheck::mailbox, MAILBOX_COUNT, MAILBOX_SIZE, mwi_observer, mwi_type_cb(), NULL, num_to_mailbox(), running_total, sub, subscriptions_destroy(), and sum_total.
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 127 of file test_mwi.c.
References ast_log, ast_mwi_remove_observer(), ast_mwi_unsubscribe_and_join(), AST_VECTOR_CALLBACK_VOID, AST_VECTOR_FREE, expect_zero, LOG_ERROR, mwi_observer, running_total, and sum_total.
Referenced by AST_TEST_DEFINE(), and subscriptions_create().
|
static |
Definition at line 393 of file test_mwi.c.
References AST_TEST_UNREGISTER.
|
static |
Definition at line 83 of file test_mwi.c.
References ast_log, expect_zero, LOG_ERROR, mailbox_to_num(), ast_mwi_state::new_msgs, ast_mwi_state::old_msgs, running_total, ast_mwi_state::uniqueid, and ast_mwi_state::urgent_msgs.
Referenced by explicit_publish_cb(), handle_validate(), and implicit_publish_cb().
|
static |
Definition at line 409 of file test_mwi.c.
|
static |
Definition at line 409 of file test_mwi.c.
|
static |
This value is set to check if MWI data is zero before publishing
Definition at line 52 of file test_mwi.c.
Referenced by publish(), subscriptions_create(), subscriptions_destroy(), and validate_data().
struct ast_mwi_observer mwi_observer |
Definition at line 117 of file test_mwi.c.
Referenced by subscriptions_create(), and subscriptions_destroy().
|
static |
Test variable that tracks the running total of mailboxes
Definition at line 49 of file test_mwi.c.
Referenced by publish(), subscriptions_create(), subscriptions_destroy(), and validate_data().
|
static |
For testing purposes each subscribed mailbox is a number. This value is the summation of all mailboxes.
Definition at line 46 of file test_mwi.c.
Referenced by publish(), subscriptions_create(), and subscriptions_destroy().