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

📄 au_init.cpp

📁 map协议源代码
💻 CPP
字号:
#ifdef __cplusplus
extern "C"{
#endif

/* header include files (.h) */
#include "envopt.h"        /* environment options */
#include "envdep.h"        /* environment dependent */
#include "envind.h"        /* environment independent */
#include "ssi.h"
#include "gen.h"
#include "cm5.h"           /* Common timer */
#include "cm_ss7.h"        /* SS7 Specific */
#include "cm_llist.h"
#include "cm_hash.h"       /* common hash */
#include "cm_tpt.h"
#include "cm_err.h"        /* common error */
#include "cm_dns.h"        /* Common DNS library */
#include "cm_inet.h"
#include "mf.h"
#include "lsb.h"           /* layer management, SCTP  */
#include "lit.h"           /* layer management M3UA  */
#include "lsp.h"
#include "lst.h"
#include "lma.h"
#include "stu.h"
#include "mat.h"
#include "spt.h"
#include "sct.h"           /* SCT interface */
#include "snt.h"
#include "hit.h"           /* HIT interface */
#include "ma.h"
#include "st.h"
#include "st_mf.h"
#include "sp.h"
#include "it.h"            /* M3UA internal defines */
#include "sb_mtu.h"
#include "sb.h"            /* SCTP internal defines */
#include "sb_err.h"        /* SCTP error */


/* header/extern include files (.x) */
#include "gen.x"
#include "ssi.x"
#include "cm_hash.x"
#include "cm_llist.x"
#include "cm_lib.x"
#include "cm5.x"
#include "cm_ss7.x"
#include "cm_tpt.x"
#include "cm_dns.x"        /* Common DNS library */
#include "cm_inet.x"
#include "sct.x"           /* SCT interface */
#include "mf.x"
#include "lsb.x"           /* layer management SCTP */
#include "lit.x"           /* layer management M3UA */
#include "lsp.x"
#include "lst.x"
#include "lma.x"
#include "stu.x"
#include "spt.x"
#include "mat.x"
#include "snt.x"
#include "sct.x"
#include "sb_mtu.x"
#include "hit.x"           /* HIT interface */
#include "ma.x"
#include "st_mf.x"
#include "st.x"
#include "sp.x"
#ifdef IT_FTHA             
#include "sht.x"           /* SHT Interface header file */
#endif /* IT_FTHA */
#include "snt.x"           /* SNT interface */
#include "it.x"            /* M3UA internal typedefs */
#include "sb.x"            /* SCTP internal typedefs */

#include "oam_sim.h"
#include "hi_common.h"
#include "sb_dbg.h"
#include "it_init.h"
#include "sp_init.h"
#include "st_init.h"
#include "ma_dbg.h"
#include "au.h"
#include "au_init.h"
#include "au_ext.h"
#include "cp_oam_stru.h"
#include "sb_dbg.h"
#include "au_dlg.h"
#include "it_cfg.h"

PUBLIC U16 g_LayerCount = 0;

EXTERN unsigned char g_itRegisterFlag;
EXTERN unsigned char g_spRegisterFlag;
EXTERN unsigned char g_stRegisterFlag;
EXTERN unsigned char g_maRegisterFlag;
EXTERN unsigned char g_tuclregisterFlag;
EXTERN unsigned char g_sctpregisterFlag;

EXTERN VOID hiNmSyncCallback(U16 msgtype, U32 sepuense, U8 pack_end, tb_record* prow);
EXTERN VOID sbNmSyncCallback(U16 msgtype, U32 sepuense, U8 pack_end, tb_record* prow);
EXTERN VOID itNmSyncCallback(U16 msgtype, U32 sepuense, U8 pack_end, tb_record* prow);
EXTERN VOID spNmSyncCallback(U16 msgtype, U32 sequense, U8 pack_end, tb_record* prow);
EXTERN VOID stNmSyncCallback(U16 msgtype, U32 sepuense, U8 pack_end, tb_record* prow);
EXTERN VOID maNmSyncCallback(U16 msgtype, U32 sepuense, U8 pack_end, tb_record* prow);
EXTERN U16 getCfgNum(void);

EXTERN PUBLIC XS16 MapStart(SSTskId tskId);
EXTERN PUBLIC S16 SInit();
EXTERN PUBLIC S16 auTst();
EXTERN PUBLIC S16 sb_init_own(void);
EXTERN PUBLIC S16 hi_init_fun(void);

EXTERN StCb stCb;
EXTERN SpCb spCb;
EXTERN ItCfgGlobal itGlobalTabCfg;

#ifdef ANSI
PUBLIC S16 smTst
(
Void
)
#else
PUBLIC S16 smTst(Void)
#endif
{
	SSTskId tskId;

	if (ROK != SRegTTsk(ENTSM, SM_INST_0, TTNORM, PRIOR0, smActvInit, smActvTsk))
	{
		RETVALUE(RFAILED);
	}

   if (SCreateSTsk(PRIOR0, &tskId) != ROK)
   {
        RETVALUE(RFAILED);
   }

	if (ROK != SAttachTTsk(ENTSM, SM_INST_0, tskId))
	{
		RETVALUE(RFAILED);
	}

	RETVALUE(ROK);
}



#ifdef ANSI
PUBLIC S16 tst
(
Void
)
#else
PUBLIC S16 tst(Void)
#endif
{
	SSTskId tskId = 0;

	SCreateSTsk(0, &tskId);
	
    if (ROK != smTst())			/* start SM */
    {
		printf("Start SM FAILED!\n");

		RETVALUE(RFAILED);
    }
	
    if (ROK != hi_init_fun())			/* start TUCL */
    {
		printf("Start TUCL FAILED!\n");

		RETVALUE(RFAILED);
    }
	

    if (ROK != sb_init_own())			/* start SCTP */
    {
		printf("Start SCTP FAILED!\n");

		RETVALUE(RFAILED);
    }
	

    if (ROK != itTst())			/* start M3UA */
    {
		printf("Start M3UA FAILED!\n");

		RETVALUE(RFAILED);
    }
	
	
    if (ROK != sp_init_fun(tskId))			/* start SCCP */
    {
		printf("Start SCCP FAILED!\n");

		RETVALUE(RFAILED);
    }
	
    if (ROK != st_init_fun(tskId))			/* start TCAP */
    {
		printf("Start TCAP FAILED!\n");

		RETVALUE(RFAILED);
    }
	
    if (ROK != MapStart(tskId))		/* start MAP */
    {
		printf("Start MAP FAILED!\n");

		RETVALUE(RFAILED);
    }

    if (ROK != auTst())		/* start AU */
    {
		printf("Start AU FAILED!\n");

		RETVALUE(RFAILED);
    }

	RETVALUE(ROK);
}

VOID AMS_Init(VOID *t, VOID *v)
{
	XS32 rc;
	
	printf("Integrated Running . . . . . .\n");

	rc = SInit();
	if (rc!=ROK)
	{
		printf(" SSI Init Failed!\n");
		RETVOID;
	}    

	RETVOID;
}

PUBLIC S16 cpsSndBndReq()
{
	U32 i;
    CP_SS7_SSN_TAB *ssn;
	Pst pst;
	MaSap       *maSap;    /* IS41 lower SAP */
	StSPSap   *spSapCp;     /* pointer to lower SAP */
	SpNSapCb *nSapCb;
	CP_SS7_OPC_TAB          *opc;
	U16 	reason;
	CmStatus    sta;           /* status */
    ItCfgM3uaPspTab* pspcfg = (ItCfgM3uaPspTab*)NULLP;

	pst.dstEnt 	= ENTMA;
	pst.dstInst = MA_INST_0;
	pst.dstProcId = SFndProcId();

	pst.srcEnt 	= ENTAU;
	pst.srcInst = AU_INST_0;
	pst.srcProcId = SFndProcId();

	pst.selector = AU_SEL_TC;
	
	sbCfgBndtucl();

	Sleep(1000);
	
	printf("\n    ----------- SCTP BIND TUCL DONE ----------- \n\n");

    if (ROK != itLiBndSap(0, &sta, TRUE))
	{
		RETVALUE(RFAILED);
	}
#if 0
	if (ROK != sbLiBindSap(0, NULLP))
	{
		RETVALUE(RFAILED);
	}
#endif

	printf("\n    ----------- M3UA BIND SCTP DONE ----------- \n\n");

    for( i = 0; i < gstCpSs7Global.OPCTabNum; i++)
    {
		opc = &gstCpSs7Global.OPCTab[i];
		
	   if ((nSapCb = *(spCb.nSapList + (PTR)opc->OpcIndex))==NULLP)
	   	{
			RETVALUE(RFAILED);   
	   	}
#if 0	   		
  		if (ROK != 
			SpLiSntBndReq(&nSapCb->pst, nSapCb->suId, nSapCb->spId, nSapCb->nwData->sInfo))
		{
			RETVALUE(RFAILED);
		}
#endif
#if 1
  		if (ROK != spEnableLowerSap(nSapCb, &reason))
		{
			RETVALUE(RFAILED);
		}
#endif		
    }
	
	printf("\n    ----------- SCCP BIND M3UA DONE ----------- \n\n");

	for( i = 0; i < gstCpSs7Global.SSNTabNum; i++)
	{
	    ssn = &gstCpSs7Global.SSNTab[i];
	    if(ssn->SsnUsr != EN_CP_SSNUSR_MAP)
	    {
	    	continue;
	    }
		
#if 0
	    if ((spSapCp = *(stCb.spSapLst + ssn->SsnIndex)) == NULLP)
      	{
			RETVALUE(RFAILED);      		
      	}

		if (ROK != 
			StLiSptBndReq(&spSapCp->pstSP, spSapCp->suId, spSapCp->spId,ssn->Ssn))
		{
			RETVALUE(RFAILED);      		
		}
#else
		if (ROK != stEnableSPSap((SuId)ssn->SsnIndex))
		{
			RETVALUE(RFAILED);      		
		}
#endif

	   if (ssn->SsnIndex >= maCb.maCP.nmbMAUSaps || ssn->SsnIndex < 0 || 
	       ((maSap = *(maCb.maSapLmaPtr + ssn->SsnIndex)) == NULLP))
	   {
	      RETVALUE(RFAILED);
	   }
	   
#if 0
		if (ROK != MaLiStuBndReq(&maSap->maPstST, maSap->sapId, maSap->spIdTC, ssn->Ssn))
		{
			RETVALUE(RFAILED);
		}
#else
		if (ROK != maEnableSpSap(maSap))
		{
			RETVALUE(RFAILED);
		}
#endif		

		if (ROK != AuLiMatBndReq(&pst, (SuId)ssn->SsnIndex, (SpId)ssn->SsnIndex))
		{
			RETVALUE(RFAILED);
		}
	}

	printf("\n    ----------- AU-MAP-TCAP BIND SCCP DONE ----------- \n\n");
#if 0
    for ( i=0; i< 1; i++ )
    {
    	pspcfg = &(itGlobalTabCfg.PspTab[i]);

	    if ( (ItCfgM3uaPspTab*)NULLP == pspcfg )
	    {
			RETVALUE(RFAILED);
	    }

		if (ROK != itAcEst(IT_PSPnENDP2ASSOC(pspcfg->PspID, 0),&sta))
	    {
			RETVALUE(RFAILED);
	    }
    }
#endif	
	RETVALUE(ROK);
	
}

VOID CallBack_Init(VOID *t, VOID *v)
{
	g_LayerCount = 6;
	S32 threadId;
	tb_record * prow = NULLP, *tmProw = NULLP;

	threadId = (S32)GetCurrentThread();

	parseFile();

	for(;;)
	{
		if(TRUE == g_tuclregisterFlag)
		{
			oamTblProc(&prow);
			tmProw = prow;
			hiNmSyncCallback(NMMSG_SYNC, 1, 1, tmProw);
			g_tuclregisterFlag = FALSE;
		}

		if(TRUE == g_sctpregisterFlag)
		{
			tmProw = prow;
			sbNmSyncCallback(NMMSG_SYNC, 1, 1, tmProw);
			g_sctpregisterFlag = FALSE;
		}


		if(TRUE == g_itRegisterFlag)
		{
			tmProw = prow;
			itNmSyncCallback(NMMSG_SYNC, 1, 1, tmProw);
			g_itRegisterFlag = FALSE;
		}

		if(TRUE == g_spRegisterFlag)
		{
			tmProw = prow;
			spNmSyncCallback(NMMSG_SYNC, 1, 1, tmProw);
			g_spRegisterFlag = FALSE;
		}
		
		if(TRUE == g_stRegisterFlag)
		{
			tmProw = prow;
			stNmSyncCallback(NMMSG_SYNC, 1, 1, tmProw);
			g_stRegisterFlag = FALSE;
		}
		
		if(TRUE == g_maRegisterFlag)
		{
			tmProw = prow;
			maNmSyncCallback(NMMSG_SYNC, 1, 1, tmProw);
			g_maRegisterFlag = FALSE;
		}

		if (g_LayerCount == getCfgNum())
		{
			printf("Call back finished!\n");
			break;
		}
		else
		{
			Sleep(500);
			continue;
		}
	}

	freeOamTblRow(prow);
	tmProw = NULLP;

	cpsSndBndReq();
	RETVOID;

}

#ifdef __cplusplus
}
#endif


⌨️ 快捷键说明

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