summaryrefslogtreecommitdiff
path: root/include/asterisk/event.h
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2013-08-17 14:39:27 +0000
committerKinsey Moore <kmoore@digium.com>2013-08-17 14:39:27 +0000
commit59753b1ea10a83ea770c35b24cd443620913349c (patch)
treec5fd1c815cd9f51e0083703845f4d69a2fbd4250 /include/asterisk/event.h
parent35b9c6a660236e23e6b9102cc641ab11e967a25a (diff)
Strip down the old event system
This removes unused code, event types, IE pltypes, and event IE types where possible and makes several functions private that were once public. This includes a renumbering of the remaining event and IE types which breaks binary compatibility with previous versions. The last remaining consumers of the old event system (or parts thereof) are main/security_events.c, res/res_security_log.c, tests/test_cel.c, tests/test_event.c, main/cel.c, and the CEL backends. Review: https://reviewboard.asterisk.org/r/2703/ (closes issue ASTERISK-22139) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396887 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk/event.h')
-rw-r--r--include/asterisk/event.h262
1 files changed, 3 insertions, 259 deletions
diff --git a/include/asterisk/event.h b/include/asterisk/event.h
index 90e27b2f6..7d7820720 100644
--- a/include/asterisk/event.h
+++ b/include/asterisk/event.h
@@ -90,9 +90,7 @@ typedef void (*ast_event_cb_t)(const struct ast_event *event, void *userdata);
* and must end with AST_EVENT_IE_END.
*
* If the ie_type specified is *not* AST_EVENT_IE_END, then it must be followed
- * by a valid IE payload type. If the payload type specified is
- * AST_EVENT_IE_PLTYPE_EXISTS, then the 3rd argument should not be provided.
- * Otherwise, a payload must also be specified.
+ * by a valid IE payload type. A payload must also be specified.
*
* \return This returns a reference to the subscription for use with
* un-subscribing later. If there is a failure in creating the
@@ -160,20 +158,6 @@ int ast_event_sub_append_ie_uint(struct ast_event_sub *sub,
enum ast_event_ie_type ie_type, uint32_t uint);
/*!
- * \brief Append a bitflags parameter to a subscription
- *
- * \param sub the dynamic subscription allocated with ast_event_subscribe_new()
- * \param ie_type the information element type for the parameter
- * \param flags the flags that must be present in the event to match this subscription
- *
- * \retval 0 success
- * \retval non-zero failure
- * \since 1.8
- */
-int ast_event_sub_append_ie_bitflags(struct ast_event_sub *sub,
- enum ast_event_ie_type ie_type, uint32_t flags);
-
-/*!
* \brief Append a string parameter to a subscription
*
* \param sub the dynamic subscription allocated with ast_event_subscribe_new()
@@ -203,20 +187,6 @@ int ast_event_sub_append_ie_raw(struct ast_event_sub *sub,
enum ast_event_ie_type ie_type, void *data, size_t raw_datalen);
/*!
- * \brief Append an 'exists' parameter to a subscription
- *
- * \param sub the dynamic subscription allocated with ast_event_subscribe_new()
- * \param ie_type the information element type that must be present in the event
- * for it to match this subscription.
- *
- * \retval 0 success
- * \retval non-zero failure
- * \since 1.6.1
- */
-int ast_event_sub_append_ie_exists(struct ast_event_sub *sub,
- enum ast_event_ie_type ie_type);
-
-/*!
* \brief Activate a dynamically built subscription
*
* \param sub the subscription to activate that was allocated using
@@ -246,15 +216,6 @@ int ast_event_sub_activate(struct ast_event_sub *sub);
struct ast_event_sub *ast_event_unsubscribe(struct ast_event_sub *event_sub);
/*!
- * \brief Get description for a subscription
- *
- * \param sub subscription
- *
- * \return string description of the subscription
- */
-const char *ast_event_subscriber_get_description(struct ast_event_sub *sub);
-
-/*!
* \brief Check if subscribers exist
*
* \param event_type This is the type of event that the caller would like to
@@ -269,9 +230,7 @@ const char *ast_event_subscriber_get_description(struct ast_event_sub *sub);
* and must end with AST_EVENT_IE_END.
*
* If the ie_type specified is *not* AST_EVENT_IE_END, then it must be followed
- * by a valid IE payload type. If the payload type specified is
- * AST_EVENT_IE_PLTYPE_EXISTS, then the 3rd argument should not be provided.
- * Otherwise, a payload must also be specified.
+ * by a valid IE payload type. A payload must also be specified.
*
* \return This returns one of the values defined in the ast_event_subscriber_res
* enum which will indicate if subscribers exist that match the given
@@ -310,12 +269,6 @@ enum ast_event_subscriber_res ast_event_check_subscriber(enum ast_event_type eve
void ast_event_report_subs(const struct ast_event_sub *sub);
/*!
- * \brief Dump the event cache for the subscriber
- * \since 1.6.1
- */
-void ast_event_dump_cache(const struct ast_event_sub *event_sub);
-
-/*!
* \brief Create a new event
*
* \param event_type The type of event to create
@@ -328,8 +281,7 @@ void ast_event_dump_cache(const struct ast_event_sub *event_sub);
* and must end with AST_EVENT_IE_END.
*
* If the ie_type specified is *not* AST_EVENT_IE_END, then it must be followed
- * by a valid IE payload type. The payload type, EXISTS, should not be used here
- * because it makes no sense to do so. So, a payload must also be specified
+ * by a valid IE payload type. A payload must also be specified
* after the IE payload type.
*
* \note The EID IE will be appended automatically when this function is used
@@ -385,63 +337,6 @@ void ast_event_destroy(struct ast_event *event);
int ast_event_queue(struct ast_event *event);
/*!
- * \brief Queue and cache an event
- *
- * \param event the event to be queued and cached
- *
- * \details
- * The purpose of caching events is so that the core can retain the last known
- * information for events that represent some sort of state. That way, when
- * code needs to find out the current state, it can query the cache.
- *
- * The event API already knows which events can be cached and how to cache them.
- *
- * \retval 0 success
- * \retval non-zero failure.
- */
-int ast_event_queue_and_cache(struct ast_event *event);
-
-/*!
- * \brief Retrieve an event from the cache
- *
- * \param ast_event_type The type of event to retrieve from the cache
- *
- * The rest of the arguments to this function specify information elements to
- * match for retrieving events from the cache. They are specified in the form:
- * \code
- * <enum ast_event_ie_type>, [enum ast_event_ie_pltype, [payload] ]
- * \endcode
- * and must end with AST_EVENT_IE_END.
- *
- * If the ie_type specified is *not* AST_EVENT_IE_END, then it must be followed
- * by a valid IE payload type. If the payload type specified is
- * AST_EVENT_IE_PLTYPE_EXISTS, then the 3rd argument should not be provided.
- * Otherwise, a payload must also be specified.
- *
- * \return A reference to an event retrieved from the cache. If no event was
- * found that matches the specified criteria, then NULL will be returned.
- *
- * \note If more than one event in the cache matches the specified criteria, only
- * one will be returned, and it is undefined which one it will be.
- *
- * \note The caller of this function *must* call ast_event_destroy() on the
- * returned event after it is done using it.
- *
- * Example Usage:
- *
- * \code
- * event = ast_event_get_cached(AST_EVENT_MWI,
- * AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
- * AST_EVENT_IE_END);
- * \endcode
- *
- * This example will check for an MWI event in the cache that matches the
- * specified mailbox. This would be the way to find out the last known state
- * of a mailbox without having to poll the mailbox directly.
- */
-struct ast_event *ast_event_get_cached(enum ast_event_type, ...);
-
-/*!
* \brief Append an information element that has a string payload
*
* \param event the event that the IE will be appended to
@@ -476,55 +371,6 @@ int ast_event_append_ie_uint(struct ast_event **event, enum ast_event_ie_type ie
uint32_t data);
/*!
- * \brief Append an information element that has a bitflags payload
- *
- * \param event the event that the IE will be appended to
- * \param ie_type the type of IE to append
- * \param bitflags the flags that are the payload of the IE
- *
- * \retval 0 success
- * \retval -1 failure
- * \since 1.8
- *
- * The pointer to the event will get updated with the new location for the event
- * that now contains the appended information element. If the re-allocation of
- * the memory for this event fails, it will be set to NULL.
- */
-int ast_event_append_ie_bitflags(struct ast_event **event, enum ast_event_ie_type ie_type,
- uint32_t bitflags);
-
-/*!
- * \brief Append an information element that has a raw payload
- *
- * \param event the event that the IE will be appended to
- * \param ie_type the type of IE to append
- * \param data A pointer to the raw data for the payload of the IE
- * \param data_len The amount of data to copy into the payload
- *
- * \retval 0 success
- * \retval -1 failure
- *
- * The pointer to the event will get updated with the new location for the event
- * that now contains the appended information element. If the re-allocation of
- * the memory for this event fails, it will be set to NULL.
- */
-int ast_event_append_ie_raw(struct ast_event **event, enum ast_event_ie_type ie_type,
- const void *data, size_t data_len);
-
-/*!
- * \brief Append the global EID IE
- *
- * \param event the event to append IE to
- *
- * \note For ast_event_new() that includes IEs, this is done automatically
- * for you.
- *
- * \retval 0 success
- * \retval -1 failure
- */
-int ast_event_append_eid(struct ast_event **event);
-
-/*!
* \brief Get the value of an information element that has an integer payload
*
* \param event The event to get the IE from
@@ -537,18 +383,6 @@ int ast_event_append_eid(struct ast_event **event);
uint32_t ast_event_get_ie_uint(const struct ast_event *event, enum ast_event_ie_type ie_type);
/*!
- * \brief Get the value of an information element that has a bitflags payload
- *
- * \param event The event to get the IE from
- * \param ie_type the type of information element to retrieve
- *
- * \return This returns the payload of the information element with the given type.
- * However, an IE with a payload of 0, and the case where no IE is found
- * yield the same return value.
- */
-uint32_t ast_event_get_ie_bitflags(const struct ast_event *event, enum ast_event_ie_type ie_type);
-
-/*!
* \brief Get the value of an information element that has a string payload
*
* \param event The event to get the IE from
@@ -560,40 +394,6 @@ uint32_t ast_event_get_ie_bitflags(const struct ast_event *event, enum ast_event
const char *ast_event_get_ie_str(const struct ast_event *event, enum ast_event_ie_type ie_type);
/*!
- * \brief Get the hash for the string payload of an IE
- *
- * \param event The event to get the IE from
- * \param ie_type the type of information element to retrieve the hash for
- *
- * \return This function returns the hash value as calculated by ast_str_hash()
- * for the string payload. This is stored in the event to avoid
- * unnecessary string comparisons.
- */
-uint32_t ast_event_get_ie_str_hash(const struct ast_event *event, enum ast_event_ie_type ie_type);
-
-/*!
- * \brief Get the value of an information element that has a raw payload
- *
- * \param event The event to get the IE from
- * \param ie_type the type of information element to retrieve
- *
- * \return This returns the payload of the information element with the given type.
- * If the information element isn't found, NULL will be returned.
- */
-const void *ast_event_get_ie_raw(const struct ast_event *event, enum ast_event_ie_type ie_type);
-
-/*!
- * \brief Get the length of the raw payload for a particular IE
- *
- * \param event The event to get the IE payload length from
- * \param ie_type the type of information element to get the length of
- *
- * \return If an IE of type ie_type is found, its payload length is returned.
- * Otherwise, 0 is returned.
- */
-uint16_t ast_event_get_ie_raw_payload_len(const struct ast_event *event, enum ast_event_ie_type ie_type);
-
-/*!
* \brief Get the string representation of an information element type
*
* \param ie_type the information element type to get the string representation of
@@ -624,28 +424,6 @@ enum ast_event_ie_pltype ast_event_get_ie_pltype(enum ast_event_ie_type ie_type)
enum ast_event_type ast_event_get_type(const struct ast_event *event);
/*!
- * \brief Get the string representation of the type of the given event
- *
- * \arg event the event to get the type of
- *
- * \return the string representation of the event type of the provided event
- * \since 1.6.1
- */
-const char *ast_event_get_type_name(const struct ast_event *event);
-
-/*!
- * \brief Convert a string into an event type
- *
- * \param str the string to convert
- * \param event_type an output parameter for the event type
- *
- * \retval 0 success
- * \retval non-zero failure
- * \since 1.6.1
- */
-int ast_event_str_to_event_type(const char *str, enum ast_event_type *event_type);
-
-/*!
* \brief Convert a string to an IE type
*
* \param str the string to convert
@@ -708,15 +486,6 @@ enum ast_event_ie_type ast_event_iterator_get_ie_type(struct ast_event_iterator
uint32_t ast_event_iterator_get_ie_uint(struct ast_event_iterator *iterator);
/*!
- * \brief Get the value of the current IE in the iterator as a bitflags payload
- *
- * \param iterator The iterator instance
- *
- * \return This returns the payload of the information element as bitflags.
- */
-uint32_t ast_event_iterator_get_ie_bitflags(struct ast_event_iterator *iterator);
-
-/*!
* \brief Get the value of the current IE in the iterator as a string payload
*
* \param iterator The iterator instance
@@ -725,31 +494,6 @@ uint32_t ast_event_iterator_get_ie_bitflags(struct ast_event_iterator *iterator)
*/
const char *ast_event_iterator_get_ie_str(struct ast_event_iterator *iterator);
-/*!
- * \brief Get the value of the current IE in the iterator instance that has a raw payload
- *
- * \param iterator The iterator instance
- *
- * \return This returns the payload of the information element as type raw.
- */
-void *ast_event_iterator_get_ie_raw(struct ast_event_iterator *iterator);
-
-/*!
- * \brief Get the length of the raw payload for the current IE for an iterator
- *
- * \param iterator The IE iterator
- *
- * \return The payload length of the current IE
- */
-uint16_t ast_event_iterator_get_ie_raw_payload_len(struct ast_event_iterator *iterator);
-
-/*!
- * \brief Get the minimum length of an ast_event.
- *
- * \return minimum amount of memory that will be consumed by any ast_event.
- */
-size_t ast_event_minimum_length(void);
-
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif