예제 #1
0
/**
    closeConnectionSocket - close the server listening socket to disallow
    new client connections.
*/
void HTTPAcceptor::closeConnectionSocket()
{
    if (_rep)
    {
        // unregister the socket

        // ATTN - comment out - see CIMServer::stopClientConnection()
        //_monitor->unsolicitSocketMessages(_rep->socket);

        // close the socket
        _rep->closeSocket();
        // Unlink Local Domain Socket Bug# 3312
        if (_connectionType == LOCAL_CONNECTION)
        {
#ifndef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET
            PEG_TRACE_CSTRING(TRC_HTTP, Tracer::LEVEL3,
                "HTTPAcceptor::closeConnectionSocket Unlinking local "
                    "connection.");
            ::unlink(
                reinterpret_cast<struct sockaddr_un*>(_rep->address)->sun_path);
#else
            PEGASUS_ASSERT(false);
#endif
        }
    }
    else
    {
        PEG_TRACE_CSTRING(TRC_HTTP, Tracer::LEVEL2,
            "HTTPAcceptor::closeConnectionSocket failure _rep is null.");
    }
}
예제 #2
0
Sint8 Thread::initializeKey()
{
    PEG_METHOD_ENTER(TRC_THREAD, "Thread::initializeKey");
    if (!Thread::_key_initialized)
    {
        if (Thread::_key_error)
        {
            PEG_TRACE_CSTRING(TRC_THREAD, Tracer::LEVEL1,
                          "Thread: ERROR - thread key error");
            return -1;
        }

        if (TSDKey::create(&Thread::_platform_thread_key) == 0)
        {
            PEG_TRACE_CSTRING(TRC_THREAD, Tracer::LEVEL4,
                          "Thread: able to create a thread key");
            Thread::_key_initialized = true;
        }
        else
        {
            PEG_TRACE_CSTRING(TRC_THREAD, Tracer::LEVEL1,
                          "Thread: ERROR - unable to create a thread key");
            Thread::_key_error = true;
            return -1;
        }
    }

    PEG_METHOD_EXIT();
    return 0;
}
예제 #3
0
/**
   reconnectConnectionSocket - creates a new server socket.
*/
void HTTPAcceptor::reconnectConnectionSocket()
{
    if (_rep)
    {
        // unregister the socket
        _monitor->unsolicitSocketMessages(_rep->socket);
        // close the socket
        _rep->closeSocket();
        // Unlink Local Domain Socket
        if (_connectionType == LOCAL_CONNECTION)
        {
#ifndef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET
            PEG_TRACE_CSTRING(TRC_HTTP, Tracer::LEVEL3,
                "HTTPAcceptor::reconnectConnectionSocket Unlinking local "
                    "connection." );
            ::unlink(
                reinterpret_cast<struct sockaddr_un*>(_rep->address)->sun_path);
#else
            PEGASUS_ASSERT(false);
#endif
        }
        // open the socket
        _bind();
    }
    else
    {
        PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL1,
            "HTTPAcceptor::reconnectConnectionSocket failure _rep is null.");
    }
}
예제 #4
0
파일: TLS.cpp 프로젝트: brunolauze/pegasus
Sint32 MP_Socket::accept()
{
#ifndef PEGASUS_OS_ZOS
    return 1;
#else
    PEG_METHOD_ENTER(TRC_SSL, "MP_Socket::accept()");
    // ************************************************************************
    // This is a z/OS specific section. No other platform can port this.
    // Pegasus on z/OS has no OpenSSL but cat use a transparent layer called
    // AT-TLS ( Applicatin Transparent Transport Layer Security ) to handle
    // HTTPS connections.
    // ************************************************************************

    int rc;

    if (isSecure())
    {
        PEG_TRACE_CSTRING(TRC_SSL, Tracer::LEVEL4, "---> HTTPS processing.");
        rc = ATTLS_zOS_query();
    }
    else
    {
        // ********************************************************************
        // If the socket is a UNIX Domain socket on z/OS, the local security
        // credentials are read form the socket.
        // ********************************************************************
        LocalSocket_zOS_query();
        PEG_TRACE_CSTRING(TRC_SSL, Tracer::LEVEL4,
            "---> Normal HTTP processing.");
        rc = 1;
    }
    PEG_METHOD_EXIT();
    return rc;
#endif
}
예제 #5
0
void DynamicIndicationProvider::sendIndication(
    int severity,
    String classname,
    String description)
{
    PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
        "DynamicIndicationProvider::sendIndications");

    CIMInstance instance(classname);
    instance.addProperty(CIMProperty(
        CIMName("SystemCreationClassName"),
        CIMValue(String("CIM_AlertIndication"))));
    instance.addProperty(CIMProperty(
        CIMName("SystemName"),
        CIMValue(System::getHostName())));
    instance.addProperty(CIMProperty(
        CIMName("AlertType"),
        CIMValue(Uint16(5))));   //Device Alert
    instance.addProperty(CIMProperty(
        CIMName("PerceivedSeverity"),
        CIMValue(severity)));
    instance.addProperty(CIMProperty(
        CIMName("Description"),
        CIMValue(description)));
    instance.addProperty(CIMProperty(
        CIMName("ProbableCause"),
        CIMValue(Uint16(1))));
    instance.addProperty(CIMProperty(
        CIMName("Trending"),
        CIMValue(Uint16(1))));
    instance.addProperty(CIMProperty(
        CIMName("TimeStamp"),
        CIMValue(CIMDateTime::getCurrentDateTime())));

    Array<CIMKeyBinding> keys;

    //you have to set the namespace
    CIMObjectPath cop(
        System::getHostName(), _DynamicIndicationNameSpace, classname, keys);
    instance.setPath(cop);

    Buffer buffer;
    MofWriter::appendInstanceElement(buffer, instance);

    PEG_TRACE_CSTRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4, buffer.getData());
    PEG_TRACE_CSTRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
        (const char*)instance.getPath().toString().getCString());

    CIMIndication cimIndication(instance);
    _pHandler->deliver(cimIndication);

    PEG_METHOD_EXIT();
}
예제 #6
0
    static CMPIString* errGetOwningEntity(
        const CMPIError* eErr, 
        CMPIStatus* rc)
    {
        PEG_METHOD_ENTER(
            TRC_CMPIPROVIDERINTERFACE,
            "CMPI_Error:errGetOwningEntity()");
        CIMError* cer=(CIMError*)eErr->hdl;
        if (!cer)
        {
            PEG_TRACE_CSTRING(
                TRC_CMPIPROVIDERINTERFACE,
                Tracer::LEVEL1,
                "Received invalid Handle - cer...");
            CMSetStatus(rc, CMPI_RC_ERR_INVALID_PARAMETER);
            PEG_METHOD_EXIT();
            return NULL;
        }

        CMPIBoolean notNull;
        String pgOwningEntity;

        try
        {
            notNull = cer->getOwningEntity(pgOwningEntity);
            if (!notNull)
            {
                PEG_TRACE_CSTRING(
                    TRC_CMPIPROVIDERINTERFACE,
                    Tracer::LEVEL1,
                    "Received invalid Parameter...");
                CMSetStatus(rc, CMPI_RC_ERR_INVALID_PARAMETER);
                PEG_METHOD_EXIT();
                return NULL;
            }
        }
        catch (...)
        {
            PEG_TRACE_CSTRING(
                TRC_CMPIPROVIDERINTERFACE,
                Tracer::LEVEL1,
                "Exception: Unknown Exception caught...");
            CMSetStatus(rc, CMPI_RC_ERR_FAILED);
            PEG_METHOD_EXIT();
            return NULL;
        }

        CMSetStatus(rc,CMPI_RC_OK);
        PEG_METHOD_EXIT();
        return string2CMPIString(pgOwningEntity);
    }
예제 #7
0
파일: TLS.cpp 프로젝트: brunolauze/pegasus
Sint32 SSLSocket::read(void* ptr, Uint32 size)
{
    PEG_METHOD_ENTER(TRC_SSL, "SSLSocket::read()");
    Sint32 rc;

    PEG_TRACE_CSTRING(TRC_SSL, Tracer::LEVEL4, "---> SSL: (r) ");
    PEG_TRACE_CSTRING(TRC_SSL, Tracer::LEVEL4,
        SSL_state_string_long(static_cast<SSL*>(_SSLConnection)));
    rc = SSL_read(static_cast<SSL*>(_SSLConnection), (char *)ptr, size);

    _sslReadErrno = errno;

    PEG_METHOD_EXIT();
    return rc;
}
예제 #8
0
void ProviderAgent::_writeResponse(Message* message)
{
    PEG_METHOD_ENTER(TRC_PROVIDERAGENT, "ProviderAgent::_writeResponse");

    CIMMessage* response = dynamic_cast<CIMMessage*>(message);
    PEGASUS_ASSERT(response != 0);

    //
    // Write the response message to the pipe
    //
    try
    {
        // Use Mutex to prevent concurrent writes to the same pipe
        AutoMutex pipeLock(_pipeToServerMutex);

        AnonymousPipe::Status writeStatus =
            _pipeToServer->writeMessage(response);

        if (writeStatus != AnonymousPipe::STATUS_SUCCESS)
        {
            PEG_TRACE_CSTRING(TRC_PROVIDERAGENT, Tracer::LEVEL1,
                "Error writing response to pipe.");
            Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::WARNING,
                MessageLoaderParms(
                    "ProviderManager.ProviderAgent.ProviderAgent."
                        "CIMSERVER_COMMUNICATION_FAILED",
                    "cimprovagt \"$0\" communication with CIM Server failed.  "
                        "Exiting.",
                    _agentId));
            _terminating = true;
        }
    }
    catch (...)
    {
        PEG_TRACE_CSTRING(TRC_PROVIDERAGENT, Tracer::LEVEL1,
            "Caught exception while writing response.");
        Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::WARNING,
            MessageLoaderParms(
                "ProviderManager.ProviderAgent.ProviderAgent."
                    "CIMSERVER_COMMUNICATION_FAILED",
                "cimprovagt \"$0\" communication with CIM Server failed.  "
                    "Exiting.",
                _agentId));
        _terminating = true;
    }

    PEG_METHOD_EXIT();
}
예제 #9
0
void ProviderAgent::_processGetSCMOClassResponse(
    ProvAgtGetScmoClassResponseMessage* response)
{
    PEG_METHOD_ENTER(TRC_PROVIDERAGENT,
        "ProviderAgent::_processGetSCMOClassResponse");
    //
    // The provider agent requests a SCMOClass from the server by
    // _scmoClassCache_GetClass()
    //

    if (0 != _transferSCMOClass)
    {
         PEG_TRACE_CSTRING(TRC_PROVIDERAGENT, Tracer::LEVEL1,
             "_transferSCMOClass was not cleand up!");
         delete  _transferSCMOClass;
         _transferSCMOClass = 0;
    }


    // Copy class from response
    _transferSCMOClass = new SCMOClass(response->scmoClass);

    // signal delivery of SCMOClass to _scmoClassCache_GetClass()
    _scmoClassDelivered.signal();

    PEG_METHOD_EXIT();
}
예제 #10
0
Message* ProviderAgent::_processRequest(CIMRequestMessage* request)
{
    PEG_METHOD_ENTER(TRC_PROVIDERAGENT, "ProviderAgent::_processRequest");

    Message* response = 0;

    try
    {
        // Forward the request to the ProviderManager
        response = _providerManagerRouter.processMessage(request);
    }
    catch (Exception& e)
    {
        PEG_TRACE((TRC_PROVIDERAGENT, Tracer::LEVEL1,
            "Caught exception while processing request: %s",
            (const char*)e.getMessage().getCString()));
        CIMResponseMessage* cimResponse = request->buildResponse();
        cimResponse->cimException = PEGASUS_CIM_EXCEPTION(
            CIM_ERR_FAILED, e.getMessage());
        response = cimResponse;
    }
    catch (...)
    {
        PEG_TRACE_CSTRING(TRC_PROVIDERAGENT, Tracer::LEVEL1,
            "Caught exception while processing request.");
        CIMResponseMessage* cimResponse = request->buildResponse();
        cimResponse->cimException = PEGASUS_CIM_EXCEPTION(
            CIM_ERR_FAILED, String::EMPTY);
        response = cimResponse;
    }

    PEG_METHOD_EXIT();
    return response;
}
예제 #11
0
 CMPICount sbcGetCount(const CMPISubCond* eSbc, CMPIStatus* rc)
 {
     PEG_METHOD_ENTER(
         TRC_CMPIPROVIDERINTERFACE,
         "CMPI_SubCond:sbcGetCount()");
     const CMPI_SubCond *sbc = (CMPI_SubCond*)eSbc->hdl;
     if( !sbc )
     {
         PEG_TRACE_CSTRING(
             TRC_CMPIPROVIDERINTERFACE,
             Tracer::LEVEL1,
             "Invalid handle in CMPI_SubCond:sbcGetCount");
         CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
         PEG_METHOD_EXIT();
         return 0;
     }
     CMPI_TableauRow* row = (CMPI_TableauRow* )sbc->priv;
     CMSetStatus(rc,CMPI_RC_OK);
     if( row )
     {
         PEG_METHOD_EXIT();
         return row->size();
     }
     PEG_METHOD_EXIT();
     return 0;
 }
예제 #12
0
void Logger::_putInternal(
    LogFileType logFileType,
    const String& systemId,
    const Uint32 logComponent, // FUTURE: Support logComponent mask
    Uint32 logLevel,
    const String& message)
{
    if (!_rep)
       _rep = new LoggerRep(_homeDirectory);

    // Call the actual logging routine is in LoggerRep.
    _rep->log(logFileType, systemId, logLevel, message);

    // PEP 315
    // The trace can be routed into the log. The logged trace messages are
    // logged with logFileType of Logger::TRACE_LOG.
    // To avoid a cirular writing of these messages, log messages with
    // logFileType of Logger::TRACE_LOG are never send to the trace.
    if (Logger::TRACE_LOG != logFileType)
    {
        // For all other logFileType's send the log messages to the trace.
        // But do not write log messages to trace when the trace facility is
        // set to log. This avoids double messages.
        if (Tracer::TRACE_FACILITY_LOG != Tracer::getTraceFacility())
        {
            PEG_TRACE_CSTRING(
                TRC_LOGMSG,
                Tracer::LEVEL1,
                (const char*) message.getCString());
        }
    }
}
예제 #13
0
/** Initializes the consumer.
 *  Caller assumes responsibility for catching exceptions thrown by this method.
 */
void DynamicConsumer::initialize()
{
    PEG_METHOD_ENTER(TRC_LISTENER, "DynamicConsumer::initialize");

    if (!_initialized)
    {
        try
        {
            //there is no cimom handle in the listener, so pass null
            CIMOMHandle* handle = 0;
            DynamicConsumerFacade::initialize(*(handle));

            updateIdleTimer();
            _initialized = true;

            PEG_TRACE_CSTRING(
                TRC_LISTENER,
                Tracer::LEVEL3,
                "Successfully initialized consumer.");

        } catch (...)
        {
            PEG_TRACE((TRC_LISTENER,Tracer::LEVEL1,
                "Exception caught in DynamicConsumerFacade::initialize for %s",
                (const char*)_name.getCString()));
            throw;
        }
    }

    PEG_METHOD_EXIT();
}
예제 #14
0
 ClientCIMOMHandleAccessController(Mutex& lock)
     : _lock(lock)
 {
     try
     {
         // assume default client timeout
         if (!_lock.timed_lock(PEGASUS_DEFAULT_CLIENT_TIMEOUT_MILLISECONDS))
         {
             throw CIMException(CIM_ERR_ACCESS_DENIED, MessageLoaderParms(
                 "Provider.CIMOMHandle.CIMOMHANDLE_TIMEOUT",
                 "Timeout waiting for CIMOMHandle"));
         }
     }
     catch (Exception& e)
     {
         PEG_TRACE((TRC_CIMOM_HANDLE, Tracer::LEVEL2,
             "Unexpected Exception: %s",
             (const char*)e.getMessage().getCString()));
         throw;
     }
     catch (...)
     {
         PEG_TRACE_CSTRING(TRC_CIMOM_HANDLE, Tracer::LEVEL2,
             "Unexpected exception");
         throw;
     }
 }
예제 #15
0
/** Returns true if the consumer has been inactive for
 *  longer than the idle period.
 */
Boolean DynamicConsumer::isIdle()
{
    PEG_METHOD_ENTER(TRC_LISTENER, "DynamicConsumer::isIdle");

    if (!isLoaded())
    {
        PEG_TRACE_CSTRING(
            TRC_LISTENER,
            Tracer::LEVEL2,
            "Consumer is not loaded.");
        return false;
    }

    struct timeval now;
    Time::gettimeofday(&now);

    struct timeval timeout = {0,0};
    getIdleTimer(&timeout);

    // if no consumer is currently being served and there's no consumer that
    // has pending indications, we are idle
    if (!_current_operations.get() && !getPendingIndications())
    {
        PEG_METHOD_EXIT();
        return true;
    }

    PEG_METHOD_EXIT();
    return false;
}
예제 #16
0
Boolean DefaultProviderManager::hasActiveProviders()
{
    PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
        "DefaultProviderManager::hasActiveProviders");

    try
    {
        AutoMutex lock(_providerTableMutex);
        PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,
            "Number of providers in _providers table = %d", _providers.size()));

        // Iterate through the _providers table looking for an active provider
        for (ProviderTable::Iterator i = _providers.start(); i != 0; i++)
        {
            if (i.value()->status.isInitialized())
            {
                PEG_METHOD_EXIT();
                return true;
            }
        }
    }
    catch (...)
    {
        // Unexpected exception; do not assume that no providers are loaded
        PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1,
            "Unexpected Exception in hasActiveProviders.");
        PEG_METHOD_EXIT();
        return true;
    }

    // No active providers were found in the _providers table
    PEG_METHOD_EXIT();
    return false;
}
예제 #17
0
void ProviderAgent::_unloadIdleProviders()
{
    PEG_METHOD_ENTER(TRC_PROVIDERAGENT, "ProviderAgent::_unloadIdleProviders");
    ThreadStatus rtn = PEGASUS_THREAD_OK;
    // Ensure that only one _unloadIdleProvidersHandler thread runs at a time
    _unloadIdleProvidersBusy++;
    if ((_unloadIdleProvidersBusy.get() == 1) &&
        ((rtn =_threadPool.allocate_and_awaken(
             (void*)this,
             ProviderAgent::_unloadIdleProvidersHandler)) == PEGASUS_THREAD_OK))
    {
        // _unloadIdleProvidersBusy is decremented in
        // _unloadIdleProvidersHandler
    }
    else
    {
        // If we fail to allocate a thread, don't retry now.
        _unloadIdleProvidersBusy--;
    }
    if (rtn != PEGASUS_THREAD_OK)
    {
         PEG_TRACE_CSTRING(TRC_PROVIDERAGENT, Tracer::LEVEL1,
             "Could not allocate thread to unload idle providers.");
    }
    PEG_METHOD_EXIT();
}
void SystemLogListenerDestination::_writeToSystemLog(
    const String& identifier,
    Uint32 severity,
    const String& formattedText)
{
    PEG_METHOD_ENTER(TRC_IND_HANDLER,
        "SystemLogListenerDestination::_writeToSystemLog");

#if defined(PEGASUS_USE_SYSLOGS)

    System::syslog(identifier, severity, formattedText.getCString());

#else

    PEG_TRACE_CSTRING(TRC_INDICATION_GENERATION, Tracer::LEVEL3,
       "SystemLogListenerDestination writing to PegasusStandard.log");
    // PEGASUS_USE_SYSLOGS is not defined, writes the formatted
    // indications into PegasusStandard.log file
    Logger::put(Logger::STANDARD_LOG , identifier, severity,
        (const char*)formattedText.getCString());

#endif

    PEG_METHOD_EXIT();

}
예제 #19
0
void HTTPAcceptor::unbind()
{
    if (_rep)
    {
        _portNumber = 0;
        _rep->closeSocket();

        if (_connectionType == LOCAL_CONNECTION)
        {
#ifndef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET
            ::unlink(
                reinterpret_cast<struct sockaddr_un*>(_rep->address)->sun_path);
#else
            PEGASUS_ASSERT(false);
#endif
        }

        delete _rep;
        _rep = 0;
    }
    else
    {
        PEG_TRACE_CSTRING(TRC_HTTP, Tracer::LEVEL1,
            "HTTPAcceptor::unbind failure _rep is null." );
    }
}
예제 #20
0
    static CMPIStatus errSetOtherErrorSourceFormat(
        CMPIError* eErr, 
        const char* otherErrorSourceFormat)
    {
        PEG_METHOD_ENTER(
            TRC_CMPIPROVIDERINTERFACE,
            "CMPI_Error:errSetOtherErrorSourceFormat()");
        CIMError* cer=(CIMError*)eErr->hdl;
        if (!cer)
        {
            PEG_METHOD_EXIT();
            CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);
        }

        String pgOtherErrorSourceFormat(otherErrorSourceFormat);

        try
        {
            cer->setOtherErrorSourceFormat(pgOtherErrorSourceFormat);
        }
        catch (...)
        {
            PEG_TRACE_CSTRING(
                TRC_CMPIPROVIDERINTERFACE,
                Tracer::LEVEL1,
                "Exception: Unknown Exception received...");
            PEG_METHOD_EXIT();
            CMReturn(CMPI_RC_ERR_FAILED);
        }

        PEG_METHOD_EXIT();
        CMReturn(CMPI_RC_OK);
    }
예제 #21
0
void DefaultProviderManager::unloadIdleProviders()
{
    PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
        "DefaultProviderManager::unloadIdleProviders");

    try
    {
        struct timeval now;
        Time::gettimeofday(&now);

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

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

        for (Uint32 i = 0; i < providerList.size(); i++)
        {
            ProviderMessageHandler* provider = providerList[i];

            AutoMutex lock(provider->status.getStatusMutex());

            if (!provider->status.isInitialized())
            {
                continue;
            }

            struct timeval providerTime = {0, 0};
            provider->status.getLastOperationEndTime(&providerTime);

            PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,
                "provider->status.isIdle() returns: %s",
                (const char*)CIMValue(provider->status.isIdle())
                       .toString().getCString()));

            if (provider->status.isIdle() &&
                ((now.tv_sec - providerTime.tv_sec) >
                 ((Sint32)PEGASUS_PROVIDER_IDLE_TIMEOUT_SECONDS)))
            {
                PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL3,
                    "Unloading idle provider: %s",
                    (const char*)provider->getName().getCString()));
                _unloadProvider(provider);
            }
        }
    }
    catch (...)
    {
        PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1,
            "Caught unexpected exception in unloadIdleProviders.");
    }

    PEG_METHOD_EXIT();
}
예제 #22
0
void IndicationDispatchEvent::increaseRetries()
{
    PEG_TRACE_CSTRING(TRC_LISTENER, Tracer::LEVEL4, "Increasing retries\n");
    _retries++;
    _lastAttemptTime = CIMDateTime::getCurrentDateTime();
    PEG_TRACE((TRC_LISTENER,Tracer::LEVEL4,"Last attempt time %s",
        (const char*)_lastAttemptTime.toString().getCString()));
}
예제 #23
0
void CIMExportClient::exportIndication(
   const String& url,
   const CIMInstance& instanceName,
   const ContentLanguageList& contentLanguages)
{
    PEG_METHOD_ENTER (TRC_EXPORT_CLIENT, "CIMExportClient::exportIndication()");

    try
    {
        // encode request
        CIMRequestMessage* request = new CIMExportIndicationRequestMessage(
            String::EMPTY,
            url,
            instanceName,
            QueueIdStack(),
            String::EMPTY,
            String::EMPTY);

        request->operationContext.set
            (ContentLanguageListContainer(contentLanguages));

        PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL4,
            "Exporting %s Indication for destination %s:%d%s",
            (const char*)(instanceName.getClassName().getString().
            getCString()),
            (const char*)(_connectHost.getCString()), _connectPortNumber,
            (const char*)(url.getCString())));

        Message* message = _doRequest(request,
            CIM_EXPORT_INDICATION_RESPONSE_MESSAGE);

        PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL4,
            "%s Indication for destination %s:%d%s exported successfully",
            (const char*)(instanceName.getClassName().getString().
            getCString()),
            (const char*)(_connectHost.getCString()), _connectPortNumber,
            (const char*)(url.getCString())));

        CIMExportIndicationResponseMessage* response =
            (CIMExportIndicationResponseMessage*)message;

        AutoPtr<CIMExportIndicationResponseMessage> ap(response);
    }
    catch (const Exception& e)
    {
        PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL1,
            "Failed to export indication: %s",
            (const char*)e.getMessage().getCString()));
        throw;
    }
    catch (...)
    {
        PEG_TRACE_CSTRING (TRC_DISCARDED_DATA, Tracer::LEVEL1,
            "Failed to export indication");
        throw;
    }
    PEG_METHOD_EXIT();
}
예제 #24
0
//async request handler method invoked on a seperate thread per provider
//through the async request executor.
CIMException DefaultProviderManager::_asyncRequestCallback(
    void *callbackPtr,
    AsyncRequestExecutor::AsyncRequestMsg* request)
{
    PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
        "DefaultProviderManager::_asyncRequestCallback");

    CIMException responseException;

    //extract the parameters
    UnloadProviderRequest* my_request =
        dynamic_cast<UnloadProviderRequest*>(request);
    if(my_request != NULL)
    {
        PEGASUS_ASSERT(0 != callbackPtr);

        DefaultProviderManager *dpmPtr = 
            static_cast<DefaultProviderManager*>(callbackPtr);

        ProviderMessageHandler* provider =
            dynamic_cast<ProviderMessageHandler*>(my_request->_provider);
        try 
        {
            AutoMutex lock(provider->status.getStatusMutex());
            //unload the provider
            if (provider->status.isInitialized())
            {
                dpmPtr->_unloadProvider(provider);
            }
            else
            {
                PEGASUS_ASSERT(0);
            }
       }
        catch (CIMException& e)
        {
            PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"CIMException: %s",
                (const char*)e.getMessage().getCString()));
            responseException = e;
        }
        catch (Exception& e)
        {
            PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"Exception: %s",
                (const char*)e.getMessage().getCString()));
            responseException = CIMException(CIM_ERR_FAILED, e.getMessage());
        }
        catch (PEGASUS_STD(exception)& e)
        {
            responseException = CIMException(CIM_ERR_FAILED, e.what());
        }
        catch (...)
        {
            PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1,
                "Exception: Unknown");
            responseException = PEGASUS_CIM_EXCEPTION(
                CIM_ERR_FAILED, "Unknown error.");
        }
    }
예제 #25
0
    static CMPIErrorType errGetErrorType(const CMPIError* eErr, CMPIStatus* rc)
    {
        PEG_METHOD_ENTER(
            TRC_CMPIPROVIDERINTERFACE,
            "CMPI_Error:errGetErrorType()");
        CIMError* cer=(CIMError*)eErr->hdl;
        if (!cer)
        {
            PEG_TRACE_CSTRING(
                TRC_CMPIPROVIDERINTERFACE,
                Tracer::LEVEL1,
                "Received invalid Handle - cer...");
            CMSetStatus(rc, CMPI_RC_ERR_INVALID_PARAMETER);
            PEG_METHOD_EXIT();
            return UnknownErrorType;
        }

        CMPIBoolean notNull;
        CIMError::ErrorTypeEnum pgErrorType;

        try
        {
            notNull = cer->getErrorType(pgErrorType);
            if (!notNull)
            {
                PEG_TRACE_CSTRING(
                    TRC_CMPIPROVIDERINTERFACE,
                    Tracer::LEVEL1,
                    "Received invalid Parameter...");
                CMSetStatus(rc, CMPI_RC_ERR_INVALID_PARAMETER);
                PEG_METHOD_EXIT();
                return UnknownErrorType;
            }
        }
        catch (...)
        {
            CMSetStatus(rc, CMPI_RC_ERR_FAILED);
            PEG_METHOD_EXIT();
            return UnknownErrorType;
        }

        CMSetStatus(rc,CMPI_RC_OK);
        PEG_METHOD_EXIT();
        return(CMPIErrorType)pgErrorType;
    }
예제 #26
0
PaseCcsid::~PaseCcsid()
{
    if (_SETCCSID(_back) == -1)
    {
        PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL1,
                "PaseCcsid::~PaseCcsid: Can not change PASE CCSID.");
    }
    _paseCcsidMutex.unlock();
}
예제 #27
0
PaseCcsid::PaseCcsid(int to, int back)
    : _to(to), _back(back)
{
    _paseCcsidMutex.lock();
   if (_SETCCSID(_to) == -1)
   {
       PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL1,
               "PaseCcsid::PaseCcsid: Can not change PASE CCSID.");
   }
}
    ProviderManagerContainer(
        const String& physicalName,
        const String& logicalName,
        const String& interfaceName,
        PEGASUS_INDICATION_CALLBACK_T indicationCallback,
        PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback,
        Boolean subscriptionInitComplete)
    : _manager(0)
    {
#if defined (PEGASUS_OS_VMS)
    String provDir = ConfigManager::getInstance()->
                                    getCurrentValue("providerDir");
    _physicalName = ConfigManager::getHomedPath(provDir) + "/" +
                       FileSystem::buildLibraryFileName(physicalName);
#else
        _physicalName = physicalName;  // providerMgrPath comes with full path
        //_physicalName = ConfigManager::getHomedPath(PEGASUS_DEST_LIB_DIR) +
        //    String("/") + FileSystem::buildLibraryFileName(physicalName);
#endif

        _logicalName = logicalName;
        _interfaceName = interfaceName;

        _module.reset(new ProviderManagerModule(_physicalName));
        Boolean moduleLoaded = _module->load();

        if (moduleLoaded)
        {
            _manager = _module->getProviderManager(_logicalName);
        }
        else
        {
            PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2,
                "ProviderManagerModule load failed.");
        }

        if (_manager == 0)
        {
            MessageLoaderParms parms(
                "ProviderManager.BasicProviderManagerRouter."
                    "PROVIDERMANAGER_LOAD_FAILED",
                "Failed to load the Provider Manager for interface "
                    "type \"$0\" from library \"$1\".",
                _interfaceName, _physicalName);
            Logger::put_l(
                Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
                parms);
            throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms);
        }

        _manager->setIndicationCallback(indicationCallback);
        _manager->setResponseChunkCallback(responseChunkCallback);

        _manager->setSubscriptionInitComplete (subscriptionInitComplete);
    }
예제 #29
0
void DynamicConsumer::enqueueEvent(IndicationDispatchEvent* event)
{
    PEG_METHOD_ENTER(TRC_LISTENER, "DynamicConsumer::enqueueEvent");

    if (!isLoaded())
    {
        PEG_TRACE_CSTRING(
            TRC_LISTENER,
            Tracer::LEVEL1,
            "Error: The consumer is not loaded and "
                "therefore cannot handle events.");
        return;
    }

    try
    {
        PEG_TRACE((TRC_LISTENER,Tracer::LEVEL4,
            "enqueueEvent before %s",(const char*)_name.getCString()));

        // Our event queue is first in first out.
        _eventqueue.insert_back(event);
        _check_queue->signal();

        PEG_TRACE((TRC_LISTENER,Tracer::LEVEL4,
            "enqueueEvent after %s",(const char*)_name.getCString()));

    } catch (Exception& ex)
    {
        //ATTN: Log missed indication
        PEG_TRACE((TRC_LISTENER,Tracer::LEVEL1,
            "Exception at enqueueingEvent: %s",
            (const char*)ex.getMessage().getCString()));

    } catch (...)
    {
        //ATTN: Log missed indication
        PEG_TRACE_CSTRING(TRC_LISTENER,Tracer::LEVEL1,
            "Unknow exception at enqueueingEvent!");
    }

    PEG_METHOD_EXIT();
}
예제 #30
0
void Thread::setCurrent(Thread * thrd)
{
    PEG_METHOD_ENTER(TRC_THREAD, "Thread::setCurrent");
    if (Thread::initializeKey() == 0)
    {
        if (TSDKey::
            set_thread_specific(Thread::_platform_thread_key,
                                (void *) thrd) == 0)
        {
            PEG_TRACE_CSTRING(TRC_THREAD, Tracer::LEVEL4,
                "Successful set Thread * into thread specific storage");
        }
        else
        {
            PEG_TRACE_CSTRING(TRC_THREAD, Tracer::LEVEL1,
                "ERROR: error setting Thread * into thread specific storage");
        }
    }
    PEG_METHOD_EXIT();
}