📄 tup2.cpp
字号:
(u_pMsg[indexByte] >> 7) & 0x01, (u_pMsg[indexByte] >> 6) & 0x01);
////////////////////////////////////////////
//消息表示语(12)
strLength += sprintf(&v_pParseData[strLength], "\n === Message Indicators === \n" );
indexByte += 1;
strLength += sprintf(&v_pParseData[strLength], \
"%02X %02X NAI :......%d%d %s\n",
u_pMsg[indexByte+1], u_pMsg[indexByte],\
(u_pMsg[indexByte]>>1 & 0x01), (u_pMsg[indexByte] & 0x01), \
m_msgID_BA_Table[(u_pMsg[indexByte]&0x03)] );
strLength += sprintf(&v_pParseData[strLength], \
" NCI :....%d%d.. %s\n",
(u_pMsg[indexByte]>>3 & 0x01), (u_pMsg[indexByte]>>2 & 0x01), \
m_msgID_DC_Table[(u_pMsg[indexByte]>>2 & 0x03)] );
strLength += sprintf(&v_pParseData[strLength], \
" CCI :..%d%d.... %s\n",
(u_pMsg[indexByte]>>5 & 0x01), (u_pMsg[indexByte]>>4 & 0x01), \
m_msgID_FE_Table[(u_pMsg[indexByte]>>4 & 0x03)] );
strLength += sprintf(&v_pParseData[strLength], \
" ESI :.%d...... %s\n",
(u_pMsg[indexByte]>>6 & 0x01), \
m_msgID_G_Table[(u_pMsg[indexByte]>>6 & 0x01)] );
strLength += sprintf(&v_pParseData[strLength], \
" IICI :%d....... %s\n",
(u_pMsg[indexByte]>>7 & 0x01), \
m_msgID_H_Table[(u_pMsg[indexByte]>>7 & 0x01)] );
indexByte += 1;
strLength += sprintf(&v_pParseData[strLength], \
" RCI :.......%d %s\n",
(u_pMsg[indexByte] & 0x01), \
m_msgID_I_Table[(u_pMsg[indexByte] & 0x01)] );
strLength += sprintf(&v_pParseData[strLength], \
" ADPRI :......%d. %s\n",
(u_pMsg[indexByte]>>1 & 0x01), \
m_msgID_J_Table[(u_pMsg[indexByte]>>1 & 0x01)] );
strLength += sprintf(&v_pParseData[strLength], \
" SPI :.....%d.. %s\n",
(u_pMsg[indexByte]>>2 & 0x01), \
m_msgID_K_Table[(u_pMsg[indexByte]>>2 & 0x01)] );
strLength += sprintf(&v_pParseData[strLength], \
" SPARE :....%d... \n",
(u_pMsg[indexByte]>>3 & 0x01) );
strLength += sprintf(&v_pParseData[strLength], " ---Addr Sig Num--- \n" );
strLength += sprintf(&v_pParseData[strLength], \
" NSA :%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) );
////////////////////////////////////////////
//地址信号(被叫用户电话号码)(n*8)
strLength += sprintf(&v_pParseData[strLength], "\n === Address Signals === \n" );
telNoNum = (int)(u_pMsg[indexByte]>>4 & 0x0F);
if((telNoNum%2)==0)
j = telNoNum/2;
else
j = telNoNum/2 + 1;
int telNum=0;
for(i=1; i<=j; i++)
{
strLength += sprintf(&v_pParseData[strLength], "%02X ", u_pMsg[indexByte+i] );
}
strLength += sprintf(&v_pParseData[strLength], " AS :");
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) );
}
strLength += sprintf(&v_pParseData[strLength], "%s ", " 地址信号(被叫用户电话号码)");
return TRUE;
}
//////////////////////////////////////////////////////////////////////////////////
//Initial Address message with additional Information
//IAI:
BOOL CTup2::GetDataDecode_IAI(BYTE *u_pMsg, DWORD u_msgLength, char *v_pParseData)
{
int dataLength=0;
int strLength=0, indexByte=0, telNoNum=0;
int flagFirstID_A=0;
int flagFirstID_B=0;
int flagFirstID_C=0;
int flagFirstID_D=0;
int flagFirstID_E=0;
int flagFirstID_F=0;
int flagFirstID_G=0;
dataLength = u_msgLength - SS7_TUP_DATA_OFFSET;
int i=0, j=0, k=0;
/////////
/*extern CDecodeApp2 theApp;
k = sprintf(&v_pParseData[0], "==IAI==");
for(i=0; i<dataLength; i++)
{
theApp.ConvertOneByte(u_pMsg[SS7_TUP_DATA_OFFSET + i], &v_pParseData[k+j]);
j += 3;
}
strLength = strlen(v_pParseData);
sprintf(&v_pParseData[strLength], "%s", "\n");
strLength = strlen(v_pParseData);
*/
////////////////////////////////////////////
//主叫用户类别(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", \
(u_pMsg[indexByte] >> 7) & 0x01, (u_pMsg[indexByte] >> 6) & 0x01);
////////////////////////////////////////////
//消息表示语(12)
strLength += sprintf(&v_pParseData[strLength], "\n === Message Indicators === \n" );
indexByte += 1;
strLength += sprintf(&v_pParseData[strLength], \
"%02X %02X NAI :......%d%d %s\n",
u_pMsg[indexByte+1], u_pMsg[indexByte],\
(u_pMsg[indexByte]>>1 & 0x01), (u_pMsg[indexByte] & 0x01), \
m_msgID_BA_Table[(u_pMsg[indexByte]&0x03)] );
strLength += sprintf(&v_pParseData[strLength], \
" NCI :....%d%d.. %s\n",
(u_pMsg[indexByte]>>3 & 0x01), (u_pMsg[indexByte]>>2 & 0x01), \
m_msgID_DC_Table[(u_pMsg[indexByte]>>2 & 0x03)] );
strLength += sprintf(&v_pParseData[strLength], \
" CCI :..%d%d.... %s\n",
(u_pMsg[indexByte]>>5 & 0x01), (u_pMsg[indexByte]>>4 & 0x01), \
m_msgID_FE_Table[(u_pMsg[indexByte]>>4 & 0x03)] );
strLength += sprintf(&v_pParseData[strLength], \
" ESI :.%d...... %s\n",
(u_pMsg[indexByte]>>6 & 0x01), \
m_msgID_G_Table[(u_pMsg[indexByte]>>6 & 0x01)] );
strLength += sprintf(&v_pParseData[strLength], \
" IICI :%d....... %s\n",
(u_pMsg[indexByte]>>7 & 0x01), \
m_msgID_H_Table[(u_pMsg[indexByte]>>7 & 0x01)] );
indexByte += 1;
strLength += sprintf(&v_pParseData[strLength], \
" RCI :.......%d %s\n",
(u_pMsg[indexByte] & 0x01), \
m_msgID_I_Table[(u_pMsg[indexByte] & 0x01)] );
strLength += sprintf(&v_pParseData[strLength], \
" ADPRI :......%d. %s\n",
(u_pMsg[indexByte]>>1 & 0x01), \
m_msgID_J_Table[(u_pMsg[indexByte]>>1 & 0x01)] );
strLength += sprintf(&v_pParseData[strLength], \
" SPI :.....%d.. %s\n",
(u_pMsg[indexByte]>>2 & 0x01), \
m_msgID_K_Table[(u_pMsg[indexByte]>>2 & 0x01)] );
strLength += sprintf(&v_pParseData[strLength], \
" SPARE :....%d... \n",
(u_pMsg[indexByte]>>3 & 0x01) );
strLength += sprintf(&v_pParseData[strLength], " ---Addr Sig Num--- \n" );
strLength += sprintf(&v_pParseData[strLength], \
" NSA :%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) );
////////////////////////////////////////////
//地址信号(被叫用户电话号码)(n*8)
strLength += sprintf(&v_pParseData[strLength], "\n === Address Signals === \n" );
telNoNum = (int)(u_pMsg[indexByte]>>4 & 0x0F);
if((telNoNum%2)==0)
j = telNoNum/2;
else
j = telNoNum/2 + 1;
int telNum=0;
for(i=1; i<=j; i++)
{
strLength += sprintf(&v_pParseData[strLength], "%02X ", u_pMsg[indexByte+i] );
}
strLength += sprintf(&v_pParseData[strLength], " AS :");
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) );
}
strLength += sprintf(&v_pParseData[strLength], "%s ", " 地址信号(被叫用户电话号码)");
strLength += sprintf(&v_pParseData[strLength], "\n");
indexByte += j;
/* if((telNoNum%2)==0)
j = telNoNum/2;
else
j = telNoNum/2 + 1;
int telNum=0;
for(i=0; i<j; i++)
{
indexByte += 1;
telNum++;
strLength += sprintf(&v_pParseData[strLength], \
"%02X Addr-Sig(%d) :....%d%d%d%d %d\n", \
u_pMsg[indexByte], (telNum), \
(u_pMsg[indexByte]>>3 & 0x01), (u_pMsg[indexByte]>>2 & 0x01), \
(u_pMsg[indexByte]>>1 & 0x01), (u_pMsg[indexByte] & 0x01), \
(u_pMsg[indexByte] & 0x0F) );
telNum++;
strLength += sprintf(&v_pParseData[strLength], \
" Addr-Sig(%d) :%d%d%d%d.... %d\n",
(telNum), \
(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) );
}
*/
////////////////////////////////////////////
//第一表示语八位位组(8)
strLength += sprintf(&v_pParseData[strLength], "\n === First Indicator Octet === \n" );
indexByte += 1;
strLength += sprintf(&v_pParseData[strLength], \
"%02X NCUFII :.......%d %s\n",
u_pMsg[indexByte], (u_pMsg[indexByte] & 0x01), \
m_firstID_A_Table[(u_pMsg[indexByte] & 0x01)] );
flagFirstID_A = u_pMsg[indexByte] & 0x01;
strLength += sprintf(&v_pParseData[strLength], \
" CUGII :......%d. %s\n",
(u_pMsg[indexByte]>>1 & 0x01), \
m_firstID_B_Table[(u_pMsg[indexByte]>>1 & 0x01)] );
flagFirstID_B = u_pMsg[indexByte]>>1 & 0x01;
strLength += sprintf(&v_pParseData[strLength], \
" ACPII :.....%d.. %s\n",
(u_pMsg[indexByte]>>2 & 0x01), \
m_firstID_C_Table[(u_pMsg[indexByte]>>2 & 0x01)] );
flagFirstID_C = u_pMsg[indexByte]>>2 & 0x01;
strLength += sprintf(&v_pParseData[strLength], \
" ARII :....%d... %s\n",
(u_pMsg[indexByte]>>3 & 0x01), \
m_firstID_D_Table[(u_pMsg[indexByte]>>3 & 0x01)] );
flagFirstID_D = u_pMsg[indexByte]>>3 & 0x01;
strLength += sprintf(&v_pParseData[strLength], \
" CLII :...%d.... %s\n",
(u_pMsg[indexByte]>>4 & 0x01), \
m_firstID_E_Table[(u_pMsg[indexByte]>>4 & 0x01)] );
flagFirstID_E = u_pMsg[indexByte]>>4 & 0x01;
strLength += sprintf(&v_pParseData[strLength], \
" OCAI :..%d..... %s\n",
(u_pMsg[indexByte]>>5 & 0x01), \
m_firstID_F_Table[(u_pMsg[indexByte]>>5 & 0x01)] );
flagFirstID_F = u_pMsg[indexByte]>>5 & 0x01;
strLength += sprintf(&v_pParseData[strLength], \
" CII :.%d...... %s\n",
(u_pMsg[indexByte]>>6 & 0x01), \
m_firstID_G_Table[(u_pMsg[indexByte]>>6 & 0x01)] );
flagFirstID_G = u_pMsg[indexByte]>>6 & 0x01;
strLength += sprintf(&v_pParseData[strLength], \
" SPARE :%d....... %s\n",
(u_pMsg[indexByte]>>7 & 0x01), "SPARE" );
indexByte += 1;
////////////////////////////////////////////
//网路能力或用户性能信息(国内选用)(8)
if(flagFirstID_A == 0x01)
{
strLength += sprintf(&v_pParseData[strLength], "\n === National Use === \n" );
strLength += sprintf(&v_pParseData[strLength], \
"%02X National Use :0x%02X\n", \
u_pMsg[indexByte], u_pMsg[indexByte] );
indexByte += 1;
}
else
{
//没有信息
}
////////////////////////////////////////////
//闭合用户群信息(40)
if(flagFirstID_B == 0x01)
{
strLength += sprintf(&v_pParseData[strLength], "\n === Closed User Group Inf === \n" );
strLength += sprintf( &v_pParseData[strLength], \
"%02X %02X %02X %02X %02X Closed-User-Group-Inf : %s\n", \
u_pMsg[indexByte+4], u_pMsg[indexByte+3], u_pMsg[indexByte+2], \
u_pMsg[indexByte+1], u_pMsg[indexByte], ("Not Used,now") );
indexByte += 6;
}
else
{
//没有信息
}
////////////////////////////////////////////
//附加主叫用户信息 (n*8)
if(flagFirstID_C == 0x01)
{
strLength += sprintf(&v_pParseData[strLength], "\n === Additional Calling Inf === \n" );
//解析附加主叫用户信息
}
else
{
//没有信息
}
////////////////////////////////////////////
//附加路由信息 (n*8)
if(flagFirstID_D == 0x01)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -