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