summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2016-04-12 15:29:52 -0500
committerRichard Mudgett <rmudgett@digium.com>2016-04-22 16:44:05 -0500
commitba63aa7c9e01919d53588e0e35066db554613d53 (patch)
tree4f0f0c72bdc19a21ff92c41e8911f0bdd873899c /include
parentd5ee6acf28f67670b5afa1be0161280b33a5a9e9 (diff)
Manager: Short circuit AMI message processing.
Improve AMI message processing performance if there are no consumers listening for the messages. We now skip creating the AMI event message text strings. Change-Id: I7b22fc5ec4e500d00635c1a467aa8ea68a1bb2b3
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/stasis.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/include/asterisk/stasis.h b/include/asterisk/stasis.h
index 16b30ccb3..4fc295bc4 100644
--- a/include/asterisk/stasis.h
+++ b/include/asterisk/stasis.h
@@ -416,14 +416,14 @@ const struct timeval *stasis_message_timestamp(const struct stasis_message *msg)
* May return \c NULL, to indicate no representation. The returned object should
* be ast_json_unref()'ed.
*
- * \param message Message to convert to JSON string.
+ * \param msg Message to convert to JSON string.
* \param sanitize Snapshot sanitization callback.
*
* \return Newly allocated string with JSON message.
* \return \c NULL on error.
* \return \c NULL if JSON format is not supported.
*/
-struct ast_json *stasis_message_to_json(struct stasis_message *message, struct stasis_message_sanitizer *sanitize);
+struct ast_json *stasis_message_to_json(struct stasis_message *msg, struct stasis_message_sanitizer *sanitize);
/*!
* \brief Build the AMI representation of the message.
@@ -431,12 +431,21 @@ struct ast_json *stasis_message_to_json(struct stasis_message *message, struct s
* May return \c NULL, to indicate no representation. The returned object should
* be ao2_cleanup()'ed.
*
- * \param message Message to convert to AMI.
+ * \param msg Message to convert to AMI.
* \return \c NULL on error.
* \return \c NULL if AMI format is not supported.
*/
-struct ast_manager_event_blob *stasis_message_to_ami(
- struct stasis_message *message);
+struct ast_manager_event_blob *stasis_message_to_ami(struct stasis_message *msg);
+
+/*!
+ * \brief Determine if the given message can be converted to AMI.
+ *
+ * \param msg Message to see if can be converted to AMI.
+ *
+ * \retval 0 Cannot be converted
+ * \retval non-zero Can be converted
+ */
+int stasis_message_can_be_ami(struct stasis_message *msg);
/*!
* \brief Build the \ref AstGenericEvents representation of the message.
@@ -444,12 +453,11 @@ struct ast_manager_event_blob *stasis_message_to_ami(
* May return \c NULL, to indicate no representation. The returned object should
* be disposed of via \ref ast_event_destroy.
*
- * \param message Message to convert to AMI.
+ * \param msg Message to convert to AMI.
* \return \c NULL on error.
* \return \c NULL if AMI format is not supported.
*/
-struct ast_event *stasis_message_to_event(
- struct stasis_message *message);
+struct ast_event *stasis_message_to_event(struct stasis_message *msg);
/*! @} */