stasis_internal.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. /*! \file
  19. *
  20. * \brief Internal Stasis APIs.
  21. *
  22. * This header file is used to define functions that are shared between files that make
  23. * up \ref stasis. Functions declared here should not be used by any module outside of
  24. * Stasis.
  25. *
  26. * If you find yourself needing to call one of these functions directly, something has
  27. * probably gone horribly wrong.
  28. *
  29. * \author Matt Jordan <mjordan@digium.com>
  30. */
  31. #include "asterisk/stasis.h"
  32. #ifndef STASIS_INTERNAL_H_
  33. #define STASIS_INTERNAL_H_
  34. /*!
  35. * \brief Create a subscription.
  36. *
  37. * In addition to being AO2 managed memory (requiring an ao2_cleanup() to free
  38. * up this reference), the subscription must be explicitly unsubscribed from its
  39. * topic using stasis_unsubscribe().
  40. *
  41. * The invocations of the callback are serialized, but may not always occur on
  42. * the same thread. The invocation order of different subscriptions is
  43. * unspecified.
  44. *
  45. * Note: modules outside of Stasis should use \ref stasis_subscribe.
  46. *
  47. * \param topic Topic to subscribe to.
  48. * \param callback Callback function for subscription messages.
  49. * \param data Data to be passed to the callback, in addition to the message.
  50. * \param needs_mailbox Determines whether or not the subscription requires a mailbox.
  51. * Subscriptions with mailboxes will be delivered on some non-publisher thread;
  52. * subscriptions without mailboxes will be delivered on the publisher thread.
  53. * \param use_thread_pool Use the thread pool for the subscription. This is only
  54. * relevant if \c needs_mailbox is non-zero.
  55. * \return New \ref stasis_subscription object.
  56. * \return \c NULL on error.
  57. * \since 12
  58. */
  59. struct stasis_subscription *internal_stasis_subscribe(
  60. struct stasis_topic *topic,
  61. stasis_subscription_cb callback,
  62. void *data,
  63. int needs_mailbox,
  64. int use_thread_pool,
  65. const char *file,
  66. int lineno,
  67. const char *func);
  68. #endif /* STASIS_INTERNAL_H_ */