Asterisk - The Open Source Telephony Project GIT-master-f36a736
Data Structures | Macros | Functions | Variables
test_mwi.c File Reference
#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"
Include dependency graph for test_mwi.c:

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_moduleAST_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_infoast_module_info = &__mod_info
 
static int expect_zero
 
struct ast_mwi_observer mwi_observer
 
static size_t running_total
 
static size_t sum_total
 

Macro Definition Documentation

◆ MAILBOX_COUNT

#define MAILBOX_COUNT   500

Definition at line 36 of file test_mwi.c.

◆ MAILBOX_PREFIX

#define MAILBOX_PREFIX   "test~" /* Hopefully sufficiently unlikely */

Definition at line 35 of file test_mwi.c.

◆ MAILBOX_SIZE

#define MAILBOX_SIZE   32

Definition at line 37 of file test_mwi.c.

◆ test_category

#define test_category   "/mwi/"

Definition at line 33 of file test_mwi.c.

Function Documentation

◆ __reg_module()

static void __reg_module ( void  )
static

Definition at line 409 of file test_mwi.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 409 of file test_mwi.c.

◆ AST_MODULE_SELF_SYM()

struct ast_module * AST_MODULE_SELF_SYM ( void  )

Definition at line 409 of file test_mwi.c.

◆ AST_TEST_DEFINE() [1/2]

AST_TEST_DEFINE ( explicit_publish  )

Definition at line 362 of file test_mwi.c.

363{
364 struct subscriptions subs;
365 struct publishers pubs;
366 int rc = AST_TEST_PASS;
367
368 switch (cmd) {
369 case TEST_INIT:
370 info->name = __func__;
371 info->category = test_category;
372 info->summary = "Test explicit publishing of MWI state";
373 info->description = info->summary;
374 return AST_TEST_NOT_RUN;
375 case TEST_EXECUTE:
376 break;
377 }
378
379 ast_test_validate(test, !subscriptions_create(&subs));
380 ast_test_validate_cleanup(test, !publishers_create(&pubs), rc, cleanup);
381
382 ast_test_validate_cleanup(test, !publish(explicit_publish_cb, &pubs),
383 rc, cleanup);
384
385cleanup:
386 if (subscriptions_destroy(&subs) || publishers_destroy(&pubs)) {
387 return AST_TEST_FAIL;
388 }
389
390 return rc;
391}
def info(msg)
static void * cleanup(void *unused)
Definition: pbx_realtime.c:124
@ TEST_INIT
Definition: test.h:200
@ TEST_EXECUTE
Definition: test.h:201
@ AST_TEST_PASS
Definition: test.h:195
@ AST_TEST_FAIL
Definition: test.h:196
@ AST_TEST_NOT_RUN
Definition: test.h:194
static int subscriptions_destroy(struct subscriptions *subs)
Definition: test_mwi.c:127
static int publishers_create(struct publishers *pubs)
Definition: test_mwi.c:215
static int publishers_destroy(struct publishers *pubs)
Definition: test_mwi.c:190
#define test_category
Definition: test_mwi.c:33
static int publish(on_mwi_state cb, void *user_data)
Definition: test_mwi.c:306
static int subscriptions_create(struct subscriptions *subs)
Definition: test_mwi.c:145
static int explicit_publish_cb(struct ast_mwi_state *mwi_state, void *data)
Definition: test_mwi.c:273

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() [2/2]

AST_TEST_DEFINE ( implicit_publish  )

Definition at line 333 of file test_mwi.c.

334{
335 struct subscriptions subs;
336 int rc = AST_TEST_PASS;
337
338 switch (cmd) {
339 case TEST_INIT:
340 info->name = __func__;
341 info->category = test_category;
342 info->summary = "Test implicit publishing of MWI state";
343 info->description = info->summary;
344 return AST_TEST_NOT_RUN;
345 case TEST_EXECUTE:
346 break;
347 }
348
349 ast_test_validate(test, !subscriptions_create(&subs));
350
351 ast_test_validate_cleanup(test, !publish(implicit_publish_cb, NULL),
352 rc, cleanup);
353
354cleanup:
356 return AST_TEST_FAIL;
357 }
358
359 return rc;
360}
#define NULL
Definition: resample.c:96
static int implicit_publish_cb(struct ast_mwi_state *mwi_state, void *data)
Definition: test_mwi.c:254

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.

◆ explicit_publish_cb()

static int explicit_publish_cb ( struct ast_mwi_state mwi_state,
void *  data 
)
static

Definition at line 273 of file test_mwi.c.

274{
275 struct publishers *pubs = data;
276 struct ast_mwi_publisher *pub;
277 size_t num;
278
279 if (!ast_begins_with(mwi_state->uniqueid, MAILBOX_PREFIX)) {
280 /* Ignore any mailboxes not prefixed */
281 return 0;
282 }
283
284 num = validate_data(mwi_state);
285 if (num < 0) {
286 return CMP_STOP;
287 }
288
289 if (mailbox_to_num(mwi_state->uniqueid, &num)) {
290 return CMP_STOP;
291 }
292
293 /* Mailbox number will always be the index */
294 pub = AST_VECTOR_GET(pubs, num);
295
296 if (!pub) {
297 ast_log(LOG_ERROR, "Unable to locate MWI publisher for mailbox '%s'\n", mwi_state->uniqueid);
298 return CMP_STOP;
299 }
300
301 ast_mwi_publish(pub, num, num, num, NULL, NULL);
302
303 return 0;
304}
#define ast_log
Definition: astobj2.c:42
@ CMP_STOP
Definition: astobj2.h:1028
#define LOG_ERROR
int ast_mwi_publish(struct ast_mwi_publisher *publisher, int urgent_msgs, int new_msgs, int old_msgs, const char *channel_id, struct ast_eid *eid)
Publish MWI for the given mailbox.
Definition: mwi.c:358
static int force_inline attribute_pure ast_begins_with(const char *str, const char *prefix)
Checks whether a string begins with another.
Definition: strings.h:97
const ast_string_field uniqueid
Definition: mwi.h:458
static int mailbox_to_num(const char *mailbox, size_t *num)
Definition: test_mwi.c:64
static int validate_data(struct ast_mwi_state *mwi_state)
Definition: test_mwi.c:83
#define MAILBOX_PREFIX
Definition: test_mwi.c:35
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.
Definition: vector.h:680

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().

◆ handle_validate()

static void handle_validate ( const char *  mailbox,
struct ast_mwi_subscriber sub 
)
static

Definition at line 106 of file test_mwi.c.

107{
108 struct ast_mwi_state *mwi_state = ast_mwi_subscriber_data(sub);
109
110 if (ast_begins_with(mwi_state->uniqueid, MAILBOX_PREFIX)) {
111 validate_data(mwi_state);
112 }
113
114 ao2_cleanup(mwi_state);
115}
#define ao2_cleanup(obj)
Definition: astobj2.h:1934
struct ast_mwi_state * ast_mwi_subscriber_data(struct ast_mwi_subscriber *sub)
Retrieves the state data object associated with the MWI subscriber.
Definition: mwi.c:269
struct stasis_forward * sub
Definition: res_corosync.c:240
The structure that contains MWI state.
Definition: mwi.h:455

References ao2_cleanup, ast_begins_with(), ast_mwi_subscriber_data(), MAILBOX_PREFIX, sub, ast_mwi_state::uniqueid, and validate_data().

◆ implicit_publish_cb()

static int implicit_publish_cb ( struct ast_mwi_state mwi_state,
void *  data 
)
static

Definition at line 254 of file test_mwi.c.

255{
256 size_t num;
257
258 if (!ast_begins_with(mwi_state->uniqueid, MAILBOX_PREFIX)) {
259 /* Ignore any mailboxes not prefixed */
260 return 0;
261 }
262
263 num = validate_data(mwi_state);
264 if (num < 0) {
265 return CMP_STOP;
266 }
267
268 ast_mwi_publish_by_mailbox(mwi_state->uniqueid, NULL, num, num, num, NULL, NULL);
269
270 return 0;
271}
int ast_mwi_publish_by_mailbox(const char *mailbox, const char *context, int urgent_msgs, int new_msgs, int old_msgs, const char *channel_id, struct ast_eid *eid)
Publish MWI for the given mailbox.
Definition: mwi.c:375

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().

◆ load_module()

static int load_module ( void  )
static

Definition at line 401 of file test_mwi.c.

402{
403 AST_TEST_REGISTER(implicit_publish);
404 AST_TEST_REGISTER(explicit_publish);
405
407}
@ AST_MODULE_LOAD_SUCCESS
Definition: module.h:70
#define AST_TEST_REGISTER(cb)
Definition: test.h:127

References AST_MODULE_LOAD_SUCCESS, and AST_TEST_REGISTER.

◆ mailbox_to_num()

static int mailbox_to_num ( const char *  mailbox,
size_t *  num 
)
static

Definition at line 64 of file test_mwi.c.

65{
66 uintmax_t tmp;
67 const char *p = strchr(mailbox, '~');
68
69 if (!p) {
70 ast_log(LOG_ERROR, "Prefix separator '~' not found in '%s'\n", mailbox);
71 return -1;
72 }
73
74 if (ast_str_to_umax(++p, &tmp)) {
75 ast_log(LOG_ERROR, "Unable to convert mailbox '%s' to numeric\n", mailbox);
76 return -1;
77 }
78 *num = (size_t) tmp;
79
80 return 0;
81}
static int tmp()
Definition: bt_open.c:389
int ast_str_to_umax(const char *str, uintmax_t *res)
Convert the given string to an unsigned max size integer.
Definition: conversions.c:119

References ast_log, ast_str_to_umax(), LOG_ERROR, voicemailpwcheck::mailbox, and tmp().

Referenced by explicit_publish_cb(), and validate_data().

◆ mwi_type_cb()

static void mwi_type_cb ( void *  data,
struct stasis_subscription sub,
struct stasis_message message 
)
static

Definition at line 122 of file test_mwi.c.

123{
124 /* No op since we are not really testing stasis topic handling here */
125}

Referenced by subscriptions_create().

◆ num_to_mailbox()

static int num_to_mailbox ( char *  mailbox,
size_t  size,
size_t  num 
)
static

Definition at line 54 of file test_mwi.c.

55{
56 if (snprintf(mailbox, 10, MAILBOX_PREFIX "%zu", num) == -1) {
57 ast_log(LOG_ERROR, "Unable to convert mailbox to string\n");
58 return -1;
59 }
60
61 return 0;
62}

References ast_log, LOG_ERROR, voicemailpwcheck::mailbox, and MAILBOX_PREFIX.

Referenced by publishers_create(), publishers_destroy(), and subscriptions_create().

◆ publish()

static int publish ( on_mwi_state  cb,
void *  user_data 
)
static

Definition at line 306 of file test_mwi.c.

307{
308 /* First time there is no state data */
309 expect_zero = 1;
310
311 running_total = 0;
312 ast_mwi_state_callback_all(cb, user_data);
313
314 if (running_total != sum_total) {
315 ast_log(LOG_ERROR, "Failed MWI state callback (1): running=%zu, sum=%zu\n",
317 return -1;
318 }
319
320 /* Second time check valid state data exists */
322 ast_mwi_state_callback_all(cb, user_data);
323
324 if (running_total != sum_total) {
325 ast_log(LOG_ERROR, "Failed MWI state callback (2): running=%zu, sum=%zu\n",
327 return -1;
328 }
329
330 return 0;
331}
void ast_mwi_state_callback_all(on_mwi_state handler, void *data)
For each managed mailbox call the given handler.
Definition: mwi.c:338
static int expect_zero
Definition: test_mwi.c:52
static size_t sum_total
Definition: test_mwi.c:46
static size_t running_total
Definition: test_mwi.c:49

References ast_log, ast_mwi_state_callback_all(), expect_zero, LOG_ERROR, running_total, and sum_total.

Referenced by AST_TEST_DEFINE().

◆ publishers_create()

static int publishers_create ( struct publishers pubs)
static

Definition at line 215 of file test_mwi.c.

216{
217 size_t i;
218
219 if (AST_VECTOR_INIT(pubs, MAILBOX_COUNT)) {
220 return -1;
221 }
222
223 for (i = 0; i < MAILBOX_COUNT; ++i) {
224 struct ast_mwi_publisher *pub;
225 char mailbox[MAILBOX_SIZE];
226
228 break;
229 }
230
231 /* Create the MWI publisher */
233 if (!pub) {
234 ast_log(LOG_ERROR, "Failed to create an MWI publisher for mailbox '%s'\n", mailbox);
235 break;
236 }
237
238 if (AST_VECTOR_APPEND(pubs, pub)) {
239 ast_log(LOG_ERROR, "Failed to add to an MWI publisher to vector for mailbox '%s'\n", mailbox);
240 ao2_ref(pub, -1);
241 break;
242 }
243 }
244
245 if (i != MAILBOX_COUNT) {
246 ast_log(LOG_ERROR, "Failed to create all MWI publishers: count=%zu\n", i);
247 publishers_destroy(pubs);
248 return -1;
249 }
250
251 return 0;
252}
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:459
struct ast_mwi_publisher * ast_mwi_add_publisher(const char *mailbox)
Add an MWI state publisher to the mailbox.
Definition: mwi.c:295
static int num_to_mailbox(char *mailbox, size_t size, size_t num)
Definition: test_mwi.c:54
#define MAILBOX_COUNT
Definition: test_mwi.c:36
#define MAILBOX_SIZE
Definition: test_mwi.c:37
#define AST_VECTOR_INIT(vec, size)
Initialize a vector.
Definition: vector.h:113
#define AST_VECTOR_APPEND(vec, elem)
Append an element to a vector, growing the vector if needed.
Definition: vector.h:256

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().

◆ publishers_destroy()

static int publishers_destroy ( struct publishers pubs)
static

Definition at line 190 of file test_mwi.c.

191{
192 size_t i;
193
194 if (pubs) {
195 /* Remove explicit publishers */
197 AST_VECTOR_FREE(pubs);
198 return 0;
199 }
200
201 for (i = 0; i < MAILBOX_COUNT; ++i) {
202 char mailbox[MAILBOX_SIZE];
203
204 /* Remove implicit publishers */
206 return -1;
207 }
208
210 }
211
212 return 0;
213}
#define ast_delete_mwi_state(mailbox, context)
Delete MWI state cached by stasis.
Definition: mwi.h:431
#define AST_VECTOR_FREE(vec)
Deallocates this vector.
Definition: vector.h:174
#define AST_VECTOR_CALLBACK_VOID(vec, callback,...)
Execute a callback on every element in a vector disregarding callback return.
Definition: vector.h:862

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().

◆ subscriptions_create()

static int subscriptions_create ( struct subscriptions subs)
static

Definition at line 145 of file test_mwi.c.

146{
147 size_t i;
148
151 return -1;
152 }
153
155 expect_zero = 1;
156
157 for (i = 0; i < MAILBOX_COUNT; ++i) {
158 struct ast_mwi_subscriber *sub;
159 char mailbox[MAILBOX_SIZE];
160
162 break;
163 }
164
166 if (!sub) {
167 ast_log(LOG_ERROR, "Failed to create a MWI subscriber for mailbox '%s'\n", mailbox);
168 break;
169 }
170
171 if (AST_VECTOR_APPEND(subs, sub)) {
172 ast_log(LOG_ERROR, "Failed to add to MWI sub to vector for mailbox '%s'\n", mailbox);
173 ao2_ref(sub, -1);
174 break;
175 }
176
177 sum_total += i;
178 }
179
180 if (i != MAILBOX_COUNT || running_total != sum_total) {
181 ast_log(LOG_ERROR, "Failed to create all MWI subscriptions: running=%zu, sum=%zu\n",
184 return -1;
185 }
186
187 return 0;
188}
int ast_mwi_add_observer(struct ast_mwi_observer *observer)
Add an observer to receive MWI state related events.
Definition: mwi.c:301
struct ast_mwi_subscriber * ast_mwi_subscribe_pool(const char *mailbox, stasis_subscription_cb callback, void *data)
Add an MWI state subscriber, and stasis subscription to the mailbox.
Definition: mwi.c:235
static void mwi_type_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
Definition: test_mwi.c:122
struct ast_mwi_observer mwi_observer
Definition: test_mwi.c:117

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().

◆ subscriptions_destroy()

static int subscriptions_destroy ( struct subscriptions subs)
static

Definition at line 127 of file test_mwi.c.

128{
130
132 AST_VECTOR_FREE(subs);
133
135
136 if (running_total != sum_total) {
137 ast_log(LOG_ERROR, "Failed to destroy all MWI subscriptions: running=%zu, sum=%zu\n",
139 return -1;
140 }
141
142 return 0;
143}
void ast_mwi_remove_observer(struct ast_mwi_observer *observer)
Remove an MWI state observer.
Definition: mwi.c:307
void * ast_mwi_unsubscribe_and_join(struct ast_mwi_subscriber *sub)
Unsubscribe from the stasis topic, block until the final message is received, and then unsubscribe fr...
Definition: mwi.c:259

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().

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 393 of file test_mwi.c.

394{
395 AST_TEST_UNREGISTER(implicit_publish);
396 AST_TEST_UNREGISTER(explicit_publish);
397
398 return 0;
399}
#define AST_TEST_UNREGISTER(cb)
Definition: test.h:128

References AST_TEST_UNREGISTER.

◆ validate_data()

static int validate_data ( struct ast_mwi_state mwi_state)
static

Definition at line 83 of file test_mwi.c.

84{
85 size_t num;
86 size_t val;
87
88 if (mailbox_to_num(mwi_state->uniqueid, &num)) {
89 return -1;
90 }
91
92 running_total += num;
93
94 val = expect_zero ? 0 : num;
95
96 if (mwi_state->urgent_msgs != val || mwi_state->new_msgs != val ||
97 mwi_state->old_msgs != val) {
98 ast_log(LOG_ERROR, "Unexpected MWI state data for '%s', %d != %zu\n",
99 mwi_state->uniqueid, mwi_state->urgent_msgs, val);
100 return -1;
101 }
102
103 return num;
104}
int urgent_msgs
Definition: mwi.h:464
int old_msgs
Definition: mwi.h:460
int new_msgs
Definition: mwi.h:459
Definition: ast_expr2.c:325

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().

Variable Documentation

◆ __mod_info

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

Definition at line 409 of file test_mwi.c.

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 409 of file test_mwi.c.

◆ expect_zero

int expect_zero
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().

◆ mwi_observer

struct ast_mwi_observer mwi_observer
Initial value:
= {
.on_subscribe = handle_validate,
.on_unsubscribe = handle_validate
}
static void handle_validate(const char *mailbox, struct ast_mwi_subscriber *sub)
Definition: test_mwi.c:106

Definition at line 117 of file test_mwi.c.

Referenced by subscriptions_create(), and subscriptions_destroy().

◆ running_total

size_t running_total
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().

◆ sum_total

size_t sum_total
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().