version 1.27, 2001/06/19 23:53:41
|
version 1.28, 2001/06/23 21:42:58
|
|
|
#include <Pegasus/Protocol/Handler.h> | #include <Pegasus/Protocol/Handler.h> |
#include <Pegasus/Common/Logger.h> | #include <Pegasus/Common/Logger.h> |
#include <Pegasus/Common/System.h> | #include <Pegasus/Common/System.h> |
|
#include <slp/slp.h> |
| |
| |
| |
|
|
// try loop to bind the address, and run the server | // try loop to bind the address, and run the server |
try | try |
{ | { |
|
String serviceURL; |
|
serviceURL.assign("service:cim.pegasus://"); |
|
char *host_name = slp_get_host_name(); |
|
serviceURL += host_name; |
|
serviceURL += ":"; |
|
serviceURL += address; |
|
char *url = serviceURL.allocateCString(); |
|
free(host_name); |
|
|
Selector selector; | Selector selector; |
CIMServer server(&selector, pegasusHome); | CIMServer server(&selector, pegasusHome); |
server.setSLP(useSLP); |
|
| |
// bind throws an exception of the bind fails | // bind throws an exception of the bind fails |
server.bind(address); | server.bind(address); |
delete [] address; | delete [] address; |
|
|
|
slp_client *discovery = NULL; |
|
if(useSLP) |
|
discovery = new slp_client(); |
|
|
|
time_t last = 0; |
|
while( 1 ) |
|
{ |
|
if(useSLP ) |
|
{ |
|
int success, failure; |
|
|
|
if( (time(NULL) - last ) > 60 ) |
|
{ |
|
if( discovery != NULL && url != NULL ) |
|
discovery->srv_reg_all(url, |
|
"(namespace=root/cimv20)", |
|
"service:cim.pegasus", |
|
"DEFAULT", |
|
3600) ; |
|
time(&last); |
|
} |
|
} |
server.runForever(); | server.runForever(); |
|
} |
| |
Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION, | Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION, |
"Normal Termination"); | "Normal Termination"); |
|
|
} | } |
catch(Exception& e) | catch(Exception& e) |
{ | { |