📄 cmautoras.c
字号:
/***********************************************************************
Copyright (c) 2002 RADVISION Ltd.
************************************************************************
NOTICE:
This document contains information that is confidential and proprietary
to RADVISION Ltd.. No part of this document may be reproduced in any
form whatsoever without written prior approval by RADVISION Ltd..
RADVISION Ltd. reserve the right to revise this publication and make
changes without obligation to notify any person of such revisions or
changes.
***********************************************************************/
#include "rvinternal.h"
#include "cmintr.h"
#include "cmiras.h"
#include "q931asn1.h"
#include "cmutils.h"
#include "cmAutoRasEP.h"
#include "cmAutoRasCall.h"
#include "cmAutoRasAltGK.h"
#include "cmAutoRas.h"
#ifdef __cplusplus
extern "C" {
#endif
/************************************************************************
*
* Private functions
*
************************************************************************/
/************************************************************************
*
* Public functions
*
************************************************************************/
/************************************************************************
* cmiAutoRASInit
* purpose: Initialize the RAS module and all the network related with
* RAS.
* input : hApp - Application's stack handle
* logMgr - Log manager used by the stack
* hTimers - Timers pool used by the stack
* hVal - Value tree handle
* rasConfNode - RAS configuration tree
* evFunc - Event handler to set
* output : none
* return : Automatic RAS handle created on success
* NULL on failure
************************************************************************/
HAUTORASMGR cmiAutoRASInit(
IN HAPP hApp,
IN RvH323TimerPoolHandle hTimers,
IN HPVT hVal,
IN int rasConfNode,
IN cmiEvAutoRASEventT evFunc)
{
autorasEndpoint* autoras;
if(RvMemoryAlloc(NULL, (void**)&autoras, sizeof(autorasEndpoint)) != RV_OK)
return NULL;
memset(autoras, 0, sizeof(autorasEndpoint));
/* Set automatic RAS parameters */
autoras->hApp = hApp;
autoras->hTimers = hTimers;
autoras->hVal = hVal;
autoras->confNode = rasConfNode;
autoras->event = evFunc;
autoras->state = cmIdle;
autoras->regTimer = NULL;
autoRasStartAltGKs(autoras);
autoras->GKID.string = autoras->GKIDstr;
autoras->GKID.length = 0;
return (HAUTORASMGR)autoras;
}
/************************************************************************
* cmiAutoRASStart
* purpose: Start the RAS module and all the network related with
* RAS.
* input : hApp - Application's stack handle
* output : none
* return : Non negative value on success
* Negative value on failure
************************************************************************/
int cmiAutoRASStart(IN HAPP hApp)
{
HAUTORASMGR hAutoRas = cmiGetAutoRasHandle(hApp);
cmiAutoRASEPStart(hAutoRas);
cmiAutoRASCallStart(hAutoRas);
return 0;
}
/************************************************************************
* cmiAutoRASEnd
* purpose: End the automatic RAS module
* input : hApp - Application's stack handle
* output : none
* return : none
************************************************************************/
void cmiAutoRASEnd(IN HAPP hApp)
{
autorasEndpoint* autoras = (autorasEndpoint *)((cmElem*)hApp)->hAutoRas;
if (autoras != NULL)
{
autoRasStopAltGKs(autoras);
RvMemoryFree(autoras);
}
}
/************************************************************************
* cmiAutoRAS
* purpose: Returns the RAS mode
* input : hApp - Application's stack handle
* output : none
* return : RV_TRUE for automatic RAS
* RV_FALSE for manual RAS
************************************************************************/
RvBool cmiAutoRAS(IN HAPP hApp)
{
return (((cmElem*)hApp)->hAutoRas != NULL);
}
/************************************************************************
* setRasAlternateGatekeeper
* purpose: Called after a confirmation message, sets the current GK and
* updates the list of AltGKs.
* input : autoras - Automatic RAS EndPoint instance
* : autorasC - Automatic RAS Call instance (may be NULL)
* nodeId - node of the AltGKs
* output : none
* return : none
************************************************************************/
void setRasAlternateGatekeeper(autorasEndpoint * autoras, autorasCall * autorasC, int nodeId)
{
if(autoRasIsInSearch(autoras, autorasC))
{
if((autoRasGotPermList(autoras)) && (autorasC ? !autorasC->isTempRdrn : !autoras->isTempRdrn))
{ /* we found the confirming GK through sending to PERMANENT AltGKs */
/* Set this GK as our GK */
int GKnode = autoRasGetCurrentAltGkNode(autoras, autorasC);
if(GKnode < 0)
/* SHOULD NEVER BE HERE! VERY BAD! */
autoRasRemovePermList(autoras);
else
{
int GKAddrNode = pvtGetChild(autoras->hVal, GKnode, __q931(rasAddress), NULL);
cmVtToTA(autoras->hVal, GKAddrNode, (cmTransportAddress *) &autoras->setGK);
GKAddrNode = pvtGetChild(autoras->hVal, GKnode, __q931(gatekeeperIdentifier), NULL);
if(GKAddrNode) vtToAlias(autoras->hVal, &autoras->GKID, GKAddrNode);
autoRasChangeState(autoras, cmPermanentAlternateGatekeeperConfirmation, GKnode);
}
}
autoRasResetSearch(autoras, autorasC);
if(autorasC) autorasC->isTempRdrn = RV_FALSE;
else autoras->isTempRdrn = RV_FALSE;
}
/* getting the alternate gatekeepers from the message */
if(nodeId >= 0)
autoRasSetPermList(autoras, nodeId);
}
#ifdef __cplusplus
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -