version 1.153, 2005/03/03 03:09:40
|
version 1.161, 2005/05/05 20:24:31
|
|
|
// | // |
// Modified By: Heather Sterling, IBM (hsterl@us.ibm.com) - PEP#222 | // Modified By: Heather Sterling, IBM (hsterl@us.ibm.com) - PEP#222 |
// | // |
|
// Modified By: Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) - Bug#3452 |
|
// |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
| |
|
|
#include <Pegasus/Server/CIMServer.h> | #include <Pegasus/Server/CIMServer.h> |
#include <Service/ServerProcess.h> | #include <Service/ServerProcess.h> |
| |
|
#if defined(PEGASUS_OS_OS400) |
|
# include "vfyptrs.cinc" |
|
# include "OS400ConvertChar.h" |
|
#endif |
|
|
PEGASUS_USING_PEGASUS; | PEGASUS_USING_PEGASUS; |
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
| |
|
|
cout << MessageLoader::getMessage(parms) << endl; | cout << MessageLoader::getMessage(parms) << endl; |
} | } |
| |
|
//This needs to be called at various points in the code depending on the platform and error conditions. |
|
//We need to delete the _cimServer reference on exit in order for the destructors to get called. |
|
void deleteCIMServer() |
|
{ |
|
if (_cimServer) |
|
{ |
|
delete _cimServer; |
|
_cimServer = 0; |
|
} |
|
} |
|
|
// l10n | // l10n |
// | // |
// Dummy function for the Thread object associated with the initial thread. | // Dummy function for the Thread object associated with the initial thread. |
|
|
"Forced shutdown initiated."); | "Forced shutdown initiated."); |
PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) << PEGASUS_STD(endl); | PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) << PEGASUS_STD(endl); |
} | } |
|
PEGASUS_STD(cerr) << "Exit! " << endl; |
exit(1); | exit(1); |
#endif | #endif |
} | } |
|
|
#endif | #endif |
| |
// Make sure at least one connection is enabled | // Make sure at least one connection is enabled |
#ifndef PEGASUS_LOCAL_DOMAIN_SOCKET |
#ifdef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET |
if (!enableHttpConnection && !enableHttpsConnection) | if (!enableHttpConnection && !enableHttpsConnection) |
{ | { |
//l10n | //l10n |
|
|
// We put String into Cstring because | // We put String into Cstring because |
// Directory functions only handle Cstring. | // Directory functions only handle Cstring. |
// ATTN-KS: create String based directory functions. | // ATTN-KS: create String based directory functions. |
|
#if !defined(PEGASUS_USE_SYSLOGS) |
|
// When using syslog facility. No files anymore. |
logsDirectory = configManager->getCurrentValue("logdir"); | logsDirectory = configManager->getCurrentValue("logdir"); |
logsDirectory = | logsDirectory = |
ConfigManager::getHomedPath(configManager->getCurrentValue("logdir")); | ConfigManager::getHomedPath(configManager->getCurrentValue("logdir")); |
|
#endif |
#ifdef PEGASUS_OS_OS400 | #ifdef PEGASUS_OS_OS400 |
} // end if (os400StartupOption == false) | } // end if (os400StartupOption == false) |
#endif | #endif |
|
|
// ATTN: Need tool to completely disable logging. | // ATTN: Need tool to completely disable logging. |
| |
#if !defined(PEGASUS_OS_HPUX) && !defined(PEGASUS_PLATFORM_LINUX_IA64_GNU) && \ | #if !defined(PEGASUS_OS_HPUX) && !defined(PEGASUS_PLATFORM_LINUX_IA64_GNU) && \ |
!defined(PEGASUS_OS_OS400) |
!defined(PEGASUS_OS_OS400) && !defined(PEGASUS_USE_SYSLOGS) |
Logger::setHomeDirectory(logsDirectory); | Logger::setHomeDirectory(logsDirectory); |
#endif | #endif |
| |
|
|
// Leave this in until people get familiar with the logs. | // Leave this in until people get familiar with the logs. |
//l10n | //l10n |
//cout << "Logs Directory = " << logsDirectory << endl; | //cout << "Logs Directory = " << logsDirectory << endl; |
|
#if !defined(PEGASUS_USE_SYSLOGS) |
MessageLoaderParms parms("src.Server.cimserver.LOGS_DIRECTORY", | MessageLoaderParms parms("src.Server.cimserver.LOGS_DIRECTORY", |
"Logs Directory = "); | "Logs Directory = "); |
cout << MessageLoader::getMessage(parms) << logsDirectory << endl; | cout << MessageLoader::getMessage(parms) << logsDirectory << endl; |
#endif | #endif |
|
#endif |
} | } |
catch (UnrecognizedConfigProperty& e) | catch (UnrecognizedConfigProperty& e) |
{ | { |
|
|
#endif | #endif |
} | } |
| |
|
// Bug 2148 - Here is the order of operations for determining the server HTTP and HTTPS ports. |
|
// 1) If the user explicitly specified a port, use it. |
|
// 2) If the user did not specify a port, get the port from the services file. |
|
// 3) If no value is specified in the services file, use the IANA WBEM default port. |
|
// Note that 2 and 3 are done within the System::lookupPort method |
|
// An empty string from the ConfigManager implies that the user did not specify a port. |
|
|
Uint32 portNumberHttps=0; | Uint32 portNumberHttps=0; |
Uint32 portNumberHttp=0; | Uint32 portNumberHttp=0; |
Uint32 portNumberExportHttps=0; | Uint32 portNumberExportHttps=0; |
|
|
if (enableHttpsConnection) | if (enableHttpsConnection) |
{ | { |
String httpsPort = configManager->getCurrentValue("httpsPort"); | String httpsPort = configManager->getCurrentValue("httpsPort"); |
|
if (httpsPort == String::EMPTY) |
|
{ |
|
// |
|
// Look up the WBEM-HTTPS port number |
|
// |
|
portNumberHttps = System::lookupPort(WBEM_HTTPS_SERVICE_NAME, WBEM_DEFAULT_HTTPS_PORT); |
|
|
|
} else |
|
{ |
|
// |
|
// user-specified |
|
// |
CString portString = httpsPort.getCString(); | CString portString = httpsPort.getCString(); |
char* end = 0; | char* end = 0; |
Uint32 port = strtol(portString, &end, 10); |
portNumberHttps = strtol(portString, &end, 10); |
if(!(end != 0 && *end == '\0')) | if(!(end != 0 && *end == '\0')) |
{ | { |
PEGASUS_STD(cerr) << "Bad HTTPS Port Value" << PEGASUS_STD(endl); |
InvalidPropertyValue e("httpsPort", httpsPort); |
|
cerr << e.getMessage() << endl; |
exit(1); | exit(1); |
} | } |
|
} |
|
|
// |
|
// Look up the WBEM-HTTPS port number |
|
// |
|
portNumberHttps = System::lookupPort(WBEM_HTTPS_SERVICE_NAME, port); |
|
} | } |
| |
if (enableHttpConnection) | if (enableHttpConnection) |
{ | { |
String httpPort = configManager->getCurrentValue("httpPort"); | String httpPort = configManager->getCurrentValue("httpPort"); |
|
if (httpPort == String::EMPTY) |
|
{ |
|
// |
|
// Look up the WBEM-HTTP port number |
|
// |
|
portNumberHttp = System::lookupPort(WBEM_HTTP_SERVICE_NAME, WBEM_DEFAULT_HTTP_PORT); |
|
|
|
} else |
|
{ |
|
// |
|
// user-specified |
|
// |
CString portString = httpPort.getCString(); | CString portString = httpPort.getCString(); |
char* end = 0; | char* end = 0; |
Uint32 port = strtol(portString, &end, 10); |
portNumberHttp = strtol(portString, &end, 10); |
if(!(end != 0 && *end == '\0')) | if(!(end != 0 && *end == '\0')) |
{ | { |
PEGASUS_STD(cerr) << "Bad HTTP Port Value" << PEGASUS_STD(endl); |
InvalidPropertyValue e("httpPort", httpPort); |
|
cerr << e.getMessage() << endl; |
exit(1); | exit(1); |
} | } |
// |
|
// Look up the WBEM-HTTP port number |
|
// |
|
portNumberHttp = System::lookupPort(WBEM_HTTP_SERVICE_NAME, port); |
|
} | } |
|
} |
|
|
| |
if (enableSSLExportClientVerification) | if (enableSSLExportClientVerification) |
{ | { |
|
|
//l10n | //l10n |
| |
// Get the parent's PID before forking | // Get the parent's PID before forking |
parentPid = System::getPID(); |
_cimServerProcess->set_parent_pid(System::getPID()); |
| |
// do we need to run as a daemon ? | // do we need to run as a daemon ? |
if (daemonOption) | if (daemonOption) |
|
|
try | try |
{ | { |
| |
|
|
|
|
|
|
|
|
Monitor monitor; | Monitor monitor; |
//PEP#222 | //PEP#222 |
//CIMServer server(&monitor); | //CIMServer server(&monitor); |
|
|
"Listening on Export HTTPS port $0.", portNumberExportHttps); | "Listening on Export HTTPS port $0.", portNumberExportHttps); |
} | } |
| |
#ifdef PEGASUS_LOCAL_DOMAIN_SOCKET |
#ifndef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET |
_cimServer->addAcceptor(true, 0, false, false); | _cimServer->addAcceptor(true, 0, false, false); |
//l10n | //l10n |
//Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, | //Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
|
|
cout << MessageLoader::getMessage(parms) << endl; | cout << MessageLoader::getMessage(parms) << endl; |
} | } |
| |
# ifdef PEGASUS_LOCAL_DOMAIN_SOCKET |
# ifndef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET |
//l10n | //l10n |
//cout << "Listening on local connection socket" << endl; | //cout << "Listening on local connection socket" << endl; |
MessageLoaderParms parms("src.Server.cimserver.LISTENING_ON_LOCAL", | MessageLoaderParms parms("src.Server.cimserver.LISTENING_ON_LOCAL", |
|
|
_cimServer->runForever(); | _cimServer->runForever(); |
| |
} | } |
MessageQueueService::force_shutdown(true); |
|
// | // |
// normal termination | // normal termination |
// | // |
|
|
if (daemonOption) | if (daemonOption) |
_cimServerProcess->notify_parent(1); | _cimServerProcess->notify_parent(1); |
| |
|
deleteCIMServer(); |
return 1; | return 1; |
} | } |
| |
|
deleteCIMServer(); |
return 0; | return 0; |
} | } |
| |