Ejemplo n.º 1
0
    virtual FILE* openFile(
        const char* path,
        int mode)
    {
        FILE* fhandle = NULL;
        switch (mode)
        {
            case 'r':
                fhandle = fopen(path, "r");
                break;

            case 'w':
                fhandle = fopen(path, "w");
                break;

            case 'a':
                fhandle = fopen(path, "a+");
                break;

            default:
                PEGASUS_ASSERT(fhandle);
                break;
        }

        if(!fhandle)
        {
            PEG_TRACE((TRC_SERVER, Tracer::LEVEL1,
                "Open of file %s in mode %c failed: %s",path,mode,
                (const char*) PEGASUS_SYSTEM_ERRORMSG.getCString()));
        }
        return fhandle;
    }
Ejemplo n.º 2
0
Thread::Thread(
    PEGASUS_THREAD_RETURN (PEGASUS_THREAD_CDECL *start)(void *),
    void *parameter,
    Boolean detached)
    : _is_detached(detached),
      _cancel_enabled(true),
      _cancelled(false),
      _suspend_count(),
      _start(start),
      _cleanup(true),
      _tsd(true),
      _thread_parm(parameter),
      _exit_code(0)
{
    pthread_attr_init(&_handle.thatt);

#if defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC)
    size_t stacksize;
    if (pthread_attr_getstacksize(&_handle.thatt, &stacksize) == 0)
    {
       int rc = pthread_attr_setstacksize(&_handle.thatt, stacksize*2);
       PEGASUS_ASSERT(rc == 0);
    }
#endif

    _handle.thid = 0;
}
Ejemplo n.º 3
0
void test15()
{
    VCOUT << "Test assignment CIMName=(char*) ASCII with invalid UTF-8. "
                 "Error in sequence bytes starts at byte index 3...";
    try
    {
        CIMName tempCIMName = utf8BrokenSequenceByte;
    }
    catch(Exception& e)
    {
        String message=e.getMessage();
        String expectedErrorMessage("The byte sequence starting at index 3 "
                                        "is not valid UTF-8 encoding.");
        // check if this is the expected exception
        if (String::equalNoCase(message, expectedErrorMessage))
        {
            VCOUT << " +++++ passed" << endl;
            return;
        }
        else 
        {
            throw;
        }
    }
    PEGASUS_ASSERT(false);
}
Ejemplo n.º 4
0
Boolean MessageQueueService::SendAsync(
    AsyncOpNode *op,
    Uint32 destination,
    void (*callback)(AsyncOpNode *, MessageQueue *, void *),
    MessageQueue *callback_response_q,
    void *callback_ptr)
{
   PEGASUS_ASSERT(op != 0 && callback != 0);

   // get the queue handle for the destination

   op->lock();
   op->_op_dest = MessageQueue::lookup(destination); // destination of this message
   op->_flags |= ASYNC_OPFLAGS_CALLBACK;
   op->_flags &= ~(ASYNC_OPFLAGS_FIRE_AND_FORGET);
   // initialize the callback data
   op->_async_callback = callback;   // callback function to be executed by recpt. of response
   op->_callback_node = op;          // the op node
   op->_callback_response_q = callback_response_q;  // the queue that will receive the response
   op->_callback_ptr = callback_ptr;   // user data for callback
   op->_callback_request_q = this;     // I am the originator of this request

   op->unlock();
   if (op->_op_dest == 0)
      return false;

   return  _meta_dispatcher->route_async(op);
}
inline static Boolean _Compare(const T& x, const T& y, WQLOperation op)
{
    switch (op)
    {
        case WQL_EQ:
            return x == y;

        case WQL_NE:
            return x != y;

        case WQL_LT:
            return x < y;
        case WQL_LE:
            return x <= y;

        case WQL_GT:
            return x > y;

        case WQL_GE:
            return x >= y;

        default:
            PEGASUS_ASSERT(0);
    }

    return false;
}
Ejemplo n.º 6
0
void setPropertyValue(CIMInstance& instance, const CIMName& propertyName,
    const Uint32 value)
{
    Uint32 pos;
    PEGASUS_ASSERT(pos = instance.findProperty(propertyName) != PEG_NOT_FOUND);
    instance.getProperty(pos).setValue(CIMValue(value));
}
//
// Test with invalid userPass
//
void testAuthenticationFailure_1()
{
    String authHeader = String::EMPTY;
    Boolean authenticated;

    LocalAuthenticationHandler  localAuthHandler;

    //
    // Test with invalid auth header
    //
    authHeader = testUser;
    authHeader.append(filePath);
    authHeader.append(challenge);

    authenticated = localAuthHandler.authenticate(authHeader, authInfo);

    if (verbose) cout << "authHeader: " << authHeader << endl;

    if (authenticated)
        if (verbose) cout << "User " + testUser + " authenticated successfully." << endl;
    else
        if (verbose) cout << "User " + testUser + " authentication failed.." << endl;

    PEGASUS_ASSERT(!authenticated);
}
Ejemplo n.º 8
0
// Need a static method to act as a callback for the control provider.
// This doesn't belong here, but I don't have a better place to put it.
static Message* controlProviderReceiveMessageCallback(
    Message* message,
    void* instance)
{
    CIMRequestMessage* request = dynamic_cast<CIMRequestMessage*>(message);
    PEGASUS_ASSERT(request != 0);

    Thread::setLanguages(
        ((AcceptLanguageListContainer) request->operationContext.get(
            AcceptLanguageListContainer::NAME)).getLanguages());

    ProviderMessageHandler* pmh =
        reinterpret_cast<ProviderMessageHandler*>(instance);

    MessageType reqType = request->getType();
    if (reqType == CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE)
    {
        pmh->terminate();
        return 0;
    }
    else if (reqType == CIM_SUBSCRIPTION_INIT_COMPLETE_REQUEST_MESSAGE)
    {
        pmh->subscriptionInitComplete();
        return 0;
    }
    else if (reqType == CIM_INDICATION_SERVICE_DISABLED_REQUEST_MESSAGE)
    {
        pmh->indicationServiceDisabled();
        return 0;
    }
    return pmh->processMessage(request);
}
Ejemplo n.º 9
0
void cimom::_handle_cimom_op(AsyncOpNode *op)
{
    Message* msg = op->getRequest();

    // We handle only one message at present.
    PEGASUS_ASSERT( msg->getType() ==  ASYNC_IOCLOSE);
    _global_this->_routed_queue_shutdown = 1;
    _make_response(msg, async_results::OK);
    // All services are shutdown, empty out the queue
    for(;;)
    {
        AsyncOpNode* operation = 0;
        try
        {
            operation = _global_this->_routed_ops.dequeue();
            if (operation)
            {
                _global_this->cache_op(operation);
            }
            else
            {
                break;
            }
        }
        catch (...)
        {
             break;
        }
    }
    // shutdown the AsyncQueue
    _global_this->_routed_ops.close();
    // exit the routing thread.
    _die++;
}
void ProviderIndicationCountTable::insertEntry(
    const CIMInstance& providerInstance)
{
    PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
        "ProviderIndicationCountTable::insertEntry");

    String providerModuleName;
    String providerName;
    getProviderKeys(providerInstance, providerModuleName, providerName);

    String providerKey = _generateKey(providerModuleName, providerName);
    _ProviderIndicationCountTableEntry entry;

    WriteLock lock(_tableLock);

    if (!_table.lookup(providerKey, entry))
    {
        //
        // The entry is not in the table yet; insert a new entry.
        //
        _ProviderIndicationCountTableEntry newEntry;
        newEntry.providerModuleName = providerModuleName;
        newEntry.providerName = providerName;
        newEntry.indicationCount = 0;
        newEntry.orphanIndicationCount = 0;

        Boolean succeeded = _table.insert(providerKey, newEntry);
        PEGASUS_ASSERT(succeeded);
    }

    PEG_METHOD_EXIT();
}
void CIMListenerIndicationDispatcher::handleEnqueue(Message* message)
{
    PEG_METHOD_ENTER(TRC_SERVER,
        "CIMListenerIndicationDispatcher::handleEnqueue");

    if(message!=NULL)
    {
        switch (message->getType())
        {
            case CIM_EXPORT_INDICATION_REQUEST_MESSAGE:
                {
                    CIMExportIndicationRequestMessage* request =
                        (CIMExportIndicationRequestMessage*)message;

                    CIMExportIndicationResponseMessage* response =
                        static_cast<CIMListenerIndicationDispatcherRep*>(_rep)->
                            handleIndicationRequest(request);

                    MessageQueue* queue = MessageQueue::lookup(response->dest);
                    PEGASUS_ASSERT(queue != 0);
                    queue->enqueue(response);
                }
                break;
            default:
                break;
        }
    delete message;
    }

    PEG_METHOD_EXIT();
}
void ProviderIndicationCountTable::removeModuleEntries(
    const String& providerModuleName)
{
    PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
        "ProviderIndicationCountTable::removeModuleEntries");

    {
        WriteLock lock(_tableLock);
        Array<String> keysToRemove;

        // First collect a list of ProviderIndicationCountTable entries for
        // this provider module.
        for (_ProviderIndicationCountTable::Iterator i = _table.start(); i; i++)
        {
            if (i.value().providerModuleName == providerModuleName)
            {
                keysToRemove.append(i.key());
            }
        }

        // Now remove the entries, outside the Iterator scope.
        for (Uint32 i = 0; i < keysToRemove.size(); i++)
        {
            Boolean isRemoved = _table.remove(keysToRemove[i]);
            PEGASUS_ASSERT(isRemoved);
        }
    }

    PEG_METHOD_EXIT();
}
Ejemplo n.º 13
0
void CMPIProvider::terminate()
{
    PEG_METHOD_ENTER(
        TRC_CMPIPROVIDERINTERFACE,
        "CMPIProvider::terminate()");
    if (_status == INITIALIZED)
    {
        try
        {

            _terminate(true);
            PEGASUS_ASSERT(unloadStatus == CMPI_RC_OK);
        }
        catch (...)
        {
            PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL1,
                "Exception caught in CMPIProviderFacade::Terminate for %s",
                (const char*)getName().getCString()));
            throw;
        }
    }

    // Provider's cleanup method called successfully, if there are still any
    // pending operations with provider then we were asked to cleanup forcibly,
    // don't uninitialize provider.
    if (_current_operations.get() == 0)
    {
        _status = UNINITIALIZED;
    }

    PEG_METHOD_EXIT();
}
CIMHandler* IndicationHandlerService::_lookupHandlerForClass(
   const CIMName& className)
{
   PEG_METHOD_ENTER(TRC_IND_HANDLER,
        "IndicationHandlerService::_lookupHandlerForClass()");

   String handlerId;

   if (className.equal(PEGASUS_CLASSNAME_INDHANDLER_CIMXML) ||
       className.equal(PEGASUS_CLASSNAME_LSTNRDST_CIMXML))
   {
       handlerId = String("CIMxmlIndicationHandler");
   }
   else if (className.equal(PEGASUS_CLASSNAME_INDHANDLER_SNMP))
   {
       handlerId = String("snmpIndicationHandler");
   }
   else if (className.equal(PEGASUS_CLASSNAME_LSTNRDST_SYSTEM_LOG))
       handlerId = String("SystemLogListenerDestination");
   else if (className.equal(PEGASUS_CLASSNAME_LSTNRDST_EMAIL))
       handlerId = String("EmailListenerDestination");

   PEGASUS_ASSERT(handlerId.size() != 0);

   CIMHandler* handler = _handlerTable.getHandler(handlerId, _repository);

   PEG_METHOD_EXIT();
   return handler;
}
//
// Test with invalid CIM user or invalid password
//
void testAuthenticationFailure_4()
{
    String authHeader = String::EMPTY;
    Boolean authenticated;

    BasicAuthenticationHandler  basicAuthHandler;

    AuthenticationInfo* authInfo = new AuthenticationInfo(true);

    String userPass = invalidUser;
    userPass.append(":");
    userPass.append(invalidPassword);

    authHeader.append(encodeUserPass(userPass));

    authenticated = basicAuthHandler.authenticate(authHeader, authInfo);

    if (authenticated)
        if (verbose) cout << "User " + testUser + " authenticated successfully." << endl;
    else
        if (verbose) cout << "User " + testUser + " authentication failed." << endl;

    delete authInfo;

    PEGASUS_ASSERT(!authenticated);
}
Ejemplo n.º 16
0
void DefaultProviderManager::_unloadProvider(ProviderMessageHandler* provider)
{
    //
    // NOTE:  It is the caller's responsibility to make sure that the
    // provider->status.getStatusMutex() mutex is locked before calling
    // this method.
    //

    PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
        "DefaultProviderManager::_unloadProvider");

    if (provider->status.numCurrentOperations() > 0)
    {
        PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,
            "Provider cannot be unloaded due to pending operations: %s",
            (const char*)provider->getName().getCString()));
    }
    else
    {
        PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,
            "Terminating Provider %s",
            (const char*)provider->getName().getCString()));

        provider->terminate();

        // unload provider module
        PEGASUS_ASSERT(provider->status.getModule() != 0);
        PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL3,
            "Unloading provider module: %s",
            (const char*)provider->getName().getCString()));
        provider->status.getModule()->unloadModule();

        PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
            "DefaultProviderManager: Unloaded provider %s",
            (const char*)provider->getName().getCString()));

        // NOTE: The "delete provider->status.getCIMOMHandle()" operation
        //   was moved to be called after the unloadModule() call above
        //   as part of a fix for bugzilla 3669. For some providers
        //   run out-of-process on Windows platforms (i.e. running
        //   the cimserver with the forceProviderProcesses config option
        //   set to "true"), deleting the provider's CIMOMHandle before
        //   unloading the provider library caused the unload mechanism
        //   to deadlock, making that provider unavailable and preventing
        //   the cimserver from shutting down. It should NOT be moved back
        //   above the unloadModule() call. See bugzilla 3669 for details.

        // delete the cimom handle
        PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,
            "Destroying provider's CIMOMHandle: %s",
            (const char*)provider->getName().getCString()));
        delete provider->status.getCIMOMHandle();

        // set provider status to uninitialized
        provider->status.setInitialized(false);
    }

    PEG_METHOD_EXIT();
}
Ejemplo n.º 17
0
void WbemExecClient::_reconnect()
{
    PEGASUS_ASSERT(_connected);
    _httpConnector->disconnect(_httpConnection);
    _httpConnection = 0;
    _connected = false;
    _connect();
}
Ejemplo n.º 18
0
PEGASUS_NAMESPACE_BEGIN


const CIMPropertyList FQLQueryExpressionRep::getPropertyList() const
{
   PEGASUS_ASSERT(false);
   return CIMPropertyList();
}
void CIMExportRequestDecoder::handleEnqueue(Message* message)
{
    PEGASUS_ASSERT(message != 0);

    switch (message->getType())
    {
    case HTTP_MESSAGE:
        handleHTTPMessage((HTTPMessage*)message);
        break;

    default:
        PEGASUS_ASSERT(0);
        break;
    }

    delete message;
}
Ejemplo n.º 20
0
/**
Load the config properties from the current and planned files.
*/
void ConfigManager::loadConfigFiles()
{
    PEGASUS_ASSERT(useConfigFiles);

    _configFileHandler.reset(new ConfigFileHandler());

    _loadConfigProperties();
}
int main(int argc, char** argv)
{
    verbose = (getenv ("PEGASUS_TEST_VERBOSE")) ? true : false;
    if (verbose) cout << argv[0] << ": started" << endl;

#if defined(PEGASUS_OS_TYPE_UNIX)

    try
    {
#ifdef DEBUG
        Tracer::setTraceFile("/tmp/trace");
        Tracer::setTraceComponents("all");
	verbose = true;
#endif

        ConfigManager* configManager = ConfigManager::getInstance();

        const char* path = getenv("PEGASUS_HOME");
        String pegHome = path;

        if(pegHome.size())
            ConfigManager::setPegasusHome(pegHome);

        if (verbose) cout << "Peg Home : " << ConfigManager::getPegasusHome() << endl;
        authInfo = new AuthenticationInfo(true);

        if (verbose) cout << "Doing testAuthHeader()...." << endl;
        testAuthHeader();

        if (verbose) cout << "Doing testAuthenticationFailure_1()...." << endl;
        testAuthenticationFailure_1();

        if (verbose) cout << "Doing testAuthenticationFailure_2()...." << endl;
        testAuthenticationFailure_2();

        if (verbose) cout << "Doing testAuthenticationFailure_3()...." << endl;
        testAuthenticationFailure_3();

        if (verbose) cout << "Doing testAuthenticationFailure_4()...." << endl;
        testAuthenticationFailure_4();

        if (verbose) cout << "Doing testAuthenticationSuccess()...." << endl;
        testAuthenticationSuccess();

    }
    catch(Exception& e)
    {
      cout << argv[0] << "Exception: " << e.getMessage() << endl;
        PEGASUS_ASSERT(0);
    }

    delete authInfo;
#endif

    cout << argv[0] << " +++++ passed all tests" << endl;

    return 0;
}
Ejemplo n.º 22
0
void _checkFilterOrHandlerPath
  (const CIMObjectPath & path, const CIMName & className, const String & name)
{
  PEGASUS_ASSERT (path.getClassName () == className);
  Array < CIMKeyBinding > keyBindings = path.getKeyBindings ();
  Boolean SCCNfound = false;
  Boolean SNfound = false;
  Boolean CCNfound = false;
  Boolean Nfound = false;
  for (Uint32 i = 0; i < keyBindings.size (); i++)
    {
      if (keyBindings[i].getName ().equal ("SystemCreationClassName"))
	{
	  SCCNfound = true;
	  PEGASUS_ASSERT (keyBindings[i].getValue () ==
			  System::getSystemCreationClassName ());
	}
      else if (keyBindings[i].getName ().equal ("SystemName"))
	{
	  SNfound = true;
	  PEGASUS_ASSERT (keyBindings[i].getValue () ==
			  System::getFullyQualifiedHostName ());
	}
      else if (keyBindings[i].getName ().equal ("CreationClassName"))
	{
	  CCNfound = true;
	  PEGASUS_ASSERT (keyBindings[i].getValue () ==
			  className.getString ());
	}
      else if (keyBindings[i].getName ().equal ("Name"))
	{
	  Nfound = true;
	  PEGASUS_ASSERT (keyBindings[i].getValue () == name);
	}
      else
	{
	  PEGASUS_ASSERT (false);
	}
    }

  PEGASUS_ASSERT (SCCNfound);
  PEGASUS_ASSERT (SNfound);
  PEGASUS_ASSERT (CCNfound);
  PEGASUS_ASSERT (Nfound);
}
Ejemplo n.º 23
0
CIMResponseMessage*
DefaultProviderManager::_handleSubscriptionInitCompleteRequest(
    CIMRequestMessage* message)
{
    PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
        "DefaultProviderManager::_handleSubscriptionInitCompleteRequest");

    CIMSubscriptionInitCompleteRequestMessage* request =
        dynamic_cast<CIMSubscriptionInitCompleteRequestMessage*>(message);
    PEGASUS_ASSERT(request != 0);

    CIMSubscriptionInitCompleteResponseMessage* response =
        dynamic_cast<CIMSubscriptionInitCompleteResponseMessage*>(
            request->buildResponse());
    PEGASUS_ASSERT(response != 0);

    _subscriptionInitComplete = true;

    // Make a copy of the table so it is not locked during the provider calls
    Array<ProviderMessageHandler*> providerList;
    {
        AutoMutex lock(_providerTableMutex);

        for (ProviderTable::Iterator i = _providers.start(); i != 0; i++)
        {
            providerList.append(i.value());
        }
    }

    //
    // Notify all providers that subscription initialization is complete
    //
    for (Uint32 j = 0; j < providerList.size(); j++)
    {
        AutoMutex lock(providerList[j]->status.getStatusMutex());

        if (providerList[j]->status.isInitialized())
        {
            providerList[j]->subscriptionInitComplete();
        }
    }

    PEG_METHOD_EXIT();
    return response;
}
Ejemplo n.º 24
0
/**

    Connects to cimserver.

    @param   outPrintWriter     the ostream to which error output should be
                                written

    @return  the Channel created

    @exception       Exception  if an error is encountered in creating
                               the connection

 */
 void WbemExecCommand::_connectToServer( WbemExecClient& client,
                         ostream& outPrintWriter )
{
    String                 host                  = String ();
    Uint32                 portNumber            = 0;
    Boolean                connectToLocal        = false;

    //
    //  Construct host address
    //
    if ((!_hostNameSet) && (!_portNumberSet))
      {
        connectToLocal = true;
      }
#ifndef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET
    if ((_hostNameSet) || (_portNumberSet))
    {
#endif
      host = _hostName;
      portNumber = _portNumber;
#ifndef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET
    }
#endif

    if( _useSSL )
    {
#ifdef PEGASUS_HAS_SSL
        if( connectToLocal )
        {
            client.connectLocal();
        }
        else
        {
            //
            // Get environment variables:
            //
            const char* pegasusHome = getenv("PEGASUS_HOME");

            String certpath = FileSystem::getAbsolutePath(
                    pegasusHome, PEGASUS_SSLCLIENT_CERTIFICATEFILE);

            String randFile;

#ifdef PEGASUS_SSL_RANDOMFILE
            randFile = FileSystem::getAbsolutePath(
                    pegasusHome, PEGASUS_SSLCLIENT_RANDOMFILE);
#endif
            SSLContext sslcontext(certpath, verifyCertificate, randFile);
            client.connect(host, portNumber, &sslcontext, _userName, _password);
        }
#else
        PEGASUS_UNREACHABLE(PEGASUS_ASSERT(false);)
#endif
    }
    else
    {
        if( connectToLocal )
Ejemplo n.º 25
0
int Threads::create(
    ThreadType& thread,
    Type type,
    void* (*start)(void*),
    void* arg)
{
    // Initialize thread attributes:

    pthread_attr_t attr;
    int rc = pthread_attr_init(&attr);
    if(rc != 0)
    {
        return rc;
    }

    // Detached:

    if (type == DETACHED)
    {
#if defined(PEGASUS_OS_ZOS)
        int ds = 1;
        pthread_attr_setdetachstate(&attr, &ds);
#else
        pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
#endif
    }

    // Stack size:
    rc = pthread_attr_setstacksize(&attr, PEGASUS_INITIAL_THREADSTACK_SIZE);
    PEGASUS_ASSERT(rc == 0);

    // Scheduling policy:

#if defined(PEGASUS_OS_SOLARIS)

    pthread_attr_setschedpolicy(&attr, SCHED_OTHER);

#endif /* defined(PEGASUS_OS_SOLARIS) */

    // Create thread:

    rc = pthread_create(&thread.thread, &attr, start, arg);

    if (rc != 0)
    {
        thread = ThreadType();
    }

    // Destroy attributes now.

    pthread_attr_destroy(&attr);

    // Return:

    return rc;
}
void testAuthHeader()
{
    BasicAuthenticationHandler  basicAuthHandler;

    String respHeader = basicAuthHandler.getAuthResponseHeader();

    if (verbose) cout << "realm = " << respHeader << endl;

    PEGASUS_ASSERT(respHeader.size() != 0);
}
Ejemplo n.º 27
0
inline String DynamicRoutingTable::_getWildRoutingKey(
    const CIMName& className) const
{
    //ATTN: We don't support wild class names.
    PEGASUS_ASSERT(!className.isNull());
    String key(":");
    key.append(className.getString());

    return key;
}
Ejemplo n.º 28
0
void WsmProcessor::handleEnqueue(Message* message)
{
    if (!message)
    {
        return;
    }

    PEGASUS_ASSERT(dynamic_cast<CIMResponseMessage*>(message) != 0);
    handleResponse(dynamic_cast<CIMResponseMessage*>(message));
}
Ejemplo n.º 29
0
Boolean MessageQueueService::_enqueueResponse(
   Message* request,
   Message* response)
{

  STAT_COPYDISPATCHER

   PEG_METHOD_ENTER(TRC_MESSAGEQUEUESERVICE,
                    "MessageQueueService::_enqueueResponse");

   if (request->getMask() & message_mask::ha_async)
   {
      if (response->getMask() & message_mask::ha_async)
      {
         _completeAsyncResponse(static_cast<AsyncRequest *>(request),
                                static_cast<AsyncReply *>(response),
                                ASYNC_OPSTATE_COMPLETE, 0);
         PEG_METHOD_EXIT();
         return true;
      }
   }

   if (request->_async != 0)
   {
      Uint32 mask = request->_async->getMask();
      PEGASUS_ASSERT(mask & (message_mask::ha_async | message_mask::ha_request));

      AsyncRequest *async = static_cast<AsyncRequest *>(request->_async);
      AsyncOpNode *op = async->op;
      request->_async = 0;
      // the legacy request is going to be deleted by its handler
      // remove it from the op node

      static_cast<AsyncLegacyOperationStart *>(async)->get_action();

      AsyncLegacyOperationResult *async_result =
         new AsyncLegacyOperationResult(
            async->getKey(),
            async->getRouting(),
            op,
            response);
      _completeAsyncResponse(
         async,
         async_result,
         ASYNC_OPSTATE_COMPLETE,
         0);
      PEG_METHOD_EXIT();
      return true;
   }

   // ensure that the destination queue is in response->dest
   PEG_METHOD_EXIT();
   return SendForget(response);

}
Ejemplo n.º 30
0
Boolean cimom::_monitorCIMService(MessageQueueService *service)
{
    AutoMutex mtx(_registeredServicesTableLock);
    Boolean *monitoring;
    if (!_registeredServicesTable.lookupReference(service, monitoring))
    {
        return false;
    }
    PEGASUS_ASSERT (*monitoring == false);
    return *monitoring = true;
}