📄 tup2.cpp
字号:
{ strcpy(m_msgIndicator_E_Table[0x00], "呼叫不前转");
strcpy(m_msgIndicator_E_Table[0x01], "呼叫前转");
}
void CTup2::create_msgIndicator_F_Table()
{ strcpy(m_msgIndicator_F_Table[0x00], "任何通道");
strcpy(m_msgIndicator_F_Table[0x01], "全部是No.7信令方式通道");
}
void CTup2::create_GRM_blocking_Table() //MGB,HGB,SGB
{ strcpy(m_GRM_blocking_Table[0x00], "不闭塞");
strcpy(m_GRM_blocking_Table[0x01], "闭塞");
}
void CTup2::create_GRM_blockingAck_Table() //MBA,HBA,SBA
{ strcpy(m_GRM_blockingAck_Table[0x00], "未闭塞证实");
strcpy(m_GRM_blockingAck_Table[0x01], "闭塞证实");
}
void CTup2::create_GRM_unblocking_Table() //MGU,HGU,SGU
{ strcpy(m_GRM_unblocking_Table[0x00], "未解除闭塞");
strcpy(m_GRM_unblocking_Table[0x01], "解除闭塞");
}
void CTup2::create_GRM_unblockingAck_Table() //MUA,HUA,SUA
{ strcpy(m_GRM_unblockingAck_Table[0x00], "未解除闭塞证实");
strcpy(m_GRM_unblockingAck_Table[0x01], "解除闭塞证实");
}
void CTup2::create_GRM_resetAck_Table() //GRA
{ strcpy(m_GRM_resetAck_Table[0x00], "由于维护引起的不闭塞");
strcpy(m_GRM_resetAck_Table[0x01], "由于维护引起的闭塞");
}
////////////////////////////////////////////
BOOL CTup2::GetH1H0(BYTE *u_pMsg, DWORD u_msgLength, char *v_pH1H0)
{
sprintf(v_pH1H0, "%02X", u_pMsg[SS7_TUP_H1H0_OFFSET]);
return TRUE;
}
BOOL CTup2::GetSls(BYTE *u_pMsg, DWORD u_msgLength, char *v_pSls)
{
sprintf(v_pSls, "%X", u_pMsg[SS7_TUP_SLS_OFFSET] & SS7_TUP_SLS_MASK);
return TRUE;
}
BOOL CTup2::GetCic(BYTE *u_pMsg, DWORD u_msgLength, char *v_pCic)
{
sprintf(v_pCic, "%X%02X", u_pMsg[SS7_TUP_CIC_OFFSET + 1] & 0x0F, \
u_pMsg[SS7_TUP_CIC_OFFSET]);
return TRUE;
}
BOOL CTup2::GetData(BYTE *u_pMsg, DWORD u_msgLength, char *v_pData)
{
extern CDecodeApp2 theApp;
int dataLength;
int temp=0;
int i=0;
////#define MAX_DATA_BYTE_NUMBER (16) //送显示的缩略数据长度
////应该给为正常的数据,可能大于16
temp = SS7_TUP_DATA_OFFSET + MAX_DATA_BYTE_NUMBER - 1;
if(temp > ((int )u_msgLength))
{
dataLength = u_msgLength - SS7_TUP_DATA_OFFSET;
}
else
{
dataLength = MAX_DATA_BYTE_NUMBER;
}
temp = 0;
for(i=0; i<dataLength; i++)
{
theApp.ConvertOneByte(u_pMsg[SS7_TUP_DATA_OFFSET + i], \
&v_pData[temp]);
temp += 3;
}
return TRUE;
}
BOOL CTup2::GetMessageDecodeInfo(BYTE *u_pMsg, DWORD u_msgLength, char *v_pDecodeResult)
{
int strLength;
BYTE temp;
strLength = 0;
temp = u_pMsg[SS7_TUP_SLS_OFFSET];
sprintf(&v_pDecodeResult[strLength],
"%02X SLS :...%d%d%d%d%d \n",
temp, (temp >> 4) & 0x01, (temp >> 3) & 0x01, (temp >> 2) & 0x01,
(temp >> 1) & 0x01, temp & 0x01);
strLength = strlen(v_pDecodeResult);
sprintf(&v_pDecodeResult[strLength], \
" SPARE :%d%d%d..... \n",
(temp >> 7) & 0x01, (temp >> 6) & 0x01, (temp >> 5) & 0x01);
strLength = strlen(v_pDecodeResult);
sprintf(&v_pDecodeResult[strLength], \
"%02X %02X CIC : 'h%X%02X \n",
u_pMsg[SS7_TUP_CIC_OFFSET + 1], u_pMsg[SS7_TUP_CIC_OFFSET],
u_pMsg[SS7_TUP_CIC_OFFSET + 1] & 0x0F, u_pMsg[SS7_TUP_CIC_OFFSET]);
strLength = strlen(v_pDecodeResult);
temp = u_pMsg[SS7_TUP_H1H0_OFFSET];
sprintf(&v_pDecodeResult[strLength], \
"%02X H1H0 :%s \n",
temp, m_h1h0Table[temp]);
///////////////////////////////////////////////
//// 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 CTup2::GetMessageDecodeInfo_AfterH1H0(BYTE *u_pMsg, DWORD u_msgLength, char *v_pDecodeResult)
{ /////////////////////////////////////////////
//// 此编写不同类消息解析的代码
BYTE nH1H0;
nH1H0 = u_pMsg[SS7_TUP_H1H0_OFFSET];
switch(nH1H0)
{
/////////////////////////////////////////////////////////////
//Forward Address Message (前向地址消息 群组)
case 0x11: // "IAM"
GetDataDecode_IAM(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x21: // "IAI"
GetDataDecode_IAI(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x31: // "SAM"
GetDataDecode_SAM(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x41: // "SAO"
GetDataDecode_SAO(u_pMsg, u_msgLength, v_pDecodeResult);
break;
/////////////////////////////////////////////////////////////
//Forward Set-up Message (前向建立消息 群组)
case 0x12: // "GSM"
GetDataDecode_GSM(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x32: // "COT"
GetDataDecode_COT(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x42: // "CCF"
GetDataDecode_CCF(u_pMsg, u_msgLength, v_pDecodeResult);
break;
/////////////////////////////////////////////////////////////
//Software generated group blocking-acknowledgement message
//(软件产生的群闭塞证实消息)
case 0x13: // "GRQ"
GetDataDecode_GRQ(u_pMsg, u_msgLength, v_pDecodeResult);
break;
/////////////////////////////////////////////////////////////
//Backward Set-up Message (后向建立消息)
case 0x14: // "ACM"
GetDataDecode_ACM(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x24: // "CHG"
GetDataDecode_CHG(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x1A: // "ACC"
GetDataDecode_ACC(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x2C: // "MPM"
GetDataDecode_MPM(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x1D: // "OPR"
GetDataDecode_OPR(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x1E: // "SLB"
GetDataDecode_SLB(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x2E: // "STB"
GetDataDecode_STB(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x1F: // "MAL"
GetDataDecode_MAL(u_pMsg, u_msgLength, v_pDecodeResult);
break;
/////////////////////////////////////////////////////////////
//Unsuccessful Backward set-up information Message (后向建立不成功消息 群组)
case 0x15: // "SEC"
GetDataDecode_SEC(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x25: // "CGC"
GetDataDecode_CGC(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x35: // "NNC"
GetDataDecode_NNC(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x45: // "ADI"
GetDataDecode_ADI(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x55: // "CFL"
GetDataDecode_CFL(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x65: // "SSB"
GetDataDecode_SSB(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x75: // "UNN"
GetDataDecode_UNN(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x85: // "LOS"
GetDataDecode_LOS(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x95: // "SST"
GetDataDecode_SST(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0xA5: // "ACB"
GetDataDecode_ACB(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0xB5: // "DPN"
GetDataDecode_DPN(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0xC5: // "MPR"
GetDataDecode_MPR(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0xF5: // "EUM"
GetDataDecode_EUM(u_pMsg, u_msgLength, v_pDecodeResult);
break;
/////////////////////////////////////////////////////////////
//Call Supervision Message (电路监视消息 群组)
case 0x06: // "ANU"
GetDataDecode_ANU(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x16: // "ANC"
GetDataDecode_ANC(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x26: // "ANN"
GetDataDecode_ANN(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x36: // "CBK"
GetDataDecode_CBK(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x46: // "CLF"
GetDataDecode_CLF(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x56: // "RAN"
GetDataDecode_RAN(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x66: // "FOT"
GetDataDecode_FOT(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x76: // "CCL"
GetDataDecode_CCL(u_pMsg, u_msgLength, v_pDecodeResult);
break;
////////////////////////////////////////////////////////////
//CirCuit supervision Message (电路监视消息 群组)
case 0x17: // "RLG"
GetDataDecode_RLG(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x27: // "BLO"
GetDataDecode_BLO(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x37: // "BLA"
GetDataDecode_BLA(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x47: // "UBL"
GetDataDecode_UBL(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x57: // "UBA"
GetDataDecode_UBA(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x67: // "CCR"
GetDataDecode_CCR(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x77: // "RSC"
GetDataDecode_RSC(u_pMsg, u_msgLength, v_pDecodeResult);
break;
////////////////////////////////////////////////////////
//circuit GRoup supervision Message (电路群监视消息 群组)
case 0x18: // "MGB"
GetDataDecode_MGB(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x28: // "MBA"
GetDataDecode_MBA(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x38: // "MGU"
GetDataDecode_MGU(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x48: // "MUA"
GetDataDecode_MUA(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x58: // "HGB"
GetDataDecode_HGB(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x68: // "HBA"
GetDataDecode_HBA(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x78: // "HGU"
GetDataDecode_HGU(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x88: // "HUA"
GetDataDecode_HUA(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0x98: // "GRS"
GetDataDecode_GRS(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0xA8: // "GRA"
GetDataDecode_GRA(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0xB8: // "SGB"
GetDataDecode_SGB(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0xC8: // "SBA"
GetDataDecode_SBA(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0xD8: // "SGU"
GetDataDecode_SGU(u_pMsg, u_msgLength, v_pDecodeResult);
break;
case 0xE8: // "SUA"
GetDataDecode_SUA(u_pMsg, u_msgLength, v_pDecodeResult);
break;
////////////////////////////////////////////////////
default:
//默认没解析
break;
}
return TRUE;
}
//////////////////////////////////////////////////////////////////////////////////
//Initial Address Message
//IAM:
BOOL CTup2::GetDataDecode_IAM(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;
dataLength = u_msgLength - SS7_TUP_DATA_OFFSET;
////////////////////////////////////////////
//主叫用户类别(6)
strLength += sprintf(&v_pParseData[strLength], "\n === Calling Party Category === \n" );
indexByte = SS7_TUP_DATA_OFFSET;
strLength += sprintf(&v_pParseData[strLength], \
"%02X CPC :..%d%d%d%d%d%d %s\n",
u_pMsg[indexByte], \
(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), \
m_callingTable[(u_pMsg[indexByte]&0x3f)] );
strLength += sprintf(&v_pParseData[strLength], \
" SPARE :%d%d...... \n", \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -