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

📄 cimmessageserializer.cpp

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 CPP
📖 第 1 页 / 共 4 页
字号:
                out, (CIMReferenceNamesResponseMessage*)cimMessage);            break;        // Method operations        case CIM_INVOKE_METHOD_RESPONSE_MESSAGE:            _serializeCIMInvokeMethodResponseMessage(                out, (CIMInvokeMethodResponseMessage*)cimMessage);            break;        //        // CIM Indication Response Messages        //        case CIM_CREATE_SUBSCRIPTION_RESPONSE_MESSAGE:            _serializeCIMCreateSubscriptionResponseMessage(                out, (CIMCreateSubscriptionResponseMessage*)cimMessage);            break;        case CIM_MODIFY_SUBSCRIPTION_RESPONSE_MESSAGE:            _serializeCIMModifySubscriptionResponseMessage(                out, (CIMModifySubscriptionResponseMessage*)cimMessage);            break;        case CIM_DELETE_SUBSCRIPTION_RESPONSE_MESSAGE:            _serializeCIMDeleteSubscriptionResponseMessage(                out, (CIMDeleteSubscriptionResponseMessage*)cimMessage);            break;        //        // Other CIM Response Messages        //        case CIM_EXPORT_INDICATION_RESPONSE_MESSAGE:            _serializeCIMExportIndicationResponseMessage(                out, (CIMExportIndicationResponseMessage*)cimMessage);            break;        case CIM_PROCESS_INDICATION_RESPONSE_MESSAGE:            _serializeCIMProcessIndicationResponseMessage(                out, (CIMProcessIndicationResponseMessage*)cimMessage);            break;        //case CIM_NOTIFY_PROVIDER_REGISTRATION_RESPONSE_MESSAGE:            // ATTN: No need to serialize this yet            //_serializeCIMNotifyProviderRegistrationResponseMessage(            //    out,            //    (CIMNotifyProviderRegistrationResponseMessage*)cimMessage);            break;        //case CIM_NOTIFY_PROVIDER_TERMINATION_RESPONSE_MESSAGE:            // ATTN: No need to serialize this yet            //_serializeCIMNotifyProviderTerminationResponseMessage(            //    out,            //    (CIMNotifyProviderTerminationResponseMessage*)cimMessage);            break;        //case CIM_HANDLE_INDICATION_RESPONSE_MESSAGE:            // ATTN: No need to serialize this yet            //_serializeCIMHandleIndicationResponseMessage(            //    out, (CIMHandleIndicationResponseMessage*)cimMessage);            break;        case CIM_DISABLE_MODULE_RESPONSE_MESSAGE:            _serializeCIMDisableModuleResponseMessage(                out, (CIMDisableModuleResponseMessage*)cimMessage);            break;        case CIM_ENABLE_MODULE_RESPONSE_MESSAGE:            _serializeCIMEnableModuleResponseMessage(                out, (CIMEnableModuleResponseMessage*)cimMessage);            break;        //case CIM_NOTIFY_PROVIDER_ENABLE_RESPONSE_MESSAGE:            // ATTN: No need to serialize this yet            //_serializeCIMNotifyProviderEnableResponseMessage(            //    out, (CIMNotifyProviderEnableResponseMessage*)cimMessage);            break;        //case CIM_NOTIFY_PROVIDER_FAIL_RESPONSE_MESSAGE:            // ATTN: No need to serialize this yet            //_serializeCIMNotifyProviderFailResponseMessage(            //    out, (CIMNotifyProviderFailResponseMessage*)cimMessage);            //break;        case CIM_STOP_ALL_PROVIDERS_RESPONSE_MESSAGE:            _serializeCIMStopAllProvidersResponseMessage(                out, (CIMStopAllProvidersResponseMessage*)cimMessage);            break;        case CIM_INITIALIZE_PROVIDER_RESPONSE_MESSAGE:            _serializeCIMInitializeProviderResponseMessage(                out, (CIMInitializeProviderResponseMessage*)cimMessage);            break;        case CIM_INITIALIZE_PROVIDER_AGENT_RESPONSE_MESSAGE:            _serializeCIMInitializeProviderAgentResponseMessage(                out, (CIMInitializeProviderAgentResponseMessage*)cimMessage);            break;        case CIM_NOTIFY_CONFIG_CHANGE_RESPONSE_MESSAGE:            _serializeCIMNotifyConfigChangeResponseMessage(                out, (CIMNotifyConfigChangeResponseMessage*)cimMessage);            break;        case CIM_SUBSCRIPTION_INIT_COMPLETE_RESPONSE_MESSAGE:            _serializeCIMSubscriptionInitCompleteResponseMessage(                out,                (CIMSubscriptionInitCompleteResponseMessage *)                cimMessage);            break;        default:            PEGASUS_ASSERT(0);    }    XmlWriter::append(out, "</PGRESP>");}//// Utility Methods////// _serializeUserInfo consolidates encoding of these common message attributes//void CIMMessageSerializer::_serializeUserInfo(    Buffer& out,    const String& authType,    const String& userName){    XmlWriter::appendValueElement(out, authType);    XmlWriter::appendValueElement(out, userName);}//// _serializeQueueIdStack//void CIMMessageSerializer::_serializeQueueIdStack(    Buffer& out,    const QueueIdStack& queueIdStack){    QueueIdStack stackCopy = queueIdStack;    // Use a PGQIDSTACK element to encapsulate the QueueIdStack encoding    XmlWriter::append(out, "<PGQIDSTACK>\n");    while (!stackCopy.isEmpty())    {        Uint32 item = stackCopy.top();        stackCopy.pop();        XmlWriter::appendValueElement(out, item);    }    XmlWriter::append(out, "</PGQIDSTACK>\n");}//// _serializeOperationContext//void CIMMessageSerializer::_serializeOperationContext(    Buffer& out,    const OperationContext& operationContext){    // Use a PGOP element to encapsulate the OperationContext encoding    XmlWriter::append(out, "<PGOC>\n");    // Note: OperationContext class does not allow iteration through Containers    if (operationContext.contains(IdentityContainer::NAME))    {        const IdentityContainer container =            operationContext.get(IdentityContainer::NAME);        XmlWriter::append(out, "<PGOCID>\n");        XmlWriter::appendValueElement(out, container.getUserName());        XmlWriter::append(out, "</PGOCID>\n");    }    if (operationContext.contains(SubscriptionInstanceContainer::NAME))    {        const SubscriptionInstanceContainer container =            operationContext.get(SubscriptionInstanceContainer::NAME);        XmlWriter::append(out, "<PGOCSI>\n");        _serializeCIMInstance(out, container.getInstance());        XmlWriter::append(out, "</PGOCSI>\n");    }    if (operationContext.contains(SubscriptionFilterConditionContainer::NAME))    {        const SubscriptionFilterConditionContainer container =            operationContext.get(SubscriptionFilterConditionContainer::NAME);        XmlWriter::append(out, "<PGOCSFC>\n");        XmlWriter::appendValueElement(out, container.getFilterCondition());        XmlWriter::appendValueElement(out, container.getQueryLanguage());        XmlWriter::append(out, "</PGOCSFC>\n");    }    if (operationContext.contains(SubscriptionFilterQueryContainer::NAME))    {        const SubscriptionFilterQueryContainer container =            operationContext.get(SubscriptionFilterQueryContainer::NAME);        XmlWriter::append(out, "<PGOCSFQ>\n");        XmlWriter::appendValueElement(out, container.getFilterQuery());        XmlWriter::appendValueElement(out, container.getQueryLanguage());        _serializeCIMNamespaceName(out, container.getSourceNameSpace());        XmlWriter::append(out, "</PGOCSFQ>\n");    }    if (operationContext.contains(SubscriptionInstanceNamesContainer::NAME))    {        const SubscriptionInstanceNamesContainer container =            operationContext.get(SubscriptionInstanceNamesContainer::NAME);        XmlWriter::append(out, "<PGOCSIN>\n");        Array<CIMObjectPath> cimObjectPaths = container.getInstanceNames();        for (Uint32 i=0; i < cimObjectPaths.size(); i++)        {            _serializeCIMObjectPath(out, cimObjectPaths[i]);        }        XmlWriter::append(out, "</PGOCSIN>\n");    }    if (operationContext.contains(TimeoutContainer::NAME))    {        const TimeoutContainer container =            operationContext.get(TimeoutContainer::NAME);        XmlWriter::append(out, "<PGOCTO>\n");        XmlWriter::appendValueElement(out, container.getTimeOut());        XmlWriter::append(out, "</PGOCTO>\n");    }    if (operationContext.contains(AcceptLanguageListContainer::NAME))    {        const AcceptLanguageListContainer container =            operationContext.get(AcceptLanguageListContainer::NAME);        XmlWriter::append(out, "<PGOCALL>\n");        _serializeAcceptLanguageList(out, container.getLanguages());        XmlWriter::append(out, "</PGOCALL>\n");    }    if (operationContext.contains(ContentLanguageListContainer::NAME))    {        const ContentLanguageListContainer container =            operationContext.get(ContentLanguageListContainer::NAME);        XmlWriter::append(out, "<PGOCCLL>\n");        _serializeContentLanguageList(out, container.getLanguages());        XmlWriter::append(out, "</PGOCCLL>\n");    }    if (operationContext.contains(SnmpTrapOidContainer::NAME))    {        const SnmpTrapOidContainer container =            operationContext.get(SnmpTrapOidContainer::NAME);        XmlWriter::append(out, "<PGOCSTO>\n");        XmlWriter::appendValueElement(out, container.getSnmpTrapOid());        XmlWriter::append(out, "</PGOCSTO>\n");    }    if (operationContext.contains(LocaleContainer::NAME))    {        const LocaleContainer container =            operationContext.get(LocaleContainer::NAME);        XmlWriter::append(out, "<PGOCL>\n");        XmlWriter::appendValueElement(out, container.getLanguageId());        XmlWriter::append(out, "</PGOCL>\n");    }    if (operationContext.contains(ProviderIdContainer::NAME))    {        const ProviderIdContainer container =            operationContext.get(ProviderIdContainer::NAME);        XmlWriter::append(out, "<PGOCPI>\n");        _serializeCIMInstance(out, container.getModule());        _serializeCIMInstance(out, container.getProvider());        XmlWriter::appendValueElement(out, container.isRemoteNameSpace());        XmlWriter::appendValueElement(out, container.getRemoteInfo());        XmlWriter::append(out, "</PGOCPI>\n");    }    XmlWriter::append(out, "</PGOC>\n");}//// _serializeContentLanguageList//void CIMMessageSerializer::_serializeContentLanguageList(    Buffer& out,    const ContentLanguageList& contentLanguages){    // Use a PGCONTLANGS element to encapsulate the ContentLanguageList    // encoding    XmlWriter::append(out, "<PGCONTLANGS>\n");    for (Uint32 i=0; i < contentLanguages.size(); i++)    {        XmlWriter::appendValueElement(            out, contentLanguages.getLanguageTag(i).toString());    }    XmlWriter::append(out, "</PGCONTLANGS>\n");}//// _serializeAcceptLanguageList//void CIMMessageSerializer::_serializeAcceptLanguageList(    Buffer& out,    const AcceptLanguageList& acceptLanguages){    // Use a PGACCLANGS element to encapsulate the AcceptLanguageList encoding    XmlWriter::append(out, "<PGACCLANGS>\n");    for (Uint32 i=0; i < acceptLanguages.size(); i++)    {        XmlWriter::appendValueElement(            out, acceptLanguages.getLanguageTag(i).toString());        XmlWriter::appendValueElement(out, acceptLanguages.getQualityValue(i));    }    XmlWriter::append(out, "</PGACCLANGS>\n");}//// _serializeCIMException//void CIMMessageSerializer::_serializeCIMException(    Buffer& out,    const CIMException& cimException){    TraceableCIMException e(cimException);    // Use a PGCIMEXC element to encapsulate the CIMException encoding    // (Note: This is not truly necessary and could be removed.)    XmlWriter::append(out, "<PGCIMEXC>\n");    XmlWriter::appendValueElement(out, Uint32(e.getCode()));    XmlWriter::appendValueElement(out, e.getMessage());    XmlWriter::appendValueElement(out, e.getCIMMessage());    XmlWriter::appendValueElement(out, e.getFile());    XmlWriter::appendValueElement(out, e.getLine());    _serializeContentLanguageList(out, e.getContentLanguages());    XmlWriter::append(out, "</PGCIMEXC>\n");}//// _serializeCIMPropertyList//void CIMMessageSerializer::_serializeCIMPropertyList(    Buffer& out,    const CIMPropertyList& cimPropertyList){    // Need IPARAMVALUE wrapper because the value can be null.    XmlWriter::appendPropertyListIParameter(out, cimPropertyList);}//// _serializeCIMObjectPath//void CIMMessageSerializer::_serializeCIMObjectPath(    Buffer& out,    const CIMObjectPath& cimObjectPath){    // Use a PGPATH element to encapsulate the CIMObjectPath encoding    // to account for uninitialized objects    XmlWriter::append(out, "<PGPATH>\n");    if (!cimObjectPath.getClassName().isNull())    {        XmlWriter::appendValueReferenceElement(out, cimObjectPath, true);    }    XmlWriter::append(out, "</PGPATH>\n");}//// _serializeCIMInstance//void CIMMessageSerializer::_serializeCIMInstance(    Buffer& out,    const CIMInstance& cimInstance){    // Use a PGINST element to encapsulate the CIMInstance encoding    // to account for uninitialized objects    XmlWriter::append(out, "<PGINST>\n");    if (!cimInstance.isUninitialized())    {        XmlWriter::appendInstanceElement(out, cimInstance);        _serializeCIMObjectPath(out, cimInstance.getPath());    }    XmlWriter::append(out, "</PGINST>\n");}//// _serializeCIMNamespaceName//void CIMMessageSerializer::_serializeCIMNamespaceName(    Buffer& out,    const CIMNamespaceName& cimNamespaceName){    // Encode CIMNamespaceName as a String for efficiency and so that null    // values can be handled    XmlWriter::appendValueElement(out, cimNamespaceName.getString());}//// _serializeCIMName//void CIMMessageSerializer::_serializeCIMName(    Buffer& out,    const CIMName& cimName){    // Encode CIMName as a String so that null values can be handled    XmlWriter::appendValueElement(out, cimName.getString());

⌨️ 快捷键说明

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