⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lssu2.cpp

📁 7号信令协议2M链路协议解码程序源代码
💻 CPP
字号:
// Lssu2.cpp: implementation of the CLssu2 class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "decode2.h"
#include "Lssu2.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CLssu2::CLssu2()
{
    this->createLssuTypeTable();
}

CLssu2::~CLssu2()
{

}
void CLssu2::createLssuTypeTable()
{
    int i;

    for(i=0; i<8; i++)
    {
        strcpy(m_lssuTypeTable[i], "Reserved");
    }

    strcpy(m_lssuTypeTable[0], "SIO");
    strcpy(m_lssuTypeTable[1], "SIN");
    strcpy(m_lssuTypeTable[2], "SIE");
    strcpy(m_lssuTypeTable[3], "SIOS");
    strcpy(m_lssuTypeTable[4], "SIPO");
    strcpy(m_lssuTypeTable[5], "SIB");
}
BOOL CLssu2::GetData(BYTE *u_pMsg, DWORD u_msgLength, char *v_pData)
{
    BYTE lssuType;

    lssuType = u_pMsg[SS7_LSSU_SF_OFFSET] & SS7_LSSU_SF_MASK;
    sprintf(v_pData, "LSSU %s", m_lssuTypeTable[lssuType]);

    return TRUE;
}

BOOL CLssu2::GetMessageDecodeInfo(BYTE *u_pMsg, DWORD u_msgLength, char *v_pDecodeResult)
{
/**********
    int strLength;
    BYTE temp;
    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);

    strLength = strlen(v_pDecodeResult);
    sprintf(&v_pDecodeResult[strLength], \
        "                SPARE      :%d%d...... \n",
        (u_pMsg[2] >> 7) & 0x01, (u_pMsg[2] >> 6) & 0x01);
**********/
	//2M
	int strLength;
    BYTE temp;
	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 );
	/////////////////////////////////////////////

    strLength = strlen(v_pDecodeResult);
    temp = u_pMsg[SS7_LSSU_SF_OFFSET];
    sprintf(&v_pDecodeResult[strLength], \
        "%02X              SF         :.....%d%d%d  %s \n",
        temp,
        (temp >> 2) & 0x01, (temp >> 1) & 0x01, temp & 0x01,
        m_lssuTypeTable[temp & 0x07] );

    strLength = strlen(v_pDecodeResult);
    sprintf(&v_pDecodeResult[strLength], \
        "                SPARE      :%d%d%d%d%d... \n",
        (temp >> 7) & 0x01, (temp >> 6) & 0x01, (temp >> 5) & 0x01,
        (temp >> 4) & 0x01, (temp >> 3) & 0x01);

    return TRUE;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -