ClRcT clLogClientInstall(void) { ClEoExecutionObjT* pEoObj = NULL; ClRcT rc = CL_OK; rc = clEoMyEoObjectGet(&pEoObj); if (CL_OK != rc) { return rc; } rc = clEoClientInstallTables(pEoObj,CL_EO_SERVER_SYM_MOD(gAspFuncTable,Log)); if (CL_OK != rc) { return rc; } rc = clOsalTaskKeyCreate(&LogidlSyncKey,NULL); if (CL_OK != rc) { return rc; } rc = clHandleDatabaseCreate(NULL,&LogidlDatabaseHdl); return rc; }
ClRcT clAmsTriggerRmdInitialize(void) { ClRcT rc = CL_OK; rc = clEoClientInstallTables(gAms.eoObject, CL_EO_SERVER_SYM_MOD(gAspFuncTable, AMFTrigger)); if(rc != CL_OK) { clLogError("TRIGGER", "RMD", "EO client install returned [%#x]", rc); goto out; } out: return rc; }
ClRcT clEventClientInstallTables(ClEoExecutionObjT *pEoObj) { return clEoClientInstallTables(pEoObj, CL_EO_SERVER_SYM_MOD(gAspCltFuncTable, EVT)); }
ClRcT initializeAmf(void) { SaAmfCallbacksT callbacks; SaVersionT version; ClRcT rc = CL_OK; clLogCompName = (ClCharT*)"GMS"; /* Override generated eo name with a short name for our server */ /* this function overrides the default EO configuration */ clAppConfigure(&clEoConfig,clEoBasicLibs,clEoClientLibs); /* Do the CPM client init/Register */ version.releaseCode = 'B'; version.majorVersion = 0x01; version.minorVersion = 0x01; callbacks.saAmfHealthcheckCallback = NULL; callbacks.saAmfComponentTerminateCallback = clGmsServerTerminate; callbacks.saAmfCSISetCallback = NULL; callbacks.saAmfCSIRemoveCallback = NULL; callbacks.saAmfProtectionGroupTrackCallback = NULL; gmsGlobalInfo.opState = CL_GMS_STATE_STARTING_UP; clLog(INFO,GEN,NA, CL_GMS_SERVER_STARTED); /* Initialize AMF client library. */ rc = saAmfInitialize(&amfHandle, &callbacks, &version); if(rc!= SA_AIS_OK) { clLog(EMER,GEN,NA, "Sa AMF initialization Failed with rc [0x%x]. Booting Aborted",rc); exit(0); } gmsGlobalInfo.cpmHandle=amfHandle; /* * Now register the component with AMF. At this point it is * ready to provide service, i.e. take work assignments. */ rc = saAmfComponentNameGet(amfHandle, &appName); if(rc != SA_AIS_OK) { clLog(EMER,GEN,NA, "saAmfomponentNameGet Failed with rc [0x%x]. Booting Aborted",rc); exit(0); } gmsGlobalInfo.gmsComponentName.length=appName.length; memcpy(gmsGlobalInfo.gmsComponentName.value,appName.value,appName.length); rc = clEoMyEoObjectGet(&gmsGlobalInfo.gmsEoObject); if (rc != CL_OK) { clLog(EMER,GEN,NA, "clEoMyEoObjectGet Failed with rc [0x%x]. Booting Aborted",rc); exit(0); } rc = clDebugPromptSet(GMS_COMMAND_PROMPT); if( CL_OK == rc ) { clLog(NOTICE,GEN,NA, "GMS Server registering with debug service"); rc = clDebugRegister( gmsCliCommandsList, (int)(sizeof(gmsCliCommandsList)/sizeof(ClDebugFuncEntryT)), &gGmsDebugReg); } if( rc != CL_OK ) { clLog(ERROR,GEN,NA, "Failed to register with debug server, error [0x%x]. Debug shell access disabled", rc); } rc = clEoClientInstallTables ( gmsGlobalInfo.gmsEoObject, CL_EO_SERVER_SYM_MOD(gAspFuncTable, GMS)); if ( rc != CL_OK ) { clLog (EMER,GEN,NA, "Eo client install failed with rc [0x%x]. Booting aborted",rc); exit(0); } /* This function never returns the exit is done by causing a signal from * the Terminate function */ return CL_OK; }
/** * This is the agent initilaization API called during EO initialization. * * Agent acts as intermediate layer during an active transaction. It receives * job-definition and commands from transaction manager and takes specific * action. */ ClRcT clTxnAgentInitialize(CL_IN ClEoExecutionObjT *appEoObj, CL_IN ClVersionT *pTxnVersion) { ClRcT rc = CL_OK; CL_FUNC_ENTER(); if ( (NULL == appEoObj) || (NULL == pTxnVersion) ) { CL_FUNC_EXIT(); return CL_TXN_RC(CL_ERR_NULL_POINTER); } /* Do version negotiation (later part of RC-1 or RC-2) */ if (clTxnVersionVerify(pTxnVersion) != CL_OK) { CL_FUNC_EXIT(); return (CL_TXN_RC(CL_ERR_VERSION_MISMATCH)); } clTxnAgntCfg = (ClTxnAgentCfgT *) clHeapAllocate( sizeof(ClTxnAgentCfgT)); CL_TXN_NULL_CHECK_RETURN(clTxnAgntCfg, CL_ERR_NO_MEMORY, ("Failed to allocate memory\n")); memset(clTxnAgntCfg, 0, sizeof(ClTxnAgentCfgT)); /* If possible, instead of statically registring RMD functions, txn-agent could register EO client table here. */ /* Create hash-maps for active-txn component-services */ rc = clTxnDbInit( &(clTxnAgntCfg->activeTxnMap) ); CL_TXN_ERR_RET_ON_ERROR(rc, ("Failed to allocate hash-map for active-txn rc:0x%x\n", rc)); rc = clCntThreadSafeHashtblCreate(CL_TXN_NUM_BUCKETS, _clTxnCmpServiceKeyCompare, _clTxnCmpServiceHashFn, _clTxnCompServiceDelete, _clTxnCompServiceDelete, CL_CNT_UNIQUE_KEY, (ClCntHandleT *) &clTxnAgntCfg->compServiceMap); CL_TXN_ERR_RET_ON_ERROR(rc, ("Failed to allocate hash-map for comp-service rc:0x%x\n", rc)); clTxnMutexCreateAndLock(&clTxnAgntCfg->actMtx); /* No registered service */ clTxnAgntCfg->agentCapability = CL_TXN_AGENT_NO_SERVICE_REGD; clTxnMutexUnlock(clTxnAgntCfg->actMtx); clLogInfo("AGT", NULL, "Installing function table"); rc = clEoClientInstallTables(appEoObj, CL_EO_SERVER_SYM_MOD(gAspFuncTable, TXNAgent)); if (CL_OK == rc) { rc = clTxnCommIfcInit(&(clTxnMgmtVersionSupported[0])); if(CL_OK != rc) { clLogError("AGT", NULL, "Error in initiazing communication interface, rc [0x%x]", rc); clEoClientUninstallTables(appEoObj, CL_EO_SERVER_SYM_MOD(gAspFuncTable, TXNAgent)); return rc; } } if(CL_OK == rc) { rc = clTxnAgentTableRegister(appEoObj); if(CL_OK != rc) { clLogError("AGT", NULL, "Error in table registration, rc [0x%x]", rc); clEoClientUninstallTables(appEoObj, CL_EO_SERVER_SYM_MOD(gAspFuncTable, TXNAgent)); } } CL_FUNC_EXIT(); return (rc); }
/* * This function will do following steps * 1. Create DB for ECH/G * 2. Create DB for ECH/L * 3. Create mutex to protect ECH/G DB * 4. Create mutex to protect ECH/L DB * 5. Register with CPM for component failure notification. * 6. Intialize the global variable to indicate EM is done. */ ClRcT clEvtInitialize(ClInt32T argc, ClCharT *argv[]) { ClRcT rc = CL_OK; rc = initializeAmf(); if (rc != CL_OK) { CL_DEBUG_PRINT(CL_DEBUG_CRITICAL, ("Event: Amf Initialization failed [0x%X]\n\r", rc)); CL_FUNC_EXIT(); return rc; } CL_FUNC_ENTER(); rc = clEvtChannelDBInit(); rc = clEoMyEoObjectGet(&gEvtHead.evtEOId); rc = clEoClientInstallTables(gEvtHead.evtEOId, CL_EO_SERVER_SYM_MOD(gAspFuncTable, EVT)); if (rc != CL_OK) { CL_DEBUG_PRINT(CL_DEBUG_CRITICAL, ("Event: Installing Native table failed [0x%X]\n\r", rc)); clLogWrite(CL_LOG_HANDLE_APP, CL_LOG_CRITICAL, NULL, CL_LOG_MESSAGE_1_FUNC_TABLE_INSTALL_FAILED, rc); clCntDelete(gEvtMasterECHHandle); clEvtChannelDBClean(); CL_FUNC_EXIT(); return rc; } rc = clEventLibTableInit(); if(rc != CL_OK) { CL_DEBUG_PRINT(CL_DEBUG_CRITICAL, ("Event: Installing Native Server to Server table failed [0x%X]\n\r", rc)); clLogWrite(CL_LOG_HANDLE_APP, CL_LOG_CRITICAL, NULL, CL_LOG_MESSAGE_1_FUNC_TABLE_INSTALL_FAILED, rc); clCntDelete(gEvtMasterECHHandle); clEvtChannelDBClean(); CL_FUNC_EXIT(); return rc; } rc = clEventDebugRegister(gEvtHead.evtEOId); if (rc != CL_OK) { CL_DEBUG_PRINT(CL_DEBUG_CRITICAL, ("Event: Debug Register failed [0x%X]\n\r", rc)); clLogWrite(CL_LOG_HANDLE_APP, CL_LOG_CRITICAL, NULL, CL_LOG_MESSAGE_1_DBG_REGISTER_FAILED, rc); CL_FUNC_EXIT(); return rc; } /* ** Initialize the Handle Database. */ rc = clEvtHandleDatabaseInit(); if (rc != CL_OK) { CL_DEBUG_PRINT(CL_DEBUG_CRITICAL, ("Event: Handle Database Init failed [0x%X]\n\r", rc)); CL_FUNC_EXIT(); return rc; } #ifdef CKPT_ENABLED /* ** Initialize the Check Pointing Library. */ rc = clEvtCkptInit(); if (rc != CL_OK) { CL_DEBUG_PRINT(CL_DEBUG_CRITICAL, ("Event: CKPT Init failed [0x%X]\n\r", rc)); clLogWrite(CL_LOG_HANDLE_APP, CL_LOG_CRITICAL, NULL, CL_LOG_MESSAGE_2_LIBRARY_INIT_FAILED, "Checkpoint Library", rc); CL_FUNC_EXIT(); return rc; } #endif gEvtInitDone = CL_EVT_TRUE; /* * CPM should be notified that Event Service is ready only after the * the initialization is complete. This _MUST_ be the last step. */ CL_FUNC_EXIT(); return CL_OK; }