⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 au_cmd.cpp

📁 map协议源代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/*******************************************************************

        Name:   count.c - count for Performance test
                and AU applicaiton

        Type:   C source file

        Desc:

        File:   count.c

        Sid:    count.c - 12/13/2001

        Created by:     shu.bu

********************************************************************/

#include "envopt.h"        /* environment options */
#include "envdep.h"        /* environment dependent */
#include "envind.h"        /* environment independent */
#include "gen.h"           /* general layer */
#include "ssi.h"
#include "lma.h"
#include "cm_err.h"
#include "stu.h"
#include "mat.h"
#include "cm_hash.h"
#include "cm_ss7.h"

#ifdef DAU
#include "dm.h"
#endif

#include "gen.x"
#include "ssi.x"
#include "cm_ss7.x"
#include "cm5.x"
#include "stu.x"
#include "cm_hash.x"
#include "lma.x"
#include "mat.x"

#ifdef DAU
#include "dm.x"
#endif

#include "au_ext.h"

#ifdef CP_CMS
#include "lha_app.h"
#endif
#if 0
#include "au_cfg.h"
#endif
#include "au.h"
#include "au_cmd.h"
#include "au_dlg.h"

#ifdef WIN32
#include <time.h>
#endif

AuSts   smAuSts;

AuAddr auAddr;
U8 auCloseDialog=1;

time_t startLt;
time_t endLt;

int pfmTstFlag = 1;

static unsigned long        started = 0;
static unsigned long        overrun = 0;

auSendOprPar gPar;
auCloseDlgPar gCloseDlg;

U8* bcd2Ascii(U8 *pOutput, U8 *pInput, U16 len)
{
	U8 *temp;

	/* 
	 * if output and input memory are not 
	 * allocated return false 
	 */
	if ((pOutput == NULL) || (pInput == NULL)) 
	{
		return ((U8 *)" ");
	}

	/* save head address */
	temp = pOutput;

	/* convert BCD string to ASCII string */
	while(len--)
	{
		*pOutput++ = (*pInput & 0x0F) + '0';
		
		if((*pInput & 0xF0) == 0xF0)
			*pOutput++ = '\0';
		else
			*pOutput++ = ((*pInput & 0xF0) >> 4) + '0';
		
		pInput++;
	}
	*pOutput++ = '\0';
	
	return temp;
}

U32 ascii2Bcd(U8 *pAscii, U8 *pBcd)
{
	U32 len,i;
	U8  *asc;

	if ((pAscii == NULL) || (pBcd == NULL))
	{
		return 0;
	}
	
	len = strlen((S8*)pAscii);
	asc = pAscii;
	i = 0;

	while(i < len)
	{
		*pBcd = (*asc) - '0';
		asc++;
		i++;
		if (i < len)
		{
			*pBcd |= ((*asc) - '0') << 4;
			asc++;
			i++;
		}
		else
			*pBcd |= 0xf0;
		pBcd++;
	}

	return (len + 1)/2; /* No of bytes used in BCD string */
}

void GlobalAddr(CLI_ENV *pCliEnv)
{
    U8 srcStr[32], dstStr[32];

    bcd2Ascii(srcStr, auAddr.srcGt.addr.strg, auAddr.srcGt.addr.length);    
    bcd2Ascii(dstStr, auAddr.dstGt.addr.strg, auAddr.dstGt.addr.length);
    
    XOS_CliExtPrintf(pCliEnv, "srcGtAddr=%s\r\n", srcStr);
    XOS_CliExtPrintf(pCliEnv, "srcSsn=%d\r\n", auAddr.srcSsn);
    XOS_CliExtPrintf(pCliEnv, "dstGtAddr=%s\r\n", dstStr);
    XOS_CliExtPrintf(pCliEnv, "dstSsn=%d\r\n", auAddr.dstSsn);
    
    return;
}

void strToGtAddr(U8 *strAddr, GlbTi *GtAddr)
{
    
    GtAddr->format = 4;
    GtAddr->gt.f4.tType = 0;
    GtAddr->gt.f4.numPlan = 0x01;
    GtAddr->gt.f4.encSch = (strlen((char *)strAddr) % 2)?1:2;
    GtAddr->gt.f4.natAddr = 0x03;

    GtAddr->addr.length = ascii2Bcd(strAddr, GtAddr->addr.strg);

    return;
}

void MAStatStop()
{
    started = 0;
}


/*--------------------for dlg id allocate------------------------*/
int getBitMap(CLI_ENV *pCliEnv, int par)
{
    int i;

    for (i = 0; i < dlgQueue->auBitMap.size; i++)
    {
        XOS_CliExtPrintf(pCliEnv, (char*)"bitMap[%d] = %x\r\n", i, dlgQueue->auBitMap.map[i]);
    }
    XOS_CliExtPrintf(pCliEnv,(char*)"==========================================\r\n");
    RETVALUE(ROK);
}

/*--------------------get mem available size ------------------------*/

void clearAuSts(CLI_ENV *pCliEnv, XS32 siArgc, XCHAR **ppArgv)
{
    
    memset(&smAuSts, 0, sizeof(smAuSts));

    XOS_CliExtPrintf(pCliEnv, (char *)"the au Sts is cleared\r\n");

    MAStatStop();
}


void getAuSts(CLI_ENV *pCliEnv, XS32 siArgc, XCHAR **ppArgv)
{

    XOS_CliExtPrintf(pCliEnv, (char *)"The number of MAP open Req is %d\r\n", smAuSts.lAuOpenReq);
    XOS_CliExtPrintf(pCliEnv, (char *)"The number of MAP open Ind is %d\r\n", smAuSts.lAuOpenInd);
    XOS_CliExtPrintf(pCliEnv, (char *)"The number of MAP open Rsp is %d\r\n", smAuSts.lAuOpenRsp);
    XOS_CliExtPrintf(pCliEnv, (char *)"The number of MAP open Cfm is %d\r\n", smAuSts.lAuOpenCfm);
    XOS_CliExtPrintf(pCliEnv, (char *)"The number of MAP Close Req is %d\r\n", smAuSts.lAuCloseReq);
    XOS_CliExtPrintf(pCliEnv, (char *)"The number of MAP Close Ind is %d\r\n", smAuSts.lAuCloseInd);
    XOS_CliExtPrintf(pCliEnv, (char *)"lAuTimeout = %d\r\n", smAuSts.lAuTimeout);
    XOS_CliExtPrintf(pCliEnv, (char *)"lAutiemoutFail = %d\r\n", smAuSts.lAuTimeFail);
    XOS_CliExtPrintf(pCliEnv, (char *)"lAuTimeSuc = %d\r\n", smAuSts.lAuTimeSuc);
    XOS_CliExtPrintf(pCliEnv, (char *)"The number of MAP opr Req is %d\r\n", smAuSts.lAuOprReq);
    XOS_CliExtPrintf(pCliEnv, (char *)"The number of MAP opr Ind is %d\r\n", smAuSts.lAuOprInd);
    XOS_CliExtPrintf(pCliEnv, (char *)"The number of MAP opr Rsp is %d\r\n", smAuSts.lAuOprRsp);
    XOS_CliExtPrintf(pCliEnv, (char *)"The number of MAP opr Cfm is %d\r\n", smAuSts.lAuOprCfm);
    XOS_CliExtPrintf(pCliEnv, (char *)"The number of TCAP received is %d\r\n", smAuSts.lStDatRcvd);
    XOS_CliExtPrintf(pCliEnv, (char *)"The number of TCAP dat send is %d\r\n", smAuSts.lStDatSnd);
    XOS_CliExtPrintf(pCliEnv, (char *)"The number of TCAP comps send is %d\r\n", smAuSts.lStCompSnd);
    XOS_CliExtPrintf(pCliEnv, (char *)"The SCCP UDatReq is %d\r\n", smAuSts.lSpUDatReq);
    XOS_CliExtPrintf(pCliEnv, (char *)"The SCCP UDatInd is %d\r\n", smAuSts.lSpUDatInd);

    XOS_CliExtPrintf(pCliEnv, (char *)"Au DlgId pool = %ld \r\n", dlgQueue->dlgIdPoolGet());
    XOS_CliExtPrintf(pCliEnv, (char *)"Au active dlg numner = %ld \r\n", dlgQueue->actDlgNumGet());
    XOS_CliExtPrintf(pCliEnv, (char *)"Overrun times = %ld \r\n", overrun);

    /*MAStat(pCliEnv);*/
}


void shutDownStack(CLI_ENV *pCliEnv, XS32 siArgc, XCHAR **ppArgv)
{
    XOS_CliExtPrintf(pCliEnv, (char*)"ShutDown PROTOCOL STACK......\r\n");
}

void auSendOprCmd(void)
{
    auSendOprPar par;
    int i = 0;

    memset(&par, 0, sizeof(auSendOprPar));
    memcpy(&par, &gPar, sizeof(auSendOprPar));

    if ((par.number < 0)||(par.nsec < 1))
    {
        printf("Invalid num or microSec, num = %d, microSec = %d in ENT(%d)\n",
            gPar.number, gPar.nsec, ENTAU);
        return;
    }

	printf("The create task send opertype[%d] message %d! in ENT(%d)\r\n",
		gPar.oprType, gPar.number, ENTAU);
	
    time(&startLt);

    if (gPar.number != 0)
    {
        for (i = 0; i < par.number; i++)
        {
            if (pfmTstFlag == 0)
                break;
			
            cmPkAuOpenReq(&smAuPst, gPar.oprType);
            time(&endLt);
#if 1			
			if (i%(gPar.intvl)== 0)
			{
           		OS_SLEEP(gPar.nsec);
			}
#else			
           		OS_SLEEP(gPar.nsec);
#endif			
        }
    }
    else
    {
        for (;;)
        {
            if (pfmTstFlag == 0)
                break;
            cmPkAuOpenReq(&smAuPst, gPar.oprType);
            time(&endLt);
#if 1			
			if (i%(gPar.intvl) == 0)
			{
           		OS_SLEEP(gPar.nsec);
			}
#else			
           		OS_SLEEP(gPar.nsec);
#endif			
        }
    }
    time(&endLt);
    
    printf("\r\nSend Message End in ENT(%d)!\r\n", ENTAU);
}

Void auSendOpr(CLI_ENV *pCliEnv, XS32 siArgc, XCHAR **ppArgv)
{
    int par1 = 2; /* operation Type of Connect Request for sending */
	int par2 = 0; /* the number of Connect Request for sending */
	int par3 = 1; /* the number of Connect Request between each interval */ 
	int par4 = 0; /* the time(milli sec) between each interval */

	S16 rVal;
	Buffer *mBuf;

	switch(siArgc) 
	{
	case 5:
		{
			par1 = atol(ppArgv[1]);
			par2 = atol(ppArgv[2]);
			par3 = atol(ppArgv[3]);
			par4 = atol(ppArgv[4]);
		}
		break;

	case 4:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -