[Freeswitch-svn] [commit] r10587 - in freeswitch/trunk/src: . include

FreeSWITCH SVN anthm at freeswitch.org
Wed Dec 3 20:46:10 PST 2008


Author: anthm
Date: Wed Dec  3 23:46:10 2008
New Revision: 10587

Log:
add private flags to channel for endpoints to use

Modified:
   freeswitch/trunk/src/include/switch_channel.h
   freeswitch/trunk/src/switch_channel.c

Modified: freeswitch/trunk/src/include/switch_channel.h
==============================================================================
--- freeswitch/trunk/src/include/switch_channel.h	(original)
+++ freeswitch/trunk/src/include/switch_channel.h	Wed Dec  3 23:46:10 2008
@@ -490,6 +490,10 @@
 
 SWITCH_DECLARE(void) switch_channel_audio_sync(switch_channel_t *channel);
 
+SWITCH_DECLARE(void) switch_channel_set_private_flag(switch_channel_t *channel, uint32_t flags);
+SWITCH_DECLARE(void) switch_channel_clear_private_flag(switch_channel_t *channel, uint32_t flags);
+SWITCH_DECLARE(int) switch_channel_test_private_flag(switch_channel_t *channel, uint32_t flags);
+
 /** @} */
 
 SWITCH_END_EXTERN_C

Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c	(original)
+++ freeswitch/trunk/src/switch_channel.c	Wed Dec  3 23:46:10 2008
@@ -116,6 +116,7 @@
 	switch_channel_state_t state;
 	switch_channel_state_t running_state;
 	switch_channel_flag_t flags;
+	uint32_t private_flags;
 	switch_channel_flag_t state_flags;
 	switch_caller_profile_t *caller_profile;
 	const switch_state_handler_table_t *state_handlers[SWITCH_MAX_STATE_HANDLERS];
@@ -749,6 +750,30 @@
 	}
 }
 
+
+SWITCH_DECLARE(void) switch_channel_set_private_flag(switch_channel_t *channel, uint32_t flags)
+{
+	switch_assert(channel != NULL);
+	switch_mutex_lock(channel->flag_mutex);
+	channel->private_flags |= flags;
+	switch_mutex_unlock(channel->flag_mutex);
+}
+
+SWITCH_DECLARE(void) switch_channel_clear_private_flag(switch_channel_t *channel, uint32_t flags)
+{
+	switch_assert(channel != NULL);
+	switch_mutex_lock(channel->flag_mutex);
+	channel->private_flags &= ~flags;
+	switch_mutex_unlock(channel->flag_mutex);
+}
+
+SWITCH_DECLARE(int) switch_channel_test_private_flag(switch_channel_t *channel, uint32_t flags)
+{
+	switch_assert(channel != NULL);
+	return (channel->private_flags & flags);
+}
+
+
 SWITCH_DECLARE(void) switch_channel_set_state_flag(switch_channel_t *channel, switch_channel_flag_t flags)
 {
 	switch_assert(channel != NULL);



More information about the Freeswitch-svn mailing list