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

📄 isup.cpp.bak

📁 No。7七号信令网协议64K链路协议解码程序
💻 BAK
📖 第 1 页 / 共 5 页
字号:

BOOL CIsup::GetMessageDecodeInfo(BYTE *u_pMsg, DWORD u_msgLength, char *v_pDecodeResult)
{    
    char buffer[64];
    int strLength;
    BYTE temp;
    
    strLength = 0;
    temp = u_pMsg[SS7_ISUP_SLS_OFFSET];
    sprintf(&v_pDecodeResult[strLength],
        "%02X \t\t\t\t\t\t SLS \t\t\t :....%d%d%d%d \n", 
        temp, (temp >> 3) & 0x01, (temp >> 2) & 0x01, (temp >> 1) & 0x01, temp & 0x01);
    
    strLength = strlen(v_pDecodeResult);    
    sprintf(&v_pDecodeResult[strLength], \
        "   \t\t\t\t\t\t SPARE \t\t :%d%d%d%d.... \n",   
        (temp >> 7) & 0x01, (temp >> 6) & 0x01, (temp >> 5) & 0x01, (temp >> 4) & 0x01);
            
    strLength = strlen(v_pDecodeResult);  
    sprintf(&v_pDecodeResult[strLength], \
        "%02X %02X  \t\t\t\t CIC \t\t\t : 'h%X%02X \n", 
        u_pMsg[SS7_ISUP_CIC_OFFSET + 1], u_pMsg[SS7_ISUP_CIC_OFFSET],
        u_pMsg[SS7_ISUP_CIC_OFFSET + 1] & 0x0F, u_pMsg[SS7_ISUP_CIC_OFFSET]);
    
    strLength = strlen(v_pDecodeResult);
    getH1h0FromTable(u_pMsg[SS7_ISUP_H1H0_OFFSET], buffer);
    sprintf(&v_pDecodeResult[strLength], \
        "%02X \t\t\t\t\t\t H1H0\t\t\t :%s \n", 
        u_pMsg[SS7_ISUP_H1H0_OFFSET], buffer);  

///////////////////////////////////////////////
//// added by me
	//strLength = strlen(v_pDecodeResult); 
    //sprintf(&v_pDecodeResult[strLength], "\n报文H1H0后的原始数据:");  

	strLength = strlen(v_pDecodeResult); 
	GetMessageDecodeInfo_AfterH1H0(u_pMsg, u_msgLength, &v_pDecodeResult[strLength]);
/////////////////////////////////////////////////

    return TRUE;
}


BOOL CIsup::GetMessageDecodeInfo_AfterH1H0(BYTE *u_pMsg, DWORD u_msgLength, char *v_pDecodeResult)
{
	/////////////////////////////////////////////
	//// 此编写不同类消息解析的代码
	BYTE nH1H0;
	nH1H0 = u_pMsg[SS7_ISUP_H1H0_OFFSET];	//#define SS7_ISUP_H1H0_OFFSET     (13)
	switch(nH1H0)
	{
		////////////////////////////////////////////////////////////////////
		////前向建立消息
		case 0x01 :	//IAM 初始地址消息
			 GetDataDecode_IAM(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;
		case 0x02 :	//SAM 后续地址消息
			 break;

		////////////////////////////////////////////////////////////////////
		////一般建立消息
		case 0x03 :	//INR 信息请求消息
			 break;
		case 0x04 :	//INF 信息消息
			 GetDataDecode_INF(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;
		case 0x05 :	//COT 导通消息
			 break;

		////////////////////////////////////////////////////////////////////
		////后向建立消息
		case 0x06 :	//ACM 地址全消息
			 GetDataDecode_ACM(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;
		case 0x07 :	//CON 连接消息
			 GetDataDecode_CON(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;
		case 0x2C :	//CPG 呼叫进展消息
			 GetDataDecode_CPG(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		////////////////////////////////////////////////////////////////////
		////呼叫监视消息
		case 0x09 :	//ANM 应答消息
			 GetDataDecode_ANM(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;
		case 0x08 :	//FOT 前向转移消息
			 break;
		case 0x0C :	//REL 释放消息
			 GetDataDecode_REL(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		////////////////////////////////////////////////////////////////////
		////电路监视消息
		//case ?? :	//DRS 延迟释放消息   ????
		//	 break;
		case 0x10 :	//RLC 释放完全消息
			 GetDataDecode_RLC(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;
		case 0x11 :	//CCR 导通检验请求消息
			 break;
		case 0x12 :	//RSC 电路复原消息
			 break;
		case 0x24 :	//LPA 环回确认	????
			 break;
		case 0x13 :	//BLO 闭塞消息
			 break;
	//	case 0x24 :	//UBL 解除闭塞消息	????
	//		 break;
		case 0x2E :	//UCIC 未备电路识别码
			 break;
		case 0x15 :	//BLA 闭塞证实消息
			 break;
		case 0x26 :	//UBA 解除闭塞证实消息
			 break;
		case 0x30 :	//OLM 过负荷消息
			 break;
		case 0x0D :	//SUS 暂停消息
			 break;
		case 0x0E :	//RES 恢复消息
			 break;
		case 0x2F :	//CFN 混乱消息
			 break;

		////////////////////////////////////////////////////////////////////
		////电路群监视消息
		case 0x18 :	//CGB 电路群闭塞消息
			 break;
		case 0x19 :	//CGU 电路群闭塞解除消息
			 break;
		//case ?? :	//CGBA 电路群闭塞证实消息
		//	 break;
		case 0x1B :	//CGUA 电路群闭塞解除证实消息
			 break;
		case 0x17 :	//GRS 电路群复原消息
			 break;
		case 0x29 :	//GRA 电路群复原证实消息
			 break;
		case 0x2A :	//CQM 电路群询问消息
			 break;
		case 0x2B :	//CQR 电路群询问相应消息
			 break;

		////////////////////////////////////////////////////////////////////
		////呼叫中改变消息
		//case ?? :	//CMR 呼叫改变请求消息
		//	 break;
		//case ?? :	//CMC 呼叫改变完全消息
		//	 break;
		//case ?? :	//CMRJ 呼叫改变拒绝消息
		//	 break;
		case 0x1F :	//FAR 性能请求消息
			 break;
		case 0x20 :	//FAA 性能请求接受消息
			 break;
		case 0x21 :	//FRJ 性能请求拒绝消息
			 break;

		////////////////////////////////////////////////////////////////////
		////端到端消息
		case 0x28 :	//PAM 传递消息
			 break;
		case 0x2D :	//USR 用户至用户消息
			 break;

		default:
			//默认没解析
			break;
	}

	return TRUE;
}


////////////////////////////////////////////////////////////////////
////信息消息----INF ;	 case 0x04 
BOOL CIsup::GetDataDecode_INF(BYTE *u_pMsg, DWORD u_msgLength, char *v_pParseData)   //信息
{		
	int dataLength=0; 
	int strLength=0, indexByte=0;
	int i=0, j=0, k=0;
	int indexVarParm=0, indexOptParm=0;

	dataLength = u_msgLength - SS7_ISUP_H1H0_OFFSET;
	indexByte = SS7_ISUP_DATA_OFFSET;

	////////////////////////////////////////////////////////////////////////////////////////////
	//必备固定长度
    strLength += sprintf(&v_pParseData[strLength], "\n******** MANDATORY FIXED PART ********\n" );

	////////////////////////////////////////////
	//信息表示语(16)  Information indicators
	strLength += sprintf(&v_pParseData[strLength], " === Information Indicators === \n" );
  
	strLength += sprintf(&v_pParseData[strLength], \
        "%02X %02X  \t\t\t\t CPARID  \t :......%d%d  %s\n",   
        u_pMsg[indexByte+1],  u_pMsg[indexByte],  \
		(u_pMsg[indexByte]>>1 & 0x01),  (u_pMsg[indexByte] & 0x01),\
		m_informID_BA_Table[(u_pMsg[indexByte]&0x03)] );
    strLength += sprintf(&v_pParseData[strLength], \
        "   \t\t\t\t\t\t HPID  \t\t :.....%d..  %s\n",   
		(u_pMsg[indexByte]>>2 & 0x01), \
		((u_pMsg[indexByte]>>2 & 0x01) == 0x01) ? ("提供保持") : ("不提供保持") );
    strLength += sprintf(&v_pParseData[strLength], \
        "   \t\t\t\t\t\t SPARE \t\t :...%d%d...  \n",   
		(u_pMsg[indexByte]>>5 & 0x01), (u_pMsg[indexByte]>>4 & 0x01) );
    strLength += sprintf(&v_pParseData[strLength], \
        "   \t\t\t\t\t\t CPCRID  \t :..%d.....  %s\n",   
		(u_pMsg[indexByte]>>5 & 0x01), \
		((u_pMsg[indexByte]>>5 & 0x01) == 0x01) ? ("包括主叫用户类别") : ("不包括主叫用户类别") );
    strLength += sprintf(&v_pParseData[strLength], \
        "   \t\t\t\t\t\t CIRID \t\t :.%d......  %s\n",   
		(u_pMsg[indexByte]>>6 & 0x01), \
		((u_pMsg[indexByte]>>6 & 0x01) == 0x01) ? ("包括计费信息") : ("不包括计费信息") );
    strLength += sprintf(&v_pParseData[strLength], \
        "   \t\t\t\t\t\t SIID  \t\t :%d.......  %s\n",   
		(u_pMsg[indexByte]>>7 & 0x01), \
		((u_pMsg[indexByte]>>7 & 0x01) == 0x01) ? ("未请求") : ("请求") );
	indexByte += 1;
	strLength += sprintf(&v_pParseData[strLength],  \
        "   \t\t\t\t\t\t SPARE \t\t :%d%d%d%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]>>3 & 0x01),  (u_pMsg[indexByte]>>2 & 0x01),  \
		(u_pMsg[indexByte]>>1 & 0x01),  (u_pMsg[indexByte] & 0x01) );
 	
	///////////////////////////////////////////////////////////////////////////////////////////
	//必备可变长 或 任选参数群 的指针
    strLength += sprintf(&v_pParseData[strLength], "\n******** PARAMETERS POINTER ********\n" );
		  
	indexByte += 1;
	strLength += sprintf(&v_pParseData[strLength], \
        "%02X \t\t\t\t\t\t SOP \t\t\t :0x%02X\t\t  %s\n",   
        u_pMsg[indexByte], u_pMsg[indexByte],  \
		"任选参数群的开始位置指针" );	//Offset of Start of Optional Part
	indexOptParm = indexByte + (int)u_pMsg[indexByte];

	////////////////////////////////////////////////////////////////////////////////////////////////
	//任选参数群部分
    strLength += sprintf(&v_pParseData[strLength], "\n******** OPTIONAL PARAMETERS PART ********\n" );
		
	indexByte = indexOptParm;
	while(indexByte < ((int)u_msgLength-1))
	{
	  switch(u_pMsg[indexByte])
	  {
	   case 0x29:	//任选后向呼叫表示语  Optional backward call indicators
		    getOptionParm_29(u_pMsg, strLength, indexByte, v_pParseData);
			indexByte += ((int)u_pMsg[indexByte+1] + 1);
			strLength = strlen(v_pParseData);
			break;

			//Calling party's category

	   default:
			break;
	  } // switch(u_pMsg[indexByte])
	  indexByte += 1;
	  if(indexByte == ((int)u_msgLength-1))
	  {
		strLength += sprintf(&v_pParseData[strLength], " === End of Optional Parameters === \n" );
		strLength += sprintf(&v_pParseData[strLength], \
			"%02X \t\t\t\t\t\t END \t\t\t :0x%02X \t\t %s\n",   
			u_pMsg[indexByte], u_pMsg[indexByte],  \
			SS7_ISUP_OPTPARM_END );
	  }
	}
	return TRUE;
}

////////////////////////////////////////////////////////////////////
////释放完全消息----RLC ;	 case 0x10 
BOOL CIsup::GetDataDecode_RLC(BYTE *u_pMsg, DWORD u_msgLength, char *v_pParseData)   //释放完全
{		
	int dataLength=0; 
	int strLength=0, indexByte=0;
	int i=0, j=0, k=0;
	int indexVarParm=0, indexOptParm=0;

	dataLength = u_msgLength - SS7_ISUP_H1H0_OFFSET;
	indexByte = SS7_ISUP_DATA_OFFSET;

	///////////////////////////////////////////////////////////////////////////////////////////
	//必备可变长 或 任选参数群 的指针
	strLength += sprintf(&v_pParseData[strLength], "\n******** PARAMETERS POINTER ********\n" );

	strLength += sprintf(&v_pParseData[strLength], \
        "%02X \t\t\t\t\t\t SOP \t\t\t :0x%02X\t\t  %s\n",   
        u_pMsg[indexByte], u_pMsg[indexByte],  \
		"任选参数群的开始位置指针" );	//Offset of Start of Optional Part
	indexOptParm = indexByte + (int)u_pMsg[indexByte];
 
	////////////////////////////////////////////////////////////////////////////////////////////////
	//任选参数群部分
    strLength += sprintf(&v_pParseData[strLength], "\n******** OPTIONAL PARAMETERS PART ********\n" );
		
	indexByte = indexOptParm;
	while(indexByte < ((int)u_msgLength-1))
	{
	  switch(u_pMsg[indexByte])
	  {
	   case 0x12:	//原因表示语  Cause indicators
		    getOptionParm_12(u_pMsg, strLength, indexByte, v_pParseData);
			indexByte += ((int)u_pMsg[indexByte+1] + 1);
			strLength = strlen(v_pParseData);
			break;
	   default:
			break;
	  } // switch(u_pMsg[indexByte])
	  indexByte += 1;
	  if(indexByte == ((int)u_msgLength-1))
	  {
		strLength += sprintf(&v_pParseData[strLength], " === End of Optional Parameters === \n" );
		strLength += sprintf(&v_pParseData[strLength], \
			"%02X \t\t\t\t\t\t END \t\t\t :0x%02X \t\t %s\n",   
			u_pMsg[indexByte], u_pMsg[indexByte],  \
			SS7_ISUP_OPTPARM_END );
	  }
	}
	return TRUE;

⌨️ 快捷键说明

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