📄 decode2.cpp
字号:
// decode2.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
#include "decode2.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//
// Note!
//
// If this DLL is dynamically linked against the MFC
// DLLs, any functions exported from this DLL which
// call into MFC must have the AFX_MANAGE_STATE macro
// added at the very beginning of the function.
//
// For example:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // normal function body here
// }
//
// It is very important that this macro appear in each
// function, prior to any calls into MFC. This means that
// it must appear as the first statement within the
// function, even before any object variable declarations
// as their constructors may generate calls into the MFC
// DLL.
//
// Please see MFC Technical Notes 33 and 58 for additional
// details.
//
/////////////////////////////////////////////////////////////////////////////
// CDecodeApp2
BEGIN_MESSAGE_MAP(CDecodeApp2, CWinApp)
//{{AFX_MSG_MAP(CDecodeApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDecodeApp2 construction
CDecodeApp2::CDecodeApp2()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// get one byte hex string.
char *CDecodeApp2::ConvertOneByte(BYTE u_byte, char *v_pOutput)
{
BYTE temp;
temp = (u_byte >> 4) & 0x0f;
if(temp < 10)
{
v_pOutput[0] = temp + 0x30;
}
else
{
v_pOutput[0] = temp + 55;
}
temp = u_byte & 0x0f;
if(temp < 10)
{
v_pOutput[1] = temp + 0x30;
}
else
{
v_pOutput[1] = temp + 55;
}
v_pOutput[2] = ' ';
v_pOutput[3] = 0;
return v_pOutput;
}
BOOL CDecodeApp2::GetH1H0(BYTE *u_pMsg, DWORD u_msgLength, char *v_pH1H0)
{
BYTE msuType;
if(SS7_FISU_LENGTH == u_msgLength) //3:64K; 6:2M
{
v_pH1H0[0] = 0;
}
else if(SS7_LSSU_LENGTH == u_msgLength) //4:64K; 7:2M
{
v_pH1H0[0] = 0;
}
else
{
msuType = u_pMsg[SS7_SI_OFFSET] & SS7_SI_MASK;
if(SS7_SI_SNMU == msuType)
{
m_snmu.GetH1H0(u_pMsg, u_msgLength, v_pH1H0);
}
else if(SS7_SI_STMU == msuType)
{
m_stmu.GetH1H0(u_pMsg, u_msgLength, v_pH1H0);
}
else if(SS7_SI_SCCP == msuType)
{
m_sccp.GetH1H0(u_pMsg, u_msgLength, v_pH1H0);
}
else if(SS7_SI_TUP == msuType)
{
m_tup.GetH1H0(u_pMsg, u_msgLength, v_pH1H0);
}
else if(SS7_SI_ISUP == msuType)
{
m_isup.GetH1H0(u_pMsg, u_msgLength, v_pH1H0);
}
else
{
sprintf(v_pH1H0, "*"); //暂时不解析的MSU。
}
}
return TRUE;
}
BOOL CDecodeApp2::GetSls(BYTE *u_pMsg, DWORD u_msgLength, char *v_pSls)
{
BYTE msuType;
if(SS7_FISU_LENGTH == u_msgLength) //3:64K; 6:2M
{
v_pSls[0] = 0;
}
else if(SS7_LSSU_LENGTH == u_msgLength) //4:64K; 7:2M
{
v_pSls[0] = 0;
}
else
{
msuType = u_pMsg[SS7_SI_OFFSET] & SS7_SI_MASK;
if(SS7_SI_SNMU == msuType)
{
m_snmu.GetSls(u_pMsg, u_msgLength, v_pSls);
}
else if(SS7_SI_STMU == msuType)
{
m_stmu.GetSls(u_pMsg, u_msgLength, v_pSls);
}
else if(SS7_SI_SCCP == msuType)
{
m_sccp.GetSls(u_pMsg, u_msgLength, v_pSls);
}
else if(SS7_SI_TUP == msuType)
{
m_tup.GetSls(u_pMsg, u_msgLength, v_pSls);
}
else if(SS7_SI_ISUP == msuType)
{
m_isup.GetSls(u_pMsg, u_msgLength, v_pSls);
}
else
{
sprintf(v_pSls, "*"); //暂时不解析的MSU。
}
}
return TRUE;
}
BOOL CDecodeApp2::GetCic(BYTE *u_pMsg, DWORD u_msgLength, char *v_pCic)
{
BYTE msuType;
if(SS7_FISU_LENGTH == u_msgLength) //3:64K; 6:2M
{
v_pCic[0] = 0;
}
else if(SS7_LSSU_LENGTH == u_msgLength) //4:64K; 7:2M
{
v_pCic[0] = 0;
}
else
{
msuType = u_pMsg[SS7_SI_OFFSET] & SS7_SI_MASK;
if(SS7_SI_SNMU == msuType)
{
m_snmu.GetCic(u_pMsg, u_msgLength, v_pCic);
}
else if(SS7_SI_STMU == msuType)
{
m_stmu.GetCic(u_pMsg, u_msgLength, v_pCic);
}
else if(SS7_SI_SCCP == msuType)
{
m_sccp.GetCic(u_pMsg, u_msgLength, v_pCic);
}
else if(SS7_SI_TUP == msuType)
{
m_tup.GetCic(u_pMsg, u_msgLength, v_pCic);
}
else if(SS7_SI_ISUP == msuType)
{
m_isup.GetCic(u_pMsg, u_msgLength, v_pCic);
}
else
{
sprintf(v_pCic, "*"); //暂时不解析的MSU。
}
}
return TRUE;
}
BOOL CDecodeApp2::GetData(BYTE *u_pMsg, DWORD u_msgLength, char *v_pData)
{
BYTE msuType;
if(SS7_FISU_LENGTH == u_msgLength) //3:64K; 6:2M
{
v_pData[0] = 0;
}
else if(SS7_LSSU_LENGTH == u_msgLength) //4:64K; 7:2M
{
m_lssu.GetData(u_pMsg, u_msgLength, v_pData);
}
else
{
msuType = u_pMsg[SS7_SI_OFFSET] & SS7_SI_MASK;
if(SS7_SI_SNMU == msuType)
{
m_snmu.GetData(u_pMsg, u_msgLength, v_pData);
}
else if(SS7_SI_STMU == msuType)
{
m_stmu.GetData(u_pMsg, u_msgLength, v_pData);
}
else if(SS7_SI_SCCP == msuType)
{
m_sccp.GetData(u_pMsg, u_msgLength, v_pData);
}
else if(SS7_SI_TUP == msuType)
{
m_tup.GetData(u_pMsg, u_msgLength, v_pData);
}
else if(SS7_SI_ISUP == msuType)
{
m_isup.GetData(u_pMsg, u_msgLength, v_pData);
}
else
{
sprintf(v_pData, "*"); //暂时不解析的MSU。
}
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// get message content.
BOOL CDecodeApp2::GetMessageContent(BYTE *u_pMsg, DWORD u_msgLength, char *v_pDecodeResult)
{
DWORD pos;
DWORD i;
pos = 0;
for(i=0; i<u_msgLength; i++)
{
ConvertOneByte(u_pMsg[i], &v_pDecodeResult[pos]);
pos += 3;
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// get message decoding info
BOOL CDecodeApp2::GetMessageDecodeInfo(BYTE *u_pMsg, DWORD u_msgLength, char *v_pDecodeResult)
{
char *pAfterHead;
int headStrLen;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -