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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 4 11:09:35 CDT 2009


Author: mmichelson
Date: Fri Sep  4 11:09:32 2009
New Revision: 216546

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=216546
Log:
* Change monitor backend list to RWLIST
* Fix compilation by adding new header channelstate.h and
  placing the enum for ast_channel_state in there. Big thanks
  to Russell for writing this patch.


Added:
    team/group/CCSS/include/asterisk/channelstate.h   (with props)
Modified:
    team/group/CCSS/include/asterisk/ccss.h
    team/group/CCSS/include/asterisk/channel.h
    team/group/CCSS/include/asterisk/devicestate.h
    team/group/CCSS/include/asterisk/frame.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=216546&r1=216545&r2=216546
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Fri Sep  4 11:09:32 2009
@@ -25,6 +25,7 @@
 #define _ASTERISK_CCSS_H
 
 #include "asterisk.h"
+
 #include "asterisk/linkedlists.h"
 #include "asterisk/devicestate.h"
 
@@ -117,6 +118,11 @@
 	AST_CC_MONITOR_ALWAYS,
 };
 
+struct ast_control_cc_payload {
+	enum ast_cc_service_type service;
+	const char *monitor_type;
+};
+
 /* Forward declaration. Struct is in main/ccss.c */
 struct ast_cc_config_params;
 

Modified: team/group/CCSS/include/asterisk/channel.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/include/asterisk/channel.h?view=diff&rev=216546&r1=216545&r2=216546
==============================================================================
--- team/group/CCSS/include/asterisk/channel.h (original)
+++ team/group/CCSS/include/asterisk/channel.h Fri Sep  4 11:09:32 2009
@@ -148,6 +148,7 @@
 #include "asterisk/linkedlists.h"
 #include "asterisk/stringfields.h"
 #include "asterisk/datastore.h"
+#include "asterisk/channelstate.h"
 #include "asterisk/ccss.h"
 
 #define DATASTORE_INHERIT_FOREVER	INT_MAX
@@ -495,27 +496,6 @@
 	AST_ADSI_AVAILABLE,
 	AST_ADSI_UNAVAILABLE,
 	AST_ADSI_OFFHOOKONLY,
-};
-
-/*!
- * \brief ast_channel states
- *
- * \note Bits 0-15 of state are reserved for the state (up/down) of the line
- *       Bits 16-32 of state are reserved for flags
- */
-enum ast_channel_state {
-	AST_STATE_DOWN,			/*!< Channel is down and available */
-	AST_STATE_RESERVED,		/*!< Channel is down, but reserved */
-	AST_STATE_OFFHOOK,		/*!< Channel is off hook */
-	AST_STATE_DIALING,		/*!< Digits (or equivalent) have been dialed */
-	AST_STATE_RING,			/*!< Line is ringing */
-	AST_STATE_RINGING,		/*!< Remote end is ringing */
-	AST_STATE_UP,			/*!< Line is up */
-	AST_STATE_BUSY,			/*!< Line is busy */
-	AST_STATE_DIALING_OFFHOOK,	/*!< Digits (or equivalent) have been dialed while offhook */
-	AST_STATE_PRERING,		/*!< Channel has detected an incoming call and is waiting for ring */
-
-	AST_STATE_MUTE = (1 << 16),	/*!< Do not transmit voice data */
 };
 
 /*!
@@ -923,9 +903,6 @@
  */
 struct ast_datastore *ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid);
 
-/*! \brief Change the state of a channel */
-int ast_setstate(struct ast_channel *chan, enum ast_channel_state);
-
 /*!
  * \brief Create a channel structure
  * \since 1.6.3
@@ -2669,6 +2646,8 @@
  */
 int ast_channel_connected_line_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const void *connected_info, int caller, int frame);
 
+#include "asterisk/ccss.h"
+
 /*!
  * \since 1.6.4
  * \brief Set up datastore with CCSS parameters for a channel

Added: team/group/CCSS/include/asterisk/channelstate.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/include/asterisk/channelstate.h?view=auto&rev=216546
==============================================================================
--- team/group/CCSS/include/asterisk/channelstate.h (added)
+++ team/group/CCSS/include/asterisk/channelstate.h Fri Sep  4 11:09:32 2009
@@ -1,0 +1,53 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 1999 - 2009, Digium, Inc.
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ * \brief Channel states
+ * \par See also:
+ *  \arg \ref Def_Channel
+ *  \arg \ref channel_drivers
+ */
+
+#ifndef __AST_CHANNELSTATE_H__
+#define __AST_CHANNELSTATE_H__
+
+#include "asterisk.h"
+
+/*!
+ * \brief ast_channel states
+ *
+ * \note Bits 0-15 of state are reserved for the state (up/down) of the line
+ *       Bits 16-32 of state are reserved for flags
+ */
+enum ast_channel_state {
+	AST_STATE_DOWN,			/*!< Channel is down and available */
+	AST_STATE_RESERVED,		/*!< Channel is down, but reserved */
+	AST_STATE_OFFHOOK,		/*!< Channel is off hook */
+	AST_STATE_DIALING,		/*!< Digits (or equivalent) have been dialed */
+	AST_STATE_RING,			/*!< Line is ringing */
+	AST_STATE_RINGING,		/*!< Remote end is ringing */
+	AST_STATE_UP,			/*!< Line is up */
+	AST_STATE_BUSY,			/*!< Line is busy */
+	AST_STATE_DIALING_OFFHOOK,	/*!< Digits (or equivalent) have been dialed while offhook */
+	AST_STATE_PRERING,		/*!< Channel has detected an incoming call and is waiting for ring */
+
+	AST_STATE_MUTE = (1 << 16),	/*!< Do not transmit voice data */
+};
+
+/*! \brief Change the state of a channel */
+int ast_setstate(struct ast_channel *chan, enum ast_channel_state);
+
+#endif /* __AST_CHANNELSTATE_H__ */

Propchange: team/group/CCSS/include/asterisk/channelstate.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/group/CCSS/include/asterisk/channelstate.h
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/group/CCSS/include/asterisk/channelstate.h
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/group/CCSS/include/asterisk/devicestate.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/include/asterisk/devicestate.h?view=diff&rev=216546&r1=216545&r2=216546
==============================================================================
--- team/group/CCSS/include/asterisk/devicestate.h (original)
+++ team/group/CCSS/include/asterisk/devicestate.h Fri Sep  4 11:09:32 2009
@@ -37,7 +37,7 @@
 #ifndef _ASTERISK_DEVICESTATE_H
 #define _ASTERISK_DEVICESTATE_H
 
-#include "asterisk/channel.h"
+#include "asterisk/channelstate.h"
 
 #if defined(__cplusplus) || defined(c_plusplus)
 extern "C" {

Modified: team/group/CCSS/include/asterisk/frame.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/include/asterisk/frame.h?view=diff&rev=216546&r1=216545&r2=216546
==============================================================================
--- team/group/CCSS/include/asterisk/frame.h (original)
+++ team/group/CCSS/include/asterisk/frame.h Fri Sep  4 11:09:32 2009
@@ -33,7 +33,6 @@
 
 #include "asterisk/endian.h"
 #include "asterisk/linkedlists.h"
-#include "asterisk/ccss.h"
 
 struct ast_codec_pref {
 	char order[32];
@@ -367,11 +366,6 @@
 	AST_TRANSFER_FAILED,      /*!< Transfer request on the channel failed */
 };
 
-struct ast_control_cc_payload {
-	enum ast_cc_service_type service;
-	const char *monitor_type;
-};
-
 #define AST_SMOOTHER_FLAG_G729		(1 << 0)
 #define AST_SMOOTHER_FLAG_BE		(1 << 1)
 

Modified: team/group/CCSS/main/ccss.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=216546&r1=216545&r2=216546
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Fri Sep  4 11:09:32 2009
@@ -69,8 +69,7 @@
 	char cc_callback_macro[AST_MAX_EXTENSION];
 };
 
-/* XXX Consider making this an RWLIST */
-AST_LIST_HEAD_STATIC(cc_monitor_backends, cc_monitor_backend);
+AST_RWLIST_HEAD_STATIC(cc_monitor_backends, cc_monitor_backend);
 
 struct cc_monitor_backend {
 	AST_LIST_ENTRY(cc_monitor_backend) next;
@@ -818,15 +817,15 @@
 	struct cc_monitor_backend *backend;
 	const struct ast_cc_monitor_callbacks *callbacks = NULL;
 
-	AST_LIST_LOCK(&cc_monitor_backends);
-	AST_LIST_TRAVERSE(&cc_monitor_backends, backend, next) {
+	AST_RWLIST_RDLOCK(&cc_monitor_backends);
+	AST_RWLIST_TRAVERSE(&cc_monitor_backends, backend, next) {
 		if (!strcmp(backend->callbacks->type, type)) {
 			ast_log(LOG_NOTICE, "Returning backend %s\n", backend->callbacks->type);
 			callbacks = backend->callbacks;
 			break;
 		}
 	}
-	AST_LIST_UNLOCK(&cc_monitor_backends);
+	AST_RWLIST_UNLOCK(&cc_monitor_backends);
 	return callbacks;
 }
 
@@ -1467,9 +1466,9 @@
 
 	backend->callbacks = callbacks;
 
-	AST_LIST_LOCK(&cc_monitor_backends);
-	AST_LIST_INSERT_TAIL(&cc_monitor_backends, backend, next);
-	AST_LIST_UNLOCK(&cc_monitor_backends);
+	AST_RWLIST_WRLOCK(&cc_monitor_backends);
+	AST_RWLIST_INSERT_TAIL(&cc_monitor_backends, backend, next);
+	AST_RWLIST_UNLOCK(&cc_monitor_backends);
 	return 0;
 }
 




More information about the asterisk-commits mailing list