📄 cmiras.c
字号:
if (RV_PVT_NODEID_IS_VALID(ras->defaultMessages[i][j]))
{
pvtDelete(ras->hVal, ras->defaultMessages[i][j]);
ras->defaultMessages[i][j] = RV_PVT_INVALID_NODEID;
}
/* Reset GK Address */
if (RV_PVT_NODEID_IS_VALID(ras->gatekeeperRASAddress))
{
pvtDelete(ras->hVal, ras->gatekeeperRASAddress);
ras->gatekeeperRASAddress = RV_PVT_INVALID_NODEID;
}
if (RV_PVT_NODEID_IS_VALID(ras->gatekeeperCallSignalAddress))
{
pvtDelete(ras->hVal, ras->gatekeeperCallSignalAddress);
ras->gatekeeperCallSignalAddress = RV_PVT_INVALID_NODEID;
}
/* Reset terminalAlias list */
if (RV_PVT_NODEID_IS_VALID(ras->termAliasesNode))
{
pvtDelete(ras->hVal, ras->termAliasesNode);
ras->termAliasesNode = RV_PVT_INVALID_NODEID;
}
return 0;
}
/************************************************************************
* cmiRASEnd
* purpose: Free any resources taken by a RAS instance and stop its
* activities.
* input : hRasMgr - RAS instance handle
* output : none
* return : Non negative value on success
* Negative value on failure
************************************************************************/
int RVCALLCONV cmiRASEnd(
IN HRASMGR hRasMgr)
{
rasModule* ras;
if (hRasMgr == NULL) return RV_ERROR_UNKNOWN;
ras = (rasModule *)hRasMgr;
rasDecoderEnd(ras);
cmiRASStop(hRasMgr);
/* Remove hash tables and arrays */
if (ras->outRa != NULL) emaDestruct(ras->outRa);
if (ras->outHash != NULL) hashDestruct(ras->outHash);
if (ras->inRa != NULL) emaDestruct(ras->inRa);
if (ras->inHash != NULL) hashDestruct(ras->inHash);
if (ras->messages != NULL) rpoolDestruct(ras->messages);
if (ras->timers != NULL) RvH323TimerDestruct(ras->timers);
/* Destruct mutexes */
RvLockDestruct(&ras->lockInHash);
RvLockDestruct(&ras->lockOutHash);
RvLockDestruct(&ras->lockGarbage);
/* Destruct syntax trees used */
pstDestruct(ras->synMessage);
pstDestruct(ras->synProperty);
RvLogSourceDestruct(RvLogGet(), &ras->log);
RvLogSourceDestruct(RvLogGet(), &ras->logChan);
RvMemoryFree(ras);
return 0;
}
/************************************************************************
* cmiRASGetEndpointID
* purpose: Retrieves the EndpointID stored in the ras
*
* input : hRasMgr - RAS instance handle
* eId - pointer to the buffer for endpoint ID
* buffer should be big enough for longest EID
* possible (256 byte)
* output : none
* return : The length of EID in bytes on success
* Negative value on failure
************************************************************************/
int RVCALLCONV cmiRASGetEndpointID(
IN HRASMGR hRasMgr,
IN void* eId)
{
rasModule* ras;
if (hRasMgr == NULL) return RV_ERROR_UNKNOWN;
ras = (rasModule *)hRasMgr;
if (eId)
memcpy(eId, ras->epId, (RvSize_t)RvMin(256,ras->epIdLen));
return ras->epIdLen;
}
/************************************************************************
* cmiRASUpdateRegInfo
* purpose: Update the registration information inside the default RAS
* messages. This function should be called whenever the
* registration status changes.
* It takes most of the information from the RAS configuration
* message in the PVT database.
* input : hRasMgr - RAS instance handle
* beforeRegistration - RV_TRUE if called before cmRegister()
* RV_FALSE if called after RCF received
* output : none
* return : Non negative value on success
* Negative value on failure
************************************************************************/
int RVCALLCONV cmiRASUpdateRegInfo(
IN HRASMGR hRasMgr,
IN RvBool beforeRegistration)
{
rasModule* ras;
RvPvtNodeId destNodeId, srcNodeId;
char id[256];
char* pId = NULL;
int lenId;
if (hRasMgr == NULL) return RV_ERROR_UNKNOWN;
ras = (rasModule *)hRasMgr;
if(beforeRegistration)
{
/* Reset GK Address */
if (RV_PVT_NODEID_IS_VALID(ras->gatekeeperRASAddress))
pvtDelete(ras->hVal, ras->gatekeeperRASAddress);
ras->gatekeeperRASAddress = RV_PVT_INVALID_NODEID;
if (RV_PVT_NODEID_IS_VALID(ras->gatekeeperCallSignalAddress))
pvtDelete(ras->hVal, ras->gatekeeperCallSignalAddress);
ras->gatekeeperCallSignalAddress = RV_PVT_INVALID_NODEID;
/* Reset terminalAlias list */
if (RV_PVT_NODEID_IS_VALID(ras->termAliasesNode))
pvtDelete(ras->hVal, ras->termAliasesNode);
ras->termAliasesNode = RV_PVT_INVALID_NODEID;
}
if (!RV_PVT_NODEID_IS_VALID(ras->termAliasesNode))
{
__pvtGetNodeIdByFieldIds(srcNodeId, ras->hVal, ras->confNode, {_q931(registrationInfo) _q931(terminalAlias) LAST_TOKEN});
/* Get the current aliases in the configuration for the messages */
if (RV_PVT_NODEID_IS_VALID(srcNodeId))
{
/* We have aliases in the configuration */
ras->termAliasesNode = pvtAddRoot(ras->hVal,NULL,0,NULL);
pvtSetTree(ras->hVal, ras->termAliasesNode, ras->hVal, srcNodeId);
srcNodeId = ras->termAliasesNode;
}
}
else
srcNodeId = RV_PVT_INVALID_NODEID;
/* Set the terminalAlias in RRQ, GRQ, IRR if we have one */
if (RV_PVT_NODEID_IS_VALID(srcNodeId))
{
/* RRQ */
__pvtBuildByFieldIds(destNodeId, ras->hVal, ras->defaultMessages[cmRASRegistration][cmRASTrStageRequest], {_anyField _q931(terminalAlias) LAST_TOKEN}, 0, NULL);
pvtSetTree(ras->hVal, destNodeId, ras->hVal, srcNodeId);
/* GRQ */
__pvtBuildByFieldIds(destNodeId, ras->hVal, ras->defaultMessages[cmRASGatekeeper][cmRASTrStageRequest], {_anyField _q931(endpointAlias) LAST_TOKEN}, 0, NULL);
pvtSetTree(ras->hVal, destNodeId, ras->hVal, srcNodeId);
/* IRR - solicited */
__pvtBuildByFieldIds(destNodeId, ras->hVal, ras->defaultMessages[cmRASInfo][cmRASTrStageConfirm], {_anyField _q931(endpointAlias) LAST_TOKEN}, 0, NULL);
pvtSetTree(ras->hVal, destNodeId, ras->hVal, srcNodeId);
/* IRR - unsolicited */
__pvtBuildByFieldIds(destNodeId, ras->hVal, ras->defaultMessages[cmRASUnsolicitedIRR][cmRASTrStageRequest], {_anyField _q931(endpointAlias) LAST_TOKEN}, 0, NULL);
pvtSetTree(ras->hVal, destNodeId, ras->hVal, srcNodeId);
}
/* Set the terminalType in RRQ, GRQ, IRR if we have one */
__pvtGetNodeIdByFieldIds(srcNodeId, ras->hVal, ras->confNode, {_q931(registrationInfo) _q931(terminalType) LAST_TOKEN});
if (RV_PVT_NODEID_IS_VALID(srcNodeId))
{
/* RRQ */
__pvtBuildByFieldIds(destNodeId, ras->hVal, ras->defaultMessages[cmRASRegistration][cmRASTrStageRequest], {_anyField _q931(terminalType) LAST_TOKEN}, 0, NULL);
pvtSetTree(ras->hVal, destNodeId, ras->hVal, srcNodeId);
/* GRQ */
__pvtBuildByFieldIds(destNodeId, ras->hVal, ras->defaultMessages[cmRASGatekeeper][cmRASTrStageRequest], {_anyField _q931(endpointType) LAST_TOKEN}, 0, NULL);
pvtSetTree(ras->hVal, destNodeId, ras->hVal, srcNodeId);
/* IRR - solicited */
__pvtBuildByFieldIds(destNodeId, ras->hVal, ras->defaultMessages[cmRASInfo][cmRASTrStageConfirm], {_anyField _q931(endpointType) LAST_TOKEN}, 0, NULL);
pvtSetTree(ras->hVal, destNodeId, ras->hVal, srcNodeId);
/* IRR - unsolicited */
__pvtBuildByFieldIds(destNodeId, ras->hVal, ras->defaultMessages[cmRASUnsolicitedIRR][cmRASTrStageRequest], {_anyField _q931(endpointType) LAST_TOKEN}, 0, NULL);
pvtSetTree(ras->hVal, destNodeId, ras->hVal, srcNodeId);
}
/* Set the endpointIdentifier in relevant messages if we have one */
if (!beforeRegistration)
{
/* We're registered... get from RAS object */
pId = ras->epId;
lenId = ras->epIdLen;
if (lenId > 0)
{
/* RRQ */
__pvtBuildByFieldIds(destNodeId, ras->hVal, ras->defaultMessages[cmRASRegistration][cmRASTrStageRequest], {_anyField _q931(endpointIdentifier) LAST_TOKEN}, lenId, pId);
/* RCF */
__pvtBuildByFieldIds(destNodeId, ras->hVal, ras->defaultMessages[cmRASRegistration][cmRASTrStageConfirm], {_anyField _q931(endpointIdentifier) LAST_TOKEN}, lenId, pId);
/* URQ */
__pvtBuildByFieldIds(destNodeId, ras->hVal, ras->defaultMessages[cmRASUnregistration][cmRASTrStageRequest], {_anyField _q931(endpointIdentifier) LAST_TOKEN}, lenId, pId);
/* ARQ */
__pvtBuildByFieldIds(destNodeId, ras->hVal, ras->defaultMessages[cmRASAdmission][cmRASTrStageRequest], {_anyField _q931(endpointIdentifier) LAST_TOKEN}, lenId, pId);
/* BRQ */
__pvtBuildByFieldIds(destNodeId, ras->hVal,ras->defaultMessages[cmRASBandwidth][cmRASTrStageRequest], {_anyField _q931(endpointIdentifier) LAST_TOKEN}, lenId, pId);
/* DRQ */
__pvtBuildByFieldIds(destNodeId, ras->hVal,ras->defaultMessages[cmRASDisengage][cmRASTrStageRequest], {_anyField _q931(endpointIdentifier) LAST_TOKEN}, lenId, pId);
/* IRR - solicited */
__pvtBuildByFieldIds(destNodeId, ras->hVal,ras->defaultMessages[cmRASInfo][cmRASTrStageConfirm], {_anyField _q931(endpointIdentifier) LAST_TOKEN}, lenId, pId);
/* IRR - unsolicited */
__pvtBuildByFieldIds(destNodeId, ras->hVal,ras->defaultMessages[cmRASUnsolicitedIRR][cmRASTrStageRequest], {_anyField _q931(endpointIdentifier) LAST_TOKEN}, lenId, pId);
/* RAI */
__pvtBuildByFieldIds(destNodeId, ras->hVal,ras->defaultMessages[cmRASResourceAvailability][cmRASTrStageRequest], {_anyField _q931(endpointIdentifier) LAST_TOKEN}, lenId, pId);
/* SCI */
__pvtBuildByFieldIds(destNodeId, ras->hVal,ras->defaultMessages[cmRASServiceControl][cmRASTrStageRequest], {_anyField _q931(endpointIdentifier) LAST_TOKEN}, lenId, pId);
}
}
else
{
/*keep endpointIdentifier is not in RRQ*/
__pvtGetNodeIdByFieldIds(destNodeId, ras->hVal,ras->defaultMessages[cmRASRegistration][cmRASTrStageRequest], {_anyField _q931(endpointIdentifier) LAST_TOKEN});
if (RV_PVT_NODEID_IS_VALID(destNodeId))
pvtDelete(ras->hVal, destNodeId);
}
/* Set the gatekeeperIdentifier in relevant messages if we have one */
if (beforeRegistration)
{
__pvtGetByFieldIds(srcNodeId, ras->hVal, ras->confNode, {_q931(registrationInfo) _q931(gatekeeperIdentifier) LAST_TOKEN}, NULL, &lenId, NULL);
if (RV_PVT_NODEID_IS_VALID(srcNodeId))
{
pvtGetString(ras->hVal, srcNodeId, sizeof(id), id);
pId = id;
}
else
lenId = 0;
}
else
{
/* We're registered... get from RAS object */
pId = ras->gkId;
lenId = ras->gkIdLen;
}
if (lenId > 0)
{
/* RRQ */
__pvtBuildByFieldIds(destNodeId, ras->hVal,ras->defaultMessages[cmRASRegistration][cmRASTrStageRequest], {_anyField _q931(gatekeeperIdentifier) LAST_TOKEN}, lenId, pId);
/* GRQ */
__pvtBuildByFieldIds(destNodeId, ras->hVal, ras->defaultMessages[cmRASGatekeeper][cmRASTrStageRequest], {_anyField _q931(gatekeeperIdentifier) LAST_TOKEN}, lenId, pId);
/* URQ */
__pvtBuildByFieldIds(destNodeId, ras->hVal, ras->defaultMessages[cmRASUnregistration][cmRASTrStageRequest], {_anyField _q931(gatekeeperIdentifier) LAST_TOKEN}, lenId, pId);
/* ARQ */
__pvtBuildByFieldIds(destNodeId, ras->hVal, ras->defaultMessages[cmRASAdmission][cmRASTrStageRequest], {_anyField _q931(gatekeeperIdentifier) LAST_TOKEN}, lenId, pId);
/* BRQ */
__pvtBuildByFieldIds(destNodeId, ras->hVal, ras->defaultMessages[cmRASBandwidth][cmRASTrStageRequest], {_anyField _q931(gatekeeperIdentifier) LAST_TOKEN}, lenId, pId);
/* DRQ */
__pvtBuildByFieldIds(destNodeId, ras->hVal, ras->defaultMessages[cmRASDisengage][cmRASTrStageRequest], {_anyField _q931(gatekeeperIdentifier) LAST_TOKEN}, lenId, pId);
}
else
{
/* Make sure we don't have the GK id in any of the messages */
/* RRQ */
__pvtGetNodeIdByFieldIds(destNodeId, ras->hVal,ras->defaultMessages[cmRASRegistration][cmRASTrStageRequest], {_anyField _q931(gatekeeperIdentifier) LAST_TOKEN});
if (RV_PVT_NODEID_IS_VALID(destNodeId))
pvtDelete(ras->hVal, destNodeId);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -