[asterisk-commits] kmoore: trunk r396887 - in /trunk: apps/ channels/ funcs/ include/asterisk/ m...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Aug 17 09:39:32 CDT 2013
Author: kmoore
Date: Sat Aug 17 09:39:27 2013
New Revision: 396887
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=396887
Log:
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)
Modified:
trunk/apps/app_queue.c
trunk/apps/app_voicemail.c
trunk/channels/chan_dahdi.c
trunk/channels/chan_iax2.c
trunk/channels/chan_mgcp.c
trunk/channels/chan_sip.c
trunk/channels/chan_skinny.c
trunk/channels/chan_unistim.c
trunk/channels/sig_pri.c
trunk/channels/sig_pri.h
trunk/funcs/func_presencestate.c
trunk/include/asterisk/devicestate.h
trunk/include/asterisk/event.h
trunk/include/asterisk/event_defs.h
trunk/include/asterisk/security_events_defs.h
trunk/main/ccss.c
trunk/main/devicestate.c
trunk/main/event.c
trunk/main/manager.c
trunk/main/pbx.c
trunk/main/presencestate.c
trunk/main/security_events.c
trunk/res/parking/parking_applications.c
trunk/res/parking/parking_manager.c
trunk/res/parking/parking_ui.c
trunk/res/res_jabber.c
trunk/res/res_parking.c
trunk/res/res_security_log.c
trunk/res/res_xmpp.c
trunk/tests/test_cel.c
trunk/tests/test_event.c
Modified: trunk/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_queue.c?view=diff&rev=396887&r1=396886&r2=396887
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Sat Aug 17 09:39:27 2013
@@ -96,7 +96,6 @@
#include "asterisk/astdb.h"
#include "asterisk/devicestate.h"
#include "asterisk/stringfields.h"
-#include "asterisk/event.h"
#include "asterisk/astobj2.h"
#include "asterisk/strings.h"
#include "asterisk/global_datastores.h"
Modified: trunk/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=396887&r1=396886&r2=396887
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Sat Aug 17 09:39:27 2013
@@ -131,7 +131,6 @@
#include "asterisk/strings.h"
#include "asterisk/smdi.h"
#include "asterisk/astobj2.h"
-#include "asterisk/event.h"
#include "asterisk/taskprocessor.h"
#include "asterisk/test.h"
Modified: trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=396887&r1=396886&r2=396887
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Sat Aug 17 09:39:27 2013
@@ -119,7 +119,6 @@
#include "asterisk/abstract_jb.h"
#include "asterisk/smdi.h"
#include "asterisk/astobj.h"
-#include "asterisk/event.h"
#include "asterisk/devicestate.h"
#include "asterisk/paths.h"
#include "asterisk/ccss.h"
Modified: trunk/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=396887&r1=396886&r2=396887
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Sat Aug 17 09:39:27 2013
@@ -105,7 +105,6 @@
#include "asterisk/netsock.h"
#include "asterisk/stringfields.h"
#include "asterisk/linkedlists.h"
-#include "asterisk/event.h"
#include "asterisk/astobj2.h"
#include "asterisk/timing.h"
#include "asterisk/taskprocessor.h"
Modified: trunk/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_mgcp.c?view=diff&rev=396887&r1=396886&r2=396887
==============================================================================
--- trunk/channels/chan_mgcp.c (original)
+++ trunk/channels/chan_mgcp.c Sat Aug 17 09:39:27 2013
@@ -79,7 +79,6 @@
#include "asterisk/devicestate.h"
#include "asterisk/stringfields.h"
#include "asterisk/abstract_jb.h"
-#include "asterisk/event.h"
#include "asterisk/chanvars.h"
#include "asterisk/pktccops.h"
#include "asterisk/stasis.h"
Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=396887&r1=396886&r2=396887
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Sat Aug 17 09:39:27 2013
@@ -276,7 +276,6 @@
#include "asterisk/threadstorage.h"
#include "asterisk/translate.h"
#include "asterisk/ast_version.h"
-#include "asterisk/event.h"
#include "asterisk/data.h"
#include "asterisk/aoc.h"
#include "asterisk/message.h"
Modified: trunk/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_skinny.c?view=diff&rev=396887&r1=396886&r2=396887
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Sat Aug 17 09:39:27 2013
@@ -77,7 +77,6 @@
#include "asterisk/abstract_jb.h"
#include "asterisk/threadstorage.h"
#include "asterisk/devicestate.h"
-#include "asterisk/event.h"
#include "asterisk/indications.h"
#include "asterisk/linkedlists.h"
#include "asterisk/stasis_endpoints.h"
Modified: trunk/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_unistim.c?view=diff&rev=396887&r1=396886&r2=396887
==============================================================================
--- trunk/channels/chan_unistim.c (original)
+++ trunk/channels/chan_unistim.c Sat Aug 17 09:39:27 2013
@@ -63,7 +63,6 @@
#include "asterisk/config.h"
#include "asterisk/module.h"
#include "asterisk/pbx.h"
-#include "asterisk/event.h"
#include "asterisk/rtp_engine.h"
#include "asterisk/netsock2.h"
#include "asterisk/acl.h"
Modified: trunk/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_pri.c?view=diff&rev=396887&r1=396886&r2=396887
==============================================================================
--- trunk/channels/sig_pri.c (original)
+++ trunk/channels/sig_pri.c Sat Aug 17 09:39:27 2013
@@ -8884,8 +8884,10 @@
* \brief MWI subscription event callback.
* \since 1.8
*
- * \param event the event being passed to the subscriber
- * \param userdata the data provider in the call to ast_event_subscribe()
+ * \param userdata the data provider in the call to stasis_subscribe()
+ * \param sub the subscription to which the message was delivered for this callback
+ * \param topic the topic on which the message was published
+ * \param msg the message being passed to the subscriber
*
* \return Nothing
*/
Modified: trunk/channels/sig_pri.h
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_pri.h?view=diff&rev=396887&r1=396886&r2=396887
==============================================================================
--- trunk/channels/sig_pri.h (original)
+++ trunk/channels/sig_pri.h Sat Aug 17 09:39:27 2013
@@ -27,7 +27,6 @@
#include "asterisk/channel.h"
#include "asterisk/frame.h"
-#include "asterisk/event.h"
#include "asterisk/ccss.h"
#include <libpri.h>
#include <dahdi/user.h>
Modified: trunk/funcs/func_presencestate.c
URL: http://svnview.digium.com/svn/asterisk/trunk/funcs/func_presencestate.c?view=diff&rev=396887&r1=396886&r2=396887
==============================================================================
--- trunk/funcs/func_presencestate.c (original)
+++ trunk/funcs/func_presencestate.c Sat Aug 17 09:39:27 2013
@@ -41,7 +41,6 @@
#include "asterisk/app.h"
#ifdef TEST_FRAMEWORK
#include "asterisk/test.h"
-#include "asterisk/event.h"
#include <semaphore.h>
#endif
Modified: trunk/include/asterisk/devicestate.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/devicestate.h?view=diff&rev=396887&r1=396886&r2=396887
==============================================================================
--- trunk/include/asterisk/devicestate.h (original)
+++ trunk/include/asterisk/devicestate.h Sat Aug 17 09:39:27 2013
@@ -19,7 +19,7 @@
/*! \file
* \brief Device state management
*
- * To subscribe to device state changes, use the generic ast_event_subscribe
+ * To subscribe to device state changes, use the stasis_subscribe
* method. For an example, see apps/app_queue.c.
*
* \todo Currently, when the state of a device changes, the device state provider
Modified: trunk/include/asterisk/event.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/event.h?view=diff&rev=396887&r1=396886&r2=396887
==============================================================================
--- trunk/include/asterisk/event.h (original)
+++ trunk/include/asterisk/event.h Sat Aug 17 09:39:27 2013
@@ -90,9 +90,7 @@
* 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 @@
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 @@
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
@@ -244,15 +214,6 @@
* \version 1.6.1 return changed to NULL
*/
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
@@ -269,9 +230,7 @@
* 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 @@
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 @@
* 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 @@
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 @@
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,61 +383,15 @@
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
+ * \brief Get the value of an information element that has a string 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
- * \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 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
@@ -624,28 +424,6 @@
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,47 +486,13 @@
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
+ * \brief Get the value of the current IE in the iterator as a string 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
- *
* \return This returns the payload of the information element as a string.
*/
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)
}
Modified: trunk/include/asterisk/event_defs.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/event_defs.h?view=diff&rev=396887&r1=396886&r2=396887
==============================================================================
--- trunk/include/asterisk/event_defs.h (original)
+++ trunk/include/asterisk/event_defs.h Sat Aug 17 09:39:27 2013
@@ -26,7 +26,7 @@
#define AST_EVENT_DEFS_H
/*! \brief Event types
- * \note These values can *never* change. */
+ * \note These values no longer go over the wire and can change when items are removed. */
enum ast_event_type {
/*! Reserved to provide the ability to subscribe to all events. A specific
* event should never have a payload of 0. */
@@ -36,32 +36,12 @@
* \note There are no "custom" IE types, because IEs only have to be
* unique to the event itself, not necessarily across all events. */
AST_EVENT_CUSTOM = 0x01,
- /*! Voicemail message waiting indication */
- AST_EVENT_MWI = 0x02,
/*! Someone has subscribed to events */
- AST_EVENT_SUB = 0x03,
- /*! Someone has unsubscribed from events */
- AST_EVENT_UNSUB = 0x04,
- /*! The aggregate state of a device across all servers configured to be
- * a part of a device state cluster has changed. */
- AST_EVENT_DEVICE_STATE = 0x05,
- /*! The state of a device has changed on _one_ server. This should not be used
- * directly, in general. Use AST_EVENT_DEVICE_STATE instead. */
- AST_EVENT_DEVICE_STATE_CHANGE = 0x06,
+ AST_EVENT_SUB = 0x02,
/*! Channel Event Logging events */
- AST_EVENT_CEL = 0x07,
- /*! A report of a security related event (see security_events.h) */
- AST_EVENT_SECURITY = 0x08,
- /*! Used by res_stun_monitor to alert listeners to an exernal network address change. */
- AST_EVENT_NETWORK_CHANGE = 0x09,
- /*! The presence state for a presence provider */
- AST_EVENT_PRESENCE_STATE = 0x0a,
- /*! Used to alert listeners when a named ACL has been changed. */
- AST_EVENT_ACL_CHANGE = 0x0b,
- /*! Send out a ping for debugging distributed events */
- AST_EVENT_PING = 0x0c,
+ AST_EVENT_CEL = 0x03,
/*! Number of event types. This should be the last event type + 1 */
- AST_EVENT_TOTAL = 0x0d,
+ AST_EVENT_TOTAL = 0x04,
};
/*! \brief Event Information Element types */
@@ -70,242 +50,198 @@
AST_EVENT_IE_END = -1,
/*!
- * \brief Number of new messages
- * Used by: AST_EVENT_MWI
- * Payload type: UINT
- */
- AST_EVENT_IE_NEWMSGS = 0x0001,
- /*!
- * \brief Number of
- * Used by: AST_EVENT_MWI
- * Payload type: UINT
- */
- AST_EVENT_IE_OLDMSGS = 0x0002,
- /*!
- * \brief Mailbox name \verbatim (mailbox[@context]) \endverbatim
- * Used by: AST_EVENT_MWI
- * Payload type: STR
- */
- AST_EVENT_IE_MAILBOX = 0x0003,
- /*!
* \brief Unique ID
* Used by: AST_EVENT_SUB, AST_EVENT_UNSUB
* Payload type: UINT
*/
- AST_EVENT_IE_UNIQUEID = 0x0004,
+ AST_EVENT_IE_UNIQUEID = 0x0001,
/*!
* \brief Event type
* Used by: AST_EVENT_SUB, AST_EVENT_UNSUB
* Payload type: UINT
*/
- AST_EVENT_IE_EVENTTYPE = 0x0005,
+ AST_EVENT_IE_EVENTTYPE = 0x0002,
/*!
* \brief Hint that someone cares that an IE exists
* Used by: AST_EVENT_SUB
* Payload type: UINT (ast_event_ie_type)
*/
- AST_EVENT_IE_EXISTS = 0x0006,
- /*!
- * \brief Device Name
- * Used by AST_EVENT_DEVICE_STATE_CHANGE
- * Payload type: STR
- */
- AST_EVENT_IE_DEVICE = 0x0007,
- /*!
- * \brief Generic State IE
- * Used by AST_EVENT_DEVICE_STATE_CHANGE
- * Payload type: UINT
- * The actual state values depend on the event which
- * this IE is a part of.
- */
- AST_EVENT_IE_STATE = 0x0008,
+ AST_EVENT_IE_EXISTS = 0x0003,
/*!
* \brief Context IE
* Used by AST_EVENT_MWI
* Payload type: str
*/
- AST_EVENT_IE_CONTEXT = 0x0009,
+ AST_EVENT_IE_CONTEXT = 0x0004,
/*!
* \brief Channel Event Type
* Used by: AST_EVENT_CEL
* Payload type: UINT
*/
- AST_EVENT_IE_CEL_EVENT_TYPE = 0x000a,
+ AST_EVENT_IE_CEL_EVENT_TYPE = 0x0005,
/*!
* \brief Channel Event Time (seconds)
* Used by: AST_EVENT_CEL
* Payload type: UINT
*/
- AST_EVENT_IE_CEL_EVENT_TIME = 0x000b,
+ AST_EVENT_IE_CEL_EVENT_TIME = 0x0006,
/*!
* \brief Channel Event Time (micro-seconds)
* Used by: AST_EVENT_CEL
* Payload type: UINT
*/
- AST_EVENT_IE_CEL_EVENT_TIME_USEC = 0x000c,
+ AST_EVENT_IE_CEL_EVENT_TIME_USEC = 0x0007,
/*!
* \brief Channel Event User Event Name
* Used by: AST_EVENT_CEL
* Payload type: STR
*/
- AST_EVENT_IE_CEL_USEREVENT_NAME = 0x000d,
+ AST_EVENT_IE_CEL_USEREVENT_NAME = 0x0008,
/*!
* \brief Channel Event CID name
* Used by: AST_EVENT_CEL
* Payload type: STR
*/
- AST_EVENT_IE_CEL_CIDNAME = 0x000e,
+ AST_EVENT_IE_CEL_CIDNAME = 0x0009,
/*!
* \brief Channel Event CID num
* Used by: AST_EVENT_CEL
* Payload type: STR
*/
- AST_EVENT_IE_CEL_CIDNUM = 0x000f,
+ AST_EVENT_IE_CEL_CIDNUM = 0x000a,
/*!
* \brief Channel Event extension name
* Used by: AST_EVENT_CEL
* Payload type: STR
*/
- AST_EVENT_IE_CEL_EXTEN = 0x0010,
+ AST_EVENT_IE_CEL_EXTEN = 0x000b,
/*!
* \brief Channel Event context name
* Used by: AST_EVENT_CEL
* Payload type: STR
*/
- AST_EVENT_IE_CEL_CONTEXT = 0x0011,
+ AST_EVENT_IE_CEL_CONTEXT = 0x000c,
/*!
* \brief Channel Event channel name
* Used by: AST_EVENT_CEL
* Payload type: STR
*/
- AST_EVENT_IE_CEL_CHANNAME = 0x0012,
+ AST_EVENT_IE_CEL_CHANNAME = 0x000d,
/*!
* \brief Channel Event app name
* Used by: AST_EVENT_CEL
* Payload type: STR
*/
- AST_EVENT_IE_CEL_APPNAME = 0x0013,
+ AST_EVENT_IE_CEL_APPNAME = 0x000e,
/*!
* \brief Channel Event app args/data
* Used by: AST_EVENT_CEL
* Payload type: STR
*/
- AST_EVENT_IE_CEL_APPDATA = 0x0014,
+ AST_EVENT_IE_CEL_APPDATA = 0x000f,
/*!
* \brief Channel Event AMA flags
* Used by: AST_EVENT_CEL
* Payload type: UINT
*/
- AST_EVENT_IE_CEL_AMAFLAGS = 0x0015,
+ AST_EVENT_IE_CEL_AMAFLAGS = 0x0010,
/*!
* \brief Channel Event AccountCode
* Used by: AST_EVENT_CEL
* Payload type: STR
*/
- AST_EVENT_IE_CEL_ACCTCODE = 0x0016,
+ AST_EVENT_IE_CEL_ACCTCODE = 0x0011,
/*!
* \brief Channel Event UniqueID
* Used by: AST_EVENT_CEL
* Payload type: STR
*/
- AST_EVENT_IE_CEL_UNIQUEID = 0x0017,
+ AST_EVENT_IE_CEL_UNIQUEID = 0x0012,
/*!
* \brief Channel Event Userfield
* Used by: AST_EVENT_CEL
* Payload type: STR
*/
- AST_EVENT_IE_CEL_USERFIELD = 0x0018,
+ AST_EVENT_IE_CEL_USERFIELD = 0x0013,
/*!
* \brief Channel Event CID ANI field
* Used by: AST_EVENT_CEL
* Payload type: STR
*/
- AST_EVENT_IE_CEL_CIDANI = 0x0019,
+ AST_EVENT_IE_CEL_CIDANI = 0x0014,
/*!
* \brief Channel Event CID RDNIS field
* Used by: AST_EVENT_CEL
* Payload type: STR
*/
- AST_EVENT_IE_CEL_CIDRDNIS = 0x001a,
+ AST_EVENT_IE_CEL_CIDRDNIS = 0x0015,
/*!
* \brief Channel Event CID dnid
* Used by: AST_EVENT_CEL
* Payload type: STR
*/
- AST_EVENT_IE_CEL_CIDDNID = 0x001b,
+ AST_EVENT_IE_CEL_CIDDNID = 0x0016,
/*!
* \brief Channel Event Peer -- for Things involving multiple channels, like BRIDGE
* Used by: AST_EVENT_CEL
* Payload type: STR
*/
- AST_EVENT_IE_CEL_PEER = 0x001c,
+ AST_EVENT_IE_CEL_PEER = 0x0017,
/*!
* \brief Channel Event LinkedID
* Used by: AST_EVENT_CEL
* Payload type: STR
*/
- AST_EVENT_IE_CEL_LINKEDID = 0x001d,
+ AST_EVENT_IE_CEL_LINKEDID = 0x0018,
/*!
* \brief Channel Event peeraccount
* Used by: AST_EVENT_CEL
* Payload type: STR
*/
- AST_EVENT_IE_CEL_PEERACCT = 0x001e,
+ AST_EVENT_IE_CEL_PEERACCT = 0x0019,
/*!
* \brief Channel Event extra data
* Used by: AST_EVENT_CEL
* Payload type: STR
*/
- AST_EVENT_IE_CEL_EXTRA = 0x001f,
+ AST_EVENT_IE_CEL_EXTRA = 0x001a,
/*!
* \brief Description
* Used by: AST_EVENT_SUB, AST_EVENT_UNSUB
* Payload type: STR
*/
- AST_EVENT_IE_DESCRIPTION = 0x0020,
+ AST_EVENT_IE_DESCRIPTION = 0x001b,
/*!
* \brief Entity ID
* Used by All events
* Payload type: RAW
* This IE indicates which server the event originated from
*/
- AST_EVENT_IE_EID = 0x0021,
- AST_EVENT_IE_SECURITY_EVENT = 0x0022,
- AST_EVENT_IE_EVENT_VERSION = 0x0023,
- AST_EVENT_IE_SERVICE = 0x0024,
- AST_EVENT_IE_MODULE = 0x0025,
- AST_EVENT_IE_ACCOUNT_ID = 0x0026,
- AST_EVENT_IE_SESSION_ID = 0x0027,
- AST_EVENT_IE_SESSION_TV = 0x0028,
- AST_EVENT_IE_ACL_NAME = 0x0029,
- AST_EVENT_IE_LOCAL_ADDR = 0x002a,
- AST_EVENT_IE_REMOTE_ADDR = 0x002b,
- AST_EVENT_IE_EVENT_TV = 0x002c,
- AST_EVENT_IE_REQUEST_TYPE = 0x002d,
- AST_EVENT_IE_REQUEST_PARAMS = 0x002e,
- AST_EVENT_IE_AUTH_METHOD = 0x002f,
- AST_EVENT_IE_SEVERITY = 0x0030,
- AST_EVENT_IE_EXPECTED_ADDR = 0x0031,
- AST_EVENT_IE_CHALLENGE = 0x0032,
- AST_EVENT_IE_RESPONSE = 0x0033,
- AST_EVENT_IE_EXPECTED_RESPONSE = 0x0034,
- AST_EVENT_IE_RECEIVED_CHALLENGE = 0x0035,
- AST_EVENT_IE_RECEIVED_HASH = 0x0036,
- AST_EVENT_IE_USING_PASSWORD = 0x0037,
- AST_EVENT_IE_ATTEMPTED_TRANSPORT = 0x0038,
- AST_EVENT_IE_PRESENCE_PROVIDER = 0x0039,
- AST_EVENT_IE_PRESENCE_STATE = 0x003a,
- AST_EVENT_IE_PRESENCE_SUBTYPE = 0x003b,
- AST_EVENT_IE_PRESENCE_MESSAGE = 0x003c,
-
- /*!
- * \brief Event non-cachability flag
- * Used by: All events
- * Payload type: UINT
- */
- AST_EVENT_IE_CACHABLE = 0x003d,
+ AST_EVENT_IE_EVENT_VERSION = 0x001c,
+ AST_EVENT_IE_SERVICE = 0x001d,
+ AST_EVENT_IE_MODULE = 0x001e,
+ AST_EVENT_IE_ACCOUNT_ID = 0x001f,
+ AST_EVENT_IE_SESSION_ID = 0x0020,
+ AST_EVENT_IE_SESSION_TV = 0x0021,
+ AST_EVENT_IE_ACL_NAME = 0x0022,
+ AST_EVENT_IE_LOCAL_ADDR = 0x0023,
+ AST_EVENT_IE_REMOTE_ADDR = 0x0024,
+ AST_EVENT_IE_EVENT_TV = 0x0025,
+ AST_EVENT_IE_REQUEST_TYPE = 0x0026,
+ AST_EVENT_IE_REQUEST_PARAMS = 0x0027,
+ AST_EVENT_IE_AUTH_METHOD = 0x0028,
+ AST_EVENT_IE_SEVERITY = 0x0029,
+ AST_EVENT_IE_EXPECTED_ADDR = 0x002a,
+ AST_EVENT_IE_CHALLENGE = 0x002b,
+ AST_EVENT_IE_RESPONSE = 0x002c,
+ AST_EVENT_IE_EXPECTED_RESPONSE = 0x002e,
+ AST_EVENT_IE_RECEIVED_CHALLENGE = 0x002f,
+ AST_EVENT_IE_RECEIVED_HASH = 0x0030,
+ AST_EVENT_IE_USING_PASSWORD = 0x0031,
+ AST_EVENT_IE_ATTEMPTED_TRANSPORT = 0x0032,
+
/*! \brief Must be the last IE value +1 */
- AST_EVENT_IE_TOTAL = 0x003e,
+ AST_EVENT_IE_TOTAL = 0x0033,
};
/*!
@@ -313,16 +249,12 @@
*/
enum ast_event_ie_pltype {
AST_EVENT_IE_PLTYPE_UNKNOWN = -1,
- /*! Just check if it exists, not the value */
- AST_EVENT_IE_PLTYPE_EXISTS,
/*! Unsigned Integer (Can be used for signed, too ...) */
AST_EVENT_IE_PLTYPE_UINT,
/*! String */
AST_EVENT_IE_PLTYPE_STR,
/*! Raw data, compared with memcmp */
AST_EVENT_IE_PLTYPE_RAW,
- /*! Bit flags (unsigned integer, compared using boolean logic) */
- AST_EVENT_IE_PLTYPE_BITFLAGS,
};
/*!
Modified: trunk/include/asterisk/security_events_defs.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/security_events_defs.h?view=diff&rev=396887&r1=396886&r2=396887
==============================================================================
--- trunk/include/asterisk/security_events_defs.h (original)
+++ trunk/include/asterisk/security_events_defs.h Sat Aug 17 09:39:27 2013
@@ -36,11 +36,6 @@
/*!
* \brief Security event types
- *
- * AST_EVENT_SECURITY is the event type of an ast_event generated as a security
- * event. The event will have an information element of type
- * AST_EVENT_IE_SECURITY_EVENT which identifies the security event sub-type.
- * This enum defines the possible values for this sub-type.
*/
enum ast_security_event_type {
/*!
Modified: trunk/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/ccss.c?view=diff&rev=396887&r1=396886&r2=396887
==============================================================================
--- trunk/main/ccss.c (original)
+++ trunk/main/ccss.c Sat Aug 17 09:39:27 2013
@@ -45,7 +45,6 @@
#include "asterisk/pbx.h"
#include "asterisk/utils.h"
#include "asterisk/taskprocessor.h"
-#include "asterisk/event.h"
#include "asterisk/devicestate.h"
#include "asterisk/module.h"
#include "asterisk/app.h"
Modified: trunk/main/devicestate.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/devicestate.c?view=diff&rev=396887&r1=396886&r2=396887
==============================================================================
--- trunk/main/devicestate.c (original)
+++ trunk/main/devicestate.c Sat Aug 17 09:39:27 2013
@@ -131,7 +131,6 @@
#include "asterisk/app.h"
#include "asterisk/astobj2.h"
#include "asterisk/stasis.h"
-#include "asterisk/event.h"
#include "asterisk/devicestate.h"
#define DEVSTATE_TOPIC_BUCKETS 57
Modified: trunk/main/event.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/event.c?view=diff&rev=396887&r1=396886&r2=396887
==============================================================================
--- trunk/main/event.c (original)
+++ trunk/main/event.c Sat Aug 17 09:39:27 2013
@@ -45,6 +45,11 @@
#include "asterisk/cli.h"
static struct ast_taskprocessor *event_dispatcher;
+static int event_append_ie_raw(struct ast_event **event, enum ast_event_ie_type ie_type,
+ const void *data, size_t data_len);
+static const void *event_get_ie_raw(const struct ast_event *event, enum ast_event_ie_type ie_type);
+static uint16_t event_get_ie_raw_payload_len(const struct ast_event *event, enum ast_event_ie_type ie_type);
+static uint32_t event_get_ie_str_hash(const struct ast_event *event, enum ast_event_ie_type ie_type);
/*!
* \brief An event information element
@@ -91,20 +96,6 @@
unsigned char payload[0];
} __attribute__((packed));
-
-/*!
- * \brief A holder for an event
- *
- * \details This struct used to have more of a purpose than it does now.
- * It is used to hold events in the event cache. It can be completely removed
- * if one of these two things is done:
- * - ast_event gets changed such that it never has to be realloc()d
- * - astobj2 is updated so that you can realloc() an astobj2 object
- */
-struct ast_event_ref {
- struct ast_event *event;
- unsigned int cache;
-};
struct ast_event_ie_val {
AST_LIST_ENTRY(ast_event_ie_val) entry;
@@ -138,84 +129,6 @@
* The event subscribers are indexed by which event they are subscribed to */
static AST_RWDLLIST_HEAD(ast_event_sub_list, ast_event_sub) ast_event_subs[AST_EVENT_TOTAL];
-static int ast_event_cmp(void *obj, void *arg, int flags);
-static int ast_event_hash_mwi(const void *obj, const int flags);
-static int ast_event_hash_devstate(const void *obj, const int flags);
-static int ast_event_hash_devstate_change(const void *obj, const int flags);
-
-#ifdef LOW_MEMORY
-#define NUM_CACHE_BUCKETS 17
-#else
-#define NUM_CACHE_BUCKETS 563
-#endif
-
-#define MAX_CACHE_ARGS 8
-
-struct cache_events {
- /*!
- * \brief Container of cached events
- *
- * \details This gets allocated in ast_event_init() when Asterisk starts
- * for the event types declared as using the cache.
- */
- struct ao2_container *container;
- /*! \brief Event type specific hash function */
- ao2_hash_fn *hash_fn;
- /*!
- * \brief Information Elements used for caching
- *
- * \details This array is the set of information elements that will be unique
- * among all events in the cache for this event type. When a new event gets
- * cached, a previous event with the same values for these information elements
- * will be replaced.
- */
- enum ast_event_ie_type cache_args[MAX_CACHE_ARGS];
-};
-
-/*!
- * \brief Event types that are kept in the cache.
- */
-static struct cache_events ast_event_cache[AST_EVENT_TOTAL] = {
- [AST_EVENT_MWI] = {
- .hash_fn = ast_event_hash_mwi,
- .cache_args = { AST_EVENT_IE_MAILBOX, AST_EVENT_IE_CONTEXT },
- },
- [AST_EVENT_DEVICE_STATE] = {
- .hash_fn = ast_event_hash_devstate,
- .cache_args = { AST_EVENT_IE_DEVICE, },
- },
- [AST_EVENT_DEVICE_STATE_CHANGE] = {
- .hash_fn = ast_event_hash_devstate_change,
- .cache_args = { AST_EVENT_IE_DEVICE, AST_EVENT_IE_EID, },
- },
-};
-
-/*!
- * \brief Names of cached event types, for CLI tab completion
- *
- * \note These names must match what is in the event_names array.
- */
-static const char * const cached_event_types[] = { "MWI", "DeviceState", "DeviceStateChange", NULL };
-
-/*!
- * \brief Event Names
- */
-static const char * const event_names[AST_EVENT_TOTAL] = {
- [AST_EVENT_ALL] = "All",
- [AST_EVENT_CUSTOM] = "Custom",
- [AST_EVENT_MWI] = "MWI",
- [AST_EVENT_SUB] = "Subscription",
- [AST_EVENT_UNSUB] = "Unsubscription",
- [AST_EVENT_DEVICE_STATE] = "DeviceState",
- [AST_EVENT_DEVICE_STATE_CHANGE] = "DeviceStateChange",
- [AST_EVENT_CEL] = "CEL",
- [AST_EVENT_SECURITY] = "Security",
- [AST_EVENT_NETWORK_CHANGE] = "NetworkChange",
[... 2081 lines stripped ...]
More information about the asterisk-commits
mailing list