diff options
Diffstat (limited to 'include/asterisk')
-rw-r--r-- | include/asterisk/_private.h | 1 | ||||
-rw-r--r-- | include/asterisk/cel.h | 29 | ||||
-rw-r--r-- | include/asterisk/event.h | 221 | ||||
-rw-r--r-- | include/asterisk/event_defs.h | 1 |
4 files changed, 29 insertions, 223 deletions
diff --git a/include/asterisk/_private.h b/include/asterisk/_private.h index b1f6bd471..19ec1be92 100644 --- a/include/asterisk/_private.h +++ b/include/asterisk/_private.h @@ -29,7 +29,6 @@ int dnsmgr_init(void); /*!< Provided by dnsmgr.c */ void dnsmgr_start_refresh(void); /*!< Provided by dnsmgr.c */ int dnsmgr_reload(void); /*!< Provided by dnsmgr.c */ void threadstorage_init(void); /*!< Provided by threadstorage.c */ -int ast_event_init(void); /*!< Provided by event.c */ int ast_device_state_engine_init(void); /*!< Provided by devicestate.c */ int astobj2_init(void); /*!< Provided by astobj2.c */ int ast_file_init(void); /*!< Provided by file.c */ diff --git a/include/asterisk/cel.h b/include/asterisk/cel.h index 394c0667d..62644d2fb 100644 --- a/include/asterisk/cel.h +++ b/include/asterisk/cel.h @@ -300,6 +300,35 @@ struct ast_event *ast_cel_create_event(struct ast_channel_snapshot *snapshot, enum ast_cel_event_type event_type, const char *userdefevname, struct ast_json *extra, const char *peer_name); +/*! + * \brief CEL backend callback + */ +/*typedef int (*ast_cel_backend_cb)(struct ast_cel_event_record *cel);*/ +typedef void (*ast_cel_backend_cb)(struct ast_event *event); + +/*! + * \brief Register a CEL backend + * + * \param name Name of backend to register + * \param backend_callback Callback to register + * + * \retval zero on success + * \retval non-zero on failure + * \since 12 + */ +int ast_cel_backend_register(const char *name, ast_cel_backend_cb backend_callback); + +/*! + * \brief Unregister a CEL backend + * + * \param name Name of backend to unregister + * + * \retval zero on success + * \retval non-zero on failure + * \since 12 + */ +int ast_cel_backend_unregister(const char *name); + #if defined(__cplusplus) || defined(c_plusplus) } #endif diff --git a/include/asterisk/event.h b/include/asterisk/event.h index 7d7820720..3178de5c2 100644 --- a/include/asterisk/event.h +++ b/include/asterisk/event.h @@ -64,211 +64,6 @@ extern "C" { #include "asterisk/event_defs.h" /*! - * \brief Subscriber event callback type - * - * \param event the event being passed to the subscriber - * \param userdata the data provider in the call to ast_event_subscribe() - * - * \return The event callbacks do not return anything. - */ -typedef void (*ast_event_cb_t)(const struct ast_event *event, void *userdata); - -/*! - * \brief Subscribe to events - * - * \param event_type The type of events to subscribe to - * \param cb The function to be called with events - * \param description Description of the subscription. - * \param userdata data to be passed to the event callback - * - * The rest of the arguments to this function specify additional parameters for - * the subscription to filter which events are passed to this subscriber. The - * arguments must be in sets of: - * \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. 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 - * subscription, NULL will be returned. - * - * Example usage: - * - * \code - * peer->mwi_event_sub = ast_event_subscribe(AST_EVENT_MWI, mwi_event_cb, peer, - * AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, peer->mailbox, - * AST_EVENT_IE_END); - * \endcode - * - * This creates a subscription to AST_EVENT_MWI events that contain an - * information element, AST_EVENT_IE_MAILBOX, with the same string value - * contained in peer->mailbox. Also, the event callback will be passed a - * pointer to the peer. - * - * \note A NULL description will cause this function to crash, so watch out! - */ -struct ast_event_sub *ast_event_subscribe(enum ast_event_type event_type, - ast_event_cb_t cb, const char *description, void *userdata, ...); - -/*! - * \brief Allocate a subscription, but do not activate it - * - * \param type the event type to subscribe to - * \param cb the function to call when an event matches this subscription - * \param userdata data to pass to the provided callback - * - * This function should be used when you want to dynamically build a - * subscription. - * - * \return the allocated subscription, or NULL on failure - * \since 1.6.1 - */ -struct ast_event_sub *ast_event_subscribe_new(enum ast_event_type type, - ast_event_cb_t cb, void *userdata); - -/*! - * \brief Destroy an allocated subscription - * - * \param sub the subscription to destroy - * - * This function should be used when a subscription is allocated with - * ast_event_subscribe_new(), but for some reason, you want to destroy it - * instead of activating it. This could be because of an error when - * reading in the configuration for the dynamically built subscription. - * \since 1.6.1 - */ -void ast_event_sub_destroy(struct ast_event_sub *sub); - -/*! - * \brief Append a uint 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 uint the value that must be present in the event to match this subscription - * - * \retval 0 success - * \retval non-zero failure - * \since 1.6.1 - */ -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 string 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 str the string that must be present in the event to match this subscription - * - * \retval 0 success - * \retval non-zero failure - * \since 1.6.1 - */ -int ast_event_sub_append_ie_str(struct ast_event_sub *sub, - enum ast_event_ie_type ie_type, const char *str); - -/*! - * \brief Append a raw 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 data the data that must be present in the event to match this subscription - * \param raw_datalen length of data - * - * \retval 0 success - * \retval non-zero failure - * \since 1.6.1 - */ -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 Activate a dynamically built subscription - * - * \param sub the subscription to activate that was allocated using - * ast_event_subscribe_new() - * - * Once a dynamically built subscription has had all of the parameters added - * to it, it should be activated using this function. - * - * \retval 0 success - * \retval non-zero failure - * \since 1.6.1 - */ -int ast_event_sub_activate(struct ast_event_sub *sub); - -/*! - * \brief Un-subscribe from events - * - * \param event_sub This is the reference to the subscription returned by - * ast_event_subscribe. - * - * This function will remove a subscription and free the associated data - * structures. - * - * \return NULL for convenience. - * \version 1.6.1 return changed to NULL - */ -struct ast_event_sub *ast_event_unsubscribe(struct ast_event_sub *event_sub); - -/*! - * \brief Check if subscribers exist - * - * \param event_type This is the type of event that the caller would like to - * check for subscribers to. - * - * The rest of the arguments to this function specify additional parameters for - * checking for subscriptions to subsets of an event type. The arguments must - * in sets of: - * \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. 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 - * criteria. - * - * Example usage: - * - * \code - * if (ast_event_check_subscriber(AST_EVENT_MWI, - * AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox, - * AST_EVENT_IE_END) == AST_EVENT_SUB_NONE) { - * return; - * } - * \endcode - * - * This example will check if there are any subscribers to MWI events for the - * mailbox defined in the "mailbox" variable. - */ -enum ast_event_subscriber_res ast_event_check_subscriber(enum ast_event_type event_type, ...); - -/*! - * \brief Report current subscriptions to a subscription subscriber - * - * \arg sub the subscription subscriber - * - * \return nothing - * - * This reports all of the current subscribers to a subscriber of - * subscribers to a specific event type. (Try saying that a few times fast). - * - * The idea here is that it is sometimes very useful for a module to know when - * someone subscribes to events. However, when they first subscribe, this - * provides that module the ability to request the event core report to them - * all of the subscriptions to that event type that already exist. - */ -void ast_event_report_subs(const struct ast_event_sub *sub); - -/*! * \brief Create a new event * * \param event_type The type of event to create @@ -321,22 +116,6 @@ struct ast_event *ast_event_new(enum ast_event_type event_type, ...); void ast_event_destroy(struct ast_event *event); /*! - * \brief Queue an event - * - * \param event the event to be queued - * - * \retval zero success - * \retval non-zero failure. Note that the caller of this function is - * responsible for destroying the event in the case of a failure. - * - * This function queues an event to be dispatched to all of the appropriate - * subscribers. This function will not block while the event is being - * dispatched because the event is queued up for a dispatching thread - * to handle. - */ -int ast_event_queue(struct ast_event *event); - -/*! * \brief Append an information element that has a string payload * * \param event the event that the IE will be appended to diff --git a/include/asterisk/event_defs.h b/include/asterisk/event_defs.h index e25908e29..f8f98ace0 100644 --- a/include/asterisk/event_defs.h +++ b/include/asterisk/event_defs.h @@ -271,7 +271,6 @@ enum ast_event_subscriber_res { struct ast_event; struct ast_event_ie; -struct ast_event_sub; struct ast_event_iterator; /*! |