[asterisk-commits] mmichelson: branch group/CCSS r238354 - in /team/group/CCSS: include/asterisk...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 7 10:59:57 CST 2010


Author: mmichelson
Date: Thu Jan  7 10:59:53 2010
New Revision: 238354

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=238354
Log:
Create functions to unregister agent and monitor callbacks.


Modified:
    team/group/CCSS/include/asterisk/ccss.h
    team/group/CCSS/main/ccss.c

Modified: team/group/CCSS/include/asterisk/ccss.h
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/include/asterisk/ccss.h?view=diff&rev=238354&r1=238353&r2=238354
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Thu Jan  7 10:59:53 2010
@@ -359,6 +359,20 @@
  */
 int ast_cc_monitor_register(const struct ast_cc_monitor_callbacks *callbacks);
 
+/*!
+ * \since 1.8
+ * \brief Unregister a set of monitor callbacks with the core
+ *
+ * \details
+ * If a module which makes use of a CC monitor is unloaded, then it may
+ * unregister its monitor callbacks with the core.
+ *
+ * \param callbacks The callbacks used by the monitor implementation
+ * \retval 0 Successfully unregistered
+ * \retval -1 Failure to unregister
+ */
+int ast_cc_monitor_unregister(const struct ast_cc_monitor_callbacks *callbacks);
+
 struct ast_cc_agent_callbacks;
 
 /*!
@@ -375,6 +389,20 @@
  * \retval -1 Failure to register
  */
 int ast_cc_agent_register(const struct ast_cc_agent_callbacks *callbacks);
+
+/*!
+ * \since 1.8
+ * \brief Unregister a set of agent callbacks with the core
+ *
+ * \details
+ * If a module which makes use of a CC agent is unloaded, then it may
+ * unregister its agent callbacks with the core.
+ *
+ * \param callbacks The callbacks used by the agent implementation
+ * \retval 0 Successfully unregistered
+ * \retval -1 Failure to unregister
+ */
+int ast_cc_agent_unregister(const struct ast_cc_agent_callbacks *callbacks);
 
 /* END AGENT/MONITOR REGISTRATION API */
 

Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=238354&r1=238353&r2=238354
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Thu Jan  7 10:59:53 2010
@@ -725,6 +725,23 @@
 	return callbacks;
 }
 
+int ast_cc_monitor_unregister(const struct ast_cc_monitor_callbacks *callbacks)
+{
+	struct cc_monitor_backend *backend;
+	int retval = -1;
+	AST_RWLIST_WRLOCK(&cc_monitor_backends);
+	AST_RWLIST_TRAVERSE_SAFE_BEGIN(&cc_monitor_backends, backend, next) {
+		if (backend->callbacks == callbacks) {
+			AST_RWLIST_REMOVE_CURRENT(next);
+			retval = 0;
+			break;
+		}
+	}
+	AST_RWLIST_TRAVERSE_SAFE_END;
+	AST_RWLIST_UNLOCK(&cc_monitor_backends);
+	return retval;
+}
+
 struct cc_agent_backend {
 	AST_LIST_ENTRY(cc_agent_backend) next;
 	const struct ast_cc_agent_callbacks *callbacks;
@@ -745,6 +762,23 @@
 	AST_RWLIST_INSERT_TAIL(&cc_agent_backends, backend, next);
 	AST_RWLIST_UNLOCK(&cc_agent_backends);
 	return 0;
+}
+
+int ast_cc_agent_unregister(const struct ast_cc_agent_callbacks *callbacks)
+{
+	struct cc_agent_backend *backend;
+	int retval = -1;
+	AST_RWLIST_WRLOCK(&cc_agent_backends);
+	AST_RWLIST_TRAVERSE_SAFE_BEGIN(&cc_agent_backends, backend, next) {
+		if (backend->callbacks == callbacks) {
+			AST_RWLIST_REMOVE_CURRENT(next);
+			retval = 0;
+			break;
+		}
+	}
+	AST_RWLIST_TRAVERSE_SAFE_END;
+	AST_RWLIST_UNLOCK(&cc_agent_backends);
+	return retval;
 }
 
 static const struct ast_cc_agent_callbacks *find_agent_callbacks(struct ast_channel *chan)




More information about the asterisk-commits mailing list