📄 tup2.cpp
字号:
strLength += sprintf(&v_pParseData[strLength], "\n === Additional Routing Inf === \n" );
//解析附加路由信息
}
else
{
//没有信息
}
////////////////////////////////////////////
//主叫用户线信息 (n*8)
if(flagFirstID_E == 0x01)
{
strLength += sprintf(&v_pParseData[strLength], "\n === Calling Line ID === \n" );
strLength += sprintf(&v_pParseData[strLength], " ---Addr Indicator--- \n" );
strLength += sprintf(&v_pParseData[strLength], \
"%02X NAI :......%d%d %s\n", \
u_pMsg[indexByte], \
(u_pMsg[indexByte]>>1 & 0x01), (u_pMsg[indexByte] & 0x01), \
m_callingLineID_BA_Table[(u_pMsg[indexByte] & 0x03)] );
strLength += sprintf(&v_pParseData[strLength], \
" CLIPI :.....%d.. %s\n", \
(u_pMsg[indexByte]>>2 & 0x01), \
m_callingLineID_C_Table[(u_pMsg[indexByte]>>2 & 0x01)] ); \
strLength += sprintf(&v_pParseData[strLength], \
" ICLII :....%d... %s\n", \
(u_pMsg[indexByte]>>3 & 0x01), \
m_callingLineID_D_Table[(u_pMsg[indexByte]>>3 & 0x01)] );
strLength += sprintf(&v_pParseData[strLength], " ---Addr Sig Num--- \n" );
strLength += sprintf( &v_pParseData[strLength], \
" NAS :%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) );
strLength += sprintf(&v_pParseData[strLength], " ---Calling Line Addr Sig--- \n" );
telNoNum = (int)(u_pMsg[indexByte]>>4 & 0x0F);
if((telNoNum%2)==0)
j = telNoNum/2;
else
j = telNoNum/2 + 1;
telNum = 0;
for(i=1; i<=j; i++)
{
strLength += sprintf(&v_pParseData[strLength], "%02X ", u_pMsg[indexByte+i] );
}
strLength += sprintf(&v_pParseData[strLength], " CLAS :");
for(i=1; i<=j; i++)
{
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) );
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) );
}
indexByte += j;
strLength += sprintf(&v_pParseData[strLength], " 主叫用户线标识\n");
indexByte += 1;
/*
telNoNum = (int)(u_pMsg[indexByte]>>4 & 0x0F);
if((telNoNum%2)==0)
j = telNoNum/2;
else
j = telNoNum/2 + 1;
telNum=0;
for(i=0; i<j; i++)
{
indexByte += 1;
telNum++;
strLength += sprintf(&v_pParseData[strLength], \
"%02X Calling-ID(%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], \
" Calling-ID(%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) );
}
*/
}
else
{
//没有信息
}
////////////////////////////////////////////
//原被叫地址 (n*8)
if(flagFirstID_F == 0x01)
{
strLength += sprintf(&v_pParseData[strLength], "\n === Orig Called Addr === \n" );
strLength += sprintf(&v_pParseData[strLength], " ---Addr Indicator--- \n" );
strLength += sprintf(&v_pParseData[strLength], \
"%02X NAI :......%d%d %s\n", \
u_pMsg[indexByte], \
(u_pMsg[indexByte]>>1 & 0x01), (u_pMsg[indexByte] & 0x01), \
m_callingLineID_BA_Table[(u_pMsg[indexByte] & 0x03)] );
strLength += sprintf(&v_pParseData[strLength], \
" SPARE :....%d%d.. %s\n", \
(u_pMsg[indexByte]>>3 & 0x01), (u_pMsg[indexByte]>>2 & 0x01), \
("SPARE"));
strLength += sprintf(&v_pParseData[strLength], " ---Addr Sig Num--- \n" );
strLength += sprintf( &v_pParseData[strLength], \
" NAS :%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) );
strLength += sprintf(&v_pParseData[strLength], " ---Orig Called Addr Sig--- \n" );
telNoNum = (int)(u_pMsg[indexByte]>>4 & 0x0F);
if((telNoNum%2)==0)
j = telNoNum/2;
else
j = telNoNum/2 + 1;
telNum = 0;
for(i=1; i<=j; i++)
{
strLength += sprintf(&v_pParseData[strLength], "%02X ", u_pMsg[indexByte+i] );
}
strLength += sprintf(&v_pParseData[strLength], " OCAS :");
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) );
}
indexByte += j;
strLength += sprintf(&v_pParseData[strLength], "\n");
indexByte += 1;
}
else
{
//没有信息
}
////////////////////////////////////////////
//计费信息 (n*8)
if(flagFirstID_G == 0x01)
{
strLength += sprintf(&v_pParseData[strLength], "\n === Charging Inf === \n" );
for(i=0; i<(int)(u_msgLength-indexByte); i++)
{
strLength += sprintf(&v_pParseData[strLength], "%02X ", u_pMsg[indexByte+i] );
}
strLength += sprintf(&v_pParseData[strLength], \
" CI :");
for(i=0; i<(int)(u_msgLength-indexByte); i++)
{
strLength += sprintf(&v_pParseData[strLength], "%02X ", u_pMsg[indexByte+i] );
}
}
else
{
//没有信息
}
return TRUE;
}
//////////////////////////////////////////////////////////////////////////////////
//Subsequent Address Message
//SAM:
BOOL CTup2::GetDataDecode_SAM(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;
////////////////////////////////////////////
//地址信号数量(8)
indexByte = SS7_TUP_DATA_OFFSET;
strLength += sprintf(&v_pParseData[strLength], "\n === Address Sig Num === \n" );
strLength += sprintf(&v_pParseData[strLength], \
"%02X FILLED :....0000\n", \
u_pMsg[indexByte]);
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;
}
//////////////////////////////////////////////////////////////////////////////////
//Subsequent Address message with One signal
//SAO:
BOOL CTup2::GetDataDecode_SAO(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;
////////////////////////////////////////////
//地址信号(n*8)
indexByte = SS7_TUP_DATA_OFFSET;
strLength += sprintf(&v_pParseData[strLength], "\n === Address Signals === \n" );
strLength += sprintf(&v_pParseData[strLength], \
"%02X ASN :%d \n", \
u_pMsg[indexByte], (u_pMsg[indexByte] & 0x0F) );
strLength += sprintf(&v_pParseData[strLength], \
" FILLED :%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) );
strLength += sprintf(&v_pParseData[strLength], "%s ", " 地址信号(被叫用户电话号码)");
return TRUE;
}
//////////////////////////////////////////////////////////////////////////////////
//General forward Set-up information Message
//GSM:
BOOL CTup2::GetDataDecode_GSM(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, telNum=0;
int flagRespTypeA=0x00;
int flagRespTypeB=0x00;
int flagRespTypeC=0x00;
int flagRespTypeD=0x00;
//int flagRespTypeE=0x00;
//int flagRespTypeF=0x00;
//int flagRespTypeG=0x00;
dataLength = u_msgLength - SS7_TUP_DATA_OFFSET;
////////////////////////////////////////////
//相应类型表示语(8)
strLength += sprintf(&v_pParseData[strLength], "\n === Response Type Indicator === \n" );
indexByte = SS7_TUP_DATA_OFFSET;
strLength += sprintf(&v_pParseData[strLength], \
"%02X CPCI :.......%d %s\n", \
u_pMsg[indexByte], (u_pMsg[indexByte] & 0x01), \
m_respTypeID_A_Table[(u_pMsg[indexByte] & 0x01)] );
flagRespTypeA = u_pMsg[indexByte] & 0x01;
strLength += sprintf(&v_pParseData[strLength], \
" CLII :......%d. %s\n", \
(u_pMsg[indexByte]>>1 & 0x01), \
m_respTypeID_B_Table[(u_pMsg[indexByte]>>1 & 0x01)] );
flagRespTypeB = u_pMsg[indexByte]>>1 & 0x01;
strLength += sprintf(&v_pParseData[strLength], \
" ITTEII :.....%d.. %s\n", \
(u_pMsg[indexByte]>>2 & 0x01), \
m_respTypeID_C_Table[(u_pMsg[indexByte]>>2 & 0x01)] );
flagRespTypeC = u_pMsg[indexByte]>>2 & 0x01;
strLength += sprintf(&v_pParseData[strLength], \
" OCAI :....%d... %s\n", \
(u_pMsg[indexByte]>>3 & 0x01), \
m_respTypeID_D_Table[(u_pMsg[indexByte]>>3 & 0x01)] );
flagRespTypeD = u_pMsg[indexByte]>>3 & 0x01;
strLength += sprintf(&v_pParseData[strLength], \
" OESI :...%d.... %s\n", \
(u_pMsg[indexByte]>>4 & 0x01), \
m_respTypeID_E_Table[(u_pMsg[indexByte]>>4 & 0x01)] );
strLength += sprintf(&v_pParseData[strLength], \
" MCII :..%d..... %s\n", \
(u_pMsg[indexByte]>>5 & 0x01), \
m_respTypeID_F_Table[(u_pMsg[indexByte]>>5 & 0x01)] );
strLength += sprintf(&v_pParseData[strLength], \
" HI :.%d...... %s\n", \
(u_pMsg[indexByte]>>6 & 0x01), \
m_respTypeID_G_Table[(u_pMsg[indexByte]>>6 & 0x01)] );
strLength += sprintf(&v_pParseData[strLength], \
" SPARE :%d....... %s\n", \
(u_pMsg[indexByte]>>7 & 0x01), \
"SPARE" );
////////////////////////////////////////////
//主叫用户类别(6)
if(flagRespTypeA == 0x01)
{
strLength += sprintf(&v_pParseData[strLength], "\n === Calling Party Category === \n" );
indexByte += 1;
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)] );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -