58 #ifndef SWITCH_EVENT_H
59 #define SWITCH_EVENT_H
128 #define SWITCH_EVENT_SUBCLASS_ANY NULL
153 #define switch_event_create_subclass(_e, _eid, _sn) switch_event_create_subclass_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, _e, _eid, _sn)
172 #define switch_event_get_header(_e, _h) switch_event_get_header_idx(_e, _h, -1)
174 #define switch_event_get_header_nil(e, h) switch_str_nil(switch_event_get_header(e,h))
211 #define switch_event_del_header(_e, _h) switch_event_del_header_val(_e, _h, NULL)
218 #define switch_event_safe_destroy(_event) if (_event) switch_event_destroy(_event)
242 #define switch_event_prep_for_delivery(_event) switch_event_prep_for_delivery_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, _event)
354 #define switch_event_expand_headers(_event, _in) switch_event_expand_headers_check(_event, _in, NULL, NULL, 0)
358 _In_z_ const
char *from,
_In_z_ const
char *from_domain,
359 _In_z_ const
char *status,
_In_z_ const
char *event_type,
360 _In_z_ const
char *alt_event_type,
_In_ int event_count,
361 _In_z_ const
char *unique_id,
_In_z_ const
char *channel_state,
362 _In_z_ const
char *answer_state,
_In_z_ const
char *call_direction);
363 #define switch_event_create_pres_in(event) switch_event_create_pres_in_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, \
364 proto, login, from, from_domain, status, event_type, alt_event_type, event_count, \
365 unique_id, channel_state, answer_state, call_direction)
374 #define switch_event_reserve_subclass(subclass_name) switch_event_reserve_subclass_detailed(__FILE__, subclass_name)
375 #define switch_event_free_subclass(subclass_name) switch_event_free_subclass_detailed(__FILE__, subclass_name)
383 #define switch_event_create(event, id) switch_event_create_subclass(event, id, SWITCH_EVENT_SUBCLASS_ANY)
412 #define switch_event_fire(event) switch_event_fire_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, event, NULL)
421 #define switch_event_fire_data(event, data) switch_event_fire_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, event, data)
437 #define NO_EVENT_CHANNEL_ID 0
438 #define SWITCH_EVENT_CHANNEL_GLOBAL "__global__"
_Ret_opt_z_ char * switch_event_get_header_idx(switch_event_t *event, const char *header_name, int idx)
void switch_json_add_presence_data_cols(switch_event_t *event, cJSON *json, const char *prefix)
switch_status_t switch_event_serialize_json(switch_event_t *event, char **str)
switch_event_types_t event_id
switch_priority_t priority
void switch_live_array_parse_json(cJSON *json, switch_event_channel_id_t channel_id)
switch_xml_t switch_status_t switch_event_running(void)
Determine if the event system has been initialized.
switch_status_t switch_event_bind_removable(const char *id, switch_event_types_t event, const char *subclass_name, switch_event_callback_t callback, void *user_data, switch_event_node_t **node)
Bind an event callback to a specific event.
uint32_t switch_event_channel_id_t
switch_status_t switch_live_array_visible(switch_live_array_t *la, switch_bool_t visible, switch_bool_t force)
switch_status_t switch_event_serialize_json_obj(switch_event_t *event, cJSON **json)
#define SWITCH_END_EXTERN_C
void switch_live_array_lock(switch_live_array_t *la)
void switch_event_channel_permission_modify(const char *cookie, const char *event_channel, switch_bool_t set)
switch_event_types_t
Built-in Events.
switch_status_t switch_event_binary_serialize(switch_event_t *event, void **data, switch_size_t *len)
int switch_event_add_array(switch_event_t *event, const char *var, const char *val)
switch_status_t switch_live_array_destroy(switch_live_array_t **live_arrayP)
void switch_event_add_presence_data_cols(switch_channel_t *channel, switch_event_t *event, const char *prefix)
switch_status_t switch_event_create_brackets(char *data, char a, char b, char c, switch_event_t **event, char **new_data, switch_bool_t dup)
switch_status_t switch_name_event(const char *name, switch_event_types_t *type)
return the event id that matches a given event name
switch_priority_t
Priority Indication.
cJSON * switch_live_array_get_idx(switch_live_array_t *la, int idx)
struct switch_serial_event_header_s switch_serial_event_header_t
switch_memory_pool_t * pool
switch_status_t switch_event_add_header(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *fmt,...) PRINTF_FUNCTION(4
Add a header to an event.
Representation of an event.
int switch_event_check_permission_list(switch_event_t *list, const char *name)
switch_status_t switch_event_add_body(switch_event_t *event, const char *fmt,...) PRINTF_FUNCTION(2
Add a body to an event.
void switch_event_launch_dispatch_threads(uint32_t max)
switch_status_t switch_event_set_priority(switch_event_t *event, switch_priority_t priority)
Set the priority of an event.
struct switch_event * next
switch_event_header_t * last_header
void switch_event_channel_permission_clear(const char *cookie)
A representation of an XML tree.
switch_bool_t switch_live_array_isnew(switch_live_array_t *la)
A node to store binded events.
switch_status_t switch_event_dup(switch_event_t **event, switch_event_t *todup)
Duplicate an event.
cJSON * switch_live_array_get(switch_live_array_t *la, const char *name)
void(* switch_live_array_command_handler_t)(switch_live_array_t *la, const char *cmd, const char *sessid, cJSON *jla, void *user_data)
switch_status_t switch_event_channel_broadcast(const char *event_channel, cJSON **json, const char *key, switch_event_channel_id_t id)
switch_status_t switch_event_shutdown(void)
Stop the eventing system.
switch_status_t switch_event_init(switch_memory_pool_t *pool)
Start the eventing system.
void switch_event_prep_for_delivery_detailed(const char *file, const char *func, int line, switch_event_t *event)
switch_status_t switch_event_bind(const char *id, switch_event_types_t event, const char *subclass_name, switch_event_callback_t callback, void *user_data)
Bind an event callback to a specific event.
switch_status_t switch_event_fire_detailed(const char *file, const char *func, int line, switch_event_t **event, void *user_data)
Fire an event with full arguement list.
switch_status_t switch_live_array_clear(switch_live_array_t *la)
switch_status_t switch_live_array_add(switch_live_array_t *la, const char *name, int index, cJSON **obj, switch_bool_t destroy)
switch_event_types_t event_id
switch_status_t switch_event_create_subclass_detailed(const char *file, const char *func, int line, switch_event_t **event, switch_event_types_t event_id, const char *subclass_name)
Create an event.
void switch_event_merge(switch_event_t *event, switch_event_t *tomerge)
char * switch_event_get_body(switch_event_t *event)
Retrieve the body value from an event.
switch_status_t switch_event_add_header_string(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *data)
Add a string header to an event.
switch_status_t switch_event_binary_deserialize(switch_event_t **eventp, void **data, switch_size_t len, switch_bool_t duplicate)
Render a string representation of an event suitable for printing or network transport.
const char * switch_event_name(switch_event_types_t event)
Render the name of an event id enumeration.
switch_status_t switch_status_t switch_event_set_subclass_name(switch_event_t *event, const char *subclass_name)
void switch_live_array_set_command_handler(switch_live_array_t *la, switch_live_array_command_handler_t command_handler)
void switch_event_deliver(switch_event_t **event)
Deliver an event to all of the registered event listeners.
switch_status_t switch_event_create_json(switch_event_t **event, const char *json)
static switch_status_t switch_event_create_plain(switch_event_t **event, switch_event_types_t event_id)
switch_status_t switch_event_del_header_val(switch_event_t *event, const char *header_name, const char *val)
void(* switch_event_callback_t)(switch_event_t *)
switch_bool_t switch_live_array_add_alias(switch_live_array_t *la, const char *event_channel, const char *name)
void(* switch_event_channel_func_t)(const char *event_channel, cJSON *json, const char *key, switch_event_channel_id_t id)
switch_status_t switch_live_array_bootstrap(switch_live_array_t *la, const char *sessid, switch_event_channel_id_t channel_id)
switch_status_t
Common return values.
switch_bool_t switch_live_array_clear_alias(switch_live_array_t *la, const char *event_channel, const char *name)
switch_status_t switch_live_array_create(const char *event_channel, const char *name, switch_event_channel_id_t channel_id, switch_live_array_t **live_arrayP)
struct switch_serial_event_s switch_serial_event_t
char * switch_event_expand_headers_check(switch_event_t *event, const char *in, switch_event_t *var_list, switch_event_t *api_list, uint32_t recur)
void switch_live_array_set_user_data(switch_live_array_t *la, void *user_data)
switch_status_t switch_event_dup_reply(switch_event_t **event, switch_event_t *todup)
#define switch_event_create(event, id)
Create a new event assuming it will not be custom event and therefore hiding the unused parameters...
void switch_live_array_unlock(switch_live_array_t *la)
switch_status_t switch_event_channel_bind(const char *event_channel, switch_event_channel_func_t func, switch_event_channel_id_t *id)
switch_status_t switch_live_array_del(switch_live_array_t *la, const char *name)
switch_status_t switch_event_free_subclass_detailed(const char *owner, const char *subclass_name)
switch_status_t switch_event_create_array_pair(switch_event_t **event, char **names, char **vals, int len)
char * switch_event_build_param_string(switch_event_t *event, const char *prefix, switch_hash_t *vars_map)
struct apr_pool_t switch_memory_pool_t
switch_stack_t
Expression of how to stack a list.
switch_status_t switch_event_unbind_callback(switch_event_callback_t callback)
switch_status_t switch_event_create_pres_in_detailed(_In_z_ char *file, _In_z_ char *func, _In_ int line, _In_z_ const char *proto, _In_z_ const char *login, _In_z_ const char *from, _In_z_ const char *from_domain, _In_z_ const char *status, _In_z_ const char *event_type, _In_z_ const char *alt_event_type, _In_ int event_count, _In_z_ const char *unique_id, _In_z_ const char *channel_state, _In_z_ const char *answer_state, _In_z_ const char *call_direction)
switch_status_t switch_event_reserve_subclass_detailed(const char *owner, const char *subclass_name)
Reserve a subclass name for private use with a custom event.
switch_event_callback_t callback
switch_status_t switch_status_t switch_event_set_body(switch_event_t *event, const char *body)
switch_status_t switch_event_rename_header(switch_event_t *event, const char *header_name, const char *new_header_name)
void switch_event_destroy(switch_event_t **event)
Destroy an event.
switch_event_header_t * switch_event_get_header_ptr(switch_event_t *event, const char *header_name)
Retrieve a header value from an event.
uint32_t switch_event_channel_unbind(const char *event_channel, switch_event_channel_func_t func)
switch_bool_t switch_event_channel_permission_verify(const char *cookie, const char *event_channel)
switch_status_t switch_event_serialize(switch_event_t *event, char **str, switch_bool_t encode)
switch_event_header_t * headers
switch_status_t switch_event_get_custom_events(switch_console_callback_match_t **matches)
#define SWITCH_BEGIN_EXTERN_C
switch_xml_t switch_event_xmlize(switch_event_t *event, const char *fmt,...) PRINTF_FUNCTION(2
Render a XML representation of an event suitable for printing or network transport.
switch_status_t switch_event_unbind(switch_event_node_t **node)
Unbind a bound event consumer.