version 1.66, 2002/08/23 16:11:21
|
version 1.72, 2002/09/13 21:40:43
|
|
|
// Modified By: Jenny Yu (jenny_yu@hp.com) | // Modified By: Jenny Yu (jenny_yu@hp.com) |
// | // |
// Modified By: Sushma Fernandes (sushma_fernandes@hp.com) | // Modified By: Sushma Fernandes (sushma_fernandes@hp.com) |
|
// Carol Ann Krug Graves, Hewlett-Packard Company |
|
// (carolann_graves@hp.com) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
#include <Pegasus/Common/Constants.h> | #include <Pegasus/Common/Constants.h> |
#include <Pegasus/suballoc/suballoc.h> |
|
#include <iostream> | #include <iostream> |
#include <cassert> | #include <cassert> |
#include <cstdlib> | #include <cstdlib> |
|
|
// | // |
// set client timeout to 2 seconds | // set client timeout to 2 seconds |
// | // |
client.setTimeOut(2000); |
client.setTimeout(2000); |
} | } |
catch(Exception& e) | catch(Exception& e) |
{ | { |
|
|
// | // |
String referenceStr = "//"; | String referenceStr = "//"; |
referenceStr.append(hostStr); | referenceStr.append(hostStr); |
referenceStr.append(PEGASUS_NAMESPACENAME_SHUTDOWN); |
referenceStr.append("/"); |
|
referenceStr.append(PEGASUS_NAMESPACENAME_SHUTDOWN.getString()); |
referenceStr.append(":"); | referenceStr.append(":"); |
referenceStr.append(PEGASUS_CLASSNAME_SHUTDOWN); |
referenceStr.append(PEGASUS_CLASSNAME_SHUTDOWN.getString()); |
CIMObjectPath reference(referenceStr); | CIMObjectPath reference(referenceStr); |
| |
// | // |
|
|
// | // |
// check to see if user is root | // check to see if user is root |
// | // |
|
#ifndef PEGASUS_OS_OS400 |
if (!System::isPrivilegedUser(System::getEffectiveUserName())) | if (!System::isPrivilegedUser(System::getEffectiveUserName())) |
{ | { |
cout << "You must have superuser privilege to run "; | cout << "You must have superuser privilege to run "; |
cout << "cimserver." << endl; | cout << "cimserver." << endl; |
exit(0); | exit(0); |
} | } |
|
#endif |
| |
// | // |
// Check to see if shutdown has already been specified: | // Check to see if shutdown has already been specified: |
|
|
{ | { |
String configTimeout = | String configTimeout = |
configManager->getCurrentValue("shutdownTimeout"); | configManager->getCurrentValue("shutdownTimeout"); |
ArrayDestroyer<char> timeoutCString(configTimeout.allocateCString()); |
timeoutValue = strtol(configTimeout.getCString(), (char **)0, 10); |
timeoutValue = strtol(timeoutCString.getPointer(), (char **)0, 10); |
|
| |
shutdownCIMOM(timeoutValue); | shutdownCIMOM(timeoutValue); |
| |
|
|
| |
if (useSSL) | if (useSSL) |
{ | { |
char* p = httpsPort.allocateCString(); |
|
char* end = 0; | char* end = 0; |
Uint32 port = strtol(p, &end, 10); |
CString portString = httpsPort.getCString(); |
|
Uint32 port = strtol(portString, &end, 10); |
assert(end != 0 && *end == '\0'); | assert(end != 0 && *end == '\0'); |
delete [] p; |
|
| |
// | // |
// Look up the WBEM-HTTPS port number | // Look up the WBEM-HTTPS port number |
|
|
} | } |
else | else |
{ | { |
char* p = httpPort.allocateCString(); |
|
char* end = 0; | char* end = 0; |
Uint32 port = strtol(p, &end, 10); |
CString portString = httpPort.getCString(); |
|
Uint32 port = strtol(portString, &end, 10); |
assert(end != 0 && *end == '\0'); | assert(end != 0 && *end == '\0'); |
delete [] p; |
|
| |
// | // |
// Look up the WBEM-HTTP port number | // Look up the WBEM-HTTP port number |
|
|
String serviceURL; | String serviceURL; |
serviceURL.assign("service:cim.pegasus://"); | serviceURL.assign("service:cim.pegasus://"); |
String host_name = slp_get_host_name(); | String host_name = slp_get_host_name(); |
serviceURL += host_name; |
serviceURL.append(host_name); |
serviceURL += ":"; |
serviceURL.append(":"); |
serviceURL += address; |
serviceURL.append(address); |
char *url = serviceURL.allocateCString(); |
|
// free(host_name); |
|
#endif | #endif |
| |
Monitor monitor(true); | Monitor monitor(true); |
|
|
{ | { |
if( (time(NULL) - last ) > 60 ) | if( (time(NULL) - last ) > 60 ) |
{ | { |
if( discovery != NULL && url != NULL ) |
if( discovery != NULL && serviceURL.size() ) |
discovery->srv_reg_all(url, |
discovery->srv_reg_all(serviceURL.getCString(), |
"(namespace=root/cimv2)", | "(namespace=root/cimv2)", |
"service:cim.pegasus", | "service:cim.pegasus", |
"DEFAULT", | "DEFAULT", |