📄 decode2.cpp
字号:
BYTE temp;
if(SS7_FISU_LENGTH == u_msgLength) //3:64K; 6:2M
{
fisuDecode(u_pMsg, v_pDecodeResult);
}
else if(SS7_LSSU_LENGTH == u_msgLength) //4:64K; 7:2M
{
m_lssu.GetMessageDecodeInfo(u_pMsg, u_msgLength, v_pDecodeResult);
}
else if(u_msgLength > 8) //5:64K; 8:2M
{
msuHeadDecode(u_pMsg, v_pDecodeResult, &headStrLen);
pAfterHead = &v_pDecodeResult[headStrLen];
temp = u_pMsg[SS7_SI_OFFSET] & 0x0f;
switch(temp)
{
case SS7_SI_SNMU: //0
//sprintf(pAfterHead, "Message Type: MSU, 信令网管理消息 \n");
m_snmu.GetMessageDecodeInfo(u_pMsg, u_msgLength, pAfterHead);
break;
case SS7_SI_STMU: //
//sprintf(pAfterHead, "Message Type: MSU, 信令网测试和维护消息 \n");
m_stmu.GetMessageDecodeInfo(u_pMsg, u_msgLength, pAfterHead);
break;
case 2:
//sprintf(pAfterHead, "Message Type: MSU, 备用 \n");
break;
case SS7_SI_SCCP: //3
//sprintf(pAfterHead, "Message Type: MSU, SCCP \n");
m_sccp.GetMessageDecodeInfo(u_pMsg, u_msgLength, pAfterHead);
break;
case SS7_SI_TUP: //4
//sprintf(pAfterHead, "Message Type: MSU, TUP \n");
m_tup.GetMessageDecodeInfo(u_pMsg, u_msgLength, pAfterHead);
break;
case SS7_SI_ISUP: //5
//sprintf(pAfterHead, "Message Type: MSU, ISUP \n");
m_isup.GetMessageDecodeInfo(u_pMsg, u_msgLength, pAfterHead);
break;
case 6:
//sprintf(pAfterHead, "Message Type: MSU, DUP(与呼叫和电路有关) \n");
break;
case 7:
//sprintf(pAfterHead, "Message Type: MSU, DUP(性能登记和撤消消息) \n");
break;
default:
//sprintf(pAfterHead, "Message Type: MSU, 备用 \n");
break;
}
}
return TRUE;
}
BOOL CDecodeApp2::msuHeadDecode(BYTE *u_pMsg, char *v_pDecodeResult, int *v_pHeadStrLen)
{
char *msuTpye[16] = {"信令网管理消息",
"信令网测试维护消息",
"Reserved",
"SCCP",
"TUP",
"ISUP",
"DUP(与呼叫和电路有关)",
"DUP(性能登记和撤消消息)",
"Reserved","Reserved","Reserved","Reserved",
"Reserved","Reserved","Reserved","Reserved" };
char *netType[4] = {"International Network",
"International Reserved",
"National Network",
"National Reserved" };
int strLength;
unsigned int tempSN;
//////////////////////////////////////////////////////V
// the below is different between 64K and 2M
//BSN
strLength = 0;
tempSN = u_pMsg[1];
tempSN = (tempSN & 0x0F) << 8;
tempSN = u_pMsg[0];
sprintf(&v_pDecodeResult[strLength], \
"%02X %02X BSN :%d \n",
u_pMsg[1], u_pMsg[0], tempSN);
//SPARE
strLength = strlen(v_pDecodeResult);
sprintf(&v_pDecodeResult[strLength], \
" SPARE :.%d%d%d.... \n", \
(u_pMsg[1] >> 7) & 0x01, (u_pMsg[1] >> 6) & 0x01, \
(u_pMsg[1] >> 5) & 0x01);
//BIB
strLength = strlen(v_pDecodeResult);
sprintf(&v_pDecodeResult[strLength], \
" BIB :%d....... \n", \
(u_pMsg[0] >> 7) & 0x01);
//FSN
strLength = strlen(v_pDecodeResult);
tempSN = u_pMsg[3];
tempSN = (tempSN & 0x0F) << 8 ;
tempSN = u_pMsg[2];
sprintf(&v_pDecodeResult[strLength], \
"%02X %02X FSN :%d \n",
u_pMsg[3], u_pMsg[2], tempSN);
//SPARE
strLength = strlen(v_pDecodeResult);
sprintf(&v_pDecodeResult[strLength], \
" SPARE :.%d%d%d.... \n", \
(u_pMsg[3] >> 7) & 0x01, (u_pMsg[3] >> 6) & 0x01, \
(u_pMsg[3] >> 5) & 0x01);
//FIB
strLength = strlen(v_pDecodeResult);
sprintf(&v_pDecodeResult[strLength], \
" FIB :%d....... \n", \
(u_pMsg[3] >> 7) & 0x01);
//LI
strLength = strlen(v_pDecodeResult);
tempSN = u_pMsg[5];
tempSN = (tempSN & 0x0001) << 8 ;
tempSN += u_pMsg[4];
sprintf(&v_pDecodeResult[strLength], \
"%02X %02X LI :%d Length Indicator\n",
u_pMsg[5], u_pMsg[4], tempSN);
strLength = strlen(v_pDecodeResult);
sprintf(&v_pDecodeResult[strLength], \
" SPARE :%d%d%d%d%d%d. \n",
(u_pMsg[5] >> 7) & 0x01, (u_pMsg[5] >> 6) & 0x01, \
(u_pMsg[5] >> 5) & 0x01, (u_pMsg[5] >> 4) & 0x01, \
(u_pMsg[5] >> 3) & 0x01, (u_pMsg[5] >> 2) & 0x01, \
(u_pMsg[5] >> 1) & 0x01 );
//SIO
strLength = strlen(v_pDecodeResult);
sprintf(&v_pDecodeResult[strLength], \
"%02X SIO :....%d%d%d%d %s \n",
u_pMsg[6],
(u_pMsg[6] >> 3) & 0x01, (u_pMsg[6] >> 2) & 0x01,
(u_pMsg[6] >> 1) & 0x01, u_pMsg[6] & 0x01,
msuTpye[u_pMsg[6] & 0x0F] );
strLength = strlen(v_pDecodeResult);
sprintf(&v_pDecodeResult[strLength], \
" SPARE :..%d%d.... \n",
(u_pMsg[6] >> 5) & 0x01, (u_pMsg[6] >> 4) & 0x01);
strLength = strlen(v_pDecodeResult);
sprintf(&v_pDecodeResult[strLength], \
" NI :%d%d...... %s \n",
(u_pMsg[6] >> 7) & 0x01, (u_pMsg[6] >> 6) & 0x01,
netType[(u_pMsg[6] >> 6) & 0x03] );
if(0x03 == (u_pMsg[6] & 0x0f))
{
return TRUE; //MSU SCCP
}
strLength = strlen(v_pDecodeResult);
sprintf(&v_pDecodeResult[strLength], \
"%02X %02X %02X DPC : \n",
u_pMsg[9], u_pMsg[8], u_pMsg[7]);
strLength = strlen(v_pDecodeResult);
sprintf(&v_pDecodeResult[strLength], \
"%02X %02X %02X OPC : \n",
u_pMsg[12], u_pMsg[11], u_pMsg[10]);
///////////////////////////////////////////////////////A
*v_pHeadStrLen = strlen(v_pDecodeResult);
return TRUE;
}
void CDecodeApp2::fisuDecode(BYTE *u_pMsg, char *v_pDecodeResult)
{
/********** 64K
int strLength;
strLength = 0;
sprintf(&v_pDecodeResult[strLength], \
"%02X BSN :%d \n",
u_pMsg[0], u_pMsg[0] & 0x7F);
strLength = strlen(v_pDecodeResult);
sprintf(&v_pDecodeResult[strLength], \
" BIB :%d....... \n", \
(u_pMsg[0] >> 7) & 0x01);
strLength = strlen(v_pDecodeResult);
sprintf(&v_pDecodeResult[strLength], \
"%02X FSN :%d \n",
u_pMsg[1], u_pMsg[1] & 0x7F);
strLength = strlen(v_pDecodeResult);
sprintf(&v_pDecodeResult[strLength], \
" FIB :%d....... \n", \
(u_pMsg[1] >> 7) & 0x01);
strLength = strlen(v_pDecodeResult);
sprintf(&v_pDecodeResult[strLength], \
"%02X LI :%d Length Indicator. \n",
u_pMsg[2], u_pMsg[2] & 0x3F);
*********/
//2M
int strLength;
unsigned int tempSN;
//BSN
strLength = 0;
tempSN = u_pMsg[1];
tempSN = (tempSN & 0x0F) << 8;
tempSN = u_pMsg[0];
sprintf(&v_pDecodeResult[strLength], \
"%02X %02X BSN :%d \n",
u_pMsg[1], u_pMsg[0], tempSN);
//SPARE
strLength = strlen(v_pDecodeResult);
sprintf(&v_pDecodeResult[strLength], \
" SPARE :.%d%d%d.... \n", \
(u_pMsg[1] >> 7) & 0x01, (u_pMsg[1] >> 6) & 0x01, \
(u_pMsg[1] >> 5) & 0x01);
//BIB
strLength = strlen(v_pDecodeResult);
sprintf(&v_pDecodeResult[strLength], \
" BIB :%d....... \n", \
(u_pMsg[0] >> 7) & 0x01);
//FSN
strLength = strlen(v_pDecodeResult);
tempSN = u_pMsg[3];
tempSN = (tempSN & 0x0F) << 8 ;
tempSN = u_pMsg[2];
sprintf(&v_pDecodeResult[strLength], \
"%02X %02X FSN :%d \n",
u_pMsg[3], u_pMsg[2], tempSN);
//SPARE
strLength = strlen(v_pDecodeResult);
sprintf(&v_pDecodeResult[strLength], \
" SPARE :.%d%d%d.... \n", \
(u_pMsg[3] >> 7) & 0x01, (u_pMsg[3] >> 6) & 0x01, \
(u_pMsg[3] >> 5) & 0x01);
//FIB
strLength = strlen(v_pDecodeResult);
sprintf(&v_pDecodeResult[strLength], \
" FIB :%d....... \n", \
(u_pMsg[3] >> 7) & 0x01);
//LI
strLength = strlen(v_pDecodeResult);
tempSN = u_pMsg[5];
tempSN = (tempSN & 0x01) << 8 ;
tempSN = u_pMsg[4];
sprintf(&v_pDecodeResult[strLength], \
"%02X %02X LI :%d Length Indicator. \n",
u_pMsg[5], u_pMsg[4], tempSN);
strLength = strlen(v_pDecodeResult);
sprintf(&v_pDecodeResult[strLength], \
" SPARE :%d%d%d%d%d%d. \n",
(u_pMsg[5] >> 7) & 0x01, (u_pMsg[5] >> 6) & 0x01, \
(u_pMsg[5] >> 5) & 0x01, (u_pMsg[5] >> 4) & 0x01, \
(u_pMsg[5] >> 3) & 0x01, (u_pMsg[5] >> 2) & 0x01, \
(u_pMsg[5] >> 1) & 0x01 );
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CDecodeApp2 object
CDecodeApp2 theApp;
/////////////////////////////////////////////////////////////////////////////
// API for GUI module.
////u_pMsg = EM_MSG_FORMAT::msg[320 - 12]; /*消息内容 */
DECODE_DLLAPI void decodeMsg2(
BYTE *u_pMsg,
DWORD u_msgLength,
char *v_pH1H0,
char *v_pSls,
char *v_pCic,
char *v_pData,
char *v_pMsgContent,
char *v_pMsgDecode
)
{
int temp;
theApp.GetH1H0(u_pMsg, u_msgLength, v_pH1H0);
theApp.GetSls(u_pMsg, u_msgLength, v_pSls);
theApp.GetCic(u_pMsg, u_msgLength, v_pCic);
theApp.GetData(u_pMsg, u_msgLength, v_pData);
sprintf(v_pMsgContent, "Message Content: \n\n");
temp = strlen(v_pMsgContent);
theApp.GetMessageContent(u_pMsg, u_msgLength, &v_pMsgContent[temp]);
sprintf(v_pMsgDecode, "Message Info: \n\n");
temp = strlen(v_pMsgDecode);
theApp.GetMessageDecodeInfo(u_pMsg, u_msgLength, &v_pMsgDecode[temp]);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -