add private flags to channel for endpoints to use

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10587 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-12-04 04:46:10 +00:00
parent 209c33e97d
commit ed0c26010a
2 changed files with 29 additions and 0 deletions

View File

@ -490,6 +490,10 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(_In_ switch_channe
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

View File

@ -116,6 +116,7 @@ struct switch_channel {
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_flag(switch_channel_t *channel, switch_c
}
}
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);