⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cimxmlindicationhandler.cpp

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 CPP
📖 第 1 页 / 共 2 页
字号:
                PEG_TRACE_STRING(TRC_IND_HANDLER, Tracer::LEVEL4, msg + dest);                PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,                    "CIMxmlIndicationHandler::handleIndication failed to "                    "deliver indication: "                    "missing colon "                    "in Destination " + dest);                PEG_METHOD_EXIT();                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, msg + dest);            }            String doubleSlash = dest.subString(colon + 1, 2);            if (String::equalNoCase(doubleSlash, "//"))            {                destStr = dest.subString(colon + 3, PEG_NOT_FOUND);            }            else            {                String msg = _getMalformedExceptionMsg();                PEG_TRACE_STRING(TRC_IND_HANDLER, Tracer::LEVEL4, msg + dest);                PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,                    "CIMxmlIndicationHandler::handleIndication failed to "                    "deliver indication: "                    "missing double slash "                    "in Destination " + dest);                PEG_METHOD_EXIT();                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, msg + dest);            }            bool parseError = false;            colon = destStr.find (":");            //            // get hostname and port number from destination string            //            if (colon != PEG_NOT_FOUND)            {                hostStr = destStr.subString (0, colon);                destStr = destStr.subString(colon + 1, PEG_NOT_FOUND);                String portStr = destStr.subString (0, destStr.find ("/"));                char dummy;                int noOfConversions = sscanf(portStr.getCString (), "%u%c",                    &portNumber, &dummy);                parseError = (noOfConversions != 1);            }            //            // There is no port number in the destination string,            // get port number from system            //            else            {                hostStr = destStr.subString(0, destStr.find ("/"));                if (useHttps)                {                     portNumber = System::lookupPort(WBEM_HTTPS_SERVICE_NAME,                        WBEM_DEFAULT_HTTPS_PORT);                }                else                {                    portNumber = System::lookupPort(WBEM_HTTP_SERVICE_NAME,                        WBEM_DEFAULT_HTTP_PORT);                }            }            char hostName[PEGASUS_MAXHOSTNAMELEN];            if (!parseError)            {                char dummy;                int noOfConversions = sscanf(hostStr.getCString (), "%s%c",                    hostName, &dummy);                parseError = (noOfConversions != 1);            }            if (parseError)            {                String msg = _getMalformedExceptionMsg();                PEG_TRACE_STRING(TRC_IND_HANDLER, Tracer::LEVEL4, msg + dest);                PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,                    "CIMxmlIndicationHandler::handleIndication failed to "                    "deliver indication: "                    "invalid host name or port number "                    "in Destination " + dest);                PEG_METHOD_EXIT();                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, msg + dest);            }#ifndef PEGASUS_OS_ZOS            if (useHttps)            {#ifdef PEGASUS_HAS_SSL                PEG_TRACE_STRING(TRC_IND_HANDLER, Tracer::LEVEL4,                    "Build SSL Context...");                SSLContext sslcontext(trustPath,                    certPath, keyPath, verifyListenerCertificate, randFile);                exportclient.connect (hostName, portNumber, sslcontext);#else                MessageLoaderParms param(                    "Handler.CIMxmlIndicationHandler."                        "CIMxmlIndicationHandler.ERROR",                    "CIMxmlIndicationHandler Error: ");                MessageLoaderParms param1(                    "Handler.CIMxmlIndicationHandler."                        "CIMxmlIndicationHandler.CANNOT_DO_HTTPS_CONNECTION",                    "Cannot do https connection.");                PEG_TRACE_STRING(TRC_IND_HANDLER, Tracer::LEVEL3,                     MessageLoader::getMessage(param) +                         MessageLoader::getMessage(param1));                String msg = MessageLoader::getMessage(param) +                    MessageLoader::getMessage(param1);                PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,                    "CIMxmlIndicationHandler::handleIndication failed to "                    "deliver indication: "                    "https not supported "                    "in Destination " + dest);                PEG_METHOD_EXIT();                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, msg);#endif            }            else            {                exportclient.connect (hostName, portNumber);            }#else            // On zOS the ATTLS facility is using the port number(s) defined            // of the outbound policy to decide if the indication is            // delivered through a SSL secured socket. This is totally            // transparent to the CIM Server.            exportclient.connect (hostName, portNumber);#endif            // check destStr, if no path is specified, use "/" for the URI            Uint32 slash = destStr.find ("/");            if (slash != PEG_NOT_FOUND)            {                exportclient.exportIndication(                    destStr.subString(slash), indicationInstance,                    contentLanguages);            }            else            {                exportclient.exportIndication(                    "/", indicationInstance, contentLanguages);            }            exportclient.disconnect();        }        catch(Exception& e)        {            //ATTN: Catch specific exceptions and log the error message            // as Indication delivery failed.            MessageLoaderParms param(                "Handler.CIMxmlIndicationHandler.CIMxmlIndicationHandler.ERROR",                "CIMxmlIndicationHandler Error: ");            String msg = MessageLoader::getMessage(param) + e.getMessage();            PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,                "CIMxmlIndicationHandler::handleIndication failed to deliver "                "indication due to Exception: " + e.getMessage ());            PEG_METHOD_EXIT();            throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, msg);        }        PEG_METHOD_EXIT();    }private:    String _getMalformedExceptionMsg()    {        MessageLoaderParms param(            "Handler.CIMxmlIndicationHandler.CIMxmlIndicationHandler.ERROR",            "CIMxmlIndicationHandler Error: ");        MessageLoaderParms param1(            "Handler.CIMxmlIndicationHandler."                "CIMxmlIndicationHandler.MALFORMED_HANDLER_INSTANCE",            "Malformed handler instance.");        return MessageLoader::getMessage(param) +            MessageLoader::getMessage(param1);    }};PEGASUS_NAMESPACE_ENDPEGASUS_USING_PEGASUS;// This is the entry point into this dynamic module.extern "C" PEGASUS_EXPORT CIMHandler* PegasusCreateHandler(    const String& handlerName){    if (handlerName == "CIMxmlIndicationHandler")    {        return new CIMxmlIndicationHandler;    }    return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -