📄 slpattrib.cpp
字号:
PEGASUS_ASSERT (pos != PEG_NOT_FOUND); CIMConstProperty constProperty; constProperty = saveInstance.getProperty(pos); val = constProperty.getValue(); Array<Uint16> arrayValFPS; val.get(arrayValFPS); pos = cimClass.findProperty(PROP_FUNCTIONALPROFILESSUPPORTED); for (Uint32 n=arrayValFPS.size(),i=0; i<n; i++) { String profileValue = getMappedValue(cimClass.getProperty(pos), CIMValue(arrayValFPS[i])); if (profileValue == "Other") functionaProfileDescriptions = true; functionalProfilesSupported.append(profileValue); functionalProfilesSupported.append(","); } len = functionalProfilesSupported.size(); if (len > 0) functionalProfilesSupported.remove( len-1,1); if (functionalProfileDescriptions == true) { pos = saveInstance.findProperty (PROP_FUNCTIONALPROFILEDESCRIPTIONS); PEGASUS_ASSERT (pos != PEG_NOT_FOUND); val = saveInstance.getProperty(pos).getValue(); Array<String> arrayValFPD; val.get(arrayValFPD); for (Uint32 n=arrayValFPD.size(),i=0; i<n; i++) { functionalProfileDescriptions.append(arrayValFPD[i]); functionalProfileDescriptions.append(","); } len = functionalProfileDescriptions.size(); if (len > 0) functionalProfileDescriptions.remove( len-1,1); } pos = saveInstance.findProperty (PROP_MULTIPLEOPERATIONSSUPPORTED); PEGASUS_ASSERT (pos != PEG_NOT_FOUND); val = saveInstance.getProperty(pos).getValue(); Boolean value; val.get(value); if (value == true) multipleOperationsSupported.append("TRUE"); else multipleOperationsSupported.append("FALSE"); pos = saveInstance.findProperty (PROP_AUTHENTICATIONMECHANISMSSUPPORTED); PEGASUS_ASSERT (pos != PEG_NOT_FOUND); val = saveInstance.getProperty(pos).getValue(); Array<Uint16> arrayValAMS; val.get(arrayValAMS); pos = cimClass.findProperty (PROP_AUTHENTICATIONMECHANISMSSUPPORTED); for (Uint32 n=arrayValAMS.size(),i=0; i<n; i++) { authenticationMechanismsSupported.append(getMappedValue(cimClass.getProperty(pos), CIMValue(arrayValAMS[i]))); authenticationMechanismsSupported.append(","); } len = authenticationMechanismsSupported.size(); if (len > 0) authenticationMechanismsSupported.remove( len-1,1); pos = saveInstance.findProperty (PROP_AUTHENTICATIONMECHANISMDESCRIPTIONS); PEGASUS_ASSERT (pos != PEG_NOT_FOUND); val = saveInstance.getProperty(pos).getValue(); Array<String> arrayValAMD; val.get(arrayValAMD); for (Uint32 n=arrayValAMD.size(),i=0; i<n; i++) { authenticationMechanismDescriptions.append(arrayValAMD[i]); authenticationMechanismDescriptions.append(","); } len = authenticationMechanismDescriptions.size(); if (len > 0) authenticationMechanismDescriptions.remove( len-1,1); instances = client.enumerateInstances (PEGASUS_NAMESPACENAME_INTEROP, CIM_CLASSNAME_REGISTEREDPROFILE, deepInheritance,localOnly,includeQualifiers,includeClassOrigin); for (Uint32 n=instances.size(),i=0 ; i<n; i++) { pos = instances[i].findProperty (PROP_ADVERTISETYPES); PEGASUS_ASSERT (pos != PEG_NOT_FOUND); CIMValue cAdvTypes = instances[i].getProperty(pos).getValue(); Array<Uint16> advTypes; cAdvTypes.get(advTypes); for (Uint32 n=advTypes.size(),j = 0; j < n; j++) { if(advTypes[j] == 3) { pos = instances[i].findProperty (PROP_OTHERREGISTEREDORGANIZATION); PEGASUS_ASSERT (pos != PEG_NOT_FOUND); registeredProfiles.append(instances[i].getProperty(pos).getValue().toString()); registeredProfiles.append(":"); pos = instances[i].findProperty (PROP_REGISTEREDNAME); PEGASUS_ASSERT (pos != PEG_NOT_FOUND); registeredProfiles.append(instances[i].getProperty(pos).getValue().toString()); registeredProfiles.append(","); break; } } } if (instances.size() > 0) { len = registeredProfiles.size(); registeredProfiles.remove( len-1,1); } else registeredProfiles.append(""); } catch(Exception& e) { Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING, "Server.CIMServer.EXTERNAL_SLP_REGISTRATION_FAILED_EXCEPTION", "exception raised during CIMServer registration with External SLP. $0", e.getMessage()); } catch(...) { Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING, "Server.CIMServer.EXTERNAL_SLP_REGISTRATION_FAILED_EXCEPTION", "Exception raised during CIMserver registration with External SLP."); } client.disconnect(); return true;}// Map Values to ValueMapString SLPAttrib::getMappedValue(const CIMProperty& cimProperty, CIMValue value){ String retValue; Uint16 localValue; if (strcmp(cimTypeToString(value.getType()),"string") == 0) value.get(retValue); else { value.get(localValue); retValue = Formatter::format("$0",localValue); } Uint32 posValueMap; if ((posValueMap = cimProperty.findQualifier(CIMName("ValueMap"))) == PEG_NOT_FOUND) { return retValue; } CIMConstQualifier qValueMap = cimProperty.getQualifier(posValueMap); if (!qValueMap.isArray() || (qValueMap.getType() != CIMTYPE_STRING)) { return retValue; } CIMValue q1 = qValueMap.getValue(); Array<String> val; q1.get(val); Uint32 posValue; if ((posValue = cimProperty.findQualifier("Values")) == PEG_NOT_FOUND) { return retValue; } CIMConstQualifier qValue = cimProperty.getQualifier(posValue); if (!qValue.isArray() || (qValue.getType() != CIMTYPE_STRING)) { return retValue; } CIMValue q2 = qValue.getValue(); Array<String> va2; q2.get(va2); if (va2.size() != val.size()) { return retValue; } for (Uint32 n=val.size(),i = 0; i < n; i++) { if(retValue == val[i]) { return (va2[i]); } } return retValue;}// Form the attributes String.void SLPAttrib::formAttributes(){ attributes.append(Formatter::format( "(template-url-syntax=$0),(service-hi-name=$1)," "(service-hi-description=$2),(service-id=$3)," "(Namespace=$4),(Classinfo=$5),(CommunicationMechanism=$6)," "(OtherCommunicationMechanismDescription=$7)," "(InteropSchemaNamespace=$8),(ProtocolVersion=$9),", serviceUrl,serviceHiName, serviceHiDescription,serviceId, nameSpaces,classes, communicationMechanism, otherCommunicationMechanismDescription, interopSchemaNamespace, protocolVersion)); attributes.append(Formatter::format( "(FunctionalProfilesSupported=$0)," "(FunctionalProfileDescriptions=$1)," "(MultipleOperationsSupported=$2)," "(AuthenticationMechanismsSupported=$3)," "(AuthenticationMechanismDescriptions=$4)," "(RegisteredProfilesSupported=$5)", functionalProfilesSupported, functionalProfileDescriptions, multipleOperationsSupported, authenticationMechanismsSupported, authenticationMechanismDescriptions, registeredProfiles)); if (attributes.size() > 7900) { //truncate the attributes attributes = attributes.subString(0,7900); Uint32 index = attributes.reverseFind(')'); attributes= attributes.subString(0,index+1); } return;}PEGASUS_NAMESPACE_END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -