version 1.1.2.5, 2006/10/28 17:16:10
|
version 1.2, 2006/11/29 22:09:30
|
|
|
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
static const String SERVICE_TYPE = "service:wbem"; |
|
|
|
static const String PG_INTEROP_NAMESPACE = "root/PG_InterOp"; |
|
|
|
//property names | //property names |
| |
static const String PROP_ELEMENTNAME = "ElementName"; | static const String PROP_ELEMENTNAME = "ElementName"; |
|
|
static const String PROP_NAME = "Name"; | static const String PROP_NAME = "Name"; |
static const String PROP_CLASSINFO = "Classinfo"; | static const String PROP_CLASSINFO = "Classinfo"; |
static const String PROP_COMMUNICATIONMECHANISM = "CommunicationMechanism"; | static const String PROP_COMMUNICATIONMECHANISM = "CommunicationMechanism"; |
static const String PROP_OTHERCOMMUNICATIONMECHANISMDESCRIPTION = "OtherCommunicationMechanismDescription"; |
static const String PROP_OTHERCOMMUNICATIONMECHANISMDESCRIPTION = |
|
"OtherCommunicationMechanismDescription"; |
static const String PROP_INTEROPSCHEMANAMESPACE = "InteropSchemaNamespace"; | static const String PROP_INTEROPSCHEMANAMESPACE = "InteropSchemaNamespace"; |
static const String PROP_VERSION = "Version"; | static const String PROP_VERSION = "Version"; |
static const String PROP_FUNCTIONALPROFILESSUPPORTED = "FunctionalProfilesSupported"; | static const String PROP_FUNCTIONALPROFILESSUPPORTED = "FunctionalProfilesSupported"; |
static const String PROP_FUNCTIONALPROFILEDESCRIPTIONS = "FunctionalProfileDescriptions"; |
static const String PROP_FUNCTIONALPROFILEDESCRIPTIONS = |
|
"FunctionalProfileDescriptions"; |
static const String PROP_MULTIPLEOPERATIONSSUPPORTED = "MultipleOperationsSupported"; | static const String PROP_MULTIPLEOPERATIONSSUPPORTED = "MultipleOperationsSupported"; |
static const String PROP_AUTHENTICATIONMECHANISMSSUPPORTED = "AuthenticationMechanismsSupported"; |
static const String PROP_AUTHENTICATIONMECHANISMSSUPPORTED = |
static const String PROP_AUTHENTICATIONMECHANISMDESCRIPTIONS = "AuthenticationMechanismDescriptions"; |
"AuthenticationMechanismsSupported"; |
|
static const String PROP_AUTHENTICATIONMECHANISMDESCRIPTIONS = |
|
"AuthenticationMechanismDescriptions"; |
static const String PROP_NAMESPACETYPE = "namespaceType"; | static const String PROP_NAMESPACETYPE = "namespaceType"; |
static const String PROP_IPADDRESS = "IPAddress"; | static const String PROP_IPADDRESS = "IPAddress"; |
| |
|
|
static const String PROP_ADVERTISETYPES = "AdvertiseTypes"; | static const String PROP_ADVERTISETYPES = "AdvertiseTypes"; |
| |
//constructor | //constructor |
SLPAttrib::SLPAttrib():serviceType(SERVICE_TYPE) |
SLPAttrib::SLPAttrib():serviceType(PEGASUS_SLP_SERVICE_TYPE) |
{ | { |
} | } |
| |
|
|
} | } |
| |
// fill all data required for SLP. | // fill all data required for SLP. |
void SLPAttrib::fillData(String protocol) |
// Returns true if specifie |
|
Boolean SLPAttrib::fillData(String protocol) |
{ | { |
CIMClient client; | CIMClient client; |
CIMClass cimClass; | CIMClass cimClass; |
|
|
| |
// | // |
Array <CIMInstance> instances; | Array <CIMInstance> instances; |
|
CIMInstance saveInstance; |
CIMValue val; | CIMValue val; |
Uint32 pos; | Uint32 pos; |
|
Boolean foundProtocol=false; |
Boolean localOnly=true; | Boolean localOnly=true; |
Boolean includeQualifiers=true; | Boolean includeQualifiers=true; |
Boolean includeClassOrigin=false; | Boolean includeClassOrigin=false; |
|
|
Boolean functionaProfileDescriptions = false; | Boolean functionaProfileDescriptions = false; |
| |
instances = client.enumerateInstances | instances = client.enumerateInstances |
(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_OBJECTMANAGER,deepInheritance,localOnly,includeQualifiers,includeClassOrigin); |
(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_OBJECTMANAGER, |
|
deepInheritance,localOnly,includeQualifiers,includeClassOrigin); |
| |
PEGASUS_ASSERT (instances.size () == 1); | PEGASUS_ASSERT (instances.size () == 1); |
| |
|
|
serviceId = val.toString(); | serviceId = val.toString(); |
| |
instances = client.enumerateInstances | instances = client.enumerateInstances |
(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PG_CIMXMLCOMMUNICATIONMECHANISM,deepInheritance,localOnly,includeQualifiers,includeClassOrigin); |
(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PG_CIMXMLCOMMUNICATIONMECHANISM, |
|
deepInheritance,localOnly,includeQualifiers,includeClassOrigin); |
| |
for (Uint32 n=instances.size(),i=0 ; i<n; i++) | for (Uint32 n=instances.size(),i=0 ; i<n; i++) |
{ | { |
|
|
pos = instances[i].findProperty (PROP_IPADDRESS); | pos = instances[i].findProperty (PROP_IPADDRESS); |
PEGASUS_ASSERT (pos != PEG_NOT_FOUND); | PEGASUS_ASSERT (pos != PEG_NOT_FOUND); |
val = instances[i].getProperty(pos).getValue (); | val = instances[i].getProperty(pos).getValue (); |
serviceUrl="service:wbem:"; |
// Save copy of instance of PG_CIMXMLCommunicationMechanism |
|
// matching protocol for later reference. |
|
saveInstance = instances[i]; |
|
serviceUrl= PEGASUS_SLP_SERVICE_TYPE; |
|
serviceUrl.append(":"); |
serviceUrl.append(protocol); | serviceUrl.append(protocol); |
serviceUrl.append("://"); | serviceUrl.append("://"); |
serviceUrl.append(val.toString()); | serviceUrl.append(val.toString()); |
|
foundProtocol=true; |
break; | break; |
} | } |
} | } |
|
if (!foundProtocol) |
|
{ |
|
// reset information that was already set |
|
serviceHiName.clear(); |
|
serviceHiDescription.clear(); |
|
serviceId.clear(); |
|
return false; |
|
} |
| |
cimClass = client.getClass(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_CIMNAMESPACE); | cimClass = client.getClass(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_CIMNAMESPACE); |
instances = client.enumerateInstances | instances = client.enumerateInstances |
(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_CIMNAMESPACE,deepInheritance,localOnly,includeQualifiers,includeClassOrigin); |
(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_CIMNAMESPACE,deepInheritance, |
|
localOnly,includeQualifiers,includeClassOrigin); |
| |
for (Uint32 n=instances.size(),i=0 ; i<n; i++) | for (Uint32 n=instances.size(),i=0 ; i<n; i++) |
{ | { |
|
|
classes.remove( len-1,1); | classes.remove( len-1,1); |
| |
cimClass = client.getClass | cimClass = client.getClass |
(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_OBJECTMANAGERCOMMUNICATIONMECHANISM); |
(PEGASUS_NAMESPACENAME_INTEROP, |
|
PEGASUS_CLASSNAME_OBJECTMANAGERCOMMUNICATIONMECHANISM); |
instances = client.enumerateInstances | instances = client.enumerateInstances |
(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_OBJECTMANAGERCOMMUNICATIONMECHANISM,deepInheritance,localOnly,includeQualifiers,includeClassOrigin); |
(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_OBJECTMANAGERCOMMUNICATIONMECHANISM, |
|
deepInheritance,localOnly,includeQualifiers,includeClassOrigin); |
| |
pos = instances[0].findProperty (PROP_COMMUNICATIONMECHANISM); |
pos = saveInstance.findProperty (PROP_COMMUNICATIONMECHANISM); |
PEGASUS_ASSERT (pos != PEG_NOT_FOUND); | PEGASUS_ASSERT (pos != PEG_NOT_FOUND); |
val = instances[0].getProperty(pos).getValue(); |
val = saveInstance.getProperty(pos).getValue(); |
pos = cimClass.findProperty(PROP_COMMUNICATIONMECHANISM); | pos = cimClass.findProperty(PROP_COMMUNICATIONMECHANISM); |
communicationMechanism = getMappedValue(cimClass.getProperty(pos),val); | communicationMechanism = getMappedValue(cimClass.getProperty(pos),val); |
pos = instances[0].findProperty (PROP_OTHERCOMMUNICATIONMECHANISMDESCRIPTION); |
pos = saveInstance.findProperty (PROP_OTHERCOMMUNICATIONMECHANISMDESCRIPTION); |
PEGASUS_ASSERT (pos != PEG_NOT_FOUND); | PEGASUS_ASSERT (pos != PEG_NOT_FOUND); |
val = instances[0].getProperty(pos).getValue (); |
val = saveInstance.getProperty(pos).getValue (); |
otherCommunicationMechanismDescription = val.toString(); | otherCommunicationMechanismDescription = val.toString(); |
| |
interopSchemaNamespace = PG_INTEROP_NAMESPACE; |
interopSchemaNamespace = PEGASUS_NAMESPACENAME_INTEROP.getString(); |
| |
pos = instances[0].findProperty (PROP_VERSION); |
pos = saveInstance.findProperty (PROP_VERSION); |
PEGASUS_ASSERT (pos != PEG_NOT_FOUND); | PEGASUS_ASSERT (pos != PEG_NOT_FOUND); |
val = instances[0].getProperty(pos).getValue(); |
val = saveInstance.getProperty(pos).getValue(); |
pos = cimClass.findProperty(PROP_VERSION); | pos = cimClass.findProperty(PROP_VERSION); |
protocolVersion = getMappedValue(cimClass.getProperty(pos),val); | protocolVersion = getMappedValue(cimClass.getProperty(pos),val); |
| |
pos = instances[0].findProperty (PROP_FUNCTIONALPROFILESSUPPORTED); |
pos = saveInstance.findProperty (PROP_FUNCTIONALPROFILESSUPPORTED); |
PEGASUS_ASSERT (pos != PEG_NOT_FOUND); | PEGASUS_ASSERT (pos != PEG_NOT_FOUND); |
CIMConstProperty constProperty; | CIMConstProperty constProperty; |
constProperty = instances[0].getProperty(pos); |
constProperty = saveInstance.getProperty(pos); |
val = constProperty.getValue(); | val = constProperty.getValue(); |
Array<Uint16> arrayValFPS; | Array<Uint16> arrayValFPS; |
val.get(arrayValFPS); | val.get(arrayValFPS); |
pos = cimClass.findProperty(PROP_FUNCTIONALPROFILESSUPPORTED); | pos = cimClass.findProperty(PROP_FUNCTIONALPROFILESSUPPORTED); |
for (Uint32 n=arrayValFPS.size(),i=0; i<n; i++) | for (Uint32 n=arrayValFPS.size(),i=0; i<n; i++) |
{ | { |
String profileValue = getMappedValue(cimClass.getProperty(pos),CIMValue(arrayValFPS[i])); |
String profileValue = getMappedValue(cimClass.getProperty(pos), |
|
CIMValue(arrayValFPS[i])); |
if (profileValue == "Other") | if (profileValue == "Other") |
functionaProfileDescriptions = true; | functionaProfileDescriptions = true; |
functionalProfilesSupported.append(profileValue); | functionalProfilesSupported.append(profileValue); |
|
|
| |
if (functionalProfileDescriptions == true) | if (functionalProfileDescriptions == true) |
{ | { |
pos = instances[0].findProperty (PROP_FUNCTIONALPROFILEDESCRIPTIONS); |
pos = saveInstance.findProperty (PROP_FUNCTIONALPROFILEDESCRIPTIONS); |
PEGASUS_ASSERT (pos != PEG_NOT_FOUND); | PEGASUS_ASSERT (pos != PEG_NOT_FOUND); |
val = instances[0].getProperty(pos).getValue(); |
val = saveInstance.getProperty(pos).getValue(); |
Array<String> arrayValFPD; | Array<String> arrayValFPD; |
val.get(arrayValFPD); | val.get(arrayValFPD); |
for (Uint32 n=arrayValFPD.size(),i=0; i<n; i++) | for (Uint32 n=arrayValFPD.size(),i=0; i<n; i++) |
|
|
if (len > 0) | if (len > 0) |
functionalProfileDescriptions.remove( len-1,1); | functionalProfileDescriptions.remove( len-1,1); |
} | } |
pos = instances[0].findProperty (PROP_MULTIPLEOPERATIONSSUPPORTED); |
pos = saveInstance.findProperty (PROP_MULTIPLEOPERATIONSSUPPORTED); |
PEGASUS_ASSERT (pos != PEG_NOT_FOUND); | PEGASUS_ASSERT (pos != PEG_NOT_FOUND); |
val = instances[0].getProperty(pos).getValue(); |
val = saveInstance.getProperty(pos).getValue(); |
Boolean value; | Boolean value; |
val.get(value); | val.get(value); |
if (value == true) | if (value == true) |
|
|
else | else |
multipleOperationsSupported.append("FALSE"); | multipleOperationsSupported.append("FALSE"); |
| |
pos = instances[0].findProperty (PROP_AUTHENTICATIONMECHANISMSSUPPORTED); |
pos = saveInstance.findProperty (PROP_AUTHENTICATIONMECHANISMSSUPPORTED); |
PEGASUS_ASSERT (pos != PEG_NOT_FOUND); | PEGASUS_ASSERT (pos != PEG_NOT_FOUND); |
val = instances[0].getProperty(pos).getValue(); |
val = saveInstance.getProperty(pos).getValue(); |
Array<Uint16> arrayValAMS; | Array<Uint16> arrayValAMS; |
val.get(arrayValAMS); | val.get(arrayValAMS); |
pos = cimClass.findProperty (PROP_AUTHENTICATIONMECHANISMSSUPPORTED); | pos = cimClass.findProperty (PROP_AUTHENTICATIONMECHANISMSSUPPORTED); |
for (Uint32 n=arrayValAMS.size(),i=0; i<n; i++) | for (Uint32 n=arrayValAMS.size(),i=0; i<n; i++) |
{ | { |
authenticationMechanismsSupported.append(getMappedValue(cimClass.getProperty(pos),CIMValue(arrayValAMS[i]))); |
authenticationMechanismsSupported.append(getMappedValue(cimClass.getProperty(pos), |
|
CIMValue(arrayValAMS[i]))); |
authenticationMechanismsSupported.append(","); | authenticationMechanismsSupported.append(","); |
} | } |
len = authenticationMechanismsSupported.size(); | len = authenticationMechanismsSupported.size(); |
if (len > 0) | if (len > 0) |
authenticationMechanismsSupported.remove( len-1,1); | authenticationMechanismsSupported.remove( len-1,1); |
| |
pos = instances[0].findProperty (PROP_AUTHENTICATIONMECHANISMDESCRIPTIONS); |
pos = saveInstance.findProperty (PROP_AUTHENTICATIONMECHANISMDESCRIPTIONS); |
PEGASUS_ASSERT (pos != PEG_NOT_FOUND); | PEGASUS_ASSERT (pos != PEG_NOT_FOUND); |
val = instances[0].getProperty(pos).getValue(); |
val = saveInstance.getProperty(pos).getValue(); |
Array<String> arrayValAMD; | Array<String> arrayValAMD; |
val.get(arrayValAMD); | val.get(arrayValAMD); |
for (Uint32 n=arrayValAMD.size(),i=0; i<n; i++) | for (Uint32 n=arrayValAMD.size(),i=0; i<n; i++) |
|
|
if (len > 0) | if (len > 0) |
authenticationMechanismDescriptions.remove( len-1,1); | authenticationMechanismDescriptions.remove( len-1,1); |
instances = client.enumerateInstances | instances = client.enumerateInstances |
(PEGASUS_NAMESPACENAME_INTEROP, CIM_CLASSNAME_REGISTEREDPROFILE,deepInheritance,localOnly,includeQualifiers,includeClassOrigin); |
(PEGASUS_NAMESPACENAME_INTEROP, CIM_CLASSNAME_REGISTEREDPROFILE, |
|
deepInheritance,localOnly,includeQualifiers,includeClassOrigin); |
| |
for (Uint32 n=instances.size(),i=0 ; i<n; i++) | for (Uint32 n=instances.size(),i=0 ; i<n; i++) |
{ | { |
|
|
registeredProfiles.append(""); | registeredProfiles.append(""); |
} | } |
| |
catch(CIMException& e) |
catch(Exception& e) |
{ | { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING, |
Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING, |
"SLP Registration Failed. CIMException. $0", e.getMessage()); |
"Server.CIMServer.EXTERNAL_SLP_REGISTRATION_FAILED_EXCEPTION", |
|
"exception raised during CIMServer registration with External SLP. $0", |
|
e.getMessage()); |
} | } |
| |
catch(Exception& e) |
catch(...) |
{ | { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING, |
Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING, |
"SLP Registration Failed Startup: CIMException exception. $0", e.getMessage()); |
"Server.CIMServer.EXTERNAL_SLP_REGISTRATION_FAILED_EXCEPTION", |
|
"Exception raised during CIMserver registration with External SLP."); |
} | } |
|
|
client.disconnect(); | client.disconnect(); |
return; |
return true; |
} | } |
| |
// Map Values to ValueMap | // Map Values to ValueMap |
|
|
{ | { |
| |
attributes.append(Formatter::format( | 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),", |
"(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, | serviceUrl,serviceHiName, |
serviceHiDescription,serviceId, | serviceHiDescription,serviceId, |
nameSpaces,classes, | nameSpaces,classes, |
|
|
protocolVersion)); | protocolVersion)); |
| |
attributes.append(Formatter::format( | attributes.append(Formatter::format( |
"(FunctionalProfilesSupported=$0),(FunctionalProfileDescriptions=$1),(MultipleOperationsSupported=$2),(AuthenticationMechanismsSupported=$3),(AuthenticationMechanismDescriptions=$4),(RegisteredProfilesSupported=$5)", |
"(FunctionalProfilesSupported=$0)," |
|
"(FunctionalProfileDescriptions=$1)," |
|
"(MultipleOperationsSupported=$2)," |
|
"(AuthenticationMechanismsSupported=$3)," |
|
"(AuthenticationMechanismDescriptions=$4)," |
|
"(RegisteredProfilesSupported=$5)", |
functionalProfilesSupported, | functionalProfilesSupported, |
functionalProfileDescriptions, | functionalProfileDescriptions, |
multipleOperationsSupported, | multipleOperationsSupported, |