version 1.5, 2003/11/05 04:10:42
|
version 1.7, 2004/01/29 20:57:48
|
|
|
// | // |
// Modified By: Jair Santos, Hewlett-Packard Company (jair.santos@hp.com) | // Modified By: Jair Santos, Hewlett-Packard Company (jair.santos@hp.com) |
// | // |
|
// Modified By: Dan Gorey (djgorey@us.ibm.com) |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
| |
|
|
#include <Pegasus/Client/CIMClient.h> | #include <Pegasus/Client/CIMClient.h> |
#include <Pegasus/Server/ShutdownService.h> | #include <Pegasus/Server/ShutdownService.h> |
#include <Pegasus/Common/Destroyer.h> | #include <Pegasus/Common/Destroyer.h> |
#if !defined(PEGASUS_OS_ZOS) && ! defined(PEGASUS_OS_HPUX) && ! defined(PEGASUS_NO_SLP) |
|
#include <slp/slp.h> |
|
#endif |
|
| |
| |
#if defined(PEGASUS_OS_TYPE_WINDOWS) | #if defined(PEGASUS_OS_TYPE_WINDOWS) |
|
|
// try loop to bind the address, and run the server | // try loop to bind the address, and run the server |
try | try |
{ | { |
#if !defined(PEGASUS_OS_ZOS) && ! defined(PEGASUS_OS_HPUX) && ! defined(PEGASUS_NO_SLP) |
#ifdef PEGASUS_USE_23HTTPMONITOR |
char slp_address[32]; |
|
slp_client *discovery = new slp_client() ;; |
|
String serviceURL; |
|
serviceURL.assign("service:cim.pegasus://"); |
|
String host_name = slp_get_host_name(); |
|
serviceURL.append(host_name); |
|
serviceURL.append(":"); |
|
// ATTN: Fix this to work for multiple connections |
|
sprintf(slp_address, "%u", |
|
enableHttpConnection ? portNumberHttp : portNumberHttps); |
|
serviceURL.append(slp_address); |
|
#endif |
|
|
|
Monitor monitor(true); | Monitor monitor(true); |
|
#else |
|
monitor_2 monitor(); |
|
#endif |
CIMServer server(&monitor); | CIMServer server(&monitor); |
| |
if (enableHttpConnection) | if (enableHttpConnection) |
|
|
// | // |
while( !server.terminated() ) | while( !server.terminated() ) |
{ | { |
#if !defined(PEGASUS_OS_ZOS) && ! defined(PEGASUS_OS_HPUX) && ! defined(PEGASUS_NO_SLP) |
|
if(useSLP ) |
|
{ |
|
if( (time(NULL) - last ) > 60 ) |
|
{ |
|
if( discovery != NULL && serviceURL.size() ) |
|
discovery->srv_reg_all(serviceURL.getCString(), |
|
"(namespace=root/cimv2)", |
|
"service:cim.pegasus", |
|
"DEFAULT", |
|
70) ; |
|
time(&last); |
|
} |
|
|
|
discovery->service_listener(); |
|
} |
|
#endif |
|
server.runForever(); | server.runForever(); |
} | } |
| |