Usage of the SAForum AIS (Application Interface Specification) More...
#include "asterisk.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include "ais.h"
#include "asterisk/module.h"
#include "asterisk/utils.h"
#include "asterisk/cli.h"
#include "asterisk/logger.h"
#include "asterisk/event.h"
#include "asterisk/config.h"
#include "asterisk/linkedlists.h"
#include "asterisk/devicestate.h"
Go to the source code of this file.
Data Structures | |
struct | event_channel |
struct | event_channels |
struct | publish_event |
struct | subscribe_event |
Macros | |
#define | AST_MODULE "res_ais" |
Functions | |
static void | add_publish_event (struct event_channel *event_channel, const char *event_type) |
static void | add_subscribe_event (struct event_channel *event_channel, const char *event_type) |
static char * | ais_evt_show_event_channels (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
int | ast_ais_evt_load_module (void) |
void | ast_ais_evt_membership_changed (void) |
int | ast_ais_evt_unload_module (void) |
static void | ast_event_cb (const struct ast_event *ast_event, void *data) |
ASTERISK_FILE_VERSION (__FILE__,"$Revision: 369001 $") | |
static void | build_event_channel (struct ast_config *cfg, const char *cat) |
static void | destroy_event_channels (void) |
static void | event_channel_destroy (struct event_channel *event_channel) |
void | evt_channel_open_cb (SaInvocationT invocation, SaEvtChannelHandleT channel_handle, SaAisErrorT error) |
void | evt_event_deliver_cb (SaEvtSubscriptionIdT subscription_id, const SaEvtEventHandleT event_handle, const SaSizeT event_datalen) |
static void | load_config (void) |
static void | publish_event_destroy (struct publish_event *publish_event) |
static void | queue_event (struct ast_event *ast_event) |
static SaAisErrorT | set_egress_subscription (struct event_channel *event_channel, struct subscribe_event *subscribe_event) |
static void | subscribe_event_destroy (const struct event_channel *event_channel, struct subscribe_event *subscribe_event) |
static const char * | type_to_filter_str (enum ast_event_type type) |
Variables | |
static struct ast_cli_entry | ais_cli [] |
static struct event_channels | event_channels = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, 1 } , } |
static const SaEvtCallbacksT | evt_callbacks |
SaEvtHandleT | evt_handle |
static SaAisErrorT | evt_init_res |
struct { | |
const char * str | |
enum ast_event_type type | |
} | supported_event_types [] |
static int | unique_id |
Usage of the SAForum AIS (Application Interface Specification)
This file contains the code specific to the use of the EVT (Event) Service.
Definition in file evt.c.
|
static |
Definition at line 335 of file evt.c.
References ARRAY_LEN, ast_calloc, ast_enable_distributed_devstate(), ast_event_cb(), AST_EVENT_DEVICE_STATE_CHANGE, ast_event_dump_cache(), AST_EVENT_IE_END, ast_event_subscribe(), AST_LIST_INSERT_TAIL, ast_log(), LOG_DEBUG, LOG_WARNING, event_channel::publish_events, str, publish_event::sub, supported_event_types, subscribe_event::type, and publish_event::type.
Referenced by build_event_channel().
|
static |
Definition at line 397 of file evt.c.
References ais_err2str(), ARRAY_LEN, ast_atomic_fetchadd_int(), ast_calloc, ast_enable_distributed_devstate(), AST_EVENT_DEVICE_STATE_CHANGE, AST_LIST_INSERT_TAIL, ast_log(), free, subscribe_event::id, LOG_ERROR, LOG_WARNING, set_egress_subscription(), str, event_channel::subscribe_events, supported_event_types, subscribe_event::type, and unique_id.
Referenced by build_event_channel().
|
static |
Definition at line 261 of file evt.c.
References ast_cli_args::argc, ast_cli_entry::args, ast_cli(), AST_LIST_TRAVERSE, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, event_channel::name, event_channel::publish_events, event_channel::subscribe_events, subscribe_event::type, publish_event::type, type_to_filter_str(), and ast_cli_entry::usage.
int ast_ais_evt_load_module | ( | void | ) |
Definition at line 576 of file evt.c.
References ais_err2str(), ais_version, ARRAY_LEN, ast_cli_register_multiple(), ast_log(), evt_callbacks, evt_handle, evt_init_res, load_config(), and LOG_ERROR.
Referenced by load_module().
void ast_ais_evt_membership_changed | ( | void | ) |
Definition at line 319 of file evt.c.
References ast_debug, ast_event_dump_cache(), AST_LIST_TRAVERSE, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, event_channel::name, event_channel::publish_events, and publish_event::sub.
Referenced by dispatch_thread_handler().
int ast_ais_evt_unload_module | ( | void | ) |
Definition at line 592 of file evt.c.
References ais_err2str(), ast_log(), destroy_event_channels(), evt_handle, evt_init_res, and LOG_ERROR.
Referenced by load_module(), and unload_module().
|
static |
/todo Make retention time configurable /todo Make event priorities configurable
Definition at line 184 of file evt.c.
References ais_err2str(), ast_eid_cmp(), ast_eid_default, ast_event_get_ie_raw(), ast_event_get_size(), ast_event_get_type(), AST_EVENT_IE_EID, ast_log(), clm_handle, event_channel::handle, len(), LOG_DEBUG, LOG_ERROR, and type_to_filter_str().
Referenced by add_publish_event().
ASTERISK_FILE_VERSION | ( | __FILE__ | , |
"$Revision: 369001 $" | |||
) |
|
static |
Definition at line 438 of file evt.c.
References add_publish_event(), add_subscribe_event(), ais_err2str(), ast_calloc, ast_copy_string(), ast_log(), AST_RWLIST_INSERT_TAIL, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_variable_browse(), evt_handle, free, event_channel::handle, LOG_ERROR, LOG_WARNING, ast_variable::name, event_channel::name, ast_variable::next, ast_variable::value, and var.
Referenced by load_config().
|
static |
Definition at line 565 of file evt.c.
References AST_RWLIST_REMOVE_HEAD, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, and event_channel_destroy().
Referenced by ast_ais_evt_unload_module().
|
static |
Definition at line 545 of file evt.c.
References ais_err2str(), AST_LIST_REMOVE_HEAD, ast_log(), free, event_channel::handle, LOG_ERROR, event_channel::name, publish_event_destroy(), event_channel::publish_events, subscribe_event_destroy(), and event_channel::subscribe_events.
Referenced by destroy_event_channels().
void evt_channel_open_cb | ( | SaInvocationT | invocation, |
SaEvtChannelHandleT | channel_handle, | ||
SaAisErrorT | error | ||
) |
void evt_event_deliver_cb | ( | SaEvtSubscriptionIdT | subscription_id, |
const SaEvtEventHandleT | event_handle, | ||
const SaSizeT | event_datalen | ||
) |
Definition at line 123 of file evt.c.
References ais_err2str(), ast_debug, ast_eid_cmp(), ast_eid_default, ast_event_get_ie_raw(), AST_EVENT_IE_EID, ast_event_minimum_length(), ast_log(), ast_malloc, len(), LOG_ERROR, and queue_event().
|
static |
Definition at line 490 of file evt.c.
References ast_category_browse(), ast_config_destroy(), ast_config_load, ast_log(), ast_variable_retrieve(), build_event_channel(), CONFIG_STATUS_FILEINVALID, LOG_WARNING, and subscribe_event::type.
Referenced by ast_ais_evt_load_module().
|
static |
Definition at line 523 of file evt.c.
References ast_event_unsubscribe(), free, and publish_event::sub.
Referenced by event_channel_destroy().
|
static |
Definition at line 118 of file evt.c.
References ast_event_queue_and_cache().
Referenced by evt_event_deliver_cb().
|
static |
Definition at line 370 of file evt.c.
References filter(), event_channel::handle, subscribe_event::id, len(), subscribe_event::type, and type_to_filter_str().
Referenced by add_subscribe_event().
|
static |
Definition at line 530 of file evt.c.
References ais_err2str(), ast_log(), free, event_channel::handle, subscribe_event::id, and LOG_ERROR.
Referenced by event_channel_destroy().
|
static |
Definition at line 169 of file evt.c.
References ARRAY_LEN, and supported_event_types.
Referenced by ais_evt_show_event_channels(), ast_event_cb(), and set_egress_subscription().
|
static |
|
static |
|
static |
Definition at line 69 of file evt.c.
Referenced by ast_ais_evt_load_module().
SaEvtHandleT evt_handle |
Definition at line 61 of file evt.c.
Referenced by ast_ais_evt_load_module(), ast_ais_evt_unload_module(), build_event_channel(), and dispatch_thread_handler().
|
static |
Definition at line 62 of file evt.c.
Referenced by ast_ais_evt_load_module(), and ast_ais_evt_unload_module().
struct { ... } supported_event_types[] |
Referenced by add_publish_event(), add_subscribe_event(), and type_to_filter_str().
enum ast_event_type type |
|
static |
Used to provide unique id's to egress subscriptions
Definition at line 83 of file evt.c.
Referenced by add_subscribe_event().