Ejemplo n.º 1
0
jint 
shmemBase_listen(const char *address, SharedMemoryTransport **transportPtr)
{
    int error;

    error = createTransport(address, transportPtr);
    if (error == SYS_OK) {
        (*transportPtr)->shared->isListening = JNI_TRUE;
    }
    return error;
}
Ejemplo n.º 2
0
mama_status
mamaCaptureList_parseCommandInput (mamaCaptureConfig subCapture,
                                   mamaCaptureList captureList,
                                   char* commandArg)
{
    mamaCaptureSourceList* sourceList =
        (mamaCaptureSourceList*)captureList;
    mamaCapture * capture = (mamaCapture*)subCapture;

    char* source        = NULL;
    char* transportName = NULL;
    char* symbolFile    = NULL;
    int   transportCreated  = 0;

    FILE* fp = NULL;
    char charbuf[1024];

    if (capture == NULL) return MAMA_STATUS_NULL_ARG;

    if (sourceList == NULL)
    {
        mama_log (MAMA_LOG_LEVEL_NORMAL,
                  "parseCommandInput : NullPointer " \
                  "Exception ");
        return MAMA_STATUS_NULL_ARG;
    }

    source        = strtok (commandArg, ":");
    transportName = strtok (NULL, ":");
    symbolFile    = strtok (NULL, " ");

    if (symbolFile != NULL)
    {
        if ((fp = fopen (symbolFile, "r")) == (FILE *)NULL)
        {
            perror (symbolFile);
            exit (1);
        }
    }

    while (fgets (charbuf, 1023, fp))
    {
        char *c = charbuf;
        while ((*c != '\0') && (*c != '\n'))
            c++;
        *c = '\0';
        sourceList[gCounter].mySymbolNamespace = strdup (source);
        sourceList[gCounter].myTransportName   = strdup (transportName);
        sourceList[gCounter].mySymbol          = strdup (charbuf);

        mamaSource_create (&sourceList[gCounter].mySource);
        mamaSource_setId (sourceList[gCounter].mySource,
                          sourceList[gCounter].mySymbolNamespace);
        mamaSource_setSymbolNamespace (sourceList[gCounter].mySource,
                                       sourceList[gCounter].mySymbolNamespace);
        if (transportCreated == 0)
        {
            createTransport(capture,&sourceList[gCounter].myTransport,
                            sourceList[gCounter].myTransportName);
            transportCreated = 1;
        }
        else
        {
            sourceList[gCounter].myTransport=
                sourceList[gCounter-1].myTransport;
        }
        mamaSource_setTransport (sourceList[gCounter].mySource,
                                 sourceList[gCounter].myTransport);
        gCounter++;
    }
    fclose (fp);
    fp = NULL;

    return MAMA_STATUS_OK;
}