[asterisk-commits] kmoore: branch kmoore/stasis-bridge_events r386004 - /team/kmoore/stasis-brid...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Apr 18 09:46:30 CDT 2013
Author: kmoore
Date: Thu Apr 18 09:46:27 2013
New Revision: 386004
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386004
Log:
Add documentation to static functions
Modified:
team/kmoore/stasis-bridge_events/res/res_stasis.c
Modified: team/kmoore/stasis-bridge_events/res/res_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/res/res_stasis.c?view=diff&rev=386004&r1=386003&r2=386004
==============================================================================
--- team/kmoore/stasis-bridge_events/res/res_stasis.c (original)
+++ team/kmoore/stasis-bridge_events/res/res_stasis.c Thu Apr 18 09:46:27 2013
@@ -87,8 +87,10 @@
/*! \brief Message router for the channel caching topic */
struct stasis_message_router *channel_router;
+/*! \brief Message router for the bridge caching topic */
struct stasis_message_router *bridge_router;
+/*! \brief Container for bridges which apps are interested in */
struct ao2_container *app_bridges;
/*! Ref-counting accessor for the stasis applications container */
@@ -198,6 +200,7 @@
info->uniqueid = NULL;
}
+/*! \brief Allocates a bridge_info and fills out internal structures */
static struct bridge_info *bridge_info_alloc(const char *uniqueid)
{
RAII_VAR(struct bridge_info *, info, NULL, ao2_cleanup);
@@ -244,6 +247,7 @@
}
}
+/*! \brief Add an app to a bridge_info if that app is not already in the bridge_info */
static int add_app_to_bridge_info_cb(void *obj, void *arg, int flags)
{
struct app *new_app = obj;
@@ -258,6 +262,7 @@
return 0;
}
+/*! \brief Checks a bridge snapshot for interest by an app for a channel and updates the bridge_info */
static int check_bridge_snapshot_cb(void *obj, void *arg, void *data, int flags)
{
struct ast_bridge_snapshot *snapshot = stasis_message_data(obj);
@@ -319,6 +324,7 @@
return 0;
}
+/*! \brief Matches if the app's channel exists in the bridge snapshot */
static int intersect_app_bridge_cb(void *obj, void *arg, int flags)
{
char *chan = obj;
@@ -332,6 +338,7 @@
return 0;
}
+/*! \brief Verifies that there is still interest in a bridge and removes it otherwise */
static int check_bridge_info_removal_cb(void *obj, void *arg, int flags)
{
struct bridge_info *info = obj;
@@ -372,6 +379,7 @@
return CMP_MATCH;
}
+/*! \brief Checks for continued interest in a bridges by an app */
static void remove_bridge_for_app(struct app *app)
{
ao2_callback(app_bridges, OBJ_MULTIPLE | OBJ_NODATA | OBJ_UNLINK, check_bridge_info_removal_cb, app);
@@ -751,6 +759,7 @@
return 0;
}
+/*! \brief Distributes a JSON message to the provided list of apps */
static void distribute_message(struct ao2_container *apps, struct ast_json *msg)
{
ao2_callback(apps, OBJ_NODATA, app_send_cb, msg);
@@ -838,6 +847,7 @@
distribute_message(watching_apps, msg);
}
+/*! \brief Add or update a bridge_info if there are apps interested in the channel that entered it */
static struct bridge_info *bridge_info_create_or_update(char *bridge_uniqueid, char *entering_chan)
{
RAII_VAR(struct ao2_container *, entering_apps, NULL, ao2_cleanup);
@@ -867,6 +877,7 @@
return info;
}
+/*! \brief Get the list of apps interested in a bridge */
static struct ao2_container *get_bridge_watching_apps(struct ast_bridge_snapshot *bridge)
{
RAII_VAR(struct ao2_container *, out, NULL, ao2_cleanup);
@@ -885,6 +896,7 @@
return info->apps;
}
+/*! \brief Create a bridge event JSON blob to be distributed to stasis applications */
static struct ast_json *app_bridge_event_create(
const char *event_name,
const struct ast_bridge_snapshot *snapshot,
@@ -938,6 +950,7 @@
struct ast_bridge_snapshot *old_snapshot,
struct ast_bridge_snapshot *new_snapshot);
+/*! \brief Handle sending bridge snapshots to stasis applications */
static struct ast_json *bridge_snapshot(
struct ast_bridge_snapshot *old_snapshot,
struct ast_bridge_snapshot *new_snapshot)
@@ -973,12 +986,14 @@
return app_bridge_event_create("bridge-event-destroy", old_snapshot, NULL, NULL);
}
+/*! \brief Handler functions for events based on bridge snapshot diffs */
bridge_snapshot_monitor bridge_monitors[] = {
bridge_snapshot,
bridge_create,
bridge_destroy,
};
+/*! \brief Handler for bridge snapshot updates */
static void bridge_state_cb(void *data,
struct stasis_subscription *sub,
struct stasis_topic *topic,
@@ -1041,15 +1056,17 @@
distribute_message(watching_apps, msg);
}
+/*! \brief Merge two AO2 containers with no duplicates */
static int list_merge_cb(void *obj, void *arg, int flags)
{
/* remove any current entries for this app */
- ao2_find(arg, obj, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE);
+ ao2_find(arg, obj, OBJ_POINTER | OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE);
/* relink as the only entry */
ao2_link(arg, obj);
return 0;
}
+/*! \brief Get the list of apps that are interested in the merger of two bridges */
static struct ao2_container *get_watching_merge(struct ast_bridge_merge_message *merge)
{
RAII_VAR(struct ao2_container *, watching_to, NULL, ao2_cleanup);
@@ -1074,6 +1091,7 @@
return watching_combined;
}
+/*! \brief Handle bridge merge events */
static void bridge_merge_cb(void *data,
struct stasis_subscription *sub,
struct stasis_topic *topic,
@@ -1240,6 +1258,7 @@
return 0;
}
+/*! \brief Remove the given app from all bridge_infos, matching for unlink if no apps remain */
static int app_unregister_cb(void *obj, void *arg, int flags)
{
struct bridge_info *info = obj;
@@ -1290,6 +1309,7 @@
return app_channel_event_create("channel-event-dtmf-received", obj->snapshot, extra);
}
+/*! \brief Handle bridge enter events */
static struct ast_json *handle_blob_enter(struct ast_bridge_blob *obj)
{
RAII_VAR(struct bridge_info *, info, NULL, ao2_cleanup);
@@ -1302,6 +1322,7 @@
return app_bridge_event_create("bridge-event-enter", obj->bridge, obj->channel, NULL);
}
+/*! \brief Remove bridge_infos that no longer hold any apps' interest */
static int bridge_leave_cb(void *obj, void *arg, int flags)
{
struct app *app = obj;
@@ -1318,6 +1339,7 @@
return CMP_MATCH;
}
+/*! \brief Handle bridge leave events */
static struct ast_json *handle_blob_leave(struct ast_bridge_blob *obj)
{
RAII_VAR(struct bridge_info *, info, NULL, ao2_cleanup);
More information about the asterisk-commits
mailing list