Ejemplo n.º 1
0
Int32 System_ipcListMPCreate(UInt32 regionId, UInt32 linkId, ListMP_Handle *pOutHndl, ListMP_Handle *pInHndl,
                             GateMP_Handle * pOutHndleGate, GateMP_Handle * pInHndleGate)
{
    Int32 status;
    char  listMPOutName[64];
    char  listMPInName[64];
    ListMP_Params listMPParams;
    GateMP_Params gateMPParams;

    status = System_ipcGetListMPName(linkId, listMPOutName, listMPInName);
    UTILS_assert(status==OSA_SOK);

    GateMP_Params_init(&gateMPParams);
    gateMPParams.regionId = regionId;
    gateMPParams.remoteProtect = GateMP_RemoteProtect_CUSTOM1;
    *pOutHndleGate = GateMP_create(&gateMPParams);
    UTILS_assert(*pOutHndleGate!=NULL);

    ListMP_Params_init(&listMPParams);

    listMPParams.name = listMPOutName;
    listMPParams.regionId = regionId;
    listMPParams.gate     = *pOutHndleGate;

    printf(" %u: SYSTEM: Creating ListMP [%s] in region %d ...\n",
        OSA_getCurTimeInMsec(),
        listMPParams.name,
        listMPParams.regionId
        );

    *pOutHndl = ListMP_create(&listMPParams);

    UTILS_assert(*pOutHndl!=NULL);

    GateMP_Params_init(&gateMPParams);
    gateMPParams.regionId = regionId;
    gateMPParams.remoteProtect = GateMP_RemoteProtect_CUSTOM1;
    *pInHndleGate = GateMP_create(&gateMPParams);
    UTILS_assert(*pInHndleGate!=NULL);

    ListMP_Params_init(&listMPParams);

    listMPParams.name = listMPInName;
    listMPParams.regionId = regionId;
    listMPParams.gate     = *pInHndleGate;

    printf(" %u: SYSTEM: Creating ListMP [%s] in region %d ...\n",
        OSA_getCurTimeInMsec(),
        listMPParams.name,
        listMPParams.regionId
        );

    *pInHndl = ListMP_create(&listMPParams);

    UTILS_assert(*pInHndl!=NULL);

    return status;
}
Ejemplo n.º 2
0
/*
 *  ======== Server_create ========
 */
Int Server_create()
{
    Int                 status = 0;
    MessageQ_Params     msgqParams;
    GateMP_Params       gateParams;

    /* enable some log events */
    Diags_setMask(MODULE_NAME"+EXF");

    /* create GateMP */
    GateMP_Params_init(&gateParams);

    gateParams.name             = GATEMP_SLAVE_NAME;
    gateParams.localProtect     = GateMP_LocalProtect_PROCESS;
    gateParams.remoteProtect    = GateMP_RemoteProtect_SYSTEM;

    Module.slaveGateMPHandle = GateMP_create (&gateParams);

    if (Module.slaveGateMPHandle == NULL) {
        status = GATEMPAPP_E_FAILURE;
        Log_print0(Diags_INFO, "Server_create: Failed to create GateMP");
        goto leave;
    }

    /* create local message queue (inbound messages) */
    MessageQ_Params_init(&msgqParams);
    Module.slaveQue = MessageQ_create(GateMPApp_SlaveMsgQueName, &msgqParams);

    if (Module.slaveQue == NULL) {
        status = -1;
        Log_print0(Diags_INFO, "Server_create: Failed to create MessageQ");
        GateMP_delete(&Module.slaveGateMPHandle);
        goto leave;
    }

    Log_print0(Diags_INFO,"Server_create: Slave is ready");

leave:
    Log_print1(Diags_EXIT, "<-- Server_create: %d", (IArg)status);
    return (status);
}