Esempio n. 1
0
CMPIStatus
TestCMPIIndicationProviderActivateFilter (CMPIIndicationMI * mi,
                                          CMPIContext * ctx,
                                          CMPIResult * rslt,
                                          CMPISelectExp * se,
                                          const char *ns,
                                          CMPIObjectPath * op,
                                          CMPIBoolean firstActivation)
#endif
{
  CMPIContext *context;
  //void  **arguments[4];

  const void **arguments = (const void **) malloc (4 * sizeof (char *));
  CMPIStatus rc_Clone = { CMPI_RC_OK, NULL };

  PROV_LOG_OPEN (_IndClassName, _ProviderLocation);
  PROV_LOG ("--- %s CMPI ActivateFilter() called", _IndClassName);

  // Get a new CMPI_Context which the thread will use.
  context = CBPrepareAttachThread (_broker, ctx);

  // We have to pass in the parameters some way. We are passing the
  // addresses of them  via the void pointer to the thread. 
  // This could also be achieved via passing it thread-specific data.
  arguments[0] = se; 
  arguments[1] = context; 
  arguments[2] = _broker; 
  arguments[3] = strdup(ns);
  // Spawn of a new thread!
  _broker->xft->newThread (thread, (void *)arguments, 0);

  PROV_LOG ("--- %s CMPI ActivateFilter() exited", _IndClassName);
  CMReturn (CMPI_RC_OK);
}
Esempio n. 2
0
/*!
  The function prepares a context for the MB listen thread and launches it.
 */
static void __launch_proxy_daemon()
{
    CMPIContext *ctx = CBPrepareAttachThread(__init_broker, __init_context);
    if (!(__init_context && __init_broker))
    {
        CMRelease(ctx);
        ctx = NULL;
    }
    CMPI_BrokerExt_Ftab->newThread((void*(*)(void*))__start_proxy_daemon,ctx,1);
}
Esempio n. 3
0
static void TCPCOMM_prepareAttachThread(int socket, CONST CMPIBroker * broker,
                                        CONST CMPIContext * context)
{
    CMPIContext *ctx;
    unsigned long int ctx_id;
    ctx = CBPrepareAttachThread(broker, context);
    ctx_id = save_context(ctx);
    CMAddContextEntry(ctx, RCMPI_CTX_ID, &ctx_id, CMPI_uint32);
    socketcomm_serialize_context(socket, (__sft), ctx);
}
Esempio n. 4
0
/*!
  The function evaluates the up-call context id to set up
  the basic entities broker and context, before actually
  spawning a separate thread to handle the request.

  \param socket the connection socket.
  \param broker the broker to forward the request to.

  \sa __dispatch_MB_function
  \sa __verify_MB_call
 */
static void __handle_MB_call(int socket, CONST CMPIBroker * broker)
{
    CONST CMPIContext *ctx;

    struct accept_thread *athread = (struct accept_thread *)
                                    malloc(sizeof(struct accept_thread));

    TRACE_VERBOSE(("entered function."));
    TRACE_NORMAL(("handling incoming broker service request."));

    ctx = get_context(__sft->deserialize_UINT32(socket));

    athread->socket = socket;
    athread->broker = broker;
    athread->context = CBPrepareAttachThread(broker, ctx);

    CMPI_BrokerExt_Ftab->newThread((void*(*)(void*))__dispatch_MB_function,athread,1);

    TRACE_VERBOSE(("leaving function."));
}