[asterisk-commits] mmichelson: branch group/CCSS_Monitor_Restructure r242428 - in /team/group/CC...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jan 22 16:05:25 CST 2010
Author: mmichelson
Date: Fri Jan 22 16:05:22 2010
New Revision: 242428
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=242428
Log:
s/cc_monitor/ast_cc_monitor/ and move the structure definition to the .h file.
Modified:
team/group/CCSS_Monitor_Restructure/include/asterisk/ccss.h
team/group/CCSS_Monitor_Restructure/main/ccss.c
Modified: team/group/CCSS_Monitor_Restructure/include/asterisk/ccss.h
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS_Monitor_Restructure/include/asterisk/ccss.h?view=diff&rev=242428&r1=242427&r2=242428
==============================================================================
--- team/group/CCSS_Monitor_Restructure/include/asterisk/ccss.h (original)
+++ team/group/CCSS_Monitor_Restructure/include/asterisk/ccss.h Fri Jan 22 16:05:22 2010
@@ -433,8 +433,61 @@
AST_CC_EXTENSION_MONITOR,
};
-/* Forward declaration */
-struct cc_monitor;
+/*!
+ * \internal
+ * \brief An item in a CC interface tree.
+ *
+ * These are the individual items in an interface tree.
+ * The key difference between this structure and the ast_cc_interface
+ * is that this structure contains data which is intrinsic to the item's
+ * placement in the tree, such as who its parent is.
+ */
+struct ast_cc_monitor {
+ /* Information regarding the interface.
+ */
+ struct ast_cc_interface *interface;
+ /* Every interface has an id associated with it. Think of
+ * it like a "primary key"
+ */
+ unsigned int id;
+ /* Who is this interface's parent interface? The "root" of
+ * the tree will have 0 for this. Everyone else will have at
+ * least 1 as their parent_id.
+ */
+ unsigned int parent_id;
+ /* The instance of the CC core to which this monitor belongs
+ */
+ int core_id;
+ /* An indicator that tells whether monitoring of the device
+ * has been suspended.
+ */
+ int is_suspended;
+ /* What service was offered by the endpoint. Note that
+ * this field is completely irrelevant for cc_monitors
+ * representing dialplan extensions.
+ */
+ enum ast_cc_service_type service_offered;
+ /*!
+ * Name that should be used to recall specified interface
+ *
+ * When issuing a CC recall, some technologies will require
+ * that a name other than the device name is dialed. For instance,
+ * with SIP, a specific URI will be used which chan_sip will be able
+ * to recognize as being a CC recall. Similarly, ISDN will need a specific
+ * dial string to know that the call is a recall.
+ */
+ char *dialable_name;
+ /*!
+ * The ID of the available timer used by the current monitor
+ */
+ int available_timer_id;
+ /*!
+ * Monitor callbacks
+ */
+ const struct ast_cc_monitor_callbacks *callbacks;
+ void *private_data;
+ AST_DLLIST_ENTRY(ast_cc_monitor) next;
+};
struct ast_cc_monitor_callbacks {
/*!
@@ -459,7 +512,7 @@
* \retval 0 on success
* \retval -1 on failure.
*/
- int (*request_cc)(struct cc_monitor *monitor, int *available_timer_id);
+ int (*request_cc)(struct ast_cc_monitor *monitor, int *available_timer_id);
/*!
* \brief Suspend monitoring.
*
@@ -472,7 +525,7 @@
* \retval 0 on success
* \retval -1 on failure.
*/
- int (*suspend)(struct cc_monitor *monitor);
+ int (*suspend)(struct ast_cc_monitor *monitor);
/*!
* \brief Status response to an ast_cc_monitor_status_request().
*
@@ -488,7 +541,7 @@
* \retval 0 on success
* \retval -1 on failure.
*/
- int (*status_response)(struct cc_monitor *monitor, enum ast_device_state devstate);
+ int (*status_response)(struct ast_cc_monitor *monitor, enum ast_device_state devstate);
/*!
* \brief Unsuspend monitoring.
*
@@ -500,7 +553,7 @@
* \retval 0 on success
* \retval -1 on failure.
*/
- int (*unsuspend)(struct cc_monitor *monitor);
+ int (*unsuspend)(struct ast_cc_monitor *monitor);
/*!
* \brief Cancel the running available timer.
*
@@ -517,7 +570,7 @@
* \retval 0 on success
* \retval -1 on failure.
*/
- int (*cancel_available_timer)(struct cc_monitor *monitor, int *sched_id);
+ int (*cancel_available_timer)(struct ast_cc_monitor *monitor, int *sched_id);
/*!
* \brief Destroy private data on the monitor.
*
@@ -1220,7 +1273,7 @@
* \retval 0 Request successfully queued
* \retval -1 Request could not be queued
*/
-int ast_cc_monitor_callee_available2(struct cc_monitor *monitor);
+int ast_cc_monitor_callee_available2(struct ast_cc_monitor *monitor);
/* END API FOR USE WITH/BY MONITORS */
Modified: team/group/CCSS_Monitor_Restructure/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS_Monitor_Restructure/main/ccss.c?view=diff&rev=242428&r1=242427&r2=242428
==============================================================================
--- team/group/CCSS_Monitor_Restructure/main/ccss.c (original)
+++ team/group/CCSS_Monitor_Restructure/main/ccss.c Fri Jan 22 16:05:22 2010
@@ -161,7 +161,7 @@
* to use it, and it may last beyond the lifetime of a single
* thread.
*/
-AST_DLLIST_HEAD(ast_cc_interface_tree, cc_monitor);
+AST_DLLIST_HEAD(ast_cc_interface_tree, ast_cc_monitor);
/*!
* \internal
@@ -815,71 +815,15 @@
return callbacks;
}
-/*!
- * \internal
- * \brief An item in a CC interface tree.
- *
- * These are the individual items in an interface tree.
- * The key difference between this structure and the ast_cc_interface
- * is that this structure contains data which is intrinsic to the item's
- * placement in the tree, such as who its parent is.
- */
-struct cc_monitor {
- /* Information regarding the interface.
- */
- struct ast_cc_interface *interface;
- /* Every interface has an id associated with it. Think of
- * it like a "primary key"
- */
- unsigned int id;
- /* Who is this interface's parent interface? The "root" of
- * the tree will have 0 for this. Everyone else will have at
- * least 1 as their parent_id.
- */
- unsigned int parent_id;
- /* The instance of the CC core to which this monitor belongs
- */
- int core_id;
- /* An indicator that tells whether monitoring of the device
- * has been suspended.
- */
- int is_suspended;
- /* What service was offered by the endpoint. Note that
- * this field is completely irrelevant for cc_monitors
- * representing dialplan extensions.
- */
- enum ast_cc_service_type service_offered;
- /*!
- * Name that should be used to recall specified interface
- *
- * When issuing a CC recall, some technologies will require
- * that a name other than the device name is dialed. For instance,
- * with SIP, a specific URI will be used which chan_sip will be able
- * to recognize as being a CC recall. Similarly, ISDN will need a specific
- * dial string to know that the call is a recall.
- */
- char *dialable_name;
- /*!
- * The ID of the available timer used by the current monitor
- */
- int available_timer_id;
- /*!
- * Monitor callbacks
- */
- const struct ast_cc_monitor_callbacks *callbacks;
- void *private_data;
- AST_DLLIST_ENTRY(cc_monitor) next;
-};
-
static struct ast_cc_monitor_callbacks extension_monitor_cbs = {
.type = "extension",
};
-static int cc_generic_monitor_request_cc(struct cc_monitor *monitor, int *available_timer_id);
-static int cc_generic_monitor_suspend(struct cc_monitor *monitor);
-static int cc_generic_monitor_status_response(struct cc_monitor *monitor, enum ast_device_state devstate);
-static int cc_generic_monitor_unsuspend(struct cc_monitor *monitor);
-static int cc_generic_monitor_cancel_available_timer(struct cc_monitor *monitor, int *sched_id);
+static int cc_generic_monitor_request_cc(struct ast_cc_monitor *monitor, int *available_timer_id);
+static int cc_generic_monitor_suspend(struct ast_cc_monitor *monitor);
+static int cc_generic_monitor_status_response(struct ast_cc_monitor *monitor, enum ast_device_state devstate);
+static int cc_generic_monitor_unsuspend(struct ast_cc_monitor *monitor);
+static int cc_generic_monitor_cancel_available_timer(struct ast_cc_monitor *monitor, int *sched_id);
static void cc_generic_monitor_destructor(void *private_data);
static struct ast_cc_monitor_callbacks generic_monitor_cbs = {
@@ -895,7 +839,7 @@
struct ao2_container *generic_monitors;
struct generic_monitor_instance {
- struct cc_monitor *monitor;
+ struct ast_cc_monitor *monitor;
AST_LIST_ENTRY(generic_monitor_instance) next;
};
@@ -963,7 +907,7 @@
}
static void generic_monitor_devstate_cb(const struct ast_event *event, void *userdata);
-static struct generic_monitor_instance_list *create_new_generic_list(struct cc_monitor *monitor)
+static struct generic_monitor_instance_list *create_new_generic_list(struct ast_cc_monitor *monitor)
{
struct generic_monitor_instance_list *generic_list = ao2_alloc(sizeof(*generic_list), generic_monitor_instance_list_destructor);
char *monitor_name_copy = ast_strdup(monitor->interface->name);
@@ -1066,12 +1010,12 @@
int ast_cc_available_timer_expire(const void *data)
{
- struct cc_monitor *monitor = (struct cc_monitor *) data;
+ struct ast_cc_monitor *monitor = (struct ast_cc_monitor *) data;
monitor->available_timer_id = -1;
return ast_cc_monitor_failed(monitor->core_id, monitor->interface->name, monitor->interface->monitor_type);
}
-static int cc_generic_monitor_request_cc(struct cc_monitor *monitor, int *available_timer_id)
+static int cc_generic_monitor_request_cc(struct ast_cc_monitor *monitor, int *available_timer_id)
{
struct generic_monitor_instance_list *generic_list;
struct generic_monitor_instance *generic_instance;
@@ -1117,7 +1061,7 @@
return 0;
}
-static int cc_generic_monitor_suspend(struct cc_monitor *monitor)
+static int cc_generic_monitor_suspend(struct ast_cc_monitor *monitor)
{
struct generic_monitor_instance_list *generic_list;
struct generic_monitor_instance *generic_instance;
@@ -1148,7 +1092,7 @@
return 0;
}
-static int cc_generic_monitor_status_response(struct cc_monitor *monitor, enum ast_device_state devstate)
+static int cc_generic_monitor_status_response(struct ast_cc_monitor *monitor, enum ast_device_state devstate)
{
/* The generic monitor will never issue a status request of the other side's agent.
* If this somehow gets called, something really fishy is going on.
@@ -1157,7 +1101,7 @@
return 0;
}
-static int cc_generic_monitor_unsuspend(struct cc_monitor *monitor)
+static int cc_generic_monitor_unsuspend(struct ast_cc_monitor *monitor)
{
/* When a generic monitor becomes unsuspended, we should do a status request
* to see if the device is available. That way, if it is, we can trigger an
@@ -1169,7 +1113,7 @@
return 0;
}
-static int cc_generic_monitor_cancel_available_timer(struct cc_monitor *monitor, int *sched_id)
+static int cc_generic_monitor_cancel_available_timer(struct ast_cc_monitor *monitor, int *sched_id)
{
ast_assert(sched_id != NULL);
@@ -1225,7 +1169,7 @@
ast_cc_config_params_destroy(interface->config_params);
}
-static void cc_monitor_destroy(struct cc_monitor *monitor)
+static void cc_monitor_destroy(struct ast_cc_monitor *monitor)
{
/* During the monitor creation process, it is possible for this
* function to be called prior to when callbacks are assigned
@@ -1245,7 +1189,7 @@
static void cc_interface_tree_destroy(void *data)
{
struct ast_cc_interface_tree *cc_interface_tree = data;
- struct cc_monitor *monitor;
+ struct ast_cc_monitor *monitor;
while ((monitor = AST_DLLIST_REMOVE_HEAD(cc_interface_tree, next))) {
cc_monitor_destroy(monitor);
}
@@ -1415,11 +1359,11 @@
* \retval NULL Memory allocation failure
* \retval non-NULL The newly-created cc_monitor for the extension
*/
-static struct cc_monitor *cc_extension_monitor_init(const char * const exten, const char * const context, const unsigned int parent_id)
+static struct ast_cc_monitor *cc_extension_monitor_init(const char * const exten, const char * const context, const unsigned int parent_id)
{
struct ast_str *str = ast_str_alloca(2 * AST_MAX_EXTENSION);
struct ast_cc_interface *cc_interface;
- struct cc_monitor *monitor;
+ struct ast_cc_monitor *monitor;
ast_str_set(&str, 0, "%s@%s", exten, context);
@@ -1460,7 +1404,7 @@
*/
static int cc_interfaces_datastore_init(struct ast_channel *chan) {
struct dialed_cc_interfaces *interfaces;
- struct cc_monitor *monitor;
+ struct ast_cc_monitor *monitor;
struct ast_datastore *dial_cc_datastore;
/*XXX This may be a bit controversial. In an attempt to not allocate
@@ -1570,10 +1514,10 @@
* \retval NULL Memory allocation failure
* \retval non-NULL The new ast_cc_interface created.
*/
-static struct cc_monitor *cc_device_monitor_init(const char * const device_name, const char * const dialable_name, const struct ast_control_cc_payload *cc_data, int core_id)
+static struct ast_cc_monitor *cc_device_monitor_init(const char * const device_name, const char * const dialable_name, const struct ast_control_cc_payload *cc_data, int core_id)
{
struct ast_cc_interface *cc_interface;
- struct cc_monitor *monitor;
+ struct ast_cc_monitor *monitor;
size_t device_name_len = strlen(device_name);
int parent_id = cc_data->parent_interface_id;
@@ -1643,7 +1587,7 @@
{
char *device_name;
char *dialable_name;
- struct cc_monitor *monitor;
+ struct ast_cc_monitor *monitor;
struct ast_datastore *cc_datastore;
struct dialed_cc_interfaces *cc_interfaces;
struct ast_control_cc_payload *cc_data = frame_data;
@@ -1756,7 +1700,7 @@
struct ast_datastore *cc_interfaces_datastore;
struct dialed_cc_interfaces *interfaces;
- struct cc_monitor *monitor;
+ struct ast_cc_monitor *monitor;
ast_channel_lock(chan);
if (ast_get_cc_agent_policy(ast_channel_get_cc_config_params(chan)) == AST_CC_AGENT_NEVER) {
@@ -2333,9 +2277,9 @@
return 0;
}
-static int has_children(struct cc_monitor *monitor)
-{
- struct cc_monitor *iter = monitor;
+static int has_children(struct ast_cc_monitor *monitor)
+{
+ struct ast_cc_monitor *iter = monitor;
while ((iter = AST_DLLIST_NEXT(iter, next))) {
if (iter->parent_id == monitor->id) {
@@ -2347,7 +2291,7 @@
static void request_cc(struct cc_core_instance *core_instance)
{
- struct cc_monitor *monitor_iter;
+ struct ast_cc_monitor *monitor_iter;
AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_BEGIN(core_instance->monitors, monitor_iter, next) {
if (monitor_iter->interface->monitor_class == AST_CC_DEVICE_MONITOR) {
if (monitor_iter->callbacks->request_cc(monitor_iter, &monitor_iter->available_timer_id)) {
@@ -2389,7 +2333,7 @@
static void unsuspend(struct cc_core_instance *core_instance)
{
- struct cc_monitor *monitor_iter;
+ struct ast_cc_monitor *monitor_iter;
AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_BEGIN(core_instance->monitors, monitor_iter, next) {
if (monitor_iter->interface->monitor_class == AST_CC_DEVICE_MONITOR) {
if (monitor_iter->callbacks->unsuspend(monitor_iter)) {
@@ -2436,7 +2380,7 @@
static void suspend(struct cc_core_instance *core_instance)
{
- struct cc_monitor *monitor_iter;
+ struct ast_cc_monitor *monitor_iter;
AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_BEGIN(core_instance->monitors, monitor_iter, next) {
if (monitor_iter->interface->monitor_class == AST_CC_DEVICE_MONITOR) {
if (monitor_iter->callbacks->suspend(monitor_iter)) {
@@ -2471,7 +2415,7 @@
static void cancel_available_timer(struct cc_core_instance *core_instance)
{
- struct cc_monitor *monitor_iter;
+ struct ast_cc_monitor *monitor_iter;
AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_BEGIN(core_instance->monitors, monitor_iter, next) {
if (monitor_iter->interface->monitor_class == AST_CC_DEVICE_MONITOR) {
if (monitor_iter->callbacks->cancel_available_timer(monitor_iter, &monitor_iter->available_timer_id)) {
@@ -2662,7 +2606,7 @@
struct cc_recall_ds_data *recall_data;
struct ast_cc_interface_tree *interface_tree;
char device_name[AST_CHANNEL_NAME];
- struct cc_monitor *device_monitor;
+ struct ast_cc_monitor *device_monitor;
ast_assert(core_id != NULL);
@@ -2736,7 +2680,7 @@
{
struct ast_datastore *recall_datastore;
struct ast_cc_interface_tree *interface_tree;
- struct cc_monitor *monitor_iter;
+ struct ast_cc_monitor *monitor_iter;
struct cc_recall_ds_data *recall_data;
struct ast_str *var_value = ast_str_create(64);
int multi = 0;
@@ -2775,7 +2719,7 @@
{
struct ast_datastore *recall_datastore;
struct ast_cc_interface_tree *interface_tree;
- struct cc_monitor *monitor_iter;
+ struct ast_cc_monitor *monitor_iter;
struct cc_recall_ds_data *recall_data;
unsigned int exten_id = 0;
struct ast_str *var_value = ast_str_create(64);
@@ -2882,7 +2826,7 @@
return cc_request_state_change(CC_ACTIVE, core_id, debug);
}
-int ast_cc_monitor_callee_available2(struct cc_monitor *monitor)
+int ast_cc_monitor_callee_available2(struct ast_cc_monitor *monitor)
{
return cc_request_state_change(CC_CALLEE_READY, monitor->core_id, "Device being monitored has become available");
}
@@ -2939,7 +2883,7 @@
return cc_request_state_change(CC_FAILED, core_id, debug);
}
-struct cc_monitor_failure_data {
+struct ast_cc_monitor_failure_data {
const char *device_name;
const char *monitor_type;
int core_id;
@@ -2947,9 +2891,9 @@
static int cc_monitor_failed(void *data)
{
- struct cc_monitor_failure_data *failure_data = data;
+ struct ast_cc_monitor_failure_data *failure_data = data;
struct cc_core_instance *core_instance = find_cc_core_instance(failure_data->core_id);
- struct cc_monitor *monitor_iter;
+ struct ast_cc_monitor *monitor_iter;
AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_BEGIN(core_instance->monitors, monitor_iter, next) {
if (monitor_iter->interface->monitor_class == AST_CC_DEVICE_MONITOR) {
@@ -2973,7 +2917,7 @@
int ast_cc_monitor_failed(int core_id, const char *const monitor_name, const char * const monitor_type)
{
- struct cc_monitor_failure_data *failure_data;
+ struct ast_cc_monitor_failure_data *failure_data;
int res;
if (!(failure_data = ast_calloc(1, sizeof(*failure_data)))) {
@@ -3098,7 +3042,7 @@
{
struct cc_status_response_args *args = data;
struct cc_core_instance *core_instance = args->core_instance;
- struct cc_monitor *monitor_iter;
+ struct ast_cc_monitor *monitor_iter;
enum ast_device_state devstate = args->devstate;
ast_free(args);
@@ -3348,7 +3292,7 @@
struct count_monitors_cb_data *cb_data = arg;
const char *device_name = cb_data->device_name;
const char *monitor_type = cb_data->monitor_type;
- struct cc_monitor *monitor_iter;
+ struct ast_cc_monitor *monitor_iter;
AST_DLLIST_TRAVERSE(core_instance->monitors, monitor_iter, next) {
if (!strcmp(monitor_iter->interface->name, device_name) &&
@@ -3401,7 +3345,7 @@
return;
}
-static void cc_cli_print_monitor_stats(struct cc_monitor *monitor, int fd, int parent_id)
+static void cc_cli_print_monitor_stats(struct ast_cc_monitor *monitor, int fd, int parent_id)
{
if (!monitor) {
return;
More information about the asterisk-commits
mailing list