blob: bc6122c2b2038ac9fd4842d5bbde1cdbfb87838f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
/*
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 2013, Digium, Inc.
*
* Matt Jordan <mjordan@digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
/*! \file
*
* \brief Internal Stasis APIs.
*
* This header file is used to define functions that are shared between files that make
* up \ref stasis. Functions declared here should not be used by any module outside of
* Stasis.
*
* If you find yourself needing to call one of these functions directly, something has
* probably gone horribly wrong.
*
* \author Matt Jordan <mjordan@digium.com>
*/
#include "asterisk/stasis.h"
#ifndef STASIS_INTERNAL_H_
#define STASIS_INTERNAL_H_
/*!
* \brief Create a subscription.
*
* In addition to being AO2 managed memory (requiring an ao2_cleanup() to free
* up this reference), the subscription must be explicitly unsubscribed from its
* topic using stasis_unsubscribe().
*
* The invocations of the callback are serialized, but may not always occur on
* the same thread. The invocation order of different subscriptions is
* unspecified.
*
* Note: modules outside of Stasis should use \ref stasis_subscribe.
*
* \param topic Topic to subscribe to.
* \param callback Callback function for subscription messages.
* \param data Data to be passed to the callback, in addition to the message.
* \param needs_mailbox Determines whether or not the subscription requires a mailbox.
* Subscriptions with mailboxes will be delivered on some non-publisher thread;
* subscriptions without mailboxes will be delivered on the publisher thread.
* \param use_thread_pool Use the thread pool for the subscription. This is only
* relevant if \c needs_mailbox is non-zero.
* \return New \ref stasis_subscription object.
* \return \c NULL on error.
* \since 12
*/
struct stasis_subscription *internal_stasis_subscribe(
struct stasis_topic *topic,
stasis_subscription_cb callback,
void *data,
int needs_mailbox,
int use_thread_pool);
#endif /* STASIS_INTERNAL_H_ */
|