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

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Aug 27 11:53:07 CDT 2009


Author: mmichelson
Date: Thu Aug 27 11:53:03 2009
New Revision: 214435

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=214435
Log:
Change the init callback to return int.

It is unreasonable to assume that an agent implementation
will require a non-NULL private data pointer. Instead, the
agent can do whatever it needs to do in the init and
return an int to indicate success or failure.


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

Modified: team/group/CCSS/include/asterisk/ccss.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/include/asterisk/ccss.h?view=diff&rev=214435&r1=214434&r2=214435
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Thu Aug 27 11:53:03 2009
@@ -580,9 +580,10 @@
 	 * This callback is called when the CC core
 	 * is initialized. Agents should allocate
 	 * any private data necessary for the
-	 * call.
-	 */
-	void *(*init)(struct ast_cc_agent *agent, struct ast_channel *chan);
+	 * call and assign it to the private_data
+	 * on the agent.
+	 */
+	int (*init)(struct ast_cc_agent *agent, struct ast_channel *chan);
 	/*!
 	 * \brief Start the offer timer
 	 *

Modified: team/group/CCSS/main/ccss.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=214435&r1=214434&r2=214435
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Thu Aug 27 11:53:03 2009
@@ -55,7 +55,7 @@
 static const unsigned int CC_MAX_MONITORS_DEFAULT = 5u;
 
 /* Generic agent callbacks */
-static void *cc_generic_agent_init(struct ast_cc_agent *agent, struct ast_channel *chan);
+static int cc_generic_agent_init(struct ast_cc_agent *agent, struct ast_channel *chan);
 static int cc_generic_agent_start_offer_timer(struct ast_cc_agent *agent);
 static void cc_generic_agent_ack(struct ast_cc_agent *agent);
 static enum ast_device_state cc_generic_agent_status_request(struct ast_cc_agent *agent);
@@ -550,7 +550,7 @@
 		return NULL;
 	}
 	ast_cc_copy_config_params(agent->cc_params, ast_channel_get_cc_config_params(caller_chan));
-	if (!(agent->private_data = agent->callbacks->init(agent, caller_chan))) {
+	if (agent->callbacks->init(agent, caller_chan)) {
 		ast_cc_config_params_destroy(agent->cc_params);
 		ast_free(agent);
 		return NULL;
@@ -604,10 +604,14 @@
 	return 0;
 }
 
-static void *cc_generic_agent_init(struct ast_cc_agent *agent, struct ast_channel *chan)
-{
-	/* STUB */
-	return NULL;
+static int cc_generic_agent_init(struct ast_cc_agent *agent, struct ast_channel *chan)
+{
+	/* I'm kind of playing this by ear right now. I'm not thinking
+	 * of anything that a generic agent really needs to remember, so
+	 * for now I'm setting the private data on the agent to NULL but
+	 * returning a successful condition.
+	 */
+	return 0;
 }
 
 static int cc_generic_agent_start_offer_timer(struct ast_cc_agent *agent)




More information about the svn-commits mailing list