📄 cmchangetbyxxx.c
字号:
#ifdef __cplusplus
extern "C" {
#endif
/*
NOTICE:
This document contains information that is proprietary to RADVISION LTD..
No part of this publication may be reproduced in any form whatsoever without
written prior approval by RADVISION LTD..
RADVISION LTD. reserves the right to revise this publication and make changes
without obligation to notify any person of such revisions or changes.
*/
#include <rvinternal.h>
#include <cmControl.h>
#include <cmCrossReference.h>
/* find an incoming channel with LCN == lcn */
H245Channel* getInChanByLCN(HCONTROL ctrl,int lcn)
{
/* get the pointer to the first channel from EMA call "struct" */
H245Channel * channel=(H245Channel*)cmiGetChannelListForCtrl(ctrl);
/* go through the channel list to the end (NULL) */
while(channel)
{
/* match LCN for incoming channels */
if (!channel->bOrigin && channel->myLogicalChannelNum==lcn)
/* return match */
return channel;
/* next channel on the list */
channel=channel->pNext;
}
/* not found */
return NULL;
}
/* find an outgoing channel with LCN == lcn */
H245Channel* getOutChanByLCN(HCONTROL ctrl,int lcn)
{
/* get the pointer to the first channel from EMA call "struct" */
H245Channel * channel=(H245Channel*)cmiGetChannelListForCtrl(ctrl);
/* go through the channel list to the end (NULL) */
while(channel)
{
/* match LCN for outgoing channels */
if (channel->bOrigin && channel->myLogicalChannelNum==lcn)
/* return match */
return channel;
/* next channel on the list */
channel=channel->pNext;
}
/* not found */
return NULL;
}
/* find an outgoing channel with LCN == lcn, or reverseLCN == lcn for incoming ones */
H245Channel* getOutSubChanByLCN(HCONTROL ctrl,int lcn)
{
/* get the pointer to the first channel from EMA call "struct" */
H245Channel * channel=(H245Channel*)cmiGetChannelListForCtrl(ctrl);
/* go through the channel list to the end (NULL) */
while(channel)
{
/* match LCN for outgoing channels and reverse LCN for incoming ones */
if ((channel->bOrigin && channel->myLogicalChannelNum==lcn) ||
(!channel->bOrigin && channel->reverseLogicalChannelNum==lcn))
/* return match */
return channel;
/* next channel on the list */
channel=channel->pNext;
}
/* not found */
return NULL;
}
/* find an incoming channel with LCN == lcn, or reverseLCN == lcn for outgoing ones */
H245Channel* getInSubChanByLCN(HCONTROL ctrl,int lcn)
{
/* get the pointer to the first channel from EMA call "struct" */
H245Channel * channel=(H245Channel*)cmiGetChannelListForCtrl(ctrl);
/* go through the channel list to the end (NULL) */
while(channel)
{
/* match LCN for incoming channels and reverse LCN for outgoing ones */
if ((!channel->bOrigin && channel->myLogicalChannelNum==lcn) ||
(channel->bOrigin && channel->reverseLogicalChannelNum==lcn))
/* return match */
return channel;
/* next channel on the list */
channel=channel->pNext;
}
/* not found */
return NULL;
}
/* find an outgoing channel with SID == sid */
H245Channel* getOutChanBySID(HCONTROL ctrl,int sid)
{
/* get the pointer to the first channel from EMA call "struct" */
H245Channel * channel=(H245Channel*)cmiGetChannelListForCtrl(ctrl);
/* go through the channel list to the end (NULL) */
while(channel)
{
/* match SID for outgoing channels */
if (channel->bOrigin && channel->sessionId==sid)
/* return match */
return channel;
/* next channel on the list */
channel=channel->pNext;
}
/* not found */
return NULL;
}
/* find an incoming channel with SID == sid */
H245Channel* getInChanBySID(HCONTROL ctrl,int sid)
{
/* get the pointer to the first channel from EMA call "struct" */
H245Channel * channel=(H245Channel*)cmiGetChannelListForCtrl(ctrl);
/* go through the channel list to the end (NULL) */
while(channel)
{
/* match SID for incoming channels */
if (!channel->bOrigin && channel->sessionId==sid)
/* return match */
return channel;
/* next channel on the list */
channel=channel->pNext;
}
/* not found */
return NULL;
}
/* Tests that there is no channel in the same direction with the same non-zero SID */
RvBool checkChanSIDConsistency(HCONTROL ctrl,H245Channel* test_channel)
{
/* get the pointer to the first channel from EMA call "struct" */
H245Channel * channel=(H245Channel*)cmiGetChannelListForCtrl(ctrl);
if (channel->sessionId==0)
return RV_FALSE;
/* go through the channel list to the end (NULL) */
while(channel)
{
/* see if there is a differant channel of the same direction with the same SID */
if (channel!=test_channel && channel->bOrigin==test_channel->bOrigin && channel->sessionId==test_channel->sessionId && (channel->eState != ChannelStateReleased))
return RV_TRUE;
/* next channel on the list */
channel=channel->pNext;
}
/* none found */
return RV_FALSE;
}
/* find an outgoing channel whose base is channel, starting from currentChannel */
H245Channel* getNextOutChanByBase(HCONTROL ctrl,H245Channel* channel,void** currentChannel)
{
H245Channel * itr_channel;
if (*currentChannel)
/* continue from last position */
itr_channel=((H245Channel*)*currentChannel)->pNext;
else
/* get the pointer to the first channel from EMA call "struct" */
itr_channel=(H245Channel *)cmiGetChannelListForCtrl(ctrl);
/* go through the channel list to the end (NULL) */
while (itr_channel)
{
/* find an outgoing channel whose base is this channel */
if (itr_channel->bOrigin && (itr_channel->pBase==channel))
{
/* save position */
*currentChannel=(void*)itr_channel;
/* return match */
return itr_channel;
}
/* next channel on the list */
itr_channel=itr_channel->pNext;
}
/* not found */
return NULL;
}
/* get next outgoing channel, starting from currentChannel */
H245Channel* getNextOutChan(HCONTROL ctrl, void** currentChannel)
{
H245Channel * itr_channel;
if (*currentChannel)
/* continue from last position */
itr_channel=((H245Channel*)*currentChannel)->pNext;
else
/* get the pointer to the first channel from EMA call "struct" */
itr_channel=(H245Channel *)cmiGetChannelListForCtrl(ctrl);
/* go through the channel list to the end (NULL) */
while (itr_channel)
{
/* get the next outgoing channel */
if (itr_channel->bOrigin)
{
/* save position */
*currentChannel=(void*)itr_channel;
/* return match */
return itr_channel;
}
/* next channel on the list */
itr_channel=itr_channel->pNext;
}
/* not found */
return NULL;
}
/* get next incoming channel, starting from currentChannel */
H245Channel* getNextInChan(HCONTROL ctrl, void** currentChannel)
{
H245Channel * itr_channel;
if (*currentChannel)
/* continue from last position */
itr_channel=((H245Channel*)*currentChannel)->pNext;
else
/* get the pointer to the first channel from EMA call "struct" */
itr_channel=(H245Channel *)cmiGetChannelListForCtrl(ctrl);
/* go through the channel list to the end (NULL) */
while (itr_channel)
{
/* get the next incoming channel */
if (!itr_channel->bOrigin)
{
/* save position */
*currentChannel=(void*)itr_channel;
/* return match */
return itr_channel;
}
/* next channel on the list */
itr_channel=itr_channel->pNext;
}
/* not found */
return NULL;
}
/************************************************************************
* getNextChan
* purpose: Get the next channel for a given control object.
* This function can be used to perform a single task on all
* the channels.
* input : ctrl - Control object
* currentChannel - Current channel we have.
* If the contents of this pointer is NULL, then the
* first channel will be returned
* output : currentChannel - Next channel in list
* return : Next channel in list on success
* NULL when there are no more channels
************************************************************************/
H245Channel* getNextChan(IN HCONTROL ctrl, INOUT void** currentChannel)
{
H245Channel * itr_channel;
if (*currentChannel)
/* continue from last position */
itr_channel=((H245Channel*)*currentChannel)->pNext;
else
/* get the pointer to the first channel from EMA call "struct" */
itr_channel=(H245Channel *)cmiGetChannelListForCtrl(ctrl);
/* if there is another channel in the list */
if(itr_channel)
{
/* save position */
*currentChannel=(void*)itr_channel;
/* return it */
return itr_channel;
}
return NULL;
}
int getFreeSID(HCONTROL ctrl)
{
H245Control* ctrlE = (H245Control*)ctrl;
ctrlE->nextFreeSID++;
if (ctrlE->nextFreeSID>=0x100 || ctrlE->nextFreeSID<=0x20)
ctrlE->nextFreeSID=0x20;
return ctrlE->nextFreeSID;
}
#ifdef __cplusplus
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -