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

📄 isup.cpp

📁 No。7七号信令网协议64K链路协议解码程序
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    {
        dataLength = u_msgLength - SS7_ISUP_DATA_OFFSET;
    }
    else
    {
        dataLength = MAX_DATA_BYTE_NUMBER;
    }

    temp = 0;
    for(i=0; i<dataLength; i++)
    {
        theApp.ConvertOneByte(u_pMsg[SS7_ISUP_DATA_OFFSET + i], \
            &v_pData[temp]);
        temp += 3;
    }

    return TRUE;
}

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              SLS        :....%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], \
        "                SPARE      :%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           CIC        : '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              H1H0       :%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 后续地址消息  Subsequent address
			 GetDataDecode_SAM(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		////////////////////////////////////////////////////////////////////
		////一般建立消息
		case 0x03 :	//INR 信息请求消息
			 GetDataDecode_INR(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x04 :	//INF 信息消息
			 GetDataDecode_INF(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x05 :	//COT 导通消息
			 GetDataDecode_COT(u_pMsg, u_msgLength, v_pDecodeResult);
			 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 前向转移消息
			 GetDataDecode_FOT(u_pMsg, u_msgLength, v_pDecodeResult);
			 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 导通检验请求消息 Continuity check request
			 GetDataDecode_CCR(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x12 :	//RSC 电路复原消息  Reset circuit
			 GetDataDecode_RSC(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x24 :	//LPA 环回证实	Loop back acknowledgement, (national use) (不用)
			 GetDataDecode_LPA(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x13 :	//BLO 闭塞消息
			 GetDataDecode_BLO(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x14 :	//UBL 解除闭塞消息   Unblocking
			 GetDataDecode_UBL(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x2E :	//UCIC 未备电路识别码  Unequipped circuit identification code, (national use)
			 GetDataDecode_UCIC(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x15 :	//BLA 闭塞证实消息
			 GetDataDecode_BLA(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x16 :	//UBA 解除闭塞证实消息  Unblocking acknowledgement
			 GetDataDecode_UBA(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x30 :	//OLM 过负荷消息 Overload, (national use) (目前暂不用)
			 GetDataDecode_OLM(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x0D :	//SUS 暂停消息
			 GetDataDecode_SUS(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x0E :	//RES 恢复消息
			 GetDataDecode_RES(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x2F :	//CFN 混乱消息 Confusion
			 GetDataDecode_CFN(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		////////////////////////////////////////////////////////////////////
		////电路群监视消息
		case 0x18 :	//CGB 电路群闭塞消息  Circuit group blocking
			 GetDataDecode_CGB(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x19 :	//CGU 电路群闭塞解除消息 Circuit group unblocking
			 GetDataDecode_CGU(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x1A :	//CGBA 电路群闭塞证实消息  Circuit group blocking acknowledgement
			 GetDataDecode_CGBA(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x1B :	//CGUA 电路群闭塞解除证实消息  Circuit group unblocking acknowledgement
			 GetDataDecode_CGUA(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x17 :	//GRS 电路群复原消息  Circuit group reset
			 GetDataDecode_GRS(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;
		case 0x29 :	//GRA 电路群复原证实消息  Circuit group reset acknowledgement
			 GetDataDecode_GRA(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x2A :	//CQM 电路群询问消息  Circuit group query (national use)
			 GetDataDecode_CQM(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x2B :	//CQR 电路群询问响应消息  Circuit group query response (national use)
			 GetDataDecode_CQR(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		////////////////////////////////////////////////////////////////////
		////呼叫中改变消息
		//case ?? :	//CMR 呼叫改变请求消息
		//	 break;
		//case ?? :	//CMC 呼叫改变完全消息
		//	 break;
		//case ?? :	//CMRJ 呼叫改变拒绝消息
		//	 break;
		case 0x1F :	//FAR 性能请求消息  Facility request
			 GetDataDecode_FAR(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x20 :	//FAA 性能请求接受消息  Facility accepted
			 GetDataDecode_FAA(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x21 :	//FRJ 性能请求拒绝消息  Facility reject
			 GetDataDecode_FRJ(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		////////////////////////////////////////////////////////////////////
		////端到端消息
		case 0x28 :	//PAM 传送消息  Pass-along (national use) (目前暂不用)
			 GetDataDecode_PAM(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x2D :	//USR 用户至用户消息  User-to-user information
			 GetDataDecode_USR(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		///////////////////////////////////////////////////////////////////
		////other (此种函数区分的缩写 不是中文版协议的标准缩写, 是个人创解)
		case 0x34:		//用户部分测试  User Part test	(与 0x35:用户部分可用 相同)
			 GetDataDecode_UPT(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x35:		//用户部分可用  User Part available
			 GetDataDecode_UPA(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x33:		//性能  Facility
			 GetDataDecode_FAC(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;
		case 0x32:		//网络资源管理  Network resource management
			 GetDataDecode_NRM(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x36:		//识别请求  Identification request
			 GetDataDecode_IRQ(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x37:		//识别响应  Identification response
			 GetDataDecode_IRP(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0x38:	   //分段  Segmentation
			 GetDataDecode_SEG(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;

		case 0xFE:	   //话务员消息  Operator message
			 GetDataDecode_OPR(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;
		case 0xFD:	   //主叫用户挂机   Calling clear
			 GetDataDecode_CCL(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;
		case 0xFC:	   //计次脉冲消息   Meter pulse message
			 GetDataDecode_MPM(u_pMsg, u_msgLength, v_pDecodeResult);
			 break;
		///////////////////////////////////////////////////////////////////

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

////////////////////////////////////////////////////////////////////
////计次脉冲消息----MPM	 case 0xFC  Meter pulse message
BOOL CIsup::GetDataDecode_MPM(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)  	Charge Information
	strLength += sprintf(&v_pParseData[strLength], " === Charge Information === \n" );

	strLength += sprintf(&v_pParseData[strLength], \
        "%02X %02X           CHG        :0x%02X%02X    %s\n",
        u_pMsg[indexByte],  u_pMsg[indexByte+1],  \
        u_pMsg[indexByte+1],  u_pMsg[indexByte],  \
		("计费信息") );

	return TRUE;
}

////////////////////////////////////////////////////////////////////
////主叫用户挂机----CCL	 case 0xFD  Calling clear
////reserved for future extension   ???
BOOL CIsup::GetDataDecode_CCL(BYTE *u_pMsg, DWORD u_msgLength, char *v_pParseData)   //主叫用户挂机
{
	GetDataDecode_OPR(u_pMsg, u_msgLength, v_pParseData);
	return TRUE;
}


////////////////////////////////////////////////////////////////////
////话务员消息----OPR	 case 0xFE  Operator message
////reserved for future extension   ???
BOOL CIsup::GetDataDecode_OPR(BYTE *u_pMsg, DWORD u_msgLength, char *v_pParseData)   //话务员消息
{
	/*
	* 中文版增补协议规定OPR和CCL消息:没有“消息兼容性信息”和“任选参数结束”参数

	int dataLength=0;
	int strLength=0, indexByte=0;
	//int i=0, j=0, k=0;
	int indexVarParm=0, indexOptParm=0;

⌨️ 快捷键说明

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