version 1.3, 2007/02/09 18:34:46
|
version 1.8, 2008/05/12 09:14:52
|
|
|
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
// | // |
//============================================================================== |
//============================================================================= |
| |
| |
/////////////////////////////////////////////////////////////////////////////// | /////////////////////////////////////////////////////////////////////////////// |
|
|
| |
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
|
#include <Pegasus/Common/HostAddress.h> |
#include <Pegasus/Common/PegasusVersion.h> | #include <Pegasus/Common/PegasusVersion.h> |
| |
#include <cctype> | #include <cctype> |
|
|
const CIMName CIMXMLCOMMMECH_PROPERTY_MULTIPLEOPERATIONSSUPPORTED( | const CIMName CIMXMLCOMMMECH_PROPERTY_MULTIPLEOPERATIONSSUPPORTED( |
"MultipleOperationsSupported"); | "MultipleOperationsSupported"); |
const CIMName CIMXMLCOMMMECH_PROPERTY_VERSION("Version"); | const CIMName CIMXMLCOMMMECH_PROPERTY_VERSION("Version"); |
|
const CIMName |
|
CIMXMLCOMMMECH_PROPERTY_CIMXMLPROTOVERSION("CIMXMLProtocolVersion"); |
const CIMName CIMXMLCOMMMECH_PROPERTY_NAMESPACETYPE("namespaceType"); | const CIMName CIMXMLCOMMMECH_PROPERTY_NAMESPACETYPE("namespaceType"); |
const CIMName CIMXMLCOMMMECH_PROPERTY_NAMESPACEACCESSPROTOCOL( | const CIMName CIMXMLCOMMMECH_PROPERTY_NAMESPACEACCESSPROTOCOL( |
"namespaceAccessProtocol"); | "namespaceAccessProtocol"); |
|
|
setPropertyValue(instance, CIMXMLCOMMMECH_PROPERTY_VERSION, | setPropertyValue(instance, CIMXMLCOMMMECH_PROPERTY_VERSION, |
CIMXMLProtocolVersion); | CIMXMLProtocolVersion); |
| |
|
//Populate "required" property that's not populated. |
|
// CIMXMLProtocolVersion Property |
|
setPropertyValue(instance, CIMXMLCOMMMECH_PROPERTY_CIMXMLPROTOVERSION, |
|
Uint16(1)); |
|
|
// NamespaceType Property | // NamespaceType Property |
setPropertyValue(instance, CIMXMLCOMMMECH_PROPERTY_NAMESPACETYPE, | setPropertyValue(instance, CIMXMLCOMMMECH_PROPERTY_NAMESPACETYPE, |
namespaceType); | namespaceType); |
|
|
sprintf(buffer, "%u", portNumberHttp); | sprintf(buffer, "%u", portNumberHttp); |
httpPort.assign(buffer); | httpPort.assign(buffer); |
} | } |
CIMInstance instance = |
CIMInstance instance; |
|
Array<String> ips; |
|
#ifdef PEGASUS_ENABLE_IPV6 |
|
ips = System::getInterfaceAddrs(); |
|
for (Uint32 i = 0; i < ips.size() ; ++i) |
|
{ |
|
String addr = ips[i]; |
|
if (HostAddress::isValidIPV6Address(ips[i])) |
|
{ |
|
addr = "[" + addr + "]"; |
|
} |
|
addr.append(":"); |
|
addr.append(httpPort); |
|
|
|
instance = |
buildCIMXMLCommunicationMechanismInstance( | buildCIMXMLCommunicationMechanismInstance( |
namespaceType, | namespaceType, |
namespaceAccessProtocol, | namespaceAccessProtocol, |
|
addr, |
|
commMechClass); |
|
instances.append(instance); |
|
} |
|
#endif |
|
// If System::getInterfaceAddrs() fails add ip4 addr here. |
|
if (!ips.size()) |
|
{ |
|
instance = buildCIMXMLCommunicationMechanismInstance( |
|
namespaceType, |
|
namespaceAccessProtocol, |
getHostAddress(hostName, namespaceAccessProtocol, httpPort), | getHostAddress(hostName, namespaceAccessProtocol, httpPort), |
commMechClass); | commMechClass); |
instances.append(instance); | instances.append(instance); |
} | } |
|
} |
| |
if (enableHttpsConnection) | if (enableHttpsConnection) |
{ | { |
|
|
sprintf(buffer, "%u", portNumberHttps); | sprintf(buffer, "%u", portNumberHttps); |
httpsPort.assign(buffer); | httpsPort.assign(buffer); |
} | } |
CIMInstance instance = |
CIMInstance instance; |
|
Array<String> ips; |
|
#ifdef PEGASUS_ENABLE_IPV6 |
|
ips = System::getInterfaceAddrs(); |
|
for (Uint32 i = 0; i < ips.size() ; ++i) |
|
{ |
|
String addr = ips[i]; |
|
if (HostAddress::isValidIPV6Address(ips[i])) |
|
{ |
|
addr = "[" + addr + "]"; |
|
} |
|
addr.append(":"); |
|
addr.append(httpsPort); |
|
instance = |
buildCIMXMLCommunicationMechanismInstance( | buildCIMXMLCommunicationMechanismInstance( |
namespaceType, | namespaceType, |
namespaceAccessProtocol, | namespaceAccessProtocol, |
|
addr, |
|
commMechClass); |
|
instances.append(instance); |
|
} |
|
#endif |
|
// If System::getInterfaceAddrs() fails add ip4 addr here. |
|
if (!ips.size()) |
|
{ |
|
instance = buildCIMXMLCommunicationMechanismInstance( |
|
namespaceType, |
|
namespaceAccessProtocol, |
getHostAddress(hostName, namespaceAccessProtocol, httpsPort), | getHostAddress(hostName, namespaceAccessProtocol, httpsPort), |
commMechClass); | commMechClass); |
|
|
instances.append(instance); | instances.append(instance); |
} | } |
|
} |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return instances; | return instances; |
|
|
return; | return; |
} | } |
// Modify the instance on disk | // Modify the instance on disk |
try |
|
{ |
|
repository->modifyInstance(instanceReference.getNameSpace(), | repository->modifyInstance(instanceReference.getNameSpace(), |
omInstance, false, propertyList); | omInstance, false, propertyList); |
} |
PEG_TRACE(( |
catch(const CIMException&) |
TRC_CONTROLPROVIDER, |
{ |
Tracer::LEVEL3, |
PEG_METHOD_EXIT(); |
"Interop Provider Set Statistics gathering in CIM_ObjectManager: %s", |
throw; |
(statisticsFlag? "true" : "false"))); |
} |
|
catch(const Exception&) |
|
{ |
|
PEG_METHOD_EXIT(); |
|
throw; |
|
} |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"Interop Provider Set Statistics gathering in CIM_ObjectManager: $0", |
|
(statisticsFlag? "true" : "false")); |
|
StatisticalData* sd = StatisticalData::current(); | StatisticalData* sd = StatisticalData::current(); |
sd->setCopyGSD(statisticsFlag); | sd->setCopyGSD(statisticsFlag); |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |