📄 rvh323mibstats.c
字号:
/*
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 "rvstdio.h"
#include "rvmemory.h"
#include "cm.h"
#include "q931asn1.h"
#include "h245.h"
#include "rvh323mibstats.h"
#ifdef __cplusplus
extern "C" {
#endif
/************************************************************************
*
* Public functions
*
************************************************************************/
HSTATISTIC mibCreateStatistic(void)
{
h341StatisticParametersT * pStatistic;
RvMemoryAlloc(NULL, (void**)&pStatistic, sizeof(h341StatisticParametersT));
memset((void *)pStatistic,0,sizeof(h341StatisticParametersT));
return (HSTATISTIC) pStatistic;
}
void mibDestroyStatistic(IN HSTATISTIC statistic)
{
RvMemoryFree((h341StatisticParametersT *)statistic);
}
/************************************************************************
* addStatistic
* purpose: Update the statistics information about current state of the
* stack. This information is taken from incoming and outgoing
* messages.
* input : hStatistic - Statistics information handle
* mType - Type of message to check
* hVal - Value tree of the message to check
* vNodeId - Root ID of the message to check
* directionIn - RV_TRUE if this is an incoming message, RV_FALSE if outgoing.
* output : none
* return : none
************************************************************************/
void addStatistic(
IN HSTATISTIC hStatistic,
IN cmProtocol mType,
IN HPVT hVal,
IN int vNodeId,
IN RvBool directionIn)
{
int chNodeId, index, req;
h341StatisticParametersT* pStatistic;
pStatistic = (h341StatisticParametersT *)hStatistic;
switch (mType)
{
case cmProtocolQ931:
{
/* Q931 message - increase incoming/outgoing message */
chNodeId = pvtGetChild(hVal, vNodeId, __q931(message), NULL);
if (chNodeId < 0)
return;
chNodeId = pvtChild(hVal, chNodeId);
index = pvtGetSyntaxIndex(hVal, chNodeId);
index--;
if (directionIn)
pStatistic->q931StatisticIn[index]++;
else
pStatistic->q931StatisticOut[index]++;
break;
}
case cmProtocolH245:
{
RvPstFieldId fieldId;
chNodeId = pvtChild(hVal, vNodeId);
req = pvtGetSyntaxIndex(hVal, chNodeId); /*1 request,2 response,4 for indication*/
chNodeId = pvtChild(hVal, chNodeId);
pvtGet(hVal, chNodeId, &fieldId, NULL, NULL, NULL);
if (req == 1)
{
switch(fieldId)
{
case __h245(masterSlaveDetermination):
if (!directionIn)
pStatistic->h245ControlChanneMasterSlavelDeterminations++;
break;
case __h245(terminalCapabilitySet):
pStatistic->h245CapExchangeSets++;
break;
case __h245(openLogicalChannel):
pStatistic->h245LogChanOpenLogChanTotalRequests++;
break;
case __h245(closeLogicalChannel):
pStatistic->h245LogChanCloseLogChannels++;
break;
case __h245(requestChannelClose):
pStatistic->h245LogChanCloseLogChanRequests++;
default:
break;
}
}
else if (req == 2)
{
switch(fieldId)
{
case __h245(masterSlaveDeterminationAck):
pStatistic->h245ControlChannelMasterSlaveAcks++;
break;
case __h245(masterSlaveDeterminationReject):
pStatistic->h245ControlChannelMasterSlaveRejects++;
pStatistic->h245ControlChannelNumberOfMasterSlaveInconsistentFieldRejects++;
break;
case __h245(terminalCapabilitySetAck):
pStatistic->h245CapExchangeAcks++;
break;
case __h245(terminalCapabilitySetReject):
pStatistic->h245CapExchangeRejects++;
chNodeId = pvtGetChild(hVal, chNodeId, __h245(cause), NULL);
if(chNodeId >= 0)
{
chNodeId= pvtChild(hVal, chNodeId);
index = pvtGetSyntaxIndex(hVal, chNodeId);
pStatistic->h245CapExchangeRejectCause[index-1]++;
}
break;
case __h245(openLogicalChannelAck):
pStatistic->h245LogChanOpenLogChanAcks++;
break;
case __h245(openLogicalChannelReject):
pStatistic->h245LogChanOpenLogChanRejects++;
chNodeId = pvtGetChild(hVal, chNodeId, __h245(cause), NULL);
if(chNodeId >= 0)
{
chNodeId= pvtChild(hVal, chNodeId);
index = pvtGetSyntaxIndex(hVal, chNodeId);
pStatistic->h245LogChanOpenLogChanRejectCause[index-1]++;
}
break;
case __h245(closeLogicalChannelAck):
pStatistic->h245LogChanCloseLogChanAcks++;
break;
case __h245(requestChannelCloseAck):
pStatistic->h245LogChanCloseLogChanRequestsAcks++;
break;
case __h245(requestChannelCloseReject):
pStatistic->h245LogChanCloseLogChanRequestRejects++;
break;
default:
break;
}
}
else if (req == 4)
{
switch(fieldId)
{
case __h245(masterSlaveDeterminationRelease):
pStatistic->h245ControlChannelMasterSlaveReleases++;
break;
case __h245(terminalCapabilitySetRelease):
pStatistic->h245CapExchangeReleases++;
break;
case __h245(openLogicalChannelConfirm):
pStatistic->h245LogChanOpenLogChanConfirms++;
break;
case __h245(requestChannelCloseRelease):
pStatistic->h245LogChanCloseLogChanRequestReleases++;
break;
default:
break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -