(file) Return to cimserver.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Server

  1 mike  1.32 //%/////////////////////////////////////////////////////////////////////////////
  2            //
  3            // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM
  4            //
  5            // Permission is hereby granted, free of charge, to any person obtaining a copy
  6            // of this software and associated documentation files (the "Software"), to 
  7            // deal in the Software without restriction, including without limitation the 
  8            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 
  9            // sell copies of the Software, and to permit persons to whom the Software is
 10            // furnished to do so, subject to the following conditions:
 11            // 
 12            // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN 
 13            // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 14            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 15            // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
 16            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
 17            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
 18            // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 19            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 20            //
 21            //==============================================================================
 22 mike  1.32 //
 23            // Author: Mike Brasher (mbrasher@bmc.com)
 24            //
 25            // Modified By: Mike Day (mdday@us.ibm.com) 
 26 mike  1.33 //
 27 mike  1.32 // Modified By:	Karl Schopmeyer (k.schopmeyer@opengroup.org)
 28            //
 29 mike  1.35 // Modified By: Nag Boranna (nagaraja_boranna@hp.com)
 30            //
 31            // Modified By: Jenny Yu (jenny_yu@hp.com)
 32            //
 33 kumpf 1.38 // Modified By: Sushma Fernandes (sushma_fernandes@hp.com)
 34            //
 35 mike  1.32 //%/////////////////////////////////////////////////////////////////////////////
 36            
 37            
 38            //////////////////////////////////////////////////////////////////////
 39            //
 40            // Notes on deamon operation (Unix) and service operation (Win 32):
 41            //
 42            // To run pegasus as a daemon on Unix platforms, use the -d option:
 43            //
 44            // cimserver -d
 45            //
 46            // The -d option has no effect on windows operation. 
 47            //
 48 mike  1.35 // To shutdown pegasus, use the -s option:
 49            // 
 50            // cimserver -s [-f] [-T timeout_value]
 51            //
 52 mike  1.32 // To run pegasus as an NT service, there are FOUR  different possibilities:
 53            //
 54            // To INSTALL the Pegasus service, 
 55            //
 56            // cimserver -install
 57            //
 58            // To REMOVE the Pegasus service, 
 59            //
 60            // cimserver -remove
 61            //
 62            // To START the Pegasus service, 
 63            //
 64            // net start cimserver
 65            //
 66            // To STOP the Pegasus service, 
 67            //
 68            // net stop cimserver
 69            //
 70            // Alternatively, you can use the windows service manager. Pegasus shows up 
 71            // in the service database as "Pegasus CIM Object Manager"
 72            //
 73 mike  1.32 // Mike Day, mdday@us.ibm.com
 74            // 
 75            //////////////////////////////////////////////////////////////////////
 76            
 77            
 78 mike  1.35 #include <Pegasus/Common/Config.h>
 79 mike  1.32 #include <iostream>
 80 mike  1.35 #include <cassert>
 81 mike  1.32 #include <cstdlib>
 82            #include <Pegasus/Common/FileSystem.h>
 83 mike  1.35 #include <Pegasus/Common/Monitor.h>
 84 mike  1.32 #include <Pegasus/Server/CIMServer.h>
 85            #include <Pegasus/Common/PegasusVersion.h>
 86            #include <Pegasus/Common/Logger.h>
 87            #include <Pegasus/Common/System.h>
 88 mike  1.35 #include <Pegasus/Common/Tracer.h>
 89            #include <Pegasus/Config/ConfigManager.h>
 90            #include <Pegasus/Client/CIMClient.h>
 91            #include <Pegasus/Common/HTTPConnector.h>
 92            #include <Pegasus/Server/ShutdownService.h>
 93 kumpf 1.38 #include <Pegasus/Common/Destroyer.h>
 94 mike  1.35 #ifndef PEGASUS_OS_ZOS
 95 mike  1.32 #include <slp/slp.h>
 96 mike  1.35 #endif
 97 mike  1.32 
 98            
 99            #if defined(PEGASUS_OS_TYPE_WINDOWS)
100            # include "cimserver_windows.cpp"
101            #elif defined(PEGASUS_OS_TYPE_UNIX)
102            # include "cimserver_unix.cpp"
103            #else
104            # error "Unsupported platform"
105            #endif
106            
107            PEGASUS_USING_PEGASUS;
108            PEGASUS_USING_STD;
109            
110 mike  1.35 //
111            //  The command name.
112            //
113            static const char COMMAND_NAME []    = "cimserver";
114            
115            //
116            //  The constant defining usage string.
117            //
118            static const char USAGE []           = "Usage: ";
119            
120            /**
121            Constants representing the command line options.
122            */
123            static const char OPTION_VERSION     = 'v';
124            
125            static const char OPTION_HELP        = 'h';
126            
127            static const char OPTION_HOME        = 'D';
128            
129            static const char OPTION_SHUTDOWN    = 's';
130            
131 mike  1.35 static const char OPTION_FORCE       = 'f';
132            
133            static const char OPTION_TIMEOUT     = 'T';
134            
135            static const String NAMESPACE = "root/cimv2";
136            static const String CLASSNAME_SHUTDOWNSERVICE = "PG_ShutdownService";
137 kumpf 1.36 static const String PROPERTY_TIMEOUT = "operationTimeout";
138 mike  1.35 
139            ConfigManager*    configManager;
140            
141 mike  1.32 /** GetOptions function - This function defines the Options Table
142 mike  1.35     and sets up the options from that table using the config manager.
143 mike  1.32 */
144            void GetOptions(
145 mike  1.35     ConfigManager* cm,
146 mike  1.32     int& argc,
147                char** argv,
148                const String& pegasusHome)
149            {
150 mike  1.35     try
151 mike  1.32     {
152 kumpf 1.38         cm->mergeConfigFiles();
153 mike  1.33 
154 mike  1.35         cm->mergeCommandLine(argc, argv);
155                }
156                catch (NoSuchFile nsf)
157                {
158                    throw nsf;
159                }
160                catch (FileNotReadable fnr)
161                {
162                    throw fnr;
163                }
164                catch (CannotRenameFile ftrf)
165                {
166                    throw ftrf;
167                }
168                catch (ConfigFileSyntaxError cfse)
169                {
170                    throw cfse;
171                }
172                catch(UnrecognizedConfigProperty ucp)
173                {
174                    throw ucp;
175 mike  1.35     }
176                catch(InvalidPropertyValue ipv)
177                {
178                    throw ipv;
179                }
180 mike  1.32 }
181            
182            /* PrintHelp - This is temporary until we expand the options manager to allow
183               options help to be defined with the OptionRow entries and presented from
184               those entries.
185            */
186            void PrintHelp(const char* arg0)
187            {
188 mike  1.35     /**
189                    Build the usage string for the config command.
190                */
191                String usage = String (USAGE);
192                usage.append (COMMAND_NAME);
193                usage.append (" [ [ options ] | [ configProperty=value, ... ] ]\n");
194                usage.append ("  options\n");
195                usage.append ("    -v          - displays pegasus version number\n");
196                usage.append ("    -h          - prints this help message\n");
197                usage.append ("    -D [home]   - sets pegasus home directory\n");
198                usage.append ("    -t          - turns tracing on\n");
199                usage.append ("    -t          - turns on trace of client IO to console\n");
200                usage.append ("    -l          - turns on trace of client IO to trace file\n");
201                usage.append ("    -d          - runs pegasus as a daemon\n");
202                usage.append ("    -s [-f] [-T timeout] \n");
203                usage.append ("                - shuts down pegasus\n");
204                usage.append ("    -cleanlogs  - clears the log files at startup\n");
205                usage.append ("    -install    - installs pegasus as a Windows NT Service\n");
206                usage.append ("    -remove     - removes pegasus as a Windows NT Service\n");
207                usage.append ("    -slp        - registers pegasus as a service with SLP\n\n");
208                usage.append ("    -SSL        - uses SSL\n\n");
209 mike  1.35 
210                usage.append ("  configProperty=value\n");
211                usage.append ("    port=nnnn            - sets port number to listen on\n");
212                usage.append ("    logdir=/pegasus/logs - directory for log files\n");
213            
214                cout << endl;
215 mike  1.32     cout << PEGASUS_NAME << PEGASUS_VERSION << endl;
216                cout << endl;
217 mike  1.35     cout << usage << endl;
218            }
219            
220 kumpf 1.36 void shutdownCIMOM(Boolean forceOption, Uint32 timeoutValue)
221 mike  1.35 {
222                //
223                // Create CIMClient object
224                //
225                Monitor* monitor = new Monitor;
226                HTTPConnector* httpConnector = new HTTPConnector(monitor);
227                CIMClient client(monitor, httpConnector);
228            
229                //
230                // Get the port number
231                //
232                String portNumberStr = configManager->getCurrentValue("port");
233            
234                String hostStr = System::getHostName();
235                hostStr.append(":");
236                hostStr.append(portNumberStr);
237            
238 kumpf 1.36     // Put server shutdown message to the logger
239                Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
240            	"Shutdown $0 on port $1.", PEGASUS_NAME, portNumberStr);
241            
242 mike  1.35     //
243                // open connection to CIMOM 
244                //
245                try
246                {
247                    client.connect(hostStr.allocateCString());
248                }
249                catch(Exception& e)
250                {
251 kumpf 1.36         Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
252                        "Failed to connect to $0 $1.", PEGASUS_NAME, e.getMessage());
253            
254 mike  1.35         PEGASUS_STD(cerr) << "Failed to connect to server: " << e.getMessage() << PEGASUS_STD(endl);
255                    exit(1);
256                }
257            
258                try
259                {
260                    //
261                    // construct CIMReference 
262                    //
263                    String referenceStr = "//";
264                    referenceStr.append(hostStr);
265                    referenceStr.append("/root/cimv2:PG_ShutdownService");
266                    CIMReference reference(referenceStr);
267            
268                    //
269                    // issue the invokeMethod request on the shutdown method
270                    //
271                    Array<CIMParamValue> inParams;
272                    Array<CIMParamValue> outParams;
273            
274 kumpf 1.39         inParams.append(CIMParamValue(
275                        CIMParameter("force", CIMType::BOOLEAN),
276                        CIMValue(Boolean(forceOption))));
277 mike  1.35 
278                    inParams.append(CIMParamValue(
279 kumpf 1.36             CIMParameter("timeout", CIMType::UINT32),
280 kumpf 1.39             CIMValue(Uint32(timeoutValue))));
281 mike  1.35 
282                    CIMValue retValue = client.invokeMethod(
283                        NAMESPACE,
284                        reference,
285                        "shutdown",
286                        inParams,
287                        outParams);
288 kumpf 1.36 
289                    // Put server shutdown message to the logger
290                    Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
291            	    "$0 terminated on port $1.", PEGASUS_NAME, portNumberStr);
292            
293 mike  1.35     }
294                catch(Exception& e)
295                {
296                    PEGASUS_STD(cerr) << "Failed to shutdown server: " << e.getMessage() << PEGASUS_STD(endl);
297                    exit(1);
298                }
299            
300                return;
301 mike  1.32 }
302            
303 mike  1.35 
304 mike  1.33 /////////////////////////////////////////////////////////////////////////
305 mike  1.32 //  MAIN
306            //////////////////////////////////////////////////////////////////////////
307            int main(int argc, char** argv)
308            {
309 mike  1.35     String pegasusHome  = String::EMPTY;
310                Boolean pegasusIOTrace = false;
311                Boolean pegasusIOLog = false;
312                String portOption = String::EMPTY;
313                String logsDirectory = String::EMPTY;
314                Boolean useSLP = false;
315                Boolean useSSL = false;
316                Boolean daemonOption = false;
317                Boolean shutdownOption = false;
318                Boolean forceOption = false;
319                Boolean timeoutOption = false;
320                String  timeoutStr  = String::EMPTY;
321                long timeoutValue  = 0;
322            
323 kumpf 1.38     //
324                // Get environment variables:
325                //
326                const char* tmp = getenv("PEGASUS_HOME");
327            
328                if (tmp)
329                {
330                    pegasusHome = tmp;
331                }
332            
333                FileSystem::translateSlashes(pegasusHome);
334            
335 mike  1.32     // on Windows NT if there are no command-line options, run as a service
336            
337                if (argc == 1 )
338 mike  1.35     {
339                  cim_server_service(argc, argv);
340                }
341                else
342                {
343                    // Get help, version and home options
344            
345                    for (int i = 1; i < argc; )
346                    {
347                        const char* arg = argv[i];
348            
349                        // Check for -option
350                        if (*arg == '-')
351                        {
352                            // Get the option
353                            const char* option = arg + 1;
354            
355                            //
356                            // Check to see if user asked for the version (-v option):
357                            //
358                            if (*option == OPTION_VERSION)
359 mike  1.35                 {
360                                cout << PEGASUS_VERSION << endl;
361                                exit(0);
362                            }
363                            //
364                            // Check to see if user asked for help (-h option):
365                            //
366                            else if (*option == OPTION_HELP)
367                            {
368                                PrintHelp(argv[0]);
369                                exit(0);
370                            }
371                            else if (*option == OPTION_HOME)
372                            {
373                                if (i + 1 < argc) 
374                                {
375                                    pegasusHome.assign(argv[i + 1]);
376                                }
377                                else
378                                {
379                                    cout << "Missing argument for option -" << option << endl;
380 mike  1.35                         exit(0);
381                                }
382            
383                                memmove(&argv[i], &argv[i + 2], (argc-i-1) * sizeof(char*));
384                                argc -= 2;
385                            }
386                            //
387                            // Check to see if user asked for shutdown (-s option):
388                            //
389                            else if (*option == OPTION_SHUTDOWN)
390                            {
391                                //
392                                // Check to see if shutdown has already been specified:
393                                //
394                                if (shutdownOption)
395                                {
396                                    cout << "Duplicate shutdown option specified." << endl;
397                                    exit(0);
398                                }
399                                shutdownOption = true;
400             
401 mike  1.35                     // remove the option from the command line
402                                memmove(&argv[i], &argv[i + 1], (argc-i) * sizeof(char*));
403                                argc--;   
404                            }
405                            else if (*option == OPTION_FORCE)
406                            {
407                                //
408                                // Check to see if shutdown has been specified:
409                                //
410                                if (!shutdownOption)
411                                {
412                                    cout << "Invalid option -" << option << endl;
413                                    exit(0);
414                                }
415            
416                                //
417                                // Check to see if force has already been specified:
418                                //
419                                if (forceOption)
420                                {
421                                    cout << "Duplicate force option specified." << endl;
422 mike  1.35                         exit(0);
423                                }
424            
425                                forceOption = true;
426             
427                                // remove the option from the command line
428                                memmove(&argv[i], &argv[i + 1], (argc-i) * sizeof(char*));
429                                argc--;   
430                            }
431                            else if (*option == OPTION_TIMEOUT)
432                            {
433                                //
434                                // Check to see if shutdown has been specified:
435                                //
436                                if (!shutdownOption)
437                                {
438                                    cout << "Invalid option -" << option << endl;
439                                    exit(0);
440                                }
441            
442                                if (timeoutOption)
443 mike  1.35                     {
444                                    cout << "Duplicate timeout option specified." << endl;
445                                    exit(0);
446                                }
447            
448                                timeoutOption = true;
449            
450                                if (i + 1 < argc)
451                                {
452                                    // get timeout value
453                                    timeoutStr.assign(argv[i + 1]);
454            
455                                    // validate timeout value string
456                                    char* tmp = timeoutStr.allocateCString();
457                                    char* end = 0;
458                                    timeoutValue  = strtol(tmp, &end, 10);
459                                  
460                                    if (!end || *end != '\0')
461                                    {
462                                        cout << "invalid timeout value specified: ";
463                                        cout << timeoutStr << endl;
464 mike  1.35                             delete [] tmp;
465                                        exit(0);
466                                    }
467                                }
468                                else
469                                {
470                                    cout << "Missing argument for option -";
471                                    cout << option << endl;
472                                    exit(0);
473                                }
474            
475                                // remove the option from the command line
476                                memmove(&argv[i], &argv[i + 2], (argc-i-1) * sizeof(char*));
477                                argc -= 2;
478                            }
479                            else
480                                i++;
481                        }
482                        else
483                            i++;
484 mike  1.32         }
485                }
486 mike  1.35 
487 kumpf 1.38     //
488                // Set the value for pegasusHome property
489                //
490                ConfigManager::setPegasusHome(pegasusHome);
491 mike  1.32 
492 mike  1.35     //
493                // Get an instance of the Config Manager.
494                //
495                configManager = ConfigManager::getInstance();
496            
497                //
498 mike  1.32     // Get options (from command line and from configuration file); this
499 mike  1.35     // removes corresponding options and their arguments from the command
500 mike  1.32     // line.
501 mike  1.35     //
502 mike  1.32     try
503                {
504 mike  1.35         GetOptions(configManager, argc, argv, pegasusHome);
505 mike  1.32     }
506                catch (Exception& e)
507                {
508 mike  1.35         cerr << argv[0] << ": " << e.getMessage() << endl;
509                    exit(1);
510 mike  1.32     }
511            
512            
513 mike  1.35     try
514 mike  1.32     {
515 mike  1.35         //
516                    // Check to see if we should (can) install as a NT service
517                    //
518            
519                    if (String::equal(configManager->getCurrentValue("install"), "true"))
520                    {
521                        if( 0 != cimserver_install_nt_service( pegasusHome ))
522                        {
523                            cout << "\nPegasus installed as NT Service";
524                            exit(0);
525                        }
526                    }
527 mike  1.32 
528 mike  1.35         //
529                    // Check to see if we should (can) remove Pegasus as an NT service
530                    //
531            
532                    if (String::equal(configManager->getCurrentValue("remove"), "true"))
533                    {
534                        if( 0 != cimserver_remove_nt_service() )
535                        {
536                            cout << "\nPegasus removed as NT Service";
537                            exit(0);
538                        }
539                    }
540 mike  1.32 
541 mike  1.35         //
542                    // Check to see if we should Pegasus as a daemon
543                    //
544            
545                    if (String::equal(configManager->getCurrentValue("daemon"), "true"))
546                    {
547                        daemonOption = true;
548                    }
549 mike  1.32 
550 mike  1.35         //
551 kumpf 1.36         // Check the log trace options and set global variable
552                    //
553            
554                    if (String::equal(configManager->getCurrentValue("logtrace"), "true"))
555                    {
556                        pegasusIOLog = true;
557                    }
558            
559                    // Get the log file directory definition.
560                    // We put String into Cstring because
561                    // Directory functions only handle Cstring.
562                    // ATTN-KS: create String based directory functions.
563            
564                    logsDirectory = configManager->getCurrentValue("logdir");
565 kumpf 1.38         logsDirectory = 
566            	    ConfigManager::getHomedPath(configManager->getCurrentValue("logdir"));
567 kumpf 1.36 
568                    // Set up the Logger. This does not open the logs
569                    // Might be more logical to clean before set.
570                    // ATTN: Need tool to completely disable logging.
571            
572                    Logger::setHomeDirectory(logsDirectory);
573            
574                    //
575 mike  1.35         // Check to see if we need to shutdown CIMOM 
576                    //
577                    if (shutdownOption)
578                    {
579                        //
580                        // if timeout was specified, validate the timeout value 
581                        //
582                        if (timeoutOption)
583                        {
584                            Boolean valid = configManager->validatePropertyValue(
585                                                         PROPERTY_TIMEOUT,
586                                                         timeoutStr);
587                            if (!valid)
588                            {
589                                cout << "Invalid timeout value specified: " << timeoutValue;
590                                cout << endl;
591                                exit(1);
592                            }
593                        }
594            
595 kumpf 1.36             shutdownCIMOM(forceOption, timeoutValue);
596 mike  1.35             cout << "Pegasus CIM Server terminated." << endl;
597                        exit(0);
598                    }
599 mike  1.32 
600 mike  1.35         //
601                    // Grab the port option:
602                    //
603            
604                    portOption = configManager->getCurrentValue("port");
605            
606                    //
607                    // Check the trace options and set global variable
608                    //
609            
610                    if (String::equal(configManager->getCurrentValue("trace"), "true"))
611                    {
612                        pegasusIOTrace = true;
613                        cout << "Trace Set" << endl;
614                    }
615            
616 kumpf 1.36         // Leave this in until people get familiar with the logs.
617                    cout << "Logs Directory = " << logsDirectory << endl;
618 mike  1.35 
619                    if (String::equal(configManager->getCurrentValue("cleanlogs"), "true"))
620                    {
621                        Logger::clean(logsDirectory);;
622                    }
623 mike  1.32 
624 mike  1.35         if (String::equal(configManager->getCurrentValue("slp"), "true"))
625                    {
626                        useSLP =  true;
627                    }
628 mike  1.32 
629 mike  1.35         if (String::equal(configManager->getCurrentValue("SSL"), "true"))
630                    {
631                        useSSL =  true;
632                    }
633 mike  1.32     }
634 mike  1.35     catch (UnrecognizedConfigProperty e)
635 mike  1.32     {
636 mike  1.35         cout << "Error: " << e.getMessage() << endl;
637 mike  1.32     }
638            
639                char* address = portOption.allocateCString();
640            
641                // Put out startup up message.
642                cout << PEGASUS_NAME << PEGASUS_VERSION <<
643            	 " on port " << address << endl;
644                cout << "Built " << __DATE__ << " " << __TIME__ << endl;
645                cout <<"Started..."
646            	 << (pegasusIOTrace ? " Tracing to Display ": " ") 
647                     << (pegasusIOLog ? " Tracing to Log ": " ")
648            	 << (useSLP ? " SLP reg. " : " No SLP ")
649 mike  1.35          << (useSSL ? " Use SSL " : " No SSL ")
650 mike  1.32 	<< endl;
651            
652                // Put server start message to the logger
653                Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
654 mike  1.35 	"Start $0 $1 port $2 $3 $4 $5",
655 mike  1.32 		PEGASUS_NAME, 
656            		PEGASUS_VERSION,
657            		address,
658            		(pegasusIOTrace ? " Tracing": " "),
659 mike  1.35 		(useSLP ? " SLP on " : " SLP off "),
660                            (useSSL ? " Use SSL " : " No SSL "));
661 mike  1.32 
662 mike  1.35     // do we need to run as a daemon ?
663                if (daemonOption)
664                {
665                    if(-1 == cimserver_fork())
666                      exit(-1);
667                }
668 mike  1.32 
669                // try loop to bind the address, and run the server
670                try
671                {
672 mike  1.35 #ifndef PEGASUS_OS_ZOS
673 mike  1.32       	slp_client *discovery = new slp_client() ;;
674                    String serviceURL;
675            	serviceURL.assign("service:cim.pegasus://");
676            	String host_name = slp_get_host_name();
677            	serviceURL += host_name;
678            	serviceURL += ":";
679            	serviceURL += address;
680            	char *url = serviceURL.allocateCString();
681            	//	free(host_name);
682 mike  1.35 #endif
683 mike  1.32 
684 mike  1.35 	Monitor monitor;
685 kumpf 1.38 	CIMServer server(&monitor, useSSL);
686 mike  1.35 		
687 mike  1.32 	// bind throws an exception of the bind fails
688 mike  1.33 	cout << "Binding to " << address << endl;
689 mike  1.35 
690            	char* end = 0;
691            	long portNumber = strtol(address, &end, 10);
692            	assert(end != 0 && *end == '\0');
693            	server.bind(portNumber);
694            
695 mike  1.32 	delete [] address;
696            
697            	time_t last = 0;
698 mike  1.35 
699                    //
700                    // Loop to call CIMServer's runForever() method until CIMServer
701                    // has been shutdown
702                    //
703            	while( !server.terminated() )
704 mike  1.32 	{
705 mike  1.35 #ifndef PEGASUS_OS_ZOS
706 mike  1.32 	  if(useSLP  ) 
707            	  {
708            	    if(  (time(NULL) - last ) > 60 ) 
709            	    {
710            	      if( discovery != NULL && url != NULL )
711            		discovery->srv_reg_all(url,  
712 mike  1.35 				       "(namespace=root/cimv2)",
713 mike  1.32 				       "service:cim.pegasus", 
714            				       "DEFAULT", 
715            				       70) ;
716            	      time(&last);
717            	    }
718            	  
719            	    discovery->service_listener();
720            	  }
721 mike  1.35 #endif
722 mike  1.32 	  server.runForever();
723            	}
724            
725 mike  1.34 	// This statement is unrechable!
726            	//
727            	// Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
728            	//   "Normal Termination");
729 mike  1.32     }
730                catch(Exception& e)
731                {
732            	Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
733            	    "Abnormal Termination $0", e.getMessage());
734            	
735            	PEGASUS_STD(cerr) << "Error: " << e.getMessage() << PEGASUS_STD(endl);
736                }
737            
738                return 0;
739            }

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2