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

📄 tup2.cpp

📁 7号信令协议2M链路协议解码程序源代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
		strLength += sprintf(&v_pParseData[strLength], \
			"                SPARE      :%d%d...... \n", \
			(u_pMsg[indexByte] >> 7) & 0x01, (u_pMsg[indexByte] >> 6) & 0x01);
	}
	else
	{
		//没有此类信息
	}
	////////////////////////////////////////////
	//主叫用户线信息 (n*8)
	if(flagRespTypeB == 0x01)
	{
		strLength += sprintf(&v_pParseData[strLength], "\n === Calling Line ID === \n" );

		indexByte += 1;
		strLength += sprintf(&v_pParseData[strLength], "                ---Addr Indicator--- \n" );
		strLength += sprintf(&v_pParseData[strLength], \
			"%02X              NAI        :......%d%d  %s\n",  \
			u_pMsg[indexByte],  \
			(u_pMsg[indexByte]>>1 & 0x01), (u_pMsg[indexByte] & 0x01),  \
			m_callingLineID_BA_Table[(u_pMsg[indexByte] & 0x03)] );
		strLength += sprintf(&v_pParseData[strLength], \
			"                CLIPI      :.....%d..  %s\n",  \
			(u_pMsg[indexByte]>>2 & 0x01),   \
			m_callingLineID_C_Table[(u_pMsg[indexByte]>>2 & 0x01)] );  \
		strLength += sprintf(&v_pParseData[strLength],  \
			"                ICLII      :....%d...  %s\n",  \
			(u_pMsg[indexByte]>>3 & 0x01),   \
			m_callingLineID_D_Table[(u_pMsg[indexByte]>>3 & 0x01)] );

		strLength += sprintf(&v_pParseData[strLength], "                ---Addr Sig Num--- \n" );
		strLength += sprintf( &v_pParseData[strLength], \
			"                NAS        :%d%d%d%d....  %d\n",  \
			(u_pMsg[indexByte]>>7 & 0x01), (u_pMsg[indexByte]>>6 & 0x01),  \
			(u_pMsg[indexByte]>>5 & 0x01), (u_pMsg[indexByte]>>4 & 0x01),  \
			(u_pMsg[indexByte]>>4 & 0x0F) );

		strLength += sprintf(&v_pParseData[strLength], "                ---Calling Line Addr Sig--- \n" );
		telNoNum = (int)(u_pMsg[indexByte]>>4 & 0x0F);
		if((telNoNum%2)==0)
			j = telNoNum/2;
		else
			j = telNoNum/2 + 1;
		telNum = 0;
		for(i=1; i<=j; i++)
		{
			strLength += sprintf(&v_pParseData[strLength], "%02X ",  u_pMsg[indexByte+i] );
		}
		strLength += sprintf(&v_pParseData[strLength], "    CLAS       :");

		for(i=1; i<=j; i++)
		{
			if( (u_pMsg[indexByte+i] & 0x0F) == 0x0F)
			{	strLength += sprintf(&v_pParseData[strLength], "  0x?F: ST" );
				break;
			}
			else
				strLength += sprintf(&v_pParseData[strLength], "%d ",  (u_pMsg[indexByte+i] & 0x0F) );

			if((u_pMsg[indexByte+i]>>4 & 0x0F) == 0x0F )
			{	strLength += sprintf(&v_pParseData[strLength], "  0xF?: ST" );
				break;
			}
			else
				strLength += sprintf(&v_pParseData[strLength], "%d ",  (u_pMsg[indexByte+i]>>4 & 0x0F) );
		}
		indexByte += j;
		strLength += sprintf(&v_pParseData[strLength], "  主叫用户线标识\n");
	}
	else
	{
		//没有此类信息
	}

	////////////////////////////////////////////
	//来话中继和转接交换局标识 (n*8)
	if(flagRespTypeC == 0x01)
	{
		strLength += sprintf(&v_pParseData[strLength], "\n === Incoming Trunk & Transit Exchange ID === \n" );

		indexByte += 1;
		strLength += sprintf(&v_pParseData[strLength], "                ---ID Type Indicator--- \n" );
		strLength += sprintf(&v_pParseData[strLength], \
			"%02X              ITI        :......%d%d  %s\n",  \
			u_pMsg[indexByte],  \
			(u_pMsg[indexByte]>>1 & 0x01), (u_pMsg[indexByte] & 0x01),  \
			m_inTrunkTransitExID_BA_Table[(u_pMsg[indexByte] & 0x03)] );
		strLength += sprintf(&v_pParseData[strLength], \
			"                SPARE      :....%d%d..  %s\n",  \
			(u_pMsg[indexByte]>>3 & 0x01), (u_pMsg[indexByte]>>2 & 0x01),  \
			"SPARE");

		strLength += sprintf(&v_pParseData[strLength], "                ---Exchg ID Len Indicator--- \n" );
		strLength += sprintf(&v_pParseData[strLength], \
			"                SPARE      :%d%d%d%d....  %d\n",  \
			(u_pMsg[indexByte]>>7 & 0x01), (u_pMsg[indexByte]>>6 & 0x01),  \
			(u_pMsg[indexByte]>>5 & 0x01), (u_pMsg[indexByte]>>4 & 0x01),  \
			(u_pMsg[indexByte]>>4 & 0x0F) );

		strLength += sprintf(&v_pParseData[strLength], "                ---Transit Exchange ID--- \n" );
		telNoNum = (int)(u_pMsg[indexByte]>>4 & 0x0F);
		if((telNoNum%2)==0)
			j = telNoNum/2;
		else
			j = telNoNum/2 + 1;
		telNum = 0;
		for(i=1; i<=j; i++)
		{
			strLength += sprintf(&v_pParseData[strLength], "%02X ",  u_pMsg[indexByte+i] );
		}
		strLength += sprintf(&v_pParseData[strLength], "\n");
		indexByte += j;

		strLength += sprintf(&v_pParseData[strLength], "                ---Field Len Indicator--- \n" );
		indexByte += 1;
		strLength += sprintf(&v_pParseData[strLength], \
			"%02X              SPARE      :....%d%d%d%d \n",  \
			(u_pMsg[indexByte]>>3 & 0x01), (u_pMsg[indexByte]>>2 & 0x01),  \
			(u_pMsg[indexByte]>>1 & 0x01), (u_pMsg[indexByte] & 0x01) );
		strLength += sprintf(&v_pParseData[strLength], \
			"                FLI      :%d%d%d%d....  %d\n",  \
			(u_pMsg[indexByte]>>7 & 0x01), (u_pMsg[indexByte]>>6 & 0x01),  \
			(u_pMsg[indexByte]>>5 & 0x01), (u_pMsg[indexByte]>>4 & 0x01),  \
			(u_pMsg[indexByte]>>4 & 0x0F) );

		strLength += sprintf(&v_pParseData[strLength], "                ---Incoming Trunk ID--- \n" );
		telNoNum = (int)(u_pMsg[indexByte]>>4 & 0x0F);
		if((telNoNum%2)==0)
			j = telNoNum/2;
		else
			j = telNoNum/2 + 1;
		telNum = 0;
		for(i=1; i<=j; i++)
		{
			strLength += sprintf(&v_pParseData[strLength], "%02X ",  u_pMsg[indexByte+i] );
		}
		strLength += sprintf(&v_pParseData[strLength], "\n");
	}
	else
	{
		//没有此类信息
	}

	////////////////////////////////////////////
	//原被叫地址 (n*8)
	if(flagRespTypeD == 0x01)
	{
		strLength += sprintf(&v_pParseData[strLength], "\n === Orig Called Addr === \n" );
		strLength += sprintf(&v_pParseData[strLength], "                ---Addr Indicator--- \n" );

		indexByte += 1;
		strLength += sprintf(&v_pParseData[strLength], \
			"%02X              NAI        :......%d%d  %s\n",  \
			u_pMsg[indexByte],  \
			(u_pMsg[indexByte]>>1 & 0x01), (u_pMsg[indexByte] & 0x01),  \
			m_callingLineID_BA_Table[(u_pMsg[indexByte] & 0x03)] );
		strLength += sprintf(&v_pParseData[strLength], \
			"                SPARE      :....%d%d..  %s\n",  \
			(u_pMsg[indexByte]>>3 & 0x01),  (u_pMsg[indexByte]>>2 & 0x01), \
			("SPARE"));

		strLength += sprintf(&v_pParseData[strLength], "                ---Addr Sig Num--- \n" );
		strLength += sprintf( &v_pParseData[strLength], \
			"                NAS        :%d%d%d%d....  %d\n",  \
			(u_pMsg[indexByte]>>7 & 0x01), (u_pMsg[indexByte]>>6 & 0x01),  \
			(u_pMsg[indexByte]>>5 & 0x01), (u_pMsg[indexByte]>>4 & 0x01),  \
			(u_pMsg[indexByte]>>4 & 0x0F) );

		strLength += sprintf(&v_pParseData[strLength], "                ---Orig Called Addr Sig--- \n" );
		telNoNum = (int)(u_pMsg[indexByte]>>4 & 0x0F);
		if((telNoNum%2)==0)
			j = telNoNum/2;
		else
			j = telNoNum/2 + 1;
		telNum = 0;
		for(i=1; i<=j; i++)
		{
			strLength += sprintf(&v_pParseData[strLength], "%02X ",  u_pMsg[indexByte+i] );
		}
		strLength += sprintf(&v_pParseData[strLength], "   OCAS       :");
		k = 0;
		for(i=1; i<=j; i++)
		{
			k++;
			if( (u_pMsg[indexByte+i] & 0x0F) == 0x0F)
			{	strLength += sprintf(&v_pParseData[strLength], "  0x?F: ST" );
				break;
			}
			else
				strLength += sprintf(&v_pParseData[strLength], "%d ",  (u_pMsg[indexByte+i] & 0x0F) );
			k++;
			if(k>telNoNum)
			{
				if((u_pMsg[indexByte+i]>>4 & 0x0F) == 0x0F )
				{	strLength += sprintf(&v_pParseData[strLength], "  0xF?: ST" );
				}
				break;
			}
			else
				strLength += sprintf(&v_pParseData[strLength], "%d ",  (u_pMsg[indexByte+i]>>4 & 0x0F) );
		}
		indexByte += j;
		strLength += sprintf(&v_pParseData[strLength], "\n");
		indexByte += 1;
	}
	else
	{
		//没有此类信息
	}
	return TRUE;
}

//////////////////////////////////////////////////////////////////////////////////
//General ReQuest message
//GRQ:
BOOL CTup2::GetDataDecode_GRQ(BYTE *u_pMsg, DWORD u_msgLength, char *v_pParseData)
{
	int dataLength=0;
	int strLength=0, indexByte=0; // telNoNum=0;
	//int i=0, j=0, k=0, telNum=0;

	dataLength = u_msgLength - SS7_TUP_DATA_OFFSET;

	////////////////////////////////////////////
	//请求类型表示语(8)
	strLength += sprintf(&v_pParseData[strLength], "\n === Request Type Indicator === \n" );

	indexByte = SS7_TUP_DATA_OFFSET;
    strLength += sprintf(&v_pParseData[strLength], \
        "%02X              CPCRI      :.......%d  %s\n", \
        u_pMsg[indexByte], (u_pMsg[indexByte] & 0x01),  \
		m_reqestTypeID_A_Table[(u_pMsg[indexByte] & 0x01)] );

    strLength += sprintf(&v_pParseData[strLength], \
        "                CLIRI      :......%d.  %s\n", \
        (u_pMsg[indexByte]>>1 & 0x01),  \
		m_reqestTypeID_B_Table[(u_pMsg[indexByte]>>1 & 0x01)] );

    strLength += sprintf(&v_pParseData[strLength], \
        "                OCAR       :.....%d..  %s\n", \
        (u_pMsg[indexByte]>>2 & 0x01),  \
		m_reqestTypeID_C_Table[(u_pMsg[indexByte]>>2 & 0x01)] );

    strLength += sprintf(&v_pParseData[strLength], \
        "                MCII       :....%d...  %s\n", \
        (u_pMsg[indexByte]>>3 & 0x01),  \
		m_reqestTypeID_D_Table[(u_pMsg[indexByte]>>3 & 0x01)] );

    strLength += sprintf(&v_pParseData[strLength], \
        "                HRI        :...%d....  %s\n", \
        (u_pMsg[indexByte]>>4 & 0x01),  \
		m_reqestTypeID_E_Table[(u_pMsg[indexByte]>>4 & 0x01)] );

	strLength += sprintf(&v_pParseData[strLength], \
        "                ESRI       :..%d.....  %s\n", \
        (u_pMsg[indexByte]>>5 & 0x01),  \
		m_reqestTypeID_F_Table[(u_pMsg[indexByte]>>5 & 0x01)] );

	strLength += sprintf(&v_pParseData[strLength], \
        "                SPARE      :%d%d......  %s\n", \
        (u_pMsg[indexByte]>>7 & 0x01),  (u_pMsg[indexByte]>>6 & 0x01),\
		"SPARE" );

	return TRUE;
}

//////////////////////////////////////////////////////////////////////////////////
//Address Complete Message
//ACM:
BOOL CTup2::GetDataDecode_ACM(BYTE *u_pMsg, DWORD u_msgLength, char *v_pParseData)
{
	int dataLength=0;
	int strLength=0, indexByte=0; //telNoNum=0;
	//int i=0, j=0, k=0, telNum=0;

	dataLength = u_msgLength - SS7_TUP_DATA_OFFSET;

	////////////////////////////////////////////
	//请求类型表示语(8)
	strLength += sprintf(&v_pParseData[strLength], "\n === Address Complete Message === \n" );

	indexByte = SS7_TUP_DATA_OFFSET;
	strLength += sprintf(&v_pParseData[strLength], "                ---Message Indicators--- \n" );
    strLength += sprintf(&v_pParseData[strLength], \
        "%02X              TACSI      :......%d%d  %s\n", \
        u_pMsg[indexByte],  \
		(u_pMsg[indexByte]>>1 & 0x01), (u_pMsg[indexByte] & 0x01), \
		m_msgIndicator_BA_Table[(u_pMsg[indexByte] & 0x03)] );

    strLength += sprintf(&v_pParseData[strLength], \
        "                SFI        :.....%d..  %s\n", \
        (u_pMsg[indexByte]>>2 & 0x01),  \
		m_msgIndicator_C_Table[(u_pMsg[indexByte]>>2 & 0x01)] );

    strLength += sprintf(&v_pParseData[strLength], \
        "                IESI       :....%d...  %s\n", \
        (u_pMsg[indexByte]>>3 & 0x01),  \
		m_msgIndicator_D_Table[(u_pMsg[indexByte]>>3 & 0x01)] );

    strLength += sprintf(&v_pParseData[strLength], \
        "                CFI        :...%d....  %s\n", \
        (u_pMsg[indexByte]>>4 & 0x01),  \
		m_msgIndicator_E_Table[(u_pMsg[indexByte]>>4 & 0x01)] );

    strLength += sprintf(&v_pParseData[strLength], \
        "                SPI        :..%d.....  %s\n", \
        (u_pMsg[indexByte]>>5 & 0x01),  \
		m_msgIndicator_F_Table[(u_pMsg[indexByte]>>5 & 0x01)] );

	strLength += sprintf(&v_pParseData[strLength], \
        "                SPARE      :%d%d......  %s\n", \
        (u_pMsg[indexByte]>>7 & 0x01),  (u_pMsg[indexByte]>>6 & 0x01),\
		"SPARE" );

	return TRUE;
}

//////////////////////////////////////////////////////////////////////////////////
//CHarging Message
//CHG:
BOOL CTup2::GetDataDecode_CHG(BYTE *u_pMsg, DWORD u_msgLength, char *v_pParseData)
{
	int dataLength=0;
	int strLength=0;  //telNoNum=0; indexByte=0,
	int i=0, j=0, k=0;
	dataLength = u_msgLength - SS7_TUP_DATA_OFFSET;
	/////////
	extern CDecodeApp2 theApp;

	strLength += sprintf(&v_pParseData[strLength], "\n === Charging Message === \n" );

	strLength += sprintf(&v_pParseData[strLength], "                ---Charging Inf--- \n" );
    k = strLength;

	for(i=0; i<dataLength; i++)
    {
		theApp.ConvertOneByte(u_pMsg[SS7_TUP_DATA_OFFSET + i], &v_pParseData[k+j]);
        j += 3;
    }
	////////////////////////////////////////////
	return TRUE;
}

//////////////////////////////////////////////////////////////////////////////////
//Unsuccessful Backward set-up information Message (后向建立不成功消息 群组)
//UBM:(H1:0000;H0:0101)=>0x?5;
//---H1:0000 (0x05) SPARE 备用
//---H1:0001 (0x15) SEC (Switching-Equipment-Congestion signal) 交换设备拥塞信号
//---H1:0010 (0x25) CGC (Circuit-Group-Congestion signal) 电路拥塞信号
//---H1:0011 (0x35) NNC (National-Network-Congestion signal) 国内网拥塞信号
//---H1:0100 (0x45) ADI (Address-Incomplete signal) 地址不全信号
//---H1:0101 (0x55) CFL (Call-Failure signal) 呼叫故障信号
//---H1:0110 (0x65) SSB (SubScriber-Busy signal) 用户忙信号
//---H1:0111 (0x75) UNN (UNallocated-Number signal) 空号
//---H1:1000 (0x85) LOS (Line-Out-of-Service signal) 线路不工作信号
//---H1:1001 (0x95) SST (Send-Special-information-Tone signal) 发送专用信息音信号
//---H1:1010 (0xa5) ACB (ACcess-Barred signal) 接入拒绝信号
//---H1:1011 (0xb5) DPN (Digital-Path-Not-provided signal) 不提供数字通路信号
//---H1:1101 (0xc5) SPARE 备用
//---   ...
//---H1:1110 (0xe5) SPARE 备用
//---H1:1111 (0xf5) EUM (Extended-Unsuccessful...-Message) 扩充的后向建立不成功消息
///////////////////////////////////////////////////
BOOL CTup2::GetDataDecode_SEC(BYTE *u_pMsg, DWORD u_msgLength, char *v_pParseData)
{
	int strLength=0;
	strLength += sprintf

⌨️ 快捷键说明

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