コード例 #1
0
int main(int argc, char *argv[])
{
    ClRcT   rc = CL_OK;
    if (argc < 2){
        clLog (EMER,GEN,NA, "usage : %s", GMS_USAGE);
        exit(0);
    }

    /* Connect to the SAF cluster */
    rc = initializeAmf();
    if( rc != CL_OK)
    {
        clLogCritical(GEN,NA,
                      "GMS: gmsInitialize failed [0x%X]\n\r", rc);
        return rc;
    }
    _clGmsServiceInitialize ( argc , argv );

    
    /* Block on AMF dispatch file descriptor for callbacks.
       When this function returns its time to quit. */
    dispatchLoop();
    
    saAmfFinalize(amfHandle); 

    return 0;
}
int main(int argc, char *argv[])
{
    SaAisErrorT rc = SA_AIS_OK;

    /* Connect to the SAF cluster */
    initializeAmf();

    /* Do the application specific initialization here. */
    /* Set up console redirection for demo purposes */
    (void)ev_init(argc, argv, (ClCharT*)appName.value);

    /* Block on AMF dispatch file descriptor for callbacks.
       When this function returns its time to quit. */
    dispatchLoop();
    
    /* Do the application specific finalization here. */

    /* Now finalize my connection with the SAF cluster */
    if((rc = saAmfFinalize(amfHandle)) != SA_AIS_OK)
      clprintf (CL_LOG_SEV_ERROR, "AMF finalization error[0x%X]", rc);
    else
      clprintf (CL_LOG_SEV_INFO, "AMF Finalized");   

    return 0;
}
コード例 #3
0
ClInt32T main(ClInt32T argc, ClCharT *argv[])
{
    SaAisErrorT rc = SA_AIS_OK;

    /* Connect to the SAF cluster */
    rc = initializeAmf();
    
    if( rc != SA_AIS_OK)
    {
      CL_DEBUG_PRINT(CL_DEBUG_CRITICAL,
                       ("CKPT: ckptInitialize failed [0x%X]\n\r", rc));
        return rc;
    }       
	
   
    /* Do the application specific initialization here. */
    
    /* Block on AMF dispatch file descriptor for callbacks.
       When this function returns its time to quit. */
    dispatchLoop();
    
    
    /* Now finalize my connection with the SAF cluster */
    rc = saAmfFinalize(amfHandle);
      

    return 0;
}
コード例 #4
0
int main(int argc, char *argv[])
{
    SaAisErrorT rc = SA_AIS_OK;

    /* Connect to the SAF cluster */
    initializeAmf();

    /* Do the application specific initialization here. */
    
    /* Block on AMF dispatch file descriptor for callbacks.
       When this function returns its time to quit. */
    dispatchLoop();

    checkpoint_finalize();
    
    /* Do the application specific finalization here. */

    /* Now finalize my connection with the SAF cluster */
    if((rc = saAmfFinalize(amfHandle)) != SA_AIS_OK)
      clprintf (CL_LOG_SEV_ERROR, "AMF finalization error[0x%X]", rc);
    else
      clprintf (CL_LOG_SEV_INFO, "AMF Finalized");   

    return 0;
}
int main(int argc, char *argv[])
{
    SaAisErrorT rc = SA_AIS_OK;
    SaSelectionObjectT dispatch_fd;
    fd_set read_fds;
    ClRcT ret = CL_OK;

    /* Connect to the SAF cluster */
    initializeAmf();

    /* Do the application specific initialization here. */
    FD_ZERO(&read_fds);

    if ( (rc = saAmfSelectionObjectGet(amfHandle, &dispatch_fd)) != SA_AIS_OK)
        errorExit(rc);
    
    FD_SET(dispatch_fd, &read_fds);
    
    /* Handle the AMF dispatch loop by spawning a thread that does it */
    ret = clOsalTaskCreateDetached("DISPATCH-THREAD", CL_OSAL_SCHED_OTHER, 0, 0, saAmfDispatchThread, NULL);
    if(ret != CL_OK)
    {
        clprintf(CL_LOG_SEV_ERROR, "Dispatch task create failed with rc 0x%x",rc);
        return ret;
    } 
    while (!unblockNow)
    {
        /* csa112: If I am active then I'll publish an event.
           Note, any application can publish and event regardless of
           HA state.  This tutorial simply uses HA state so only
           one of the two processes are publishing.
        */
        
        if (running && ha_state == SA_AMF_HA_ACTIVE)
        {
            csa113Comp_PublishEvent();
        }
    
        sleep(1);  /* Keep the event publish rate reasonable for this tutorial*/
    }
    
    /* Do the application specific finalization here. */
    if ((rc = saEvtChannelClose(evtChannelHandle)) != SA_AIS_OK)
    {
        clprintf(CL_LOG_SEV_ERROR, "Failed [0x%x] to close event channel", rc);
    }

    if ((rc = saEvtFinalize(evtLibHandle)) != SA_AIS_OK)
    {
        clprintf(CL_LOG_SEV_ERROR, "Failed [0x%x] to finalize event library", rc);
    }

    /* Now finalize my connection with the SAF cluster */
    if((rc = saAmfFinalize(amfHandle)) != SA_AIS_OK)
      clprintf (CL_LOG_SEV_ERROR, "AMF finalization error[0x%X]", rc);
    else
      clprintf (CL_LOG_SEV_INFO, "AMF Finalized");   

    return 0;
}
コード例 #6
0
ClInt32T main(ClInt32T argc, ClCharT *argv[])
{
    SaAisErrorT rc = SA_AIS_OK;

    /* Connect to the SAF cluster */
    rc = initializeAmf();
    if( rc != SA_AIS_OK)
    {
       clLogCritical(CL_LOG_AREA_UNSPECIFIED, CL_LOG_CONTEXT_UNSPECIFIED,
                     "CKPT: ckptInitialize failed [0x%X]\n\r", rc);
        return rc;
    }       
        
    /* Block on AMF dispatch file descriptor for callbacks.
       When this function returns its time to quit. */
    dispatchLoop();
        
    /* Now finalize my connection with the SAF cluster */
    rc = saAmfFinalize(amfHandle);
   
    return 0;
}
コード例 #7
0
ClInt32T main(ClInt32T argc, ClCharT *argv[])
{
    ClRcT rc = CL_OK;

    /* Connect to the SAF cluster */

    rc = initializeAmf();
    if(rc != CL_OK)
    {
       CL_DEBUG_PRINT(CL_DEBUG_CRITICAL,
                       ("MSG: msgInitialize failed [0x%X]\n\r", rc));
       return rc;
    }

    /* Block on AMF dispatch file descriptor for callbacks.
       When this function returns its time to quit. */
    dispatchLoop();

    /* Now finalize my connection with the SAF cluster */

   saAmfFinalize(amfHandle);

   return 0;
}
コード例 #8
0
/*
 * 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;
}