Beispiel #1
0
bool A5CpuInit(int max_rounds, int condition, int threads)
{
    LoadDLL();
    if (isDllLoaded) {
        return fInit(max_rounds, condition, threads);
    } else {
        return false;
    }
}
Beispiel #2
0
bool A5IlInit(int max_rounds, int condition, uint32_t mask)
{
    LoadDLL();
    if (isDllLoaded) {
        return fInit(max_rounds, condition, mask);
    } else {
        return false;
    }
}
Beispiel #3
0
/*==========================================================================*/
int main(int argc, char** argv)
/*----------------------------------------------------------------------------
  Description: main
  ==========================================================================*/
{
  fInit();

  for(;;)
  {
    
  }
  return (EXIT_SUCCESS);
}
Beispiel #4
0
int main(int argc, char* argv[])
{
	::CoInitialize(NULL);				// 结合SQL SERVER2000使用

	int rtn;
	char msg[256] = "";
	char *result = NULL;

	g_pSvrLink = BUPubInitialize(g_XBDefines,CallBDFunc,WriteAppInfo,&g_LogFile);
	SetLogShowLevel(0);
	if (argc<2)
		ReadIni("ksbu.ini");
	else
		ReadIni(argv[1]);

	ResetBPFunctions();
	if (argc>2)
	{
		ListBPFunctions(argv[2]);
	}

	if (g_ini_para.dynamic_load_flag)
	{
		// 加载对接第三方动态库
		if (rtn = g_LoadDll.LoadDataInfo(g_ini_para.third_part_dll_name, THIRD_RG_DLL))
		{
			sprintf(msg, "加载%s失败--错误码:[%d]", g_ini_para.third_part_dll_name, rtn);
			g_LogFile.WriteLogEx(1002, msg);
			return rtn;
		}
	}
	
	// 加载desdll库
	if (g_ini_para.des_flag)
	{
		if (rtn = g_desdll.LoadDataInfo(g_ini_para.des_dll_name, DESDLL))
		{
			sprintf(msg, "加载%s失败--错误码:[%d]", g_ini_para.des_dll_name, rtn);
			g_LogFile.WriteLogEx(1002, msg);
			return rtn;
		}

//		encrypt_work_key_asc(g_ini_para.pwd, g_ini_para.encrypt_pwd);
		decrypt_work_key_asc(g_ini_para.encrypt_pwd, g_ini_para.pwd);
	}
	
	if (g_ini_para.debug_log)
	{
		g_LogFile.WriteLogEx(1003, "用户名[%s]--原始密码[%s]--加密密码[%s]--IP地址[%s]--端口号[%d]", g_ini_para.user_id, g_ini_para.pwd, g_ini_para.encrypt_pwd,g_ini_para.ip, g_ini_para.port);
		sprintf(msg, "加载%s成功", g_ini_para.third_part_dll_name);
		g_LogFile.WriteLogEx(1002, msg);
	}

	if (g_ini_para.sysjones_func) 
	{
		result = fInit();
		if (strncmp(result, RG_SUCC, RG_FLAG_LEN))
		{
			sprintf(msg, "初始化第三方数据库失败--错误码:[%d]", rtn);
			g_LogFile.WriteLogEx(1002, msg);
			return rtn;
		}
		g_LogFile.WriteLogEx(1002, "初始化第三方数据库成功");
	}

	// 初始化与BCC连接:
	do 
	{
		rtn = g_pSvrLink->ToLink(&g_BUnit);
		if (rtn==1)
		{
			DEBUG_RUNTIME_MSGOUT("与业务调度中心(BCC)的连接成功!\n");
			break;
		}
		else if (rtn==-100)
		{
			DEBUG_RUNTIME_MSGOUT("估计业务调度中心(BCC)尚未正式启动,或者检查配置中的[SERVER]项参数\n");
			mysleep(g_BUnit.iHBInterval);
		}
		else
		{
			// 应该属于故障,或对方并不是BCC
			return(rtn);
		}
	} while (1);
#ifdef WIN32
	setnoblockgetch();
#endif

	while (g_pSvrLink->LinkOK())
	{
#ifdef WIN32
		switch (mygetch())
		{
		case '?':
		case 'h':
		case 'H':
			printf("\nCommand List:\n");
			printf("\t ? or h: display this Help informations!\n");
			printf("\t x: To eXit this business unit.\n");
			printf("\t d: Display functions status.\n");
			printf("\t l: List functions status into <function.lst>.\n");
			printf("Enter command to select:");
			break;
		case 'x':
		case 'X':
			g_pSvrLink->bExit = true;
			continue;
			break;
		case 'd':
		case 'D':
			ListBPFunctions(NULL);
			break;
		case 'l':
		case 'L':
			ListBPFunctions("function.lst");
			break;
		}
#endif
		g_pSvrLink->Processing(&g_BUnit);
		if (g_pSvrLink->bExit) break;
	}

	g_pSvrLink->Close();
	DEBUG_RUNTIME_MSGOUT("业务处理单元BU系统正常退出!\n");
	g_LogFile.Close();

	if (g_ini_para.dynamic_load_flag)
	{
		g_LoadDll.UnLoadAllDll();
		g_desdll.UnLoadAllDll();
	}
	
	::CoUninitialize();
	return(0);
}